git.iko.soy/dashared/hookah-tau
on develop help sign in
Добавила просмотр профиля пользователя, нужны всякие красивые загрузки
commit51ce6eb9f8e56a44ff3c510689aa2a5e16d0ef6e authorDarya Rednikina <rednikina.com@yandex.ru> dateTue 10 Dec 2019, 17:45 (7 years ago) parent4d0d1d2
13 files changed+295−10
Hookah Tau.xcodeproj/project.pbxproj+20 Hookah Tau/API/Authorization api/AuthorizationService.swift+3 Hookah Tau/API/ClientsService/ClientsService.swift+26 Hookah Tau/API/ClientsService/Resolvers/ClientReservationsResolver.swift+34 Hookah Tau/Controllers/Admin/Clients/Cells/ClientTableViewCell.swift+2−1 Hookah Tau/Controllers/Admin/Clients/ClientList.storyboard+60−3 Hookah Tau/Controllers/Admin/Clients/ClientsCoordinator.swift+13−3 Hookah Tau/Controllers/Admin/Clients/ClientsViewController.swift+7 Hookah Tau/Controllers/Admin/Clients/Profile/ClientProfileCoordinator.swift+29 Hookah Tau/Controllers/Admin/Clients/Profile/ProfileTableViewController.swift+98 Hookah Tau/Controllers/Client/Profile/Views/ChangeView.xib+1−1 Hookah Tau/Controllers/Client/Reservations/Active Reservations/ReservationsViewController.swift−2 Hookah Tau/Controllers/Client/Reservations/Cells/Reservation/ReservationCell.swift+2
Hookah Tau.xcodeproj/project.pbxproj+20
@@ -81,6 +81,9 @@
8181 12E35071239FA8CA004BB188 /* Extensions+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E35070239FA8CA004BB188 /* Extensions+String.swift */; };
8282 12E35074239FAF52004BB188 /* ClientsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E35073239FAF52004BB188 /* ClientsService.swift */; };
8383 12E35078239FAFA4004BB188 /* ClientsListResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E35077239FAFA4004BB188 /* ClientsListResolver.swift */; };
84+ 12E3507B239FCFB2004BB188 /* ProfileTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E3507A239FCFB2004BB188 /* ProfileTableViewController.swift */; };
85+ 12E3507D239FD1F3004BB188 /* ClientReservationsResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E3507C239FD1F3004BB188 /* ClientReservationsResolver.swift */; };
86+ 12E3507F239FDFC2004BB188 /* ClientProfileCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E3507E239FDFC2004BB188 /* ClientProfileCoordinator.swift */; };
8487 12EA99462362B674005D9FE9 /* AddressCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12EA99452362B674005D9FE9 /* AddressCoordinator.swift */; };
8588 12EA99482362B684005D9FE9 /* AddresViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12EA99472362B684005D9FE9 /* AddresViewController.swift */; };
8689 12EA994C2362F8EF005D9FE9 /* AddressView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 12EA994B2362F8EF005D9FE9 /* AddressView.xib */; };
@@ -214,6 +217,9 @@
214217 12E35070239FA8CA004BB188 /* Extensions+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extensions+String.swift"; sourceTree = "<group>"; };
215218 12E35073239FAF52004BB188 /* ClientsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientsService.swift; sourceTree = "<group>"; };
216219 12E35077239FAFA4004BB188 /* ClientsListResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientsListResolver.swift; sourceTree = "<group>"; };
220+ 12E3507A239FCFB2004BB188 /* ProfileTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileTableViewController.swift; sourceTree = "<group>"; };
221+ 12E3507C239FD1F3004BB188 /* ClientReservationsResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientReservationsResolver.swift; sourceTree = "<group>"; };
222+ 12E3507E239FDFC2004BB188 /* ClientProfileCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientProfileCoordinator.swift; sourceTree = "<group>"; };
217223 12EA99452362B674005D9FE9 /* AddressCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressCoordinator.swift; sourceTree = "<group>"; };
218224 12EA99472362B684005D9FE9 /* AddresViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddresViewController.swift; sourceTree = "<group>"; };
219225 12EA994B2362F8EF005D9FE9 /* AddressView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AddressView.xib; sourceTree = "<group>"; };
@@ -428,6 +434,7 @@
428434 123D25EE239E3D61002FA32B /* Clients */ = {
429435 isa = PBXGroup;
430436 children = (
437+ 12E35079239FCF91004BB188 /* Profile */,
431438 123D25F5239E57D6002FA32B /* Cells */,
432439 123D25F1239E3E44002FA32B /* ClientsCoordinator.swift */,
433440 123D25F3239E3FF5002FA32B /* ClientsViewController.swift */,
@@ -573,10 +580,20 @@
573580 isa = PBXGroup;
574581 children = (
575582 12E35077239FAFA4004BB188 /* ClientsListResolver.swift */,
583+ 12E3507C239FD1F3004BB188 /* ClientReservationsResolver.swift */,
576584 );
577585 path = Resolvers;
578586 sourceTree = "<group>";
579587 };
588+ 12E35079239FCF91004BB188 /* Profile */ = {
589+ isa = PBXGroup;
590+ children = (
591+ 12E3507A239FCFB2004BB188 /* ProfileTableViewController.swift */,
592+ 12E3507E239FDFC2004BB188 /* ClientProfileCoordinator.swift */,
593+ );
594+ path = Profile;
595+ sourceTree = "<group>";
596+ };
580597 12EA99492362B9F5005D9FE9 /* Adress of reservation */ = {
581598 isa = PBXGroup;
582599 children = (
@@ -998,6 +1015,7 @@
9981015 12230AF723900D44004A01E5 /* EstablishmentResolver.swift in Sources */,
9991016 1246B719235CD3AD004CBFA1 /* NoReservationsView.swift in Sources */,
10001017 F3895F4A233D323700FA6A37 /* CodeCoordinator.swift in Sources */,
1018+ 12E3507F239FDFC2004BB188 /* ClientProfileCoordinator.swift in Sources */,
10011019 12838EB4236779C700CEF108 /* ApiResolver.swift in Sources */,
10021020 12838EA9236764A600CEF108 /* APIClient.swift in Sources */,
10031021 123615D12355141600D1122A /* ProfileView.swift in Sources */,
@@ -1029,6 +1047,7 @@
10291047 12A075F72373535C00D749BB /* FirstStepReservationViewController.swift in Sources */,
10301048 12E35078239FAFA4004BB188 /* ClientsListResolver.swift in Sources */,
10311049 1246B71C235CDF3A004CBFA1 /* ReservationCell.swift in Sources */,
1050+ 12E3507B239FCFB2004BB188 /* ProfileTableViewController.swift in Sources */,
10321051 1212048C23914CFD00CAF162 /* DeleteReservationResolver.swift in Sources */,
10331052 12A075FD237357E900D749BB /* FirstStepReservationCoordinator.swift in Sources */,
10341053 124D0081237222C900AE76B9 /* ReservationsService.swift in Sources */,
@@ -1058,6 +1077,7 @@
10581077 F3851B302340A513009EE0B6 /* RegistationViewModel.swift in Sources */,
10591078 12838EAE2367701300CEF108 /* AuthorizationService.swift in Sources */,
10601079 12C72EDF23537D1B00AD7004 /* ProfileCoordinator.swift in Sources */,
1080+ 12E3507D239FD1F3004BB188 /* ClientReservationsResolver.swift in Sources */,
10611081 12EA994E2362FCE8005D9FE9 /* AddressView.swift in Sources */,
10621082 F3895F4C233D347E00FA6A37 /* PhoneNumberViewController.swift in Sources */,
10631083 12EE4A76234BB8FE005B4D1A /* CodeView.swift in Sources */,
Hookah Tau/API/Authorization api/AuthorizationService.swift+3
@@ -39,6 +39,7 @@ class AuthorizationService {
3939 }
4040
4141 completion(.success(decodedData.isUserRegistered))
42+ return
4243 }
4344 }
4445 }
@@ -65,6 +66,7 @@ class AuthorizationService {
6566
6667 self.setCookies(response: response)
6768 completion(.success(decodedData))
69+ return
6870 }
6971 }
7072 }
@@ -94,6 +96,7 @@ class AuthorizationService {
9496
9597 self.setCookies(response: response)
9698 completion(.success(decodedData))
99+ return
97100 }
98101 }
99102 }
Hookah Tau/API/ClientsService/ClientsService.swift+26
@@ -37,4 +37,30 @@ class ClientsService {
3737 }
3838 }
3939 }
40+
41+ func loadReservationsForUser(withUUID uuid: String,
42+ completion: @escaping ((Result<[Reservation], GeneralError>) -> Void)) {
43+ let resolver = ClientReservationsResolver<UserReservationsResponce>(userId: uuid)
44+ let request = ApiRequest(resolver: resolver, httpMethod: .get)
45+
46+ apiClient.load(request: request.request) { (res) in
47+ switch res {
48+ case .failure(let err):
49+ completion(.failure(err))
50+ return
51+ case .success(let responce):
52+ guard
53+ let d = responce.data,
54+ let decData = resolver.targetClass().fromJSONToSelf(data: d)
55+ else {
56+ completion(.failure(GeneralError.decodeError))
57+ return
58+ }
59+
60+ completion(.success(decData.reservations))
61+ return
62+ }
63+ }
64+
65+ }
4066}
Hookah Tau/API/ClientsService/Resolvers/ClientReservationsResolver.swiftnew file+34
@@ -0,0 +1,34 @@
1+//
2+// ClientReservations.swift
3+// Hookah Tau
4+//
5+// Created by cstore on 10/12/2019.
6+// Copyright © 2019 Daria Rednikina. All rights reserved.
7+//
8+
9+import Foundation
10+
11+struct UserReservationsResponce: MyCodable {
12+ var reservations: [Reservation]
13+}
14+
15+class ClientReservationsResolver<Responce: MyCodable>: ApiResolver {
16+
17+ var name: String {
18+ return "/clients/\(userId)/reservations"
19+ }
20+
21+ var groupName: String? {
22+ return "/admin"
23+ }
24+
25+ var userId: String
26+
27+ init(userId: String) {
28+ self.userId = userId
29+ }
30+
31+ func targetClass() -> Responce.Type {
32+ return Responce.self
33+ }
34+}
Hookah Tau/Controllers/Admin/Clients/Cells/ClientTableViewCell.swift+2−1
@@ -36,7 +36,8 @@ class ClientTableViewCell: UITableViewCell {
3636 // MARK: - Bind
3737
3838 func bind(withModel model: FullUser) {
39− nameLabel.text = model.name ?? "❔"
39+ let name = model.name ?? "❔"
40+ nameLabel.text = model.isAdmin ? "👑 " + name : name
4041 phoneNumberLabel.text = model.phoneNumber.formattedNumber()
4142 }
4243
Hookah Tau/Controllers/Admin/Clients/ClientList.storyboard+60−3
@@ -3,7 +3,7 @@
33 <device id="retina4_7" orientation="portrait" appearance="light"/>
44 <dependencies>
55 <deployment identifier="iOS"/>
6− <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14868"/>
6+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
77 <capability name="Stack View standard spacing" minToolsVersion="9.0"/>
88 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
99 </dependencies>
@@ -24,11 +24,11 @@
2424 <rect key="frame" x="0.0" y="0.0" width="375" height="69"/>
2525 <autoresizingMask key="autoresizingMask"/>
2626 <subviews>
27− <stackView opaque="NO" contentMode="scaleToFill" spacing="126" translatesAutoresizingMaskIntoConstraints="NO" id="fhd-NM-rld">
27+ <stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="fhd-NM-rld">
2828 <rect key="frame" x="16" y="8" width="343" height="53"/>
2929 <subviews>
3030 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="top" translatesAutoresizingMaskIntoConstraints="NO" id="vNV-bN-3No">
31− <rect key="frame" x="0.0" y="0.0" width="184.5" height="53"/>
31+ <rect key="frame" x="0.0" y="0.0" width="179" height="53"/>
3232 <subviews>
3333 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Стасик" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Cp-jh-0Gq">
3434 <rect key="frame" x="0.0" y="0.0" width="78.5" height="26.5"/>
@@ -85,6 +85,63 @@
8585 </objects>
8686 <point key="canvasLocation" x="0.80000000000000004" y="-112.89355322338831"/>
8787 </scene>
88+ <!--Profile Table View Controller-->
89+ <scene sceneID="8Qr-sA-YQr">
90+ <objects>
91+ <tableViewController storyboardIdentifier="ProfileTableViewController" id="mqB-EY-UGh" customClass="ProfileTableViewController" customModule="Hookah_Tau" customModuleProvider="target" sceneMemberID="viewController">
92+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="N1B-QX-4Kn">
93+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
94+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
95+ <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
96+ <view key="tableHeaderView" contentMode="scaleToFill" id="oN2-r5-lTy">
97+ <rect key="frame" x="0.0" y="0.0" width="375" height="65"/>
98+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
99+ <subviews>
100+ <stackView opaque="NO" contentMode="scaleToFill" spacing="47" translatesAutoresizingMaskIntoConstraints="NO" id="UpQ-Uf-0Kc">
101+ <rect key="frame" x="8" y="16" width="359" height="37"/>
102+ <subviews>
103+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nFA-T3-Dxe" customClass="Button" customModule="Hookah_Tau" customModuleProvider="target">
104+ <rect key="frame" x="0.0" y="0.0" width="177" height="37"/>
105+ <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
106+ <constraints>
107+ <constraint firstAttribute="height" constant="37" id="41i-38-mHD"/>
108+ <constraint firstAttribute="width" constant="174" id="po9-OR-zq1"/>
109+ </constraints>
110+ <state key="normal" title="Button"/>
111+ </button>
112+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HkY-u9-thv" customClass="Button" customModule="Hookah_Tau" customModuleProvider="target">
113+ <rect key="frame" x="224" y="0.0" width="135" height="37"/>
114+ <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
115+ <constraints>
116+ <constraint firstAttribute="height" constant="37" id="LDw-fn-Xem"/>
117+ <constraint firstAttribute="width" constant="135" id="swI-oV-Khe"/>
118+ </constraints>
119+ <state key="normal" title="Button"/>
120+ </button>
121+ </subviews>
122+ </stackView>
123+ </subviews>
124+ <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
125+ <constraints>
126+ <constraint firstItem="UpQ-Uf-0Kc" firstAttribute="top" secondItem="oN2-r5-lTy" secondAttribute="top" constant="16" id="58o-fg-n3i"/>
127+ <constraint firstItem="UpQ-Uf-0Kc" firstAttribute="leading" secondItem="oN2-r5-lTy" secondAttribute="leading" constant="8" id="5ik-TQ-N4U"/>
128+ <constraint firstAttribute="trailing" secondItem="UpQ-Uf-0Kc" secondAttribute="trailing" constant="8" id="8Ca-3C-Xld"/>
129+ </constraints>
130+ </view>
131+ <connections>
132+ <outlet property="dataSource" destination="mqB-EY-UGh" id="YZe-zB-7f3"/>
133+ <outlet property="delegate" destination="mqB-EY-UGh" id="JPi-98-LhH"/>
134+ </connections>
135+ </tableView>
136+ <connections>
137+ <outlet property="copyButton" destination="HkY-u9-thv" id="RLs-cg-y3g"/>
138+ <outlet property="phoneButton" destination="nFA-T3-Dxe" id="d7H-jf-NB5"/>
139+ </connections>
140+ </tableViewController>
141+ <placeholder placeholderIdentifier="IBFirstResponder" id="1YW-I1-Y6m" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
142+ </objects>
143+ <point key="canvasLocation" x="880.79999999999995" y="-111.0944527736132"/>
144+ </scene>
88145 </scenes>
89146 <resources>
90147 <image name="arrow" width="12" height="20"/>
Hookah Tau/Controllers/Admin/Clients/ClientsCoordinator.swift+13−3
@@ -14,13 +14,23 @@ class ClientsCoordinator: BaseCoordinator {
1414 override func start() {
1515 let storyboard = UIStoryboard(name: "ClientList", bundle: nil)
1616 let viewController = storyboard.instantiateViewController(withIdentifier: "ClientsViewController") as? ClientsViewController
17−
17+ viewController?.coordinator = self
1818 guard let vc = viewController else { return }
19− navigationController?.pushViewController(vc, animated: true)
19+ navigationController?.navigationBar.prefersLargeTitles = true
20+ navigationController?.viewControllers = [vc]
2021 }
2122
2223 /// TODO
23− func openUserProfile(withUUID uuid: String) {
24+ func openUserProfile(_ profile: FullUser) {
25+ let profileCoordinator = ClientProfileCoordinator(navigationController: navigationController)
26+ profileCoordinator.user = profile
27+
28+ self.addDependency(profileCoordinator)
29+ profileCoordinator.didEndFlow = {
30+ self.removeDependency(profileCoordinator)
31+ self.navigationController?.popViewController(animated: true)
32+ }
2433
34+ profileCoordinator.start()
2535 }
2636}
Hookah Tau/Controllers/Admin/Clients/ClientsViewController.swift+7
@@ -20,6 +20,8 @@ class ClientsViewController: UITableViewController {
2020
2121 var clientsService: ClientsService?
2222
23+ weak var coordinator: ClientsCoordinator?
24+
2325 // MARK: - Lifecycle
2426
2527 override func viewDidLoad() {
@@ -57,4 +59,9 @@ class ClientsViewController: UITableViewController {
5759 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
5860 return dataSource.count
5961 }
62+
63+ override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
64+ let user = dataSource[indexPath.row]
65+ coordinator?.openUserProfile(user)
66+ }
6067}
Hookah Tau/Controllers/Admin/Clients/Profile/ClientProfileCoordinator.swiftnew file+29
@@ -0,0 +1,29 @@
1+//
2+// ClientProfileCoordinator.swift
3+// Hookah Tau
4+//
5+// Created by cstore on 10/12/2019.
6+// Copyright © 2019 Daria Rednikina. All rights reserved.
7+//
8+
9+import UIKit
10+
11+
12+class ClientProfileCoordinator: BaseCoordinator {
13+
14+ var user: FullUser?
15+
16+ override func start() {
17+ let storyboard = UIStoryboard(name: "ClientList", bundle: nil)
18+ let viewController = storyboard.instantiateViewController(withIdentifier: "ProfileTableViewController") as? ProfileTableViewController
19+ viewController?.user = user
20+ guard let vc = viewController else { return }
21+ navigationController?.pushViewController(vc, animated: true)
22+ }
23+
24+
25+ // Создание бронирования из профиля клиента
26+ func createReservation(forUserWithPhone phoneNumber: String) {
27+
28+ }
29+}
Hookah Tau/Controllers/Admin/Clients/Profile/ProfileTableViewController.swiftnew file+98
@@ -0,0 +1,98 @@
1+//
2+// ProfileTableViewController.swift
3+// Hookah Tau
4+//
5+// Created by cstore on 10/12/2019.
6+// Copyright © 2019 Daria Rednikina. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class ProfileTableViewController: UITableViewController {
12+
13+ // MARK: - IBAOutlets
14+
15+ @IBOutlet weak var phoneButton: Button! {
16+ didSet {
17+ guard let u = user else { return }
18+
19+ let style = BlackButtonStyle()
20+ style.apply(to: phoneButton, withTitle: u.phoneNumber.formattedNumber())
21+ phoneButton.addTarget(self, action: #selector(callUser), for: .touchUpInside)
22+ }
23+ }
24+
25+ @IBOutlet weak var copyButton: Button! {
26+ didSet {
27+ let style = BlackButtonStyle()
28+ style.apply(to: copyButton, withTitle: "скопировать")
29+ }
30+ }
31+
32+ // MARK: - properties
33+
34+ var clientsService: ClientsService?
35+
36+ var user: FullUser? {
37+ didSet {
38+ guard let u = user else { return }
39+ navigationItem.title = u.name
40+ }
41+ }
42+
43+ weak var coodinator: ClientProfileCoordinator?
44+
45+ var dataSource: [Reservation] = [] {
46+ didSet {
47+ tableView.reloadData()
48+ }
49+ }
50+
51+ // MARK: - Lifecycle
52+
53+ override func viewDidLoad() {
54+ super.viewDidLoad()
55+
56+ tableView?.register(ReservationCell.self, forCellReuseIdentifier: reservationCell)
57+
58+ clientsService = ClientsService(apiClient: APIClient.shared)
59+ loadReservations()
60+ }
61+
62+ func loadReservations() {
63+ guard let uuid = user?.uuid else { return }
64+ clientsService?.loadReservationsForUser(withUUID: uuid,
65+ completion: { [weak self] (res) in
66+ switch res {
67+ case .failure(let err):
68+ print(err)
69+ case .success(let data):
70+ self?.dataSource = data
71+ }
72+ })
73+ }
74+
75+ // MARK: - Table view data source
76+
77+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
78+ return dataSource.count
79+ }
80+
81+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
82+ let cell = tableView.dequeueReusableCell(withIdentifier: reservationCell, for: indexPath) as! ReservationCell
83+
84+ cell.bind(withModel: dataSource[indexPath.row])
85+
86+ return cell
87+ }
88+
89+ @objc func callUser() {
90+ guard
91+ let u = user,
92+ let urlPhone = URL(string: "tel://79\(u.phoneNumber)")
93+ else { return }
94+
95+ UIApplication.shared.open(urlPhone)
96+ }
97+
98+}
Hookah Tau/Controllers/Client/Profile/Views/ChangeView.xib+1−1
@@ -17,7 +17,7 @@
1717 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="19Q-ZO-gm4">
1818 <rect key="frame" x="20" y="11" width="335" height="83.5"/>
1919 <subviews>
20− <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Имя" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oB7-uQ-xmw">
20+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Имя" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oB7-uQ-xmw">
2121 <rect key="frame" x="0.0" y="0.0" width="335" height="33.5"/>
2222 <fontDescription key="fontDescription" type="boldSystem" pointSize="28"/>
2323 <color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Hookah Tau/Controllers/Client/Reservations/Active Reservations/ReservationsViewController.swift−2
@@ -8,8 +8,6 @@
88
99import UIKit
1010
11−let reservationCell = "ReservationCell"
12−
1311class ReservationsViewController: BaseViewController {
1412
1513 // MARK: - Properties
Hookah Tau/Controllers/Client/Reservations/Cells/Reservation/ReservationCell.swift+2
@@ -8,6 +8,8 @@
88
99import UIKit
1010
11+let reservationCell = "ReservationCell"
12+
1113class ReservationCell: UITableViewCell {
1214
1315 // MARK: - Properties