Browse Source

serch with date complete

pull/1/head
gme_2 6 years ago
parent
commit
5ad2b6cff1
  1. 61
      GMERemittance/Module/WalletStatement/User Interface/View/WalletStatement.storyboard
  2. 33
      GMERemittance/Module/WalletStatement/User Interface/View/WalletStatementViewController.swift

61
GMERemittance/Module/WalletStatement/User Interface/View/WalletStatement.storyboard

@ -29,47 +29,11 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Q4i-L4-Mdw"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Q4i-L4-Mdw">
<rect key="frame" x="0.0" y="20" width="375" height="647"/> <rect key="frame" x="0.0" y="20" width="375" height="647"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TiK-nj-tgL">
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9hO-WA-dEt">
<rect key="frame" x="335" y="15" width="24" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="FNq-I5-k67"/>
<constraint firstAttribute="width" constant="24" id="hUa-15-2TT"/>
</constraints>
<state key="normal" image="ic_calender"/>
<connections>
<action selector="openSearchFilter:" destination="8Qn-oI-NDn" eventType="touchUpInside" id="uxZ-2y-brx"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.97647058819999999" green="0.97647058819999999" blue="0.97647058819999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="9hO-WA-dEt" firstAttribute="top" secondItem="TiK-nj-tgL" secondAttribute="top" constant="15" id="GDX-Sw-yCI"/>
<constraint firstAttribute="height" constant="50" id="OtN-er-p6d"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="s4k-ts-Yz0"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="s4k-ts-Yz0">
<rect key="frame" x="0.0" y="48" width="375" height="599"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="647"/>
<subviews> <subviews>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="LOQ-cg-yVF">
<rect key="frame" x="16" y="14" width="343" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="29" id="3Bb-uB-UZh"/>
</constraints>
<segments>
<segment title="All"/>
<segment title="In"/>
<segment title="Out"/>
</segments>
<color key="tintColor" red="0.92549019610000005" green="0.10980392160000001" blue="0.14117647059999999" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<action selector="segmentChanged:" destination="8Qn-oI-NDn" eventType="valueChanged" id="bSF-E9-Awk"/>
</connections>
</segmentedControl>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="HXS-oS-mKa"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="HXS-oS-mKa">
<rect key="frame" x="10" y="83" width="355" height="516"/>
<rect key="frame" x="10" y="45" width="355" height="602"/>
<color key="backgroundColor" red="0.90588235289999997" green="0.92941176469999998" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.90588235289999997" green="0.92941176469999998" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletStatementTableViewCell" rowHeight="124" id="lsU-QR-G1g" customClass="WalletStatementTableViewCell" customModule="GMERemittance" customModuleProvider="target"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletStatementTableViewCell" rowHeight="124" id="lsU-QR-G1g" customClass="WalletStatementTableViewCell" customModule="GMERemittance" customModuleProvider="target">
@ -170,7 +134,7 @@
</prototypes> </prototypes>
</tableView> </tableView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="Otx-07-9H8"> <stackView opaque="NO" contentMode="scaleToFill" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="Otx-07-9H8">
<rect key="frame" x="16" y="43" width="343" height="35"/>
<rect key="frame" x="16" y="5" width="343" height="35"/>
<subviews> <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="fEw-5s-hYk"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fEw-5s-hYk">
<rect key="frame" x="0.0" y="0.0" width="164" height="35"/> <rect key="frame" x="0.0" y="0.0" width="164" height="35"/>
@ -203,28 +167,21 @@
<color key="backgroundColor" red="0.90588235289999997" green="0.92941176469999998" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.90588235289999997" green="0.92941176469999998" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<constraints> <constraints>
<constraint firstItem="HXS-oS-mKa" firstAttribute="top" secondItem="Otx-07-9H8" secondAttribute="bottom" constant="5" id="0JU-27-atW"/> <constraint firstItem="HXS-oS-mKa" firstAttribute="top" secondItem="Otx-07-9H8" secondAttribute="bottom" constant="5" id="0JU-27-atW"/>
<constraint firstItem="Otx-07-9H8" firstAttribute="top" secondItem="LOQ-cg-yVF" secondAttribute="bottom" id="1yW-Jt-6nJ"/>
<constraint firstItem="Otx-07-9H8" firstAttribute="top" secondItem="s4k-ts-Yz0" secondAttribute="top" constant="5" id="6VA-jn-0RI"/>
<constraint firstItem="HXS-oS-mKa" firstAttribute="leading" secondItem="s4k-ts-Yz0" secondAttribute="leading" constant="10" id="CTI-mG-Mbd"/> <constraint firstItem="HXS-oS-mKa" firstAttribute="leading" secondItem="s4k-ts-Yz0" secondAttribute="leading" constant="10" id="CTI-mG-Mbd"/>
<constraint firstItem="LOQ-cg-yVF" firstAttribute="leading" secondItem="s4k-ts-Yz0" secondAttribute="leading" constant="16" id="DEm-Rz-q5U"/>
<constraint firstItem="Otx-07-9H8" firstAttribute="leading" secondItem="s4k-ts-Yz0" secondAttribute="leading" constant="16" id="DE1-aj-aWV"/>
<constraint firstAttribute="trailing" secondItem="HXS-oS-mKa" secondAttribute="trailing" constant="10" id="PYf-I3-73X"/> <constraint firstAttribute="trailing" secondItem="HXS-oS-mKa" secondAttribute="trailing" constant="10" id="PYf-I3-73X"/>
<constraint firstItem="Otx-07-9H8" firstAttribute="leading" secondItem="LOQ-cg-yVF" secondAttribute="leading" id="UKZ-ar-jVQ"/>
<constraint firstAttribute="trailing" secondItem="LOQ-cg-yVF" secondAttribute="trailing" constant="16" id="dEQ-qZ-TME"/>
<constraint firstItem="LOQ-cg-yVF" firstAttribute="top" secondItem="s4k-ts-Yz0" secondAttribute="top" constant="14" id="kYc-FW-nOG"/>
<constraint firstAttribute="bottom" secondItem="HXS-oS-mKa" secondAttribute="bottom" id="nfD-hR-zOx"/> <constraint firstAttribute="bottom" secondItem="HXS-oS-mKa" secondAttribute="bottom" id="nfD-hR-zOx"/>
<constraint firstItem="Otx-07-9H8" firstAttribute="trailing" secondItem="LOQ-cg-yVF" secondAttribute="trailing" id="obZ-Qa-XWc"/>
<constraint firstAttribute="trailing" secondItem="Otx-07-9H8" secondAttribute="trailing" constant="16" id="wfQ-en-q5h"/>
</constraints> </constraints>
</view> </view>
</subviews> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints> <constraints>
<constraint firstAttribute="trailing" secondItem="s4k-ts-Yz0" secondAttribute="trailing" id="Bwr-hc-1QT"/> <constraint firstAttribute="trailing" secondItem="s4k-ts-Yz0" secondAttribute="trailing" id="Bwr-hc-1QT"/>
<constraint firstItem="9hO-WA-dEt" firstAttribute="trailing" secondItem="LOQ-cg-yVF" secondAttribute="trailing" id="ESw-xG-x5C"/>
<constraint firstAttribute="trailing" secondItem="TiK-nj-tgL" secondAttribute="trailing" id="I4D-kJ-o1j"/>
<constraint firstItem="s4k-ts-Yz0" firstAttribute="top" secondItem="TiK-nj-tgL" secondAttribute="bottom" constant="-2" id="LoO-qm-qgR"/>
<constraint firstItem="s4k-ts-Yz0" firstAttribute="top" secondItem="Q4i-L4-Mdw" secondAttribute="top" id="WO4-Za-cqb"/>
<constraint firstItem="s4k-ts-Yz0" firstAttribute="leading" secondItem="Q4i-L4-Mdw" secondAttribute="leading" id="ZeF-YD-8yr"/> <constraint firstItem="s4k-ts-Yz0" firstAttribute="leading" secondItem="Q4i-L4-Mdw" secondAttribute="leading" id="ZeF-YD-8yr"/>
<constraint firstAttribute="bottom" secondItem="s4k-ts-Yz0" secondAttribute="bottom" id="bAz-Lj-Oby"/> <constraint firstAttribute="bottom" secondItem="s4k-ts-Yz0" secondAttribute="bottom" id="bAz-Lj-Oby"/>
<constraint firstItem="TiK-nj-tgL" firstAttribute="top" secondItem="Q4i-L4-Mdw" secondAttribute="top" id="gh5-Pq-FuH"/>
<constraint firstItem="TiK-nj-tgL" firstAttribute="leading" secondItem="Q4i-L4-Mdw" secondAttribute="leading" id="weB-3L-BSQ"/>
</constraints> </constraints>
</view> </view>
</subviews> </subviews>
@ -240,7 +197,6 @@
<connections> <connections>
<outlet property="dateRangeLabelHeightConstraint" destination="Pxd-5h-5QL" id="Z4d-db-hQo"/> <outlet property="dateRangeLabelHeightConstraint" destination="Pxd-5h-5QL" id="Z4d-db-hQo"/>
<outlet property="fromDateLabel" destination="fEw-5s-hYk" id="YQ4-aX-wOs"/> <outlet property="fromDateLabel" destination="fEw-5s-hYk" id="YQ4-aX-wOs"/>
<outlet property="segmentedControl" destination="LOQ-cg-yVF" id="1Et-9X-fgX"/>
<outlet property="tableView" destination="HXS-oS-mKa" id="g0z-gS-MiK"/> <outlet property="tableView" destination="HXS-oS-mKa" id="g0z-gS-MiK"/>
<outlet property="toDateLabel" destination="98a-R9-YKZ" id="3LH-lJ-hxn"/> <outlet property="toDateLabel" destination="98a-R9-YKZ" id="3LH-lJ-hxn"/>
</connections> </connections>
@ -250,8 +206,5 @@
<point key="canvasLocation" x="119" y="126"/> <point key="canvasLocation" x="119" y="126"/>
</scene> </scene>
</scenes> </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"/> <color key="tintColor" red="0.78177064659999995" green="0.55228364470000002" blue="0.018981300289999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</document> </document>

33
GMERemittance/Module/WalletStatement/User Interface/View/WalletStatementViewController.swift

@ -14,19 +14,11 @@ enum WalletStatementType {
} }
class WalletStatementViewController: UIViewController { class WalletStatementViewController: UIViewController {
enum SegmentIndex: Int {
case walletIn = 0
case walletOut
case all
}
// MARK: IBOutlets // MARK: IBOutlets
@IBOutlet weak var tableView: UITableView! @IBOutlet weak var tableView: UITableView!
@IBOutlet weak var segmentedControl: UISegmentedControl!
@IBOutlet weak var dateRangeLabelHeightConstraint: NSLayoutConstraint! @IBOutlet weak var dateRangeLabelHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var fromDateLabel: UILabel! @IBOutlet weak var fromDateLabel: UILabel!
@IBOutlet weak var toDateLabel: UILabel! @IBOutlet weak var toDateLabel: UILabel!
@ -64,6 +56,7 @@ class WalletStatementViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.setupNormalNavigation() self.setupNormalNavigation()
self.setupDateFilterButton()
self.setup() self.setup()
} }
@ -79,19 +72,7 @@ class WalletStatementViewController: UIViewController {
// MARK: IBActions // MARK: IBActions
@IBAction func segmentChanged(_ sender: UISegmentedControl) {
guard let index = SegmentIndex(rawValue: sender.selectedSegmentIndex) else {return}
switch index {
case .walletIn:
break
case .walletOut:
break
case .all:
break
}
}
@IBAction func openSearchFilter(_ sender: UIButton) {
@objc func openSearchFilter() {
// open search filter // open search filter
let viewController = UIStoryboard.init(name: "TransactionHistoryDatePicker", bundle: nil).instantiateViewController(withIdentifier: "DatePickerViewController") as! DatePickerViewController let viewController = UIStoryboard.init(name: "TransactionHistoryDatePicker", bundle: nil).instantiateViewController(withIdentifier: "DatePickerViewController") as! DatePickerViewController
viewController.completion = self.selectedDate viewController.completion = self.selectedDate
@ -102,7 +83,7 @@ class WalletStatementViewController: UIViewController {
self.from = from self.from = from
self.to = to self.to = to
guard let fromDate = from, let toDate = to else {return} guard let fromDate = from, let toDate = to else {return}
// self.presenter?.fetchTransactionHistories(fromDate: fromDate, toDate: toDate)
self.presenter?.fetchWalletSatement(fromDate: fromDate, toDate: toDate)
} }
// MARK: Other Functions // MARK: Other Functions
@ -110,10 +91,18 @@ class WalletStatementViewController: UIViewController {
private func setup() { private func setup() {
// all setup should be done here // all setup should be done here
setupDelegates() setupDelegates()
setupDateFilterButton()
self.dateRangeLabelHeightConstraint.constant = 0 self.dateRangeLabelHeightConstraint.constant = 0
self.presenter?.viewIsReady() self.presenter?.viewIsReady()
} }
private func setupDateFilterButton() {
let filterItem = UIBarButtonItem.init(image: #imageLiteral(resourceName: "ic_calender"), style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.openSearchFilter))
self.navigationItem.rightBarButtonItem = filterItem
}
private func getHUmanReadableDate(date: String?) -> String? { private func getHUmanReadableDate(date: String?) -> String? {
if let date = DateFormatter.toDate(dateString: date ?? "", format: AppConstants.dateFormat) { if let date = DateFormatter.toDate(dateString: date ?? "", format: AppConstants.dateFormat) {
let dateString = DateFormatter.toString(date: date, format: AppConstants.humanReadableDateFormat) let dateString = DateFormatter.toString(date: date, format: AppConstants.humanReadableDateFormat)

Loading…
Cancel
Save