Browse Source

add IDType, IDNumber Field at AddRecipient, EditRecipient for Thunes for Myanmar

pull/1/head
InKwon James Kim 5 years ago
parent
commit
ffd3a5f562
  1. 4
      GMERemittance/Model/Reciepient.swift
  2. 17
      GMERemittance/Model/SendMoneyCountryModel.swift
  3. 9
      GMERemittance/Module/SendMoneyModules/Recipient/AddReciepient/User Interface/Presenter/AddReciepientPresenter.swift
  4. 101
      GMERemittance/Module/SendMoneyModules/Recipient/AddReciepient/User Interface/View/AddReciepient.storyboard
  5. 64
      GMERemittance/Module/SendMoneyModules/Recipient/AddReciepient/User Interface/View/AddReciepientViewController.swift
  6. 3
      GMERemittance/Module/SendMoneyModules/Recipient/AddReciepient/User Interface/View/AddReciepientViewInterface.swift
  7. 10
      GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/Presenter/EditReciepientPresenter.swift
  8. 2
      GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/Presenter/EditRecipientRecipientViewModel.swift
  9. 8
      GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/View/EditReciepient.storyboard
  10. 75
      GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/View/EditReciepientViewController.swift
  11. 2
      GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/View/EditReciepientViewInterface.swift

4
GMERemittance/Model/Reciepient.swift

@ -97,8 +97,8 @@ struct Recipient: Codable, Mappable {
reasonId <- map["reasonId"]
countryId <- map["countryId"]
countryCode <- map["countryCode"]
idNumber <- map["IdNumber"]
idType <- map["IdType"]
idNumber <- map["idNumber"]
idType <- map["idType"]
}

17
GMERemittance/Model/SendMoneyCountryModel.swift

@ -99,6 +99,11 @@ class SendMoneyModel: Mappable {
var transferReasons: [TransferReason]?
var relations: [Relation]?
// var idTypes: [[String: String]]?
// TODO: check IDTYPES
var receiverIDTypes: [ReceiverIdType]?
required init?(map: Map) {
}
@ -107,6 +112,7 @@ class SendMoneyModel: Mappable {
countries <- map["Country"]
transferReasons <- map["TransferReasons"]
relations <- map["Relations"]
receiverIDTypes <- map["ReceiverIdType"]
}
}
@ -127,5 +133,16 @@ class SendMoneyInformationContainer: Mappable {
}
}
class ReceiverIdType: Mappable {
var id: String?
var text: String?
var dependent: String?
required init?(map: Map) {}
func mapping(map: Map) {
id <- map["id"]
text <- map["text"]
dependent <- map["dependent"]
}
}

9
GMERemittance/Module/SendMoneyModules/Recipient/AddReciepient/User Interface/Presenter/AddReciepientPresenter.swift

@ -90,12 +90,15 @@ class AddReciepientPresenter {
reciepient.reasonId = model.reasonId
reciepient.mobileNumber = model.mobileNumber
reciepient.email = model.email
reciepient.idType = model.idType
reciepient.idNumber = model.idNumber
self.interactor?.save(reciepient: reciepient)
}
}
// MARK: AddReciepient module interface
// MARK: AddReciepient module interface
extension AddReciepientPresenter: AddReciepientModuleInterface {
func viewIsReady() {
@ -116,6 +119,10 @@ extension AddReciepientPresenter: AddReciepientInteractorOutput {
self.transferReasons = model?.transferReasons ?? []
self.relations = model?.relations ?? []
self.countries = model?.countries ?? []
//TODO: set IDTYPES
self.view?.setReceiverIDTypes(with: model?.receiverIDTypes)
self.view?.hideLoading()
self.convert(models: self.countries)

101
GMERemittance/Module/SendMoneyModules/Recipient/AddReciepient/User Interface/View/AddReciepient.storyboard

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@ -23,16 +27,16 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" keyboardDismissMode="onDrag" translatesAutoresizingMaskIntoConstraints="NO" id="2cy-hR-Fme">
<rect key="frame" x="0.0" y="0.0" width="375" height="1100"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="1066"/>
<subviews>
<view contentMode="scaleToFill" placeholderIntrinsicWidth="375" placeholderIntrinsicHeight="900" translatesAutoresizingMaskIntoConstraints="NO" id="MHV-aS-FoL">
<rect key="frame" x="0.0" y="0.0" width="375" height="1071.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="1078"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="30" translatesAutoresizingMaskIntoConstraints="NO" id="bJg-iS-Pg8">
<rect key="frame" x="10" y="0.0" width="355" height="1041.5"/>
<rect key="frame" x="10" y="0.0" width="355" height="1048"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="Lsn-v9-r4g">
<rect key="frame" x="0.0" y="0.0" width="355" height="961.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="968"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Fgq-xq-dmN" userLabel="TitleStackView">
<rect key="frame" x="0.0" y="0.0" width="355" height="63"/>
@ -50,19 +54,19 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="4GX-ko-nbw" userLabel="ContentStackView">
<rect key="frame" x="0.0" y="68" width="355" height="893.5"/>
<rect key="frame" x="0.0" y="68" width="355" height="900"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="e8u-s3-fVl">
<rect key="frame" x="0.0" y="0.0" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="First Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RPh-p3-dap">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's full name" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="ydp-IU-Ddb">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="afy-81-2it"/>
</constraints>
@ -73,16 +77,16 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="BQc-tA-RUn">
<rect key="frame" x="0.0" y="69.5" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="70" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Middle Name (Optional)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lwa-xS-Mou">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's middle name" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Bgi-hL-Wf6">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="tLl-P0-Zbh"/>
</constraints>
@ -93,16 +97,16 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="A3K-Ig-mN9">
<rect key="frame" x="0.0" y="139" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="140" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Last Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aos-AF-iaO">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's last name" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="xvn-Xq-Poa">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="Ls2-ds-JKU"/>
</constraints>
@ -113,16 +117,16 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="kmX-kn-0uS">
<rect key="frame" x="0.0" y="208.5" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="210" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Country" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gnB-aR-bJE">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Select" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="rTf-lL-eJb">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="69q-4x-Lyu"/>
</constraints>
@ -133,16 +137,16 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Uwb-JF-Lu9">
<rect key="frame" x="0.0" y="278" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="280" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="State/Province" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hX8-qF-mLG">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Select" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="SpT-9V-3C8">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="Tby-y3-sva"/>
</constraints>
@ -153,16 +157,16 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="EtN-9R-GQt">
<rect key="frame" x="0.0" y="347.5" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="350" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="District" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QCa-CZ-ElQ">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Select" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="6qj-la-Mgu">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="pSC-rQ-oQk"/>
</constraints>
@ -173,16 +177,16 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="fh8-Q6-q8A">
<rect key="frame" x="0.0" y="417" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="420" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="City" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="woC-KH-z7x">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's City" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="cHL-Cf-h5a">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="UAG-D4-uH5"/>
</constraints>
@ -193,16 +197,16 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="blF-qq-qJe">
<rect key="frame" x="0.0" y="486.5" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="490" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Address" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y1V-LP-rwg">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's Address" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="R9T-Lf-bM4">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="FVQ-W0-QKk"/>
</constraints>
@ -213,16 +217,16 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="O4c-KR-vEE">
<rect key="frame" x="0.0" y="556" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="560" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Relation" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aVB-K7-liY">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Select" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="vZS-DH-n7I">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="9YL-SW-YnM"/>
</constraints>
@ -233,16 +237,16 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="7Tk-n4-kZ1">
<rect key="frame" x="0.0" y="625.5" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="630" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Mobile No." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s2u-oR-Os8">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's mobile number" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="vAR-h8-elx">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="HQh-Pf-Mui"/>
</constraints>
@ -253,7 +257,7 @@
</subviews>
</stackView>
<stackView hidden="YES" opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="2Kh-Q2-iMo">
<rect key="frame" x="0.0" y="690" width="355" height="43"/>
<rect key="frame" x="0.0" y="695" width="355" height="43"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Email (Optional)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rIa-a1-cYb">
<rect key="frame" x="0.0" y="0.0" width="355" height="0.0"/>
@ -273,16 +277,16 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="iLj-pG-L6B">
<rect key="frame" x="0.0" y="695" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="700" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Transfer Reason" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="F7d-NL-98o">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Select" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="LWI-ug-ZGq">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="Vvx-Qi-ol9"/>
</constraints>
@ -293,16 +297,17 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="I2d-JJ-OvN" userLabel="IDType">
<rect key="frame" x="0.0" y="764.5" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="770" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID Type (Optional)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LCW-9T-FLU">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Select" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Aqq-Xq-pZT">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="gBF-W7-Tev"/>
</constraints>
@ -313,22 +318,22 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="NH9-gT-qAV" userLabel="IDValue">
<rect key="frame" x="0.0" y="834" width="355" height="59.5"/>
<rect key="frame" x="0.0" y="840" width="355" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID Number (Optional)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zyl-vG-rKF">
<rect key="frame" x="0.0" y="0.0" width="355" height="16.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="17"/>
<fontDescription key="fontDescription" name="SanFranciscoText-Regular" family="San Francisco Text" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's ID value" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="1YP-BG-HGJ">
<rect key="frame" x="0.0" y="16.5" width="355" height="43"/>
<textField opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's ID value" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="1YP-BG-HGJ">
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="uF9-AD-1Sx"/>
</constraints>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/>
<textInputTraits key="textInputTraits" keyboardType="alphabet"/>
<textInputTraits key="textInputTraits" keyboardType="numbersAndPunctuation"/>
</textField>
</subviews>
</stackView>
@ -337,7 +342,7 @@
</subviews>
</stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BKY-7W-R56">
<rect key="frame" x="77.5" y="991.5" width="200" height="50"/>
<rect key="frame" x="77.5" y="998" width="200" height="50"/>
<color key="backgroundColor" red="0.92941176469999998" green="0.10980392160000001" blue="0.14117647059999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="H0T-Sg-A4P"/>

64
GMERemittance/Module/SendMoneyModules/Recipient/AddReciepient/User Interface/View/AddReciepientViewController.swift

@ -60,8 +60,24 @@ class AddReciepientViewController: UIViewController {
private var countries: [SendMoneyCountryViewModel]?
private var transferReasons: [SendMoneyTransferReasonViewModel]?
private var relations: [SendMoneyRelationViewModel]?
private var receiverIDTypes: [ReceiverIdType]?
private var idTypes = [" --- Select ID Type --- "]
private var reciepient: ReceipientViewModel?
private var selectedIDType: ReceiverIdType? {
didSet {
reciepient?.idType = selectedIDType?.id
idTypeTextField.text = selectedIDType?.text
idNumberTextField.isEnabled = selectedIDType != nil ? true : false
if !idNumberTextField.isEnabled {
idNumberTextField.text = nil
}
}
}
private var selectedCountry: SendMoneyCountryViewModel? {
didSet {
self.countryTextField.text = selectedCountry?.name
@ -135,12 +151,12 @@ class AddReciepientViewController: UIViewController {
@IBAction private func save(_ sender: UIButton) {
if let reciepient = self.reciepient {
guard
let code = selectedCountry?.code?.lowercased(),
if let code = selectedCountry?.code?.lowercased(),
let countryCode = CountryEnum(rawValue: code),
let mobileNumber = mobileTextField.text else { return }
let mobileNumber = mobileTextField.text {
reciepient.mobileNumber = countryCode.phoneCode + mobileNumber
}
self.presenter?.save(model: reciepient)
}
@ -165,7 +181,11 @@ class AddReciepientViewController: UIViewController {
self.addressTextField.autocorrectionType = .no
// for pickerView
idTypeTextField.inputView = UIView()
let pickerView = UIPickerView()
idTypeTextField.inputView = pickerView
pickerView.delegate = self
pickerView.dataSource = self
}
private func setup() {
@ -230,11 +250,10 @@ class AddReciepientViewController: UIViewController {
self.addressTextField.delegate = self
self.relationTextField.delegate = self
self.mobileTextField.delegate = self
}
private func setupTargets() {
[firstNameTextField, middleNameTextField, lastNameTextField, countryTextField, stateProvinceTextField, districtTextField, addressTextField, relationTextField, mobileTextField, emailTextField, transferReasonTextField, cityTextField].forEach({
[firstNameTextField, middleNameTextField, lastNameTextField, countryTextField, stateProvinceTextField, districtTextField, addressTextField, relationTextField, mobileTextField, emailTextField, transferReasonTextField, cityTextField, idNumberTextField].forEach({
$0.addTarget(self, action: #selector(self.textFieldChanged(sender:)), for: UIControl.Event.editingChanged)
})
}
@ -341,9 +360,23 @@ extension AddReciepientViewController: AddReciepientViewInterface {
func show(relations: [SendMoneyRelationViewModel]) {
self.relations = relations
}
func setReceiverIDTypes(with model: [ReceiverIdType]?) {
receiverIDTypes = model
guard let types = receiverIDTypes?.compactMap ({ $0.text }) else {
return
}
idTypes.append(contentsOf: types)
print("idTypes count: \(idTypes.count)")
}
}
// MARK: - UITextFieldDelegate
extension AddReciepientViewController: UITextFieldDelegate {
func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
switch textField {
@ -362,19 +395,10 @@ extension AddReciepientViewController: UITextFieldDelegate {
case transferReasonTextField:
self.showTransferReasonPickerView()
return false
case idNumberTextField:
showIDTypes()
default:
return true
}
}
private func showIDTypes() {
let pickerView = UIPickerView()
idNumberTextField.inputView = pickerView
pickerView.delegate = self
pickerView.dataSource = self
}
}
// MARK: - UIPickerViewDataSource
@ -384,14 +408,18 @@ extension AddReciepientViewController: UIPickerViewDataSource {
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return
return idTypes.count
}
}
extension AddReciepientViewController: UIPickerViewDelegate {
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return idTypes[row]
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
selectedIDType = row > 0 ? receiverIDTypes?[row - 1] : nil
}
}

3
GMERemittance/Module/SendMoneyModules/Recipient/AddReciepient/User Interface/View/AddReciepientViewInterface.swift

@ -13,4 +13,7 @@ protocol AddReciepientViewInterface: class {
func show(relations: [SendMoneyRelationViewModel])
func showLoading()
func hideLoading()
func setReceiverIDTypes(with model: [ReceiverIdType]?)
}

10
GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/Presenter/EditReciepientPresenter.swift

@ -97,6 +97,8 @@ class EditReciepientPresenter {
reciepient.reasonId = model.reasonId
reciepient.mobileNumber = model.mobileNumber
reciepient.email = model.email
reciepient.idType = model.idType
reciepient.idNumber = model.idNumber
self.interactor?.save(reciepient: reciepient)
}
@ -120,12 +122,14 @@ class EditReciepientPresenter {
reciepient.email = model.email
reciepient.district = model.district
reciepient.districtId = model.districtId
reciepient.idType = model.idType
reciepient.idNumber = model.idNumber
self.view?.show(recipient: reciepient)
}
}
// MARK: EditReciepient module interface
// MARK: EditReciepient module interface
extension EditReciepientPresenter: EditReciepientModuleInterface {
func viewIsReady() {
@ -145,6 +149,10 @@ extension EditReciepientPresenter: EditReciepientInteractorOutput {
self.transferReasons = model?.transferReasons ?? []
self.relations = model?.relations ?? []
self.countries = model?.countries ?? []
//TODO: set IDTYPES
self.view?.setReceiverIDTypes(with: model?.receiverIDTypes)
self.view?.hideLoading()
self.convert(models: self.countries)

2
GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/Presenter/EditRecipientRecipientViewModel.swift

@ -28,4 +28,6 @@ class EditRecipientRecipientViewModel {
var reason: String?
var reasonId: String?
var countryId: String?
var idType: String?
var idNumber: String?
}

8
GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/View/EditReciepient.storyboard

@ -265,7 +265,7 @@
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's email address" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="9ed-NF-4Bh">
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's email address" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="9ed-NF-4Bh">
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="gjZ-nr-ohs"/>
@ -325,7 +325,7 @@
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's ID value" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Ltw-9N-ptX">
<textField opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter receiver's ID number" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Ltw-9N-ptX">
<rect key="frame" x="0.0" y="17" width="355" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="dby-rF-LPT"/>
@ -411,10 +411,10 @@
<outlet property="firstNameTextField" destination="9Hx-oK-GHi" id="p0R-9y-ddA"/>
<outlet property="firstNameTitleLabel" destination="uA5-jW-mEK" id="LW5-dY-6u1"/>
<outlet property="headerTItleLabel" destination="Gt4-fi-XBm" id="ZxT-SD-W8B"/>
<outlet property="idNumberTextField" destination="Ltw-9N-ptX" id="wsj-ox-uHZ"/>
<outlet property="idNumberTitleLabel" destination="87k-Ld-cG5" id="POX-We-zdJ"/>
<outlet property="idTypeTextField" destination="1WU-BO-ZpU" id="8gL-nW-9Ny"/>
<outlet property="idTypeTitleLabel" destination="0Ex-bx-3lb" id="yqu-dL-fTh"/>
<outlet property="idValueTextField" destination="Ltw-9N-ptX" id="wsj-ox-uHZ"/>
<outlet property="idValueTitleLabel" destination="87k-Ld-cG5" id="POX-We-zdJ"/>
<outlet property="lastNameTextField" destination="Wd8-zG-klN" id="SwR-Rv-7au"/>
<outlet property="lastNametitleLabel" destination="tkw-bR-Oy9" id="O5M-hY-gva"/>
<outlet property="middleNameTextField" destination="Eej-kG-wrd" id="qZZ-WV-0Fb"/>

75
GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/View/EditReciepientViewController.swift

@ -76,8 +76,8 @@ class EditReciepientViewController: UIViewController {
@IBOutlet weak var idTypeTitleLabel: UILabel!
@IBOutlet weak var idTypeTextField: UITextField!
@IBOutlet weak var idValueTitleLabel: UILabel!
@IBOutlet weak var idValueTextField: UITextField!
@IBOutlet weak var idNumberTitleLabel: UILabel!
@IBOutlet weak var idNumberTextField: UITextField!
// MARK: Properties
@ -86,6 +86,25 @@ class EditReciepientViewController: UIViewController {
var countries: [SendMoneyCountryViewModel]?
var transferReasons: [SendMoneyTransferReasonViewModel]?
var relations: [SendMoneyRelationViewModel]?
private var receiverIDTypes: [ReceiverIdType]?
private var idTypes = [" --- Select ID Type --- "]
private var selectedIDType: ReceiverIdType? {
didSet {
reciepient?.idType = selectedIDType?.id
idTypeTextField.text = selectedIDType?.text
idNumberTextField.isEnabled = selectedIDType != nil ? true : false
if !idNumberTextField.isEnabled {
idNumberTextField.text = nil
}
}
}
var reciepient: EditRecipientRecipientViewModel? {
didSet {
self.populateInformations()
@ -171,6 +190,13 @@ class EditReciepientViewController: UIViewController {
self.setupNavigation()
self.configureView(isHidden: true)
self.configureLanguage()
// for pickerView
let pickerView = UIPickerView()
idTypeTextField.inputView = pickerView
pickerView.delegate = self
pickerView.dataSource = self
}
private func configureLanguage() {
@ -217,7 +243,7 @@ class EditReciepientViewController: UIViewController {
}
private func setupTargets() {
[firstNameTextField, middleNameTextField, lastNameTextField, countryTextField, stateProvinceTextField, districtTextField, addressTextField, relationTextField, mobileTextField, emailTextField, transferReasonTextField, cityTextField].forEach({
[firstNameTextField, middleNameTextField, lastNameTextField, countryTextField, stateProvinceTextField, districtTextField, addressTextField, relationTextField, mobileTextField, emailTextField, transferReasonTextField, cityTextField, idNumberTextField].forEach({
$0?.addTarget(self, action: #selector(self.textFieldChanged(sender:)), for: UIControl.Event.editingChanged)
})
}
@ -240,6 +266,8 @@ class EditReciepientViewController: UIViewController {
self.reciepient?.mobileNumber = mobileTextField.text!
case emailTextField:
self.reciepient?.email = emailTextField.text!
case idNumberTextField:
reciepient?.idNumber = idNumberTextField.text
default:
break
}
@ -267,6 +295,13 @@ class EditReciepientViewController: UIViewController {
self.addressTextField.text = reciepient?.address
self.selectedIDType = receiverIDTypes?
.filter{ $0.id == self.reciepient?.idType}
.first
self.idNumberTextField.text = reciepient?.idNumber
// For sync country in reciepient model
self.selectedCountry = self.countries?.filter{
$0.name == self.reciepient?.country
@ -288,6 +323,8 @@ class EditReciepientViewController: UIViewController {
self.mobileTextField.text = self.reciepient?.mobileNumber?.replacingOccurrences(of: countryCode.phoneCode, with: "")
}
private func setupNavigation() {
@ -375,6 +412,17 @@ extension EditReciepientViewController: EditReciepientViewInterface {
func show(recipient: EditRecipientRecipientViewModel) {
self.reciepient = recipient
}
func setReceiverIDTypes(with model: [ReceiverIdType]?) {
receiverIDTypes = model
guard let types = receiverIDTypes?.compactMap ({ $0.text }) else {
return
}
idTypes.append(contentsOf: types)
}
}
extension EditReciepientViewController: UITextFieldDelegate {
@ -454,3 +502,24 @@ extension EditReciepientViewController: TablePresenterDelegate {
}
}
// MARK: - UIPickerViewDataSource
extension EditReciepientViewController: UIPickerViewDataSource {
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return idTypes.count
}
}
extension EditReciepientViewController: UIPickerViewDelegate {
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return idTypes[row]
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
selectedIDType = row > 0 ? receiverIDTypes?[row - 1] : nil
}
}

2
GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/View/EditReciepientViewInterface.swift

@ -14,4 +14,6 @@ protocol EditReciepientViewInterface: class {
func show(recipient: EditRecipientRecipientViewModel)
func showLoading()
func hideLoading()
func setReceiverIDTypes(with model: [ReceiverIdType]?)
}
Loading…
Cancel
Save