Browse Source

added date filters

pull/1/head
gme_2 6 years ago
parent
commit
896e3f912b
  1. 62
      GMERemittance/Module/Resend/User Interface/View/Resend.storyboard
  2. 41
      GMERemittance/Module/Resend/User Interface/View/ResendViewController.swift
  3. 5
      GMERemittance/Module/TransactionHistory/User Interface/View/TransactionHistoryViewController.swift

62
GMERemittance/Module/Resend/User Interface/View/Resend.storyboard

@ -36,7 +36,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Search with Control No..." textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="DUl-wm-L0p">
<rect key="frame" x="15" y="7.5" width="345" height="35"/>
<rect key="frame" x="15" y="7.5" width="311" height="35"/>
<constraints>
<constraint firstAttribute="height" constant="35" id="ZU1-jY-pl7"/>
</constraints>
@ -44,11 +44,23 @@
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/>
<textInputTraits key="textInputTraits" keyboardType="numberPad"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rNr-vr-KE8">
<rect key="frame" x="341" y="14" width="24" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="24" id="WSp-vk-uxX"/>
<constraint firstAttribute="height" constant="22" id="WU5-kc-EnC"/>
</constraints>
<state key="normal" image="ic_calender"/>
<connections>
<action selector="openSearchFilter:" destination="ini-e3-PH4" eventType="touchUpInside" id="ci9-TE-5eM"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.97647058819999999" green="0.97647058819999999" blue="0.97647058819999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="DUl-wm-L0p" firstAttribute="leading" secondItem="Kqy-UM-ppa" secondAttribute="leading" constant="15" id="2VX-To-lrq"/>
<constraint firstAttribute="trailing" secondItem="DUl-wm-L0p" secondAttribute="trailing" constant="15" id="Gqj-8j-dSQ"/>
<constraint firstItem="rNr-vr-KE8" firstAttribute="leading" secondItem="DUl-wm-L0p" secondAttribute="trailing" constant="15" id="4Gf-H4-L0R"/>
<constraint firstItem="rNr-vr-KE8" firstAttribute="centerY" secondItem="Kqy-UM-ppa" secondAttribute="centerY" id="IHF-Xl-G93"/>
<constraint firstItem="DUl-wm-L0p" firstAttribute="centerY" secondItem="Kqy-UM-ppa" secondAttribute="centerY" id="cea-VS-XmO"/>
<constraint firstAttribute="height" constant="50" id="jcV-RK-Oih"/>
</constraints>
@ -57,7 +69,7 @@
<rect key="frame" x="0.0" y="48" width="375" height="599"/>
<subviews>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="No Transaction Found" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ujq-FS-I1H">
<rect key="frame" x="118.5" y="277.5" width="138" height="44"/>
<rect key="frame" x="122" y="277.5" width="131" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="lDS-eC-vrU"/>
</constraints>
@ -66,7 +78,7 @@
<nil key="highlightedColor"/>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="onDrag" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="s07-ms-I7n">
<rect key="frame" x="10" y="20" width="355" height="579"/>
<rect key="frame" x="10" y="55" width="355" height="544"/>
<color key="backgroundColor" red="0.90588235289999997" green="0.92941176469999998" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="ResendTableViewCell" rowHeight="120" id="IDR-UG-A5a" customClass="ResendTableViewCell" customModule="GME_Remit" customModuleProvider="target">
@ -191,20 +203,54 @@
</tableViewCell>
</prototypes>
</tableView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="v7J-ZH-GHp">
<rect key="frame" x="10" y="10" width="355" height="35"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mDh-dH-fw4">
<rect key="frame" x="0.0" y="0.0" width="170" height="35"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="16"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="-" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="b2R-UN-TUl">
<rect key="frame" x="175" y="0.0" width="5.5" height="35"/>
<constraints>
<constraint firstAttribute="width" constant="5.5" id="jgo-Hd-56n"/>
</constraints>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uLQ-0q-P97">
<rect key="frame" x="185.5" y="0.0" width="169.5" height="35"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="16"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="mDh-dH-fw4" firstAttribute="width" secondItem="uLQ-0q-P97" secondAttribute="width" id="EtE-2N-T5i"/>
<constraint firstAttribute="height" constant="35" id="eOh-zH-x3P"/>
</constraints>
</stackView>
</subviews>
<color key="backgroundColor" red="0.90588235289999997" green="0.92941176469999998" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="s07-ms-I7n" firstAttribute="leading" secondItem="39p-cv-uyM" secondAttribute="leading" constant="10" id="0wn-Vo-dZK"/>
<constraint firstItem="s07-ms-I7n" firstAttribute="top" secondItem="v7J-ZH-GHp" secondAttribute="bottom" constant="10" id="ANh-9w-DOY"/>
<constraint firstItem="Ujq-FS-I1H" firstAttribute="centerY" secondItem="39p-cv-uyM" secondAttribute="centerY" id="LeD-fH-Lyq"/>
<constraint firstItem="s07-ms-I7n" firstAttribute="top" secondItem="39p-cv-uyM" secondAttribute="top" constant="20" id="OgQ-Zb-zlY"/>
<constraint firstItem="v7J-ZH-GHp" firstAttribute="trailing" secondItem="s07-ms-I7n" secondAttribute="trailing" id="dBc-Iq-t4O"/>
<constraint firstItem="v7J-ZH-GHp" firstAttribute="leading" secondItem="s07-ms-I7n" secondAttribute="leading" id="dVs-eD-2gc"/>
<constraint firstItem="Ujq-FS-I1H" firstAttribute="centerX" secondItem="39p-cv-uyM" secondAttribute="centerX" id="jw6-m8-Nbu"/>
<constraint firstAttribute="trailing" secondItem="s07-ms-I7n" secondAttribute="trailing" constant="10" id="oyJ-mB-sel"/>
<constraint firstAttribute="bottom" secondItem="s07-ms-I7n" secondAttribute="bottom" id="q8g-38-hD1"/>
<constraint firstItem="v7J-ZH-GHp" firstAttribute="top" secondItem="39p-cv-uyM" secondAttribute="top" constant="10" id="vi5-3J-wx4"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="rNr-vr-KE8" firstAttribute="trailing" secondItem="s07-ms-I7n" secondAttribute="trailing" id="FZW-fs-p3W"/>
<constraint firstItem="39p-cv-uyM" firstAttribute="leading" secondItem="BQR-ag-XpK" secondAttribute="leading" id="WL3-sn-Dxd"/>
<constraint firstAttribute="trailing" secondItem="39p-cv-uyM" secondAttribute="trailing" id="bwb-XA-oQ6"/>
<constraint firstItem="39p-cv-uyM" firstAttribute="top" secondItem="Kqy-UM-ppa" secondAttribute="bottom" constant="-2" id="h1G-D1-tht"/>
@ -225,9 +271,12 @@
<viewLayoutGuide key="safeArea" id="vGv-NT-vse"/>
</view>
<connections>
<outlet property="dateRangeLabelHeightConstraint" destination="eOh-zH-x3P" id="3UR-tj-HGn"/>
<outlet property="emptyLabel" destination="Ujq-FS-I1H" id="Kcr-7p-lCi"/>
<outlet property="fromDateLabel" destination="mDh-dH-fw4" id="8k8-Zj-4Ji"/>
<outlet property="searchTextField" destination="DUl-wm-L0p" id="rHS-xg-UjX"/>
<outlet property="tableView" destination="s07-ms-I7n" id="oOe-nf-8aE"/>
<outlet property="toDateLabel" destination="uLQ-0q-P97" id="FTX-qu-5IO"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="DTQ-QR-ENp" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -235,5 +284,8 @@
<point key="canvasLocation" x="629.60000000000002" y="75.112443778110944"/>
</scene>
</scenes>
<resources>
<image name="ic_calender" width="25" height="25"/>
</resources>
<color key="tintColor" red="0.78177064659999995" green="0.55228364470000002" blue="0.018981300289999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</document>

41
GMERemittance/Module/Resend/User Interface/View/ResendViewController.swift

@ -27,7 +27,11 @@ class ResendViewController: UIViewController {
// MARK: IBOutlets
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var dateRangeLabelHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var emptyLabel: UILabel!
@IBOutlet weak var fromDateLabel: UILabel!
@IBOutlet weak var toDateLabel: UILabel!
@IBOutlet weak var searchTextField: UITextField!
@ -36,10 +40,23 @@ class ResendViewController: UIViewController {
// MARK: Properties
var from: String?
var to: String?
var models: [ResendListModel] = [] {
didSet {
self.emptyLabel.isHidden = !models.isEmpty
self.tableView.reloadData()
guard let fromDate = from, let toDate = to else {
self.dateRangeLabelHeightConstraint.constant = 0
return
}
self.fromDateLabel.text = self.getHUmanReadableDate(date: fromDate)
self.toDateLabel.text = self.getHUmanReadableDate(date: toDate)
UIView.animate(withDuration: 0.33, animations: {
self.dateRangeLabelHeightConstraint.constant = Constant.heightOfDateRangeLabel
})
}
}
@ -71,7 +88,12 @@ class ResendViewController: UIViewController {
// MARK: IBActions
@IBAction func openSearchFilter(_ sender: UIButton) {
// open search filter
let viewController = UIStoryboard.init(name: "TransactionHistoryDatePicker", bundle: nil).instantiateViewController(withIdentifier: "DatePickerViewController") as! DatePickerViewController
viewController.completion = self.selectedDate
self.present(viewController, animated: true, completion: nil)
}
// MARK: Other Functions
@ -81,6 +103,15 @@ class ResendViewController: UIViewController {
setupSearchTextField()
setupDelegates()
createFakeAccount()
self.dateRangeLabelHeightConstraint.constant = 0
}
private func selectedDate(from: String?, to: String?) {
self.from = from
self.to = to
guard let fromDate = from, let toDate = to else {return}
// TODO
// self.presenter?.fetchTransactionHistories(fromDate: fromDate, toDate: toDate)
}
private func setupSearchTextField() {
@ -115,6 +146,14 @@ class ResendViewController: UIViewController {
}
}
private func getHUmanReadableDate(date: String?) -> String? {
if let date = DateFormatter.toDate(dateString: date ?? "", format: AppConstants.dateFormat) {
let dateString = DateFormatter.toString(date: date, format: AppConstants.humanReadableDateFormat)
return dateString
}
return nil
}
}

5
GMERemittance/Module/TransactionHistory/User Interface/View/TransactionHistoryViewController.swift

@ -34,8 +34,6 @@ class TransactionHistoryViewController: UIViewController {
// static let unpaid = "unpaid"
}
@IBOutlet weak var fromDateLabel: UILabel!
@IBOutlet weak var toDateLabel: UILabel!
// MARK: IBOutlets
@ -43,6 +41,9 @@ class TransactionHistoryViewController: UIViewController {
@IBOutlet weak var segmentedControl: UISegmentedControl!
@IBOutlet weak var dateRangeLabelHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var emptyLabel: UILabel!
@IBOutlet weak var fromDateLabel: UILabel!
@IBOutlet weak var toDateLabel: UILabel!
@IBOutlet weak var searchTextField: UITextField!

Loading…
Cancel
Save