git.iko.soy/dashared/hookah-tau
on c896aef help sign in
46 files changed+247−1418
since splitsnapshots
unifiedsplit
Hookah Tau.xcodeproj/project.pbxproj+23−79 Hookah Tau/API/APIClient.swift−2 Hookah Tau/API/ClientsService/ClientsService.swift−63 Hookah Tau/API/ClientsService/Resolvers/BlocklistPutResolver.swift−33 Hookah Tau/API/ClientsService/Resolvers/DeleteOtherAdminResolver.swift−35 Hookah Tau/API/ClientsService/Resolvers/GetClientByPhoneNumberResolver.swift−35 Hookah Tau/API/Reservations api/ReservationsService.swift−23 Hookah Tau/API/Reservations api/Resolvers/Admin/ACreateReservationResolver.swift−37 Hookah Tau/API/ServerError.swift−1 Hookah Tau/API/ClientsService/Resolvers/AddOtherAdminResolver.swift → Hookah Tau/API/Settings/Resolvers/AddOtherAdminResolver.swift Hookah Tau/API/Settings/SettingsService.swift+34 Hookah Tau/Components/PhoneTextField.swift−63 Hookah Tau/Controllers/Admin/Clients/Cells/ClientTableViewCell.swift+3−11 Hookah Tau/Controllers/Admin/Clients/ClientList.storyboard+63−110 Hookah Tau/Controllers/Admin/Clients/ClientsCoordinator.swift+4−1 Hookah Tau/Controllers/Admin/Clients/ClientsViewController.swift+6−169 Hookah Tau/Controllers/Admin/Clients/Profile/ClientProfileCoordinator.swift+2−12 Hookah Tau/Controllers/Admin/Clients/Profile/ProfileTableViewController.swift+22−106 Hookah Tau/Controllers/Admin/Reservations/AdminReservationEditingCoordinator.swift+1−3 Hookah Tau/Controllers/Admin/Reservations/AdminReservationEditingViewController.swift+21−52 Hookah Tau/Controllers/Admin/Reservations/AdminReservations.storyboard+3−67 Hookah Tau/Controllers/Admin/Reservations/List of reservations/AdminReservationsController.swift+3−4 Hookah Tau/Controllers/Admin/Reservations/List of reservations/AdminReservationsCoordinator.swift−16 Hookah Tau/Controllers/Admin/Reservations/Making a reeservation/1/AdminFirstStepReservationViewCoordinator.swift−108 Hookah Tau/Controllers/Admin/Reservations/Making a reeservation/2/AdminSecondStepReservationViewController.swift−124 Hookah Tau/Controllers/Admin/Reservations/Making a reeservation/2/AdminSecondStepReservationViewCoordinator.swift−54 Hookah Tau/Controllers/Admin/Reservations/Making a reeservation/3/AdminFinalStepReservationCoordinator.swift−47 Hookah Tau/Controllers/Admin/Reservations/Views/AdminReservationView.swift+4−11 Hookah Tau/Controllers/Admin/Reservations/Views/AdminReservationView.xib+21−36 Hookah Tau/Controllers/Admin/Reservations/Views/No reserv/AdminNoReservationsView.swift−5 Hookah Tau/Controllers/Admin/Reservations/Views/No reserv/AdminNoReservationsView.xib−1 Hookah Tau/Controllers/BaseViewController.swift+1−1 Hookah Tau/Controllers/Client/Profile/ProfileChangeViewController.swift+3−3 Hookah Tau/Controllers/Client/Reservations/Active Reservations/ReservationsViewController.swift+1−1 Hookah Tau/Controllers/Client/Reservations/Steps/1/FirstStepReservationCoordinator.swift+1−8 Hookah Tau/Controllers/Client/Reservations/Steps/1/FirstStepReservationViewController.swift+6−15 Hookah Tau/Controllers/Client/Reservations/Steps/1/FirstStepView.xib+18−18 Hookah Tau/Controllers/Client/Reservations/Steps/2/SecondStepView.xib+2−2 Hookah Tau/Controllers/Client/Reservations/Steps/3/ThirdStepView.xib+3−3 Hookah Tau/HFunc.swift−7 Hookah Tau/Models/Reservation.swift+1−15 Hookah Tau/Models/User.swift+1−10 Hookah Tau/Supporting Files/Assets.xcassets/admin.imageset/Contents.json−12 Hookah Tau/Supporting Files/Assets.xcassets/admin.imageset/admin.pdf Hookah Tau/Supporting Files/Assets.xcassets/blacklist.imageset/Contents.json−15 Hookah Tau/Supporting Files/Assets.xcassets/blacklist.imageset/blacklist.pdf
Hookah Tau.xcodeproj/project.pbxproj+23−79
@@ -17,9 +17,6 @@
1717 12118B9E23682049006BAEE3 /* PhoneCodeResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12118B9D23682049006BAEE3 /* PhoneCodeResolver.swift */; };
1818 1212048C23914CFD00CAF162 /* DeleteReservationResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1212048B23914CFD00CAF162 /* DeleteReservationResolver.swift */; };
1919 1212048E23915A0A00CAF162 /* ChangeReservationResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1212048D23915A0A00CAF162 /* ChangeReservationResolver.swift */; };
20− 1220A6F423CDB1AD00365E36 /* GetClientByPhoneNumberResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1220A6F323CDB1AD00365E36 /* GetClientByPhoneNumberResolver.swift */; };
21− 1220A6F723CDB64A00365E36 /* AdminSecondStepReservationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1220A6F623CDB64A00365E36 /* AdminSecondStepReservationViewController.swift */; };
22− 1220A6FA23CDBE7E00365E36 /* AdminFinalStepReservationCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1220A6F923CDBE7E00365E36 /* AdminFinalStepReservationCoordinator.swift */; };
2320 12219CEF2353A63F0057DDEE /* ReservationsCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12219CEE2353A63E0057DDEE /* ReservationsCoordinator.swift */; };
2421 12230AEA238FD8B3004A01E5 /* MapView2.xib in Resources */ = {isa = PBXBuildFile; fileRef = 12230AE9238FD8B3004A01E5 /* MapView2.xib */; };
2522 12230AEC238FD8C5004A01E5 /* MapView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12230AEB238FD8C5004A01E5 /* MapView2.swift */; };
@@ -43,7 +40,6 @@
4340 124D007C23721FD400AE76B9 /* Reservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 124D007B23721FD400AE76B9 /* Reservation.swift */; };
4441 124D007F237222B200AE76B9 /* ReservationsResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 124D007E237222B200AE76B9 /* ReservationsResolver.swift */; };
4542 124D0081237222C900AE76B9 /* ReservationsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 124D0080237222C900AE76B9 /* ReservationsService.swift */; };
46− 1252D9E523CDCDB300446B6F /* ACreateReservationResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1252D9E423CDCDB300446B6F /* ACreateReservationResolver.swift */; };
4743 125AE51D2395583E00F847BD /* ChangeReservationCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125AE51C2395583E00F847BD /* ChangeReservationCoordinator.swift */; };
4844 125AE51F2395585300F847BD /* ChangeReservationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125AE51E2395585300F847BD /* ChangeReservationViewController.swift */; };
4945 125AE5212395753400F847BD /* HFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125AE5202395753400F847BD /* HFunc.swift */; };
@@ -55,9 +51,6 @@
5551 12838EB4236779C700CEF108 /* ApiResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12838EB3236779C700CEF108 /* ApiResolver.swift */; };
5652 12838EB623677FB900CEF108 /* ApiRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12838EB523677FB900CEF108 /* ApiRequest.swift */; };
5753 12838EB82367834900CEF108 /* MyCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12838EB72367834900CEF108 /* MyCodable.swift */; };
58− 129F162723CC838200EE13FC /* AdminFirstStepReservationViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 129F162623CC838200EE13FC /* AdminFirstStepReservationViewCoordinator.swift */; };
59− 129F162C23CC8D2E00EE13FC /* AdminSecondStepReservationViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 129F162B23CC8D2E00EE13FC /* AdminSecondStepReservationViewCoordinator.swift */; };
60− 129F163023CC8EF600EE13FC /* PhoneTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 129F162F23CC8EF600EE13FC /* PhoneTextField.swift */; };
6154 12A075F72373535C00D749BB /* FirstStepReservationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12A075F62373535C00D749BB /* FirstStepReservationViewController.swift */; };
6255 12A075F9237353F500D749BB /* MapView1.xib in Resources */ = {isa = PBXBuildFile; fileRef = 12A075F8237353F500D749BB /* MapView1.xib */; };
6356 12A075FB2373561A00D749BB /* Reservation.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 12A075FA2373561A00D749BB /* Reservation.storyboard */; };
@@ -76,6 +69,7 @@
7669 12B3A7AF23AC1872009E2FA6 /* AdminNoReservationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12B3A7AE23AC1872009E2FA6 /* AdminNoReservationsView.swift */; };
7770 12B3A7B123AC1885009E2FA6 /* AdminNoReservationsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 12B3A7B023AC1885009E2FA6 /* AdminNoReservationsView.xib */; };
7871 12B3A7B423AC1D09009E2FA6 /* AdminReservationCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 12B3A7B323AC1D09009E2FA6 /* AdminReservationCellView.xib */; };
72+ 12B3A7B723ACCD07009E2FA6 /* SettingsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12B3A7B623ACCD07009E2FA6 /* SettingsService.swift */; };
7973 12B3A7B923ACCD83009E2FA6 /* AddOtherAdminResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12B3A7B823ACCD83009E2FA6 /* AddOtherAdminResolver.swift */; };
8074 12B3A7BC23ACFD75009E2FA6 /* ReservationsAroundResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12B3A7BB23ACFD75009E2FA6 /* ReservationsAroundResolver.swift */; };
8175 12B3A7BE23AD0049009E2FA6 /* AdminReservationEditingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12B3A7BD23AD0048009E2FA6 /* AdminReservationEditingViewController.swift */; };
@@ -103,7 +97,6 @@
10397 12D8FA31237F08C700305F57 /* AllReservations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D8FA30237F08C700305F57 /* AllReservations.swift */; };
10498 12D928AF23C47DCF0051724D /* ADeleteReservationResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D928AE23C47DCF0051724D /* ADeleteReservationResolver.swift */; };
10599 12D928B123C486380051724D /* BaseTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D928B023C486380051724D /* BaseTableViewController.swift */; };
106− 12D928B323C7464B0051724D /* BlocklistPutResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D928B223C7464B0051724D /* BlocklistPutResolver.swift */; };
107100 12DBEEB223539F2100AF1BB6 /* Client.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 12DBEEB123539F2100AF1BB6 /* Client.storyboard */; };
108101 12E35071239FA8CA004BB188 /* Extensions+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E35070239FA8CA004BB188 /* Extensions+String.swift */; };
109102 12E35074239FAF52004BB188 /* ClientsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E35073239FAF52004BB188 /* ClientsService.swift */; };
@@ -121,7 +114,6 @@
121114 12F9652A23868E6000FCA696 /* SecondStepView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 12F9652923868E6000FCA696 /* SecondStepView.xib */; };
122115 12F9652C23868E7200FCA696 /* SecondStepView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12F9652B23868E7200FCA696 /* SecondStepView.swift */; };
123116 12F9652E23869F3100FCA696 /* SecondStepReservationCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12F9652D23869F3100FCA696 /* SecondStepReservationCoordinator.swift */; };
124− 12FC07B923C8D17600EDC55B /* DeleteOtherAdminResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12FC07B823C8D17600EDC55B /* DeleteOtherAdminResolver.swift */; };
125117 12FC40382382C93D00AB593B /* TableButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12FC40372382C93C00AB593B /* TableButtonStyle.swift */; };
126118 12FC403A2382CB6F00AB593B /* TableButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12FC40392382CB6F00AB593B /* TableButton.swift */; };
127119 F30369B5233679EA00A8EA84 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F30369B4233679EA00A8EA84 /* LaunchScreen.storyboard */; };
@@ -182,9 +174,6 @@
182174 12118B9D23682049006BAEE3 /* PhoneCodeResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneCodeResolver.swift; sourceTree = "<group>"; };
183175 1212048B23914CFD00CAF162 /* DeleteReservationResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteReservationResolver.swift; sourceTree = "<group>"; };
184176 1212048D23915A0A00CAF162 /* ChangeReservationResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeReservationResolver.swift; sourceTree = "<group>"; };
185− 1220A6F323CDB1AD00365E36 /* GetClientByPhoneNumberResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetClientByPhoneNumberResolver.swift; sourceTree = "<group>"; };
186− 1220A6F623CDB64A00365E36 /* AdminSecondStepReservationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdminSecondStepReservationViewController.swift; sourceTree = "<group>"; };
187− 1220A6F923CDBE7E00365E36 /* AdminFinalStepReservationCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminFinalStepReservationCoordinator.swift; sourceTree = "<group>"; };
188177 12219CEE2353A63E0057DDEE /* ReservationsCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReservationsCoordinator.swift; sourceTree = "<group>"; };
189178 12230AE9238FD8B3004A01E5 /* MapView2.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MapView2.xib; sourceTree = "<group>"; };
190179 12230AEB238FD8C5004A01E5 /* MapView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapView2.swift; sourceTree = "<group>"; };
@@ -208,7 +197,6 @@
208197 124D007B23721FD400AE76B9 /* Reservation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Reservation.swift; sourceTree = "<group>"; };
209198 124D007E237222B200AE76B9 /* ReservationsResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReservationsResolver.swift; sourceTree = "<group>"; };
210199 124D0080237222C900AE76B9 /* ReservationsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReservationsService.swift; sourceTree = "<group>"; };
211− 1252D9E423CDCDB300446B6F /* ACreateReservationResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ACreateReservationResolver.swift; sourceTree = "<group>"; };
212200 125AE51C2395583E00F847BD /* ChangeReservationCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeReservationCoordinator.swift; sourceTree = "<group>"; };
213201 125AE51E2395585300F847BD /* ChangeReservationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeReservationViewController.swift; sourceTree = "<group>"; };
214202 125AE5202395753400F847BD /* HFunc.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HFunc.swift; sourceTree = "<group>"; };
@@ -219,9 +207,6 @@
219207 12838EB3236779C700CEF108 /* ApiResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiResolver.swift; sourceTree = "<group>"; };
220208 12838EB523677FB900CEF108 /* ApiRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiRequest.swift; sourceTree = "<group>"; };
221209 12838EB72367834900CEF108 /* MyCodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyCodable.swift; sourceTree = "<group>"; };
222− 129F162623CC838200EE13FC /* AdminFirstStepReservationViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminFirstStepReservationViewCoordinator.swift; sourceTree = "<group>"; };
223− 129F162B23CC8D2E00EE13FC /* AdminSecondStepReservationViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminSecondStepReservationViewCoordinator.swift; sourceTree = "<group>"; };
224− 129F162F23CC8EF600EE13FC /* PhoneTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneTextField.swift; sourceTree = "<group>"; };
225210 12A075F62373535C00D749BB /* FirstStepReservationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstStepReservationViewController.swift; sourceTree = "<group>"; };
226211 12A075F8237353F500D749BB /* MapView1.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MapView1.xib; sourceTree = "<group>"; };
227212 12A075FA2373561A00D749BB /* Reservation.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Reservation.storyboard; sourceTree = "<group>"; };
@@ -240,6 +225,7 @@
240225 12B3A7AE23AC1872009E2FA6 /* AdminNoReservationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminNoReservationsView.swift; sourceTree = "<group>"; };
241226 12B3A7B023AC1885009E2FA6 /* AdminNoReservationsView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AdminNoReservationsView.xib; sourceTree = "<group>"; };
242227 12B3A7B323AC1D09009E2FA6 /* AdminReservationCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AdminReservationCellView.xib; sourceTree = "<group>"; };
228+ 12B3A7B623ACCD07009E2FA6 /* SettingsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsService.swift; sourceTree = "<group>"; };
243229 12B3A7B823ACCD83009E2FA6 /* AddOtherAdminResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddOtherAdminResolver.swift; sourceTree = "<group>"; };
244230 12B3A7BB23ACFD75009E2FA6 /* ReservationsAroundResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReservationsAroundResolver.swift; sourceTree = "<group>"; };
245231 12B3A7BD23AD0048009E2FA6 /* AdminReservationEditingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminReservationEditingViewController.swift; sourceTree = "<group>"; };
@@ -267,7 +253,6 @@
267253 12D8FA30237F08C700305F57 /* AllReservations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllReservations.swift; sourceTree = "<group>"; };
268254 12D928AE23C47DCF0051724D /* ADeleteReservationResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ADeleteReservationResolver.swift; sourceTree = "<group>"; };
269255 12D928B023C486380051724D /* BaseTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTableViewController.swift; sourceTree = "<group>"; };
270− 12D928B223C7464B0051724D /* BlocklistPutResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlocklistPutResolver.swift; sourceTree = "<group>"; };
271256 12DBEEB123539F2100AF1BB6 /* Client.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Client.storyboard; sourceTree = "<group>"; };
272257 12E35070239FA8CA004BB188 /* Extensions+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extensions+String.swift"; sourceTree = "<group>"; };
273258 12E35073239FAF52004BB188 /* ClientsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientsService.swift; sourceTree = "<group>"; };
@@ -285,7 +270,6 @@
285270 12F9652923868E6000FCA696 /* SecondStepView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SecondStepView.xib; sourceTree = "<group>"; };
286271 12F9652B23868E7200FCA696 /* SecondStepView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondStepView.swift; sourceTree = "<group>"; };
287272 12F9652D23869F3100FCA696 /* SecondStepReservationCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondStepReservationCoordinator.swift; sourceTree = "<group>"; };
288− 12FC07B823C8D17600EDC55B /* DeleteOtherAdminResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteOtherAdminResolver.swift; sourceTree = "<group>"; };
289273 12FC40372382C93C00AB593B /* TableButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableButtonStyle.swift; sourceTree = "<group>"; };
290274 12FC40392382CB6F00AB593B /* TableButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableButton.swift; sourceTree = "<group>"; };
291275 F30369B4233679EA00A8EA84 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
@@ -406,31 +390,6 @@
406390 path = Reservations;
407391 sourceTree = "<group>";
408392 };
409− 1220A6F523CDB63000365E36 /* 2 */ = {
410− isa = PBXGroup;
411− children = (
412− 1220A6F623CDB64A00365E36 /* AdminSecondStepReservationViewController.swift */,
413− 129F162B23CC8D2E00EE13FC /* AdminSecondStepReservationViewCoordinator.swift */,
414− );
415− path = 2;
416− sourceTree = "<group>";
417− };
418− 1220A6F823CDB65C00365E36 /* 1 */ = {
419− isa = PBXGroup;
420− children = (
421− 129F162623CC838200EE13FC /* AdminFirstStepReservationViewCoordinator.swift */,
422− );
423− path = 1;
424− sourceTree = "<group>";
425− };
426− 1220A6FB23CDBED900365E36 /* 3 */ = {
427− isa = PBXGroup;
428− children = (
429− 1220A6F923CDBE7E00365E36 /* AdminFinalStepReservationCoordinator.swift */,
430− );
431− path = 3;
432− sourceTree = "<group>";
433− };
434393 12230AED238FD8D5004A01E5 /* 1 */ = {
435394 isa = PBXGroup;
436395 children = (
@@ -507,7 +466,6 @@
507466 123D25ED239E3D50002FA32B /* Reservations */ = {
508467 isa = PBXGroup;
509468 children = (
510− 129F162523CC836600EE13FC /* Making a reeservation */,
511469 12B3A79623ABAD9A009E2FA6 /* Views */,
512470 12B3A7C123AD0751009E2FA6 /* Editing */,
513471 12B3A7C223AD0762009E2FA6 /* List of reservations */,
@@ -589,6 +547,7 @@
589547 12838EB923679AEB00CEF108 /* API */ = {
590548 isa = PBXGroup;
591549 children = (
550+ 12B3A7B523ACCCD0009E2FA6 /* Settings */,
592551 12838EA8236764A600CEF108 /* APIClient.swift */,
593552 12838EB3236779C700CEF108 /* ApiResolver.swift */,
594553 12838EAF236777D400CEF108 /* ServerError.swift */,
@@ -602,27 +561,9 @@
602561 path = API;
603562 sourceTree = "<group>";
604563 };
605− 129F162523CC836600EE13FC /* Making a reeservation */ = {
606− isa = PBXGroup;
607− children = (
608− 1220A6F823CDB65C00365E36 /* 1 */,
609− 1220A6F523CDB63000365E36 /* 2 */,
610− 1220A6FB23CDBED900365E36 /* 3 */,
611− );
612− path = "Making a reeservation";
613− sourceTree = "<group>";
614− };
615− 129F162823CC89EA00EE13FC /* Phone number */ = {
616− isa = PBXGroup;
617− children = (
618− );
619− path = "Phone number";
620− sourceTree = "<group>";
621− };
622564 12B3A79623ABAD9A009E2FA6 /* Views */ = {
623565 isa = PBXGroup;
624566 children = (
625− 129F162823CC89EA00EE13FC /* Phone number */,
626567 12B3A7B223AC1A1F009E2FA6 /* No reserv */,
627568 12B3A79723ABADB9009E2FA6 /* AdminReservationView.xib */,
628569 12B3A79E23ABCA21009E2FA6 /* AdminReservationView.swift */,
@@ -654,7 +595,6 @@
654595 12B3A7AC23ABEABF009E2FA6 /* AReservationsResolver.swift */,
655596 12B3A7C323AD2FCD009E2FA6 /* AChangeReservationResolver.swift */,
656597 12D928AE23C47DCF0051724D /* ADeleteReservationResolver.swift */,
657− 1252D9E423CDCDB300446B6F /* ACreateReservationResolver.swift */,
658598 );
659599 path = Admin;
660600 sourceTree = "<group>";
@@ -668,6 +608,23 @@
668608 path = "No reserv";
669609 sourceTree = "<group>";
670610 };
611+ 12B3A7B523ACCCD0009E2FA6 /* Settings */ = {
612+ isa = PBXGroup;
613+ children = (
614+ 12B3A7B623ACCD07009E2FA6 /* SettingsService.swift */,
615+ 12B3A7BA23ACCD88009E2FA6 /* Resolvers */,
616+ );
617+ path = Settings;
618+ sourceTree = "<group>";
619+ };
620+ 12B3A7BA23ACCD88009E2FA6 /* Resolvers */ = {
621+ isa = PBXGroup;
622+ children = (
623+ 12B3A7B823ACCD83009E2FA6 /* AddOtherAdminResolver.swift */,
624+ );
625+ path = Resolvers;
626+ sourceTree = "<group>";
627+ };
671628 12B3A7C123AD0751009E2FA6 /* Editing */ = {
672629 isa = PBXGroup;
673630 children = (
@@ -752,12 +709,8 @@
752709 12E35075239FAF8F004BB188 /* Resolvers */ = {
753710 isa = PBXGroup;
754711 children = (
755− 12FC07B823C8D17600EDC55B /* DeleteOtherAdminResolver.swift */,
756− 12B3A7B823ACCD83009E2FA6 /* AddOtherAdminResolver.swift */,
757712 12E35077239FAFA4004BB188 /* ClientsListResolver.swift */,
758713 12E3507C239FD1F3004BB188 /* ClientReservationsResolver.swift */,
759− 12D928B223C7464B0051724D /* BlocklistPutResolver.swift */,
760− 1220A6F323CDB1AD00365E36 /* GetClientByPhoneNumberResolver.swift */,
761714 );
762715 path = Resolvers;
763716 sourceTree = "<group>";
@@ -872,7 +825,6 @@
872825 F3DC5A04233E89D500B5E751 /* Button.swift */,
873826 12FC40372382C93C00AB593B /* TableButtonStyle.swift */,
874827 12FC40392382CB6F00AB593B /* TableButton.swift */,
875− 129F162F23CC8EF600EE13FC /* PhoneTextField.swift */,
876828 );
877829 path = Components;
878830 sourceTree = "<group>";
@@ -1197,14 +1149,11 @@
11971149 files = (
11981150 12EA99482362B684005D9FE9 /* AddresViewController.swift in Sources */,
11991151 124D007F237222B200AE76B9 /* ReservationsResolver.swift in Sources */,
1200− 129F163023CC8EF600EE13FC /* PhoneTextField.swift in Sources */,
1201− 129F162C23CC8D2E00EE13FC /* AdminSecondStepReservationViewCoordinator.swift in Sources */,
12021152 12230AF723900D44004A01E5 /* EstablishmentResolver.swift in Sources */,
12031153 1246B719235CD3AD004CBFA1 /* NoReservationsView.swift in Sources */,
12041154 F3895F4A233D323700FA6A37 /* CodeCoordinator.swift in Sources */,
12051155 12B3A7B923ACCD83009E2FA6 /* AddOtherAdminResolver.swift in Sources */,
12061156 12E3507F239FDFC2004BB188 /* ClientProfileCoordinator.swift in Sources */,
1207− 12D928B323C7464B0051724D /* BlocklistPutResolver.swift in Sources */,
12081157 12838EB4236779C700CEF108 /* ApiResolver.swift in Sources */,
12091158 12838EA9236764A600CEF108 /* APIClient.swift in Sources */,
12101159 123615D12355141600D1122A /* ProfileView.swift in Sources */,
@@ -1233,7 +1182,6 @@
12331182 F3895F48233D2EEA00FA6A37 /* CodeSmsViewController.swift in Sources */,
12341183 12219CEF2353A63F0057DDEE /* ReservationsCoordinator.swift in Sources */,
12351184 12230AF423900BCB004A01E5 /* EstablishmentService.swift in Sources */,
1236− 129F162723CC838200EE13FC /* AdminFirstStepReservationViewCoordinator.swift in Sources */,
12371185 12A07601237359BB00D749BB /* MapView1.swift in Sources */,
12381186 125AE5212395753400F847BD /* HFunc.swift in Sources */,
12391187 12BD95B8237EDB01009614D8 /* TimePointView.swift in Sources */,
@@ -1259,13 +1207,10 @@
12591207 12B3A7A323ABD594009E2FA6 /* AdminReservationsController.swift in Sources */,
12601208 F3FC7DCD2315BE610080D851 /* AppDelegate.swift in Sources */,
12611209 12838EB623677FB900CEF108 /* ApiRequest.swift in Sources */,
1262− 1220A6FA23CDBE7E00365E36 /* AdminFinalStepReservationCoordinator.swift in Sources */,
12631210 12118B9E23682049006BAEE3 /* PhoneCodeResolver.swift in Sources */,
12641211 F30369BE2336924D00A8EA84 /* ClientTabbarCoordinator.swift in Sources */,
12651212 F3FC7DFD2315C4710080D851 /* BaseCoordinator.swift in Sources */,
1266− 1220A6F723CDB64A00365E36 /* AdminSecondStepReservationViewController.swift in Sources */,
12671213 12E35071239FA8CA004BB188 /* Extensions+String.swift in Sources */,
1268− 12FC07B923C8D17600EDC55B /* DeleteOtherAdminResolver.swift in Sources */,
12691214 F3DC59FF233E893400B5E751 /* Extensions+UIFont.swift in Sources */,
12701215 F3895F53233D5EEB00FA6A37 /* BlackButtonStyle.swift in Sources */,
12711216 12F9652C23868E7200FCA696 /* SecondStepView.swift in Sources */,
@@ -1279,14 +1224,13 @@
12791224 F3851B302340A513009EE0B6 /* RegistationViewModel.swift in Sources */,
12801225 12B3A7AF23AC1872009E2FA6 /* AdminNoReservationsView.swift in Sources */,
12811226 12838EAE2367701300CEF108 /* AuthorizationService.swift in Sources */,
1227+ 12B3A7B723ACCD07009E2FA6 /* SettingsService.swift in Sources */,
12821228 12C72EDF23537D1B00AD7004 /* ProfileCoordinator.swift in Sources */,
12831229 12E3507D239FD1F3004BB188 /* ClientReservationsResolver.swift in Sources */,
12841230 12EA994E2362FCE8005D9FE9 /* AddressView.swift in Sources */,
1285− 1220A6F423CDB1AD00365E36 /* GetClientByPhoneNumberResolver.swift in Sources */,
12861231 F3895F4C233D347E00FA6A37 /* PhoneNumberViewController.swift in Sources */,
12871232 12EE4A76234BB8FE005B4D1A /* CodeView.swift in Sources */,
12881233 12230AF123900974004A01E5 /* TotalStorage.swift in Sources */,
1289− 1252D9E523CDCDB300446B6F /* ACreateReservationResolver.swift in Sources */,
12901234 12BD95B2237EC22B009614D8 /* FirstStepView.swift in Sources */,
12911235 F3EBE2472340FE87000FEE1A /* NameTextView.swift in Sources */,
12921236 120BFC7723891925001EBE89 /* ThirdStepReservationViewController.swift in Sources */,
@@ -1466,7 +1410,7 @@
14661410 buildSettings = {
14671411 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
14681412 CODE_SIGN_STYLE = Automatic;
1469− CURRENT_PROJECT_VERSION = 5;
1413+ CURRENT_PROJECT_VERSION = 3;
14701414 DEVELOPMENT_TEAM = 23S94LRHD8;
14711415 INFOPLIST_FILE = "Hookah Tau/Info.plist";
14721416 IPHONEOS_DEPLOYMENT_TARGET = 11.0;
@@ -1486,7 +1430,7 @@
14861430 buildSettings = {
14871431 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
14881432 CODE_SIGN_STYLE = Automatic;
1489− CURRENT_PROJECT_VERSION = 5;
1433+ CURRENT_PROJECT_VERSION = 3;
14901434 DEVELOPMENT_TEAM = 23S94LRHD8;
14911435 INFOPLIST_FILE = "Hookah Tau/Info.plist";
14921436 IPHONEOS_DEPLOYMENT_TARGET = 11.0;
Hookah Tau/API/APIClient.swift−2
@@ -48,8 +48,6 @@ class APIClient {
4848 let json = String(data: data, encoding: String.Encoding.utf8)
4949 print("Failure Response: \(String(describing: json))")
5050 }
51− case 404:
52− return GeneralError.notFound
5351 case 422:
5452 if let data = response.data, let error = SE.fromJSONToSelf(data: data) {
5553 print(error)
Hookah Tau/API/ClientsService/ClientsService.swift−63
@@ -63,67 +63,4 @@ class ClientsService {
6363 }
6464
6565 }
66−
67− /// Метод для удаления или добавления пользователя в чс
68− func changeBlockList(whatToDo: CrudMethod, phone: String, completion: @escaping ((Bool) -> Void)) {
69− let resolver = BlocklistPutResolver(blockList: [phone])
70− let request = ApiRequest(resolver: resolver, httpMethod: whatToDo)
71−
72− apiClient.load(request: request.request) { (res) in
73− switch res {
74− case .failure:
75− completion(false)
76− return
77− case .success:
78− completion(true)
79− return
80− }
81− }
82− }
83−
84− /// Метод для изменения статуса админки
85− func changeAdmin(crud: CrudMethod, data: String, completion: @escaping ((Bool) -> Void)) {
86− var resolver: ApiResolver!
87− if crud == .put {
88− resolver = AddOtherAdminResolver(phone: data)
89− } else {
90− resolver = DeleteOtherAdminResolver(uuid: data)
91− }
92−
93− let request = ApiRequest(resolver: resolver, httpMethod: crud)
94−
95− apiClient.load(request: request.request) { result in
96− switch result {
97− case .failure:
98− completion(false)
99− return
100− case .success:
101− completion(true)
102− return
103− }
104− }
105− }
106−
107− func getClientByPhoneNumber(userPhone: String, completion: @escaping ((Result<FullUser, GeneralError>) -> Void)) {
108− let resolver = GetClientByPhoneNumberResolver<ClientInResponce>(userPhone: userPhone)
109− let request = ApiRequest(resolver: resolver, httpMethod: .get)
110−
111− apiClient.load(request: request.request) { (result) in
112− switch result {
113− case .failure(let err):
114− completion(.failure(err))
115− return
116− case .success(let responce):
117− guard
118− let d = responce.data,
119− let decData = resolver.targetClass().fromJSONToSelf(data: d)
120− else {
121− completion(.failure(GeneralError.decodeError))
122− return
123− }
124−
125− completion(.success(decData.client))
126− }
127− }
128− }
12966}
Hookah Tau/API/ClientsService/Resolvers/BlocklistPutResolver.swiftdeleted−33
@@ -1,33 +0,0 @@
1−//
2−// BlocklistPutResolver.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 09/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import Foundation
10−
11−struct RequestBlocklist: MyCodable {
12− var blockList: [String]
13−}
14−
15−class BlocklistPutResolver: ApiResolver {
16− var name: String {
17− return "/blocklist"
18− }
19−
20− var groupName: String? {
21− return "/admin"
22− }
23−
24− var blockList: [String]
25−
26− init(blockList: [String]) {
27− self.blockList = blockList
28− }
29−
30− func parameters() -> MyCodable? {
31− return RequestBlocklist(blockList: blockList)
32− }
33−}
Hookah Tau/API/ClientsService/Resolvers/DeleteOtherAdminResolver.swiftdeleted−35
@@ -1,35 +0,0 @@
1−//
2−// DeleteOtherAdminResolver.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 10/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import Foundation
10−
11−
12−class DeleteOtherAdminResolver: ApiResolver {
13−
14− var name: String {
15− return "/other"
16− }
17−
18− var groupName: String? {
19− return "/admin"
20− }
21−
22− struct Request: MyCodable {
23− let badAdmin: String
24− }
25−
26− let uuid: String
27−
28− init(uuid: String) {
29− self.uuid = uuid
30− }
31−
32− func parameters() -> MyCodable? {
33− return Request(badAdmin: self.uuid)
34− }
35−}
Hookah Tau/API/ClientsService/Resolvers/GetClientByPhoneNumberResolver.swiftdeleted−35
@@ -1,35 +0,0 @@
1−//
2−// GetClientByPhoneNumberResolver.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 14/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import Foundation
10−
11−struct ClientInResponce: MyCodable {
12− var client: FullUser
13−}
14−
15−/// `GET /admin/clients/by-phone/{user id}`
16−class GetClientByPhoneNumberResolver<Responce: MyCodable>: ApiResolver {
17−
18− var name: String {
19− return "/clients/by-phone/\(userPhone)"
20− }
21−
22− var groupName: String? {
23− return "/admin"
24− }
25−
26− var userPhone: String
27−
28− init(userPhone: String) {
29− self.userPhone = userPhone
30− }
31−
32− func targetClass() -> Responce.Type {
33− return Responce.self
34− }
35−}
Hookah Tau/API/Reservations api/ReservationsService.swift−23
@@ -205,27 +205,4 @@ class ReservationsService {
205205 }
206206 }
207207 }
208−
209− func createReservation(reservation: AdminCreateReservation, completion: @escaping ((Result<String, GeneralError>) -> Void)) {
210− let resolver = ACreateReservationResolver<ACreateAdminResonce>(data: reservation)
211− let request = ApiRequest(resolver: resolver, httpMethod: .post)
212−
213− apiClient.load(request: request.request) { (res) in
214− switch res {
215− case .failure(let err):
216− completion(.failure(err))
217− return
218− case .success(let responce):
219− guard
220− let d = responce.data,
221− let decData = resolver.targetClass().fromJSONToSelf(data: d)
222− else {
223− completion(.failure(GeneralError.decodeError))
224− return
225− }
226−
227− completion(.success(decData.reservationUUID))
228− }
229− }
230− }
231208}
Hookah Tau/API/Reservations api/Resolvers/Admin/ACreateReservationResolver.swiftdeleted−37
@@ -1,37 +0,0 @@
1−//
2−// ACreateReservationResolver.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 14/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import Foundation
10−
11−struct ACreateAdminResonce: MyCodable {
12− var reservationUUID: String
13−}
14−
15−class ACreateReservationResolver<Responce: MyCodable>: ApiResolver {
16− var name: String {
17− return "/reservations"
18− }
19−
20− var groupName: String? {
21− return "/admin"
22− }
23−
24− var data: AdminCreateReservation
25−
26− init(data: AdminCreateReservation) {
27− self.data = data
28− }
29−
30− func parameters() -> MyCodable? {
31− return data
32− }
33−
34− func targetClass() -> Responce.Type {
35− return Responce.self
36− }
37−}
Hookah Tau/API/ServerError.swift−1
@@ -16,7 +16,6 @@ enum GeneralError: Error {
1616 case serverError(SE)
1717 case decodeError
1818 case noData
19− case notFound
2019 case Error400
2120 case somethingWentCompletelyWrong
2221 case alamofireError
Hookah Tau/API/ClientsService/Resolvers/AddOtherAdminResolver.swift → Hookah Tau/API/Settings/Resolvers/AddOtherAdminResolver.swiftrenamed

The content is the same.

Hookah Tau/API/Settings/SettingsService.swiftnew file+34
@@ -0,0 +1,34 @@
1+//
2+// AdminServise.swift
3+// Hookah Tau
4+//
5+// Created by cstore on 20/12/2019.
6+// Copyright © 2019 Daria Rednikina. All rights reserved.
7+//
8+
9+import Foundation
10+
11+class SettingsService {
12+
13+ private var apiClient: APIClient
14+
15+ init(apiClient: APIClient) {
16+ self.apiClient = apiClient
17+ }
18+
19+ func addOtherAdmin(phone: String, completion: @escaping ((Bool) -> Void)) {
20+ let resolver = AddOtherAdminResolver(phone: phone)
21+ let request = ApiRequest(resolver: resolver, httpMethod: .put)
22+
23+ apiClient.load(request: request.request) { result in
24+ switch result {
25+ case .failure:
26+ completion(false)
27+ return
28+ case .success:
29+ completion(true)
30+ return
31+ }
32+ }
33+ }
34+}
Hookah Tau/Components/PhoneTextField.swiftdeleted−63
@@ -1,63 +0,0 @@
1−//
2−// PhoneTextField.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 13/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import UIKit
10−
11−class PhoneTextField: UITextField, UITextFieldDelegate {
12−
13− override func awakeFromNib() {
14− super.awakeFromNib()
15−
16− self.delegate = self
17− self.keyboardType = .numberPad
18− }
19−
20− func bind(withModel model: String) {
21− self.text = model.formattedNumber()
22− }
23−
24− func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
25− let newString = (textField.text! as NSString).replacingCharacters(in: range, with: string)
26− textField.text = formattedNumber(newString)
27− return false
28− }
29−
30− private func formattedNumber(_ number: String) -> String {
31− let cleanPhoneNumber = number.components(separatedBy: CharacterSet.decimalDigits.inverted).joined()
32−
33− var result = ""
34− let phoneMask = "+X (XXX) XXX XX XX"
35− var index = cleanPhoneNumber.startIndex
36− for ch in phoneMask where index < cleanPhoneNumber.endIndex {
37− if ch == "X" {
38− result.append(cleanPhoneNumber[index])
39− index = cleanPhoneNumber.index(after: index)
40− } else {
41− result.append(ch)
42− }
43− }
44− return result
45− }
46−
47− /// +o (oxx) xxx xx xx
48− ///
49− /// need tor return only `x`, length is 9. And it has to have prefix +7 (9...) or +8 (9..)
50− func getFormattedNumber() -> String? {
51− guard let number = self.text else { return nil }
52−
53− let cleanPhoneNumber = String(number.components(separatedBy: CharacterSet.decimalDigits.inverted).joined())
54− let hasPrefix = cleanPhoneNumber.hasPrefix("79") || cleanPhoneNumber.hasPrefix("89")
55−
56− let result = String(cleanPhoneNumber.dropFirst(2))
57− if result.count == 9 && hasPrefix {
58− return result
59− }
60−
61− return nil
62− }
63−}
Hookah Tau/Controllers/Admin/Clients/Cells/ClientTableViewCell.swift+3−11
@@ -20,13 +20,6 @@ class ClientTableViewCell: UITableViewCell {
2020
2121 @IBOutlet weak var numberOfReservationsLabel: UILabel!
2222
23−
24− @IBOutlet weak var blockListLabel: UILabel!
25−
26− @IBOutlet weak var isAdminLabel: UILabel!
27−
28−
29−
3023 // MARK: - Lifecycle
3124
3225 override func awakeFromNib() {
@@ -43,11 +36,10 @@ class ClientTableViewCell: UITableViewCell {
4336 // MARK: - Bind
4437
4538 func bind(withModel model: Client) {
46− blockListLabel.isHidden = !model.isBlocked
47− isAdminLabel.isHidden = !model.isAdmin
48− nameLabel.text = model.name ?? "❔"
39+ let name = model.name ?? "❔"
40+ nameLabel.text = model.isAdmin ? "👑 " + name : name
4941 phoneNumberLabel.text = model.phoneNumber.formattedNumber()
50− numberOfReservationsLabel.text = model.reservationCount > 99 ? "99+" : "\(model.reservationCount)"
42+ numberOfReservationsLabel.text = "\(model.reservationCount)"
5143 }
5244
5345}
Hookah Tau/Controllers/Admin/Clients/ClientList.storyboard+63−110
@@ -1,10 +1,9 @@
11<?xml version="1.0" encoding="UTF-8"?>
2−<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33 <device id="retina4_7" orientation="portrait" appearance="light"/>
44 <dependencies>
55 <deployment identifier="iOS"/>
6− <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
7− <capability name="Safe area layout guides" minToolsVersion="9.0"/>
6+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
87 <capability name="Stack View standard spacing" minToolsVersion="9.0"/>
98 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
109 </dependencies>
@@ -31,17 +30,12 @@
3130 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="top" translatesAutoresizingMaskIntoConstraints="NO" id="vNV-bN-3No">
3231 <rect key="frame" x="0.0" y="0.0" width="179" height="53"/>
3332 <subviews>
34− <stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" alignment="center" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="uoO-w2-5yG">
33+ <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">
3534 <rect key="frame" x="0.0" y="0.0" width="78.5" height="26.5"/>
36− <subviews>
37− <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="4Cp-jh-0Gq">
38− <rect key="frame" x="0.0" y="0.0" width="78.5" height="26.5"/>
39− <fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
40− <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
41− <nil key="highlightedColor"/>
42− </label>
43− </subviews>
44− </stackView>
35+ <fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
36+ <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
37+ <nil key="highlightedColor"/>
38+ </label>
4539 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="+7 (901) 733-01-79" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0gY-h5-AV2">
4640 <rect key="frame" x="0.0" y="29" width="179" height="24"/>
4741 <fontDescription key="fontDescription" type="system" pointSize="20"/>
@@ -51,43 +45,18 @@
5145 </subviews>
5246 </stackView>
5347 <stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="tJg-ju-bFY">
54− <rect key="frame" x="219.5" y="0.0" width="123.5" height="53"/>
48+ <rect key="frame" x="310.5" y="0.0" width="32.5" height="53"/>
5549 <subviews>
56− <stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="4et-BC-7iY">
57− <rect key="frame" x="0.0" y="14.5" width="103.5" height="24"/>
58− <subviews>
59− <stackView opaque="NO" contentMode="scaleToFill" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="BHD-cD-L1c">
60− <rect key="frame" x="0.0" y="0.0" width="51" height="24"/>
61− <subviews>
62− <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="❌" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MaQ-TW-666">
63− <rect key="frame" x="0.0" y="0.0" width="23" height="24"/>
64− <fontDescription key="fontDescription" type="system" pointSize="17"/>
65− <nil key="textColor"/>
66− <nil key="highlightedColor"/>
67− </label>
68− <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="👑" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Xa-FL-GVr">
69− <rect key="frame" x="28" y="0.0" width="23" height="24"/>
70− <fontDescription key="fontDescription" type="system" pointSize="17"/>
71− <nil key="textColor"/>
72− <nil key="highlightedColor"/>
73− </label>
74− </subviews>
75− </stackView>
76− <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="99+" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Gzo-kW-60Z">
77− <rect key="frame" x="66" y="0.0" width="37.5" height="24"/>
78− <fontDescription key="fontDescription" type="system" pointSize="20"/>
79− <nil key="textColor"/>
80− <nil key="highlightedColor"/>
81− </label>
82− </subviews>
83− </stackView>
50+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="3" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Gzo-kW-60Z">
51+ <rect key="frame" x="0.0" y="14.5" width="12.5" height="24"/>
52+ <fontDescription key="fontDescription" type="system" pointSize="20"/>
53+ <nil key="textColor"/>
54+ <nil key="highlightedColor"/>
55+ </label>
8456 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow" translatesAutoresizingMaskIntoConstraints="NO" id="DrQ-Ss-gIT">
85− <rect key="frame" x="111.5" y="16.5" width="12" height="20"/>
57+ <rect key="frame" x="20.5" y="16.5" width="12" height="20"/>
8658 </imageView>
8759 </subviews>
88− <constraints>
89− <constraint firstAttribute="width" constant="123.5" id="eeb-nt-pTB"/>
90− </constraints>
9160 </stackView>
9261 </subviews>
9362 </stackView>
@@ -100,8 +69,6 @@
10069 </constraints>
10170 </tableViewCellContentView>
10271 <connections>
103− <outlet property="blockListLabel" destination="MaQ-TW-666" id="Us0-tw-9tj"/>
104− <outlet property="isAdminLabel" destination="0Xa-FL-GVr" id="fzz-2t-Lda"/>
10572 <outlet property="nameLabel" destination="4Cp-jh-0Gq" id="g6e-c0-x0u"/>
10673 <outlet property="numberOfReservationsLabel" destination="Gzo-kW-60Z" id="9J2-S4-fKq"/>
10774 <outlet property="phoneNumberLabel" destination="0gY-h5-AV2" id="rdb-GS-ceF"/>
@@ -119,75 +86,61 @@
11986 <point key="canvasLocation" x="0.80000000000000004" y="-112.89355322338831"/>
12087 </scene>
12188 <!--Profile Table View Controller-->
122− <scene sceneID="APa-VZ-6hd">
89+ <scene sceneID="8Qr-sA-YQr">
12390 <objects>
124− <viewController storyboardIdentifier="ProfileTableViewController" id="ZVH-jf-rtc" customClass="ProfileTableViewController" customModule="Hookah_Tau" customModuleProvider="target" sceneMemberID="viewController">
125− <view key="view" contentMode="scaleToFill" id="rcq-M9-CvR">
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">
12693 <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
12794 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
128− <subviews>
129− <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ciO-ia-Oob">
130− <rect key="frame" x="0.0" y="0.0" width="375" height="65"/>
131− <subviews>
132− <stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" alignment="center" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="IBA-bj-CWK">
133− <rect key="frame" x="8" y="16" width="359" height="37"/>
134− <subviews>
135− <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4WC-gi-jbD" customClass="Button" customModule="Hookah_Tau" customModuleProvider="target">
136− <rect key="frame" x="0.0" y="0.0" width="180" height="37"/>
137− <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
138− <constraints>
139− <constraint firstAttribute="width" constant="180" id="bJA-V9-gw9"/>
140− <constraint firstAttribute="height" constant="37" id="pdo-AO-o8a"/>
141− </constraints>
142− <state key="normal" title="Button"/>
143− </button>
144− <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gfq-ql-lka" customClass="Button" customModule="Hookah_Tau" customModuleProvider="target">
145− <rect key="frame" x="224" y="0.0" width="135" height="37"/>
146− <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
147− <constraints>
148− <constraint firstAttribute="width" constant="135" id="Xn3-v6-SLp"/>
149− <constraint firstAttribute="height" constant="37" id="z68-vW-NjK"/>
150− </constraints>
151− <state key="normal" title="Button"/>
152− </button>
153− </subviews>
154− </stackView>
155− </subviews>
156− <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
157− <constraints>
158− <constraint firstItem="IBA-bj-CWK" firstAttribute="leading" secondItem="ciO-ia-Oob" secondAttribute="leading" constant="8" id="WZS-Vq-tuP"/>
159− <constraint firstAttribute="trailing" secondItem="IBA-bj-CWK" secondAttribute="trailing" constant="8" id="Yk3-D1-1kg"/>
160− <constraint firstItem="IBA-bj-CWK" firstAttribute="top" secondItem="ciO-ia-Oob" secondAttribute="top" constant="16" id="fWO-oj-NuN"/>
161− <constraint firstItem="IBA-bj-CWK" firstAttribute="leading" secondItem="ciO-ia-Oob" secondAttribute="leading" constant="8" id="gP2-jh-5El"/>
162− <constraint firstAttribute="height" constant="65" id="pzZ-zw-kbc"/>
163− </constraints>
164− </view>
165− <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="T0s-lX-Z5m">
166− <rect key="frame" x="0.0" y="65" width="375" height="602"/>
167− <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
168− </view>
169− </subviews>
17095 <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
171− <constraints>
172− <constraint firstItem="ciO-ia-Oob" firstAttribute="trailing" secondItem="tIS-3m-xwG" secondAttribute="trailing" id="3An-sM-OCN"/>
173− <constraint firstItem="ciO-ia-Oob" firstAttribute="top" secondItem="tIS-3m-xwG" secondAttribute="top" id="5zl-uZ-sTi"/>
174− <constraint firstItem="T0s-lX-Z5m" firstAttribute="leading" secondItem="tIS-3m-xwG" secondAttribute="leading" id="7qA-Hh-3Us"/>
175− <constraint firstItem="T0s-lX-Z5m" firstAttribute="trailing" secondItem="tIS-3m-xwG" secondAttribute="trailing" id="9VD-9Q-wGX"/>
176− <constraint firstItem="T0s-lX-Z5m" firstAttribute="top" secondItem="ciO-ia-Oob" secondAttribute="bottom" id="RSL-fo-wIb"/>
177− <constraint firstItem="ciO-ia-Oob" firstAttribute="leading" secondItem="tIS-3m-xwG" secondAttribute="leading" id="Tuq-su-gbn"/>
178− <constraint firstItem="T0s-lX-Z5m" firstAttribute="bottom" secondItem="tIS-3m-xwG" secondAttribute="bottom" id="iQj-LM-Im9"/>
179− </constraints>
180− <viewLayoutGuide key="safeArea" id="tIS-3m-xwG"/>
181− </view>
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>
182136 <connections>
183− <outlet property="contentView" destination="T0s-lX-Z5m" id="9Z0-5T-f7Z"/>
184− <outlet property="copyButton" destination="gfq-ql-lka" id="BNi-Ip-AyF"/>
185− <outlet property="phoneButton" destination="4WC-gi-jbD" id="xlf-g7-CzU"/>
137+ <outlet property="copyButton" destination="HkY-u9-thv" id="RLs-cg-y3g"/>
138+ <outlet property="phoneButton" destination="nFA-T3-Dxe" id="d7H-jf-NB5"/>
186139 </connections>
187− </viewController>
188− <placeholder placeholderIdentifier="IBFirstResponder" id="g4Y-1k-Lxr" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
140+ </tableViewController>
141+ <placeholder placeholderIdentifier="IBFirstResponder" id="1YW-I1-Y6m" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
189142 </objects>
190− <point key="canvasLocation" x="1188" y="-113"/>
143+ <point key="canvasLocation" x="880.79999999999995" y="-111.0944527736132"/>
191144 </scene>
192145 </scenes>
193146 <resources>
Hookah Tau/Controllers/Admin/Clients/ClientsCoordinator.swift+4−1
@@ -23,7 +23,10 @@ class ClientsCoordinator: BaseCoordinator {
2323 /// TODO
2424 func openUserProfile(_ profile: Client) {
2525 let profileCoordinator = ClientProfileCoordinator(navigationController: navigationController)
26− profileCoordinator.user = profile
26+ profileCoordinator.user = FullUser(uuid: profile.uuid,
27+ name: profile.name,
28+ phoneNumber: profile.phoneNumber,
29+ isAdmin: profile.isAdmin)
2730
2831 self.addDependency(profileCoordinator)
2932 profileCoordinator.didEndFlow = {
Hookah Tau/Controllers/Admin/Clients/ClientsViewController.swift+6−169
@@ -8,7 +8,7 @@
88
99import UIKit
1010
11−class ClientsViewController: BaseTableViewController {
11+class ClientsViewController: UITableViewController {
1212
1313 // MARK: - Properties
1414
@@ -18,29 +18,16 @@ class ClientsViewController: BaseTableViewController {
1818 }
1919 }
2020
21− var filteredDataSource: [Client] = []
22−
2321 var clientsService: ClientsService?
2422
2523 weak var coordinator: ClientsCoordinator?
2624
27− var searchControl: UISearchController?
28−
29− var isFiltering: Bool {
30− return searchControl?.isActive ?? false && !searchBarIsEmpty()
31− }
32−
33− func searchBarIsEmpty() -> Bool {
34− return searchControl?.searchBar.text?.isEmpty ?? true
35− }
36−
3725 // MARK: - Lifecycle
3826
3927 override func viewDidLoad() {
4028 super.viewDidLoad()
4129
42− setupNavigationBar()
43− setupSearchController()
30+ navigationItem.title = "Клиенты"
4431 clientsService = ClientsService(apiClient: APIClient.shared)
4532 }
4633
@@ -53,25 +40,6 @@ class ClientsViewController: BaseTableViewController {
5340 super.viewDidAppear(animated)
5441 loadClients()
5542 }
56−
57− // MARK: - Setup
58−
59− func setupNavigationBar() {
60−
61− navigationItem.title = "Клиенты"
62− navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(shareCSVFile))
63− }
64−
65− func setupSearchController() {
66− searchControl = UISearchController(searchResultsController: nil)
67− navigationItem.searchController = searchControl
68− navigationItem.hidesSearchBarWhenScrolling = false
69− searchControl?.obscuresBackgroundDuringPresentation = false
70− definesPresentationContext = true
71− searchControl?.searchResultsUpdater = self
72− }
73−
74− // MARK: - Api calls
7543
7644 /// Загружаем клиентов кальянки
7745 func loadClients() {
@@ -85,155 +53,24 @@ class ClientsViewController: BaseTableViewController {
8553 })
8654 }
8755
88− // MARK: - Button handlers
89−
90− /// https://developer.apple.com/design/human-interface-guidelines/ios/views/activity-views/
91− @objc func shareCSVFile() {
92− //Your CSV text
93− let str = HFunc.main.exportClientsToCSV(dataSource)
94− let filename = getDocumentsDirectory().appendingPathComponent("clients.csv")
95−
96− do {
97− try str.write(toFile: filename, atomically: true, encoding: String.Encoding.utf8)
98−
99− let fileData = NSURL(fileURLWithPath: filename)
100−
101− let objectsToShare = [fileData]
102− let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
103−
104− self.present(activityVC, animated: true, completion: nil)
105−
106− } catch {
107− self.displayAlert(with: "По какой-то причине не могу сохранить файл!")
108− }
109− }
110−
111− func getDocumentsDirectory() -> NSString {
112− let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
113− let documentsDirectory = paths[0]
114− return documentsDirectory as NSString
115− }
116−
117− // MARK: - Change blocklist status
118−
119− func updateUserBlockStatus(wasBlocked: Bool, phone: String, indexPath: IndexPath) {
120− let crudMethod = wasBlocked ? CrudMethod.delete : CrudMethod.put
121− clientsService?.changeBlockList(whatToDo: crudMethod, phone: phone, completion: { (res) in
122− if res {
123− self.tableView?.beginUpdates()
124− self.tableView?.reloadRows(at: [indexPath], with: .automatic)
125− if self.isFiltering {
126− self.filteredDataSource[indexPath.row].isBlocked = !wasBlocked
127− let changed = self.filteredDataSource[indexPath.row]
128− let filtered = self.dataSource.map { (one: Client) -> Client in
129− if one.uuid == changed.uuid {
130− return changed
131− } else { return one } }
132− self.dataSource = filtered
133− } else {
134− self.dataSource[indexPath.row].isBlocked = !wasBlocked
135− }
136− self.tableView?.endUpdates()
137− } else {
138− self.displayAlert(with: "Не удалось \(wasBlocked ? "удалить" : "добавить") пользователя \(wasBlocked ? "из" : "в") чс! Попробуйте еще раз!")
139− return
140− }
141− })
142− }
14356
144− func updateAdminStatus(user: Client, indexPath: IndexPath) {
145−
146− let wasAdmin = user.isAdmin
147− let crudMethod = wasAdmin ? CrudMethod.delete : CrudMethod.put
148− let data = user.isAdmin ? user.uuid : user.phoneNumber
149−
150− clientsService?.changeAdmin(crud: crudMethod, data: data, completion: { (res) in
151− if res {
152− self.tableView?.beginUpdates()
153− self.tableView?.reloadRows(at: [indexPath], with: .automatic)
154− if self.isFiltering {
155− self.filteredDataSource[indexPath.row].isAdmin = !wasAdmin
156− let changed = self.filteredDataSource[indexPath.row]
157− let filtered = self.dataSource.map { (one: Client) -> Client in
158− if one.uuid == changed.uuid {
159− return changed
160− } else { return one } }
161− self.dataSource = filtered
162− } else {
163− self.dataSource[indexPath.row].isAdmin = !wasAdmin
164− }
165− self.tableView?.endUpdates()
166− } else {
167− self.displayAlert(with: "Не удалось \(wasAdmin ? "распромоутить" : "запромоутить") пользователя! Попробуйте еще раз!")
168− return
169− }
170− })
171− }
172−}
173−
174−// MARK: - Tableview
175−
176−extension ClientsViewController {
57+ // MARK: - Tableview
17758
17859 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
17960 let cell = tableView.dequeueReusableCell(withIdentifier: clientTableViewCellId, for: indexPath) as! ClientTableViewCell
18061
181− let userModel = isFiltering ? filteredDataSource[indexPath.row] : dataSource[indexPath.row]
62+ let userModel = dataSource[indexPath.row]
18263 cell.bind(withModel: userModel)
18364
18465 return cell
18566 }
18667
18768 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
188− return isFiltering ? filteredDataSource.count : dataSource.count
69+ return dataSource.count
18970 }
19071
19172 override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
192− let user = isFiltering ? filteredDataSource[indexPath.row] : dataSource[indexPath.row]
73+ let user = dataSource[indexPath.row]
19374 coordinator?.openUserProfile(user)
194− searchControl?.dismiss(animated: true, completion: nil)
195− }
196−
197− // Update
198−
199− override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
200− return true
201− }
202−
203− override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
204−
205− let user = isFiltering ? filteredDataSource[indexPath.row] : dataSource[indexPath.row]
206− let blockButton = UITableViewRowAction(style: .normal, title: "\(!user.isBlocked ? "в чс" : "убрать из чс")") { _,_ in
207−
208− self.updateUserBlockStatus(wasBlocked: user.isBlocked, phone: user.phoneNumber, indexPath: indexPath)
209− }
210−
211− blockButton.backgroundColor = .black
212−
213− return [blockButton]
214− }
215−
216− override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
217−
218− let user = isFiltering ? filteredDataSource[indexPath.row] : dataSource[indexPath.row]
219−
220− let promote = UIContextualAction(style: .normal, title: "\(!user.isAdmin ? "дать админку" : "забрать админку")") { (_, _, _) in
221− self.updateAdminStatus(user: user, indexPath: indexPath)
222− }
223− promote.backgroundColor = .black
224−
225− return UISwipeActionsConfiguration(actions: [promote])
226− }
227−}
228−
229−extension ClientsViewController: UISearchResultsUpdating {
230− func filterContentForSearchText(_ searchText: String, scope: String = "All")
231− {
232− filteredDataSource = dataSource.filter { ($0.name?.lowercased().contains(searchText.lowercased()) ?? false) || ($0.phoneNumber.lowercased().contains(searchText.lowercased())) }
233− tableView.reloadData()
234− }
235−
236− func updateSearchResults(for searchController: UISearchController) {
237− filterContentForSearchText(searchController.searchBar.text ?? "")
23875 }
23976}
Hookah Tau/Controllers/Admin/Clients/Profile/ClientProfileCoordinator.swift+2−12
@@ -11,7 +11,7 @@ import UIKit
1111
1212class ClientProfileCoordinator: BaseCoordinator {
1313
14− var user: Client?
14+ var user: FullUser?
1515
1616 override func start() {
1717 let storyboard = UIStoryboard(name: "ClientList", bundle: nil)
@@ -24,18 +24,8 @@ class ClientProfileCoordinator: BaseCoordinator {
2424
2525
2626 // Создание бронирования из профиля клиента
27− func createReservation(forUserWithPhone phoneNumber: String, user fullUser: FullUser) {
28− let coordinator = AdminFirstStepReservationViewCoordinator(navigationController: navigationController)
29− coordinator.phone = phoneNumber
30− coordinator.fullUser = fullUser
27+ func createReservation(forUserWithPhone phoneNumber: String) {
3128
32− addDependency(coordinator)
33− coordinator.didFinish = { [weak self] in
34− self?.removeDependency(coordinator)
35− self?.navigationController?.popViewController(animated: true)
36− }
37−
38− coordinator.start()
3929 }
4030
4131 // Просмотр (и редактирование) брони
Hookah Tau/Controllers/Admin/Clients/Profile/ProfileTableViewController.swift+22−106
@@ -8,7 +8,7 @@
88
99import UIKit
1010
11−class ProfileTableViewController: BaseViewController {
11+class ProfileTableViewController: BaseTableViewController {
1212
1313 // MARK: - IBAOutlets
1414
@@ -30,41 +30,24 @@ class ProfileTableViewController: BaseViewController {
3030 }
3131 }
3232
33−
34− @IBOutlet weak var contentView: UIView!
35−
3633 // MARK: - properties
3734
38− var tableView: UITableView?
39−
4035 var clientsService: ClientsService?
4136
4237 var reservationsService: ReservationsService?
4338
44− var user: Client?
39+ var user: FullUser? {
40+ didSet {
41+ guard let u = user else { return }
42+ navigationItem.title = u.name
43+ }
44+ }
4545
4646 weak var coodinator: ClientProfileCoordinator?
4747
48− var noReserationsYetView: AdminNoReservationsView?
49−
50− var activityIndicator: UIActivityIndicatorView?
51−
52− var refreshControl: UIRefreshControl?
53−
5448 var dataSource: [Reservation] = [] {
5549 didSet {
56− guard let empty = noReserationsYetView else { return }
57− if dataSource.isEmpty {
58− empty.alpha = 1
59− tableView?.alpha = 0
60− } else {
61− empty.alpha = 0
62− tableView?.alpha = 1
63− }
64−
65− refreshControl?.endRefreshing()
66− activityIndicator?.stopAnimating()
67− tableView?.reloadData()
50+ tableView.reloadData()
6851 }
6952 }
7053
@@ -73,75 +56,25 @@ class ProfileTableViewController: BaseViewController {
7356 override func viewDidLoad() {
7457 super.viewDidLoad()
7558
59+ tableView?.register(ReservationCell.self, forCellReuseIdentifier: reservationCell)
60+
7661 clientsService = ClientsService(apiClient: APIClient.shared)
7762 reservationsService = ReservationsService(apiClient: APIClient.shared)
78−
79− setupNavBar()
80− setupTable()
81− setupActivityIndicator()
82− //loadReservations()
63+ loadReservations()
8364 }
8465
8566 override func viewWillAppear(_ animated: Bool) {
86− super.viewWillAppear(animated)
87− tabBarController?.tabBar.isHidden = true
88− }
89−
90− override func viewDidAppear(_ animated: Bool) {
9167 super.viewDidAppear(animated)
92− loadReservations()
93− }
94−
95− // MARK: - Setup
96−
97− func setupNavBar() {
98− guard let u = user else { return }
99−
100− navigationItem.title = "\(u.name ?? "❔")\(u.isAdmin ? "👑" : "")\(u.isBlocked ? "❌" : "")"
101− navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(book))
102− }
103−
104− func setupTable() {
105− tableView = UITableView()
106−
107− // refresh control
108− refreshControl = UIRefreshControl()
109− refreshControl?.addTarget(self, action: #selector(refresh), for: .valueChanged)
110− tableView?.refreshControl = refreshControl
111−
112− tableView?.dataSource = self
113− tableView?.delegate = self
114−
115− noReserationsYetView = AdminNoReservationsView.loadFromNib()
116− noReserationsYetView?.setup(withTitle: "У этого пользователя пока нет ни одной брони :(")
117− noReserationsYetView?.bookButton?.addTarget(self, action: #selector(book), for: .touchUpInside)
118− contentView.addSubviewThatFills(noReserationsYetView)
119− noReserationsYetView?.alpha = 0
120−
121− tableView?.register(ReservationCell.self, forCellReuseIdentifier: reservationCell)
122−
123− contentView.addSubviewThatFills(tableView)
124−
125− tableView?.alpha = 0
126− }
127−
128− func setupActivityIndicator() {
129−
130− activityIndicator = UIActivityIndicatorView()
131− view.addSubviewThatFills(activityIndicator)
132− activityIndicator?.startAnimating()
133−
68+ tabBarController?.tabBar.isHidden = true
13469 }
13570
136− // MARK: - Api calls
137−
13871 func loadReservations() {
13972 guard let uuid = user?.uuid else { return }
14073 clientsService?.loadReservationsForUser(withUUID: uuid,
14174 completion: { [weak self] (res) in
14275 switch res {
14376 case .failure(let err):
144− self?.displayAlert(forError: err)
77+ print(err)
14578 case .success(let data):
14679 self?.dataSource = data
14780 }
@@ -182,34 +115,18 @@ class ProfileTableViewController: BaseViewController {
182115 //Alert
183116 self.displayAlert(with: "Номер скопирован!")
184117 }
185−
186− @objc func refresh() {
187− loadReservations()
188− }
189−
190− @objc func book() {
191− guard
192− let phone = user?.phoneNumber,
193− let user = user
194− else { return }
195−
196− let fullUser = FullUser(uuid: user.uuid,
197− name: user.name,
198− phoneNumber: user.phoneNumber,
199− isAdmin: user.isAdmin)
200− coodinator?.createReservation(forUserWithPhone: phone, user: fullUser)
201− }
118+
202119}
203120
204121// MARK: - Table view data source
205122
206−extension ProfileTableViewController: UITableViewDelegate, UITableViewDataSource {
123+extension ProfileTableViewController {
207124
208− func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
125+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
209126 return dataSource.count
210127 }
211128
212− func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
129+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
213130 let cell = tableView.dequeueReusableCell(withIdentifier: reservationCell, for: indexPath) as! ReservationCell
214131
215132 cell.bind(withModel: dataSource[indexPath.row])
@@ -219,24 +136,23 @@ extension ProfileTableViewController: UITableViewDelegate, UITableViewDataSource
219136
220137 // tap
221138
222− func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
139+ override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
223140 guard let u = user else { return }
224141 let r = dataSource[indexPath.row]
225− let user = FullUser(uuid: u.uuid, name: u.name, phoneNumber: u.phoneNumber, isAdmin: u.isAdmin)
226− let reservation = ReservationWithUser(reservation: r, user: user)
142+ let reservation = ReservationWithUser(reservation: r, user: u)
227143 coodinator?.seeExistingReservation(data: reservation)
228144 }
229145
230146 // Update
231147
232− func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
148+ override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
233149 return true
234150 }
235151
236− func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
152+ override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
237153
238154 let uuid = dataSource[indexPath.row].uuid
239− let cancelButton = UITableViewRowAction(style: .normal, title: "отменить бронь") { _,_ in
155+ let cancelButton = UITableViewRowAction(style: .normal, title: "❌") { _,_ in
240156
241157 self.deleteReservation(uuid: uuid) { optionalNewVal in
242158 if let newval = optionalNewVal {
Hookah Tau/Controllers/Admin/Reservations/AdminReservationEditingCoordinator.swift+1−3
@@ -9,12 +9,10 @@
99import UIKit
1010
1111
12−class AdminReservationEditingCoordinator: BaseCoordinator, ShowReservationCoordinator {
12+class AdminReservationEditingCoordinator: BaseCoordinator {
1313
1414 // MARK: - Peoperties
1515
16− var didFinish: (() -> Void)?
17−
1816 var reservationData: ReservationWithUser?
1917
2018 // MARK: - Lifecycle
Hookah Tau/Controllers/Admin/Reservations/AdminReservationEditingViewController.swift+21−52
@@ -24,17 +24,22 @@ class AdminReservationEditingViewController: BaseViewController {
2424
2525 var reservationData: ReservationWithUser?
2626
27− weak var coordinator: ShowReservationCoordinator?
27+ weak var coordinator: AdminReservationEditingCoordinator?
2828
2929 var reservationService: ReservationsService?
3030
3131 var reservedPeriods: [ReservationPeriod] = [] {
3232 didSet {
33− if let _ = reservationView {
34− setupReservationViewWithIntervals()
35− }
33+ setupReservationViewWithIntervals()
3634 }
3735 }
36+
37+ var saveButton: Button = {
38+ let button = Button()
39+ let style = BlackButtonStyle()
40+ style.apply(to: button, withTitle: "СОХРАНИТЬ")
41+ return button
42+ }()
3843
3944 // MARK:- Lifecycle
4045
@@ -59,8 +64,10 @@ class AdminReservationEditingViewController: BaseViewController {
5964 // MARK: - Setup
6065
6166 func setupButtons() {
67+ addStackViewWithButtons(rightBtn: saveButton,
68+ constant: -mainContentView.frame.height - 10)
6269
63− reservationView?.saveButton?.addTarget(self, action: #selector(saveReservation), for: .touchUpInside)
70+ saveButton.addTarget(self, action: #selector(saveReservation), for: .touchUpInside)
6471 reservationView?.cancelButton?.addTarget(self, action: #selector(cancelReservation), for: .touchUpInside)
6572 }
6673
@@ -93,14 +100,9 @@ class AdminReservationEditingViewController: BaseViewController {
93100 }
94101
95102 func loadReservedPeriods() {
96− guard
97− let model = reservationData,
98− let uuid = model.uuid
99− else {
100− setupReservationViewWithIntervals()
101− return }
103+ guard let model = reservationData else { return }
102104
103− reservationService?.getReservationsAround(uuid: uuid, completion: { [weak self] (res) in
105+ reservationService?.getReservationsAround(uuid: model.uuid, completion: { [weak self] (res) in
104106 switch res {
105107 case .failure(let err):
106108 self?.displayAlert(forError: err)
@@ -118,12 +120,9 @@ class AdminReservationEditingViewController: BaseViewController {
118120 guard
119121 let r = reservationView?.data,
120122 let uuid = reservationData?.uuid
121− else {
122− createReservation()
123− return
124− }
123+ else { return }
125124
126− reservationView?.saveButton?.loading = true
125+ saveButton.loading = true
127126
128127 reservationService?.updateReservation(startTime: r.startTime,
129128 numberOfGuests: r.numberOfGuests,
@@ -132,56 +131,26 @@ class AdminReservationEditingViewController: BaseViewController {
132131 isAdmin: true,
133132 completion: { [weak self] (res) in
134133 if res {
135− self?.coordinator?.didFinish?()
134+ self?.coordinator?.didEndFlow?()
136135 } else {
137136 self?.displayAlert(with: "Что-то пошло не так! Попробуешь еще раз?")
138137 }
139138
140− self?.reservationView?.saveButton?.loading = false
141− })
142− }
143−
144− func createReservation() {
145− guard
146− let r = reservationData,
147− let d = reservationData?.owner.phoneNumber else { return }
148−
149− let data = ReservationData(establishment: r.establishment,
150− startTime: r.startTime,
151− endTime: r.endTime,
152− numberOfGuests: r.numberOfGuests,
153− reservedTable: r.reservedTable)
154− print(data)
155− reservationService?.createReservation(reservation: AdminCreateReservation(reservation: data, user: d), completion: { (res) in
156− switch res {
157− case .failure(_):
158− self.displayAlert(with: "Что-то пошло не так!\nПопробуешь еще раз?")
159− return
160− case .success(let uuid):
161− self.reservationData?.uuid = uuid
162− self.coordinator?.didFinish?()
163− return
164− }
139+ self?.saveButton.loading = false
165140 })
166141 }
167142
168143 @objc func cancelReservation() {
169144 guard
170− let uuid = reservationData?.uuid
171− else {
172− cancelPrereservation()
173− return }
145+ let uuid = reservationData?.uuid
146+ else { return }
174147
175148 reservationService?.deleteReservation(isAdmin: true, uuid: uuid, completion: { [weak self] (res) in
176149 if res {
177− self?.coordinator?.didFinish?()
150+ self?.coordinator?.didEndFlow?()
178151 } else {
179152 self?.displayAlert(with: "Что-то пошло не так!\nПопробуешь еще раз?")
180153 }
181154 })
182155 }
183−
184− func cancelPrereservation() {
185− coordinator?.didFinish?()
186− }
187156}
Hookah Tau/Controllers/Admin/Reservations/AdminReservations.storyboard+3−67
@@ -32,14 +32,14 @@
3232 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
3333 <subviews>
3434 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uNU-TW-vfq">
35− <rect key="frame" x="0.0" y="262" width="375" height="385"/>
35+ <rect key="frame" x="0.0" y="206" width="375" height="441"/>
3636 <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
3737 <constraints>
38− <constraint firstAttribute="height" constant="385" id="wfZ-i9-ruU"/>
38+ <constraint firstAttribute="height" constant="441" id="wfZ-i9-ruU"/>
3939 </constraints>
4040 </view>
4141 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ghQ-Jv-1Uo">
42− <rect key="frame" x="0.0" y="0.0" width="375" height="254"/>
42+ <rect key="frame" x="0.0" y="0.0" width="375" height="198"/>
4343 <color key="backgroundColor" systemColor="systemGreenColor" red="0.20392156859999999" green="0.78039215689999997" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
4444 </view>
4545 </subviews>
@@ -64,69 +64,5 @@
6464 </objects>
6565 <point key="canvasLocation" x="959.20000000000005" y="158.77061469265368"/>
6666 </scene>
67− <!--Admin Second Step Reservation View Controller-->
68− <scene sceneID="VhI-Z9-iqB">
69− <objects>
70− <viewController storyboardIdentifier="AdminSecondStepReservationViewController" id="eNJ-Ja-201" customClass="AdminSecondStepReservationViewController" customModule="Hookah_Tau" customModuleProvider="target" sceneMemberID="viewController">
71− <view key="view" contentMode="scaleToFill" id="7mk-5I-JJs">
72− <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
73− <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
74− <subviews>
75− <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oAV-GW-iea">
76− <rect key="frame" x="0.0" y="0.0" width="375" height="293"/>
77− <color key="backgroundColor" systemColor="systemIndigoColor" red="0.34509803919999998" green="0.33725490200000002" blue="0.83921568629999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
78− </view>
79− <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="a4v-ng-lm7">
80− <rect key="frame" x="0.0" y="293" width="375" height="374"/>
81− <subviews>
82− <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="13" translatesAutoresizingMaskIntoConstraints="NO" id="1Bb-cO-4qW">
83− <rect key="frame" x="20" y="22" width="335" height="88.5"/>
84− <subviews>
85− <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Номер клиента" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bME-Wr-gh7">
86− <rect key="frame" x="62.5" y="0.0" width="210.5" height="33.5"/>
87− <fontDescription key="fontDescription" type="boldSystem" pointSize="28"/>
88− <nil key="textColor"/>
89− <nil key="highlightedColor"/>
90− </label>
91− <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="+7 (988) 888-88-88" textAlignment="natural" minimumFontSize="28" translatesAutoresizingMaskIntoConstraints="NO" id="wBC-oa-ekQ" customClass="PhoneTextField" customModule="Hookah_Tau" customModuleProvider="target">
92− <rect key="frame" x="13.5" y="46.5" width="308.5" height="42"/>
93− <fontDescription key="fontDescription" type="boldSystem" pointSize="28"/>
94− <textInputTraits key="textInputTraits"/>
95− </textField>
96− </subviews>
97− </stackView>
98− </subviews>
99− <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
100− <constraints>
101− <constraint firstItem="1Bb-cO-4qW" firstAttribute="top" secondItem="a4v-ng-lm7" secondAttribute="top" constant="22" id="7fb-Up-Wmb"/>
102− <constraint firstAttribute="trailing" secondItem="1Bb-cO-4qW" secondAttribute="trailing" constant="20" id="934-Ef-0xf"/>
103− <constraint firstItem="1Bb-cO-4qW" firstAttribute="leading" secondItem="a4v-ng-lm7" secondAttribute="leading" constant="20" id="sr5-aO-q1p"/>
104− <constraint firstAttribute="height" constant="374" id="uRW-2Q-OyM"/>
105− </constraints>
106− </view>
107− </subviews>
108− <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
109− <constraints>
110− <constraint firstItem="a4v-ng-lm7" firstAttribute="leading" secondItem="8aV-w1-NXE" secondAttribute="leading" id="OjU-Pl-gu1"/>
111− <constraint firstItem="oAV-GW-iea" firstAttribute="trailing" secondItem="8aV-w1-NXE" secondAttribute="trailing" id="bPj-q1-pY6"/>
112− <constraint firstItem="oAV-GW-iea" firstAttribute="top" secondItem="8aV-w1-NXE" secondAttribute="top" id="gUc-es-YHL"/>
113− <constraint firstItem="a4v-ng-lm7" firstAttribute="bottom" secondItem="8aV-w1-NXE" secondAttribute="bottom" id="hZH-fU-zM5"/>
114− <constraint firstItem="oAV-GW-iea" firstAttribute="leading" secondItem="8aV-w1-NXE" secondAttribute="leading" id="mos-8B-wjS"/>
115− <constraint firstItem="a4v-ng-lm7" firstAttribute="trailing" secondItem="8aV-w1-NXE" secondAttribute="trailing" id="ntK-1r-AUW"/>
116− <constraint firstItem="a4v-ng-lm7" firstAttribute="top" secondItem="oAV-GW-iea" secondAttribute="bottom" id="siv-Xa-Nl5"/>
117− </constraints>
118− <viewLayoutGuide key="safeArea" id="8aV-w1-NXE"/>
119− </view>
120− <connections>
121− <outlet property="heightConstraint" destination="uRW-2Q-OyM" id="fmn-uI-ooi"/>
122− <outlet property="mapContainerView" destination="oAV-GW-iea" id="jmP-q0-WbS"/>
123− <outlet property="phoneContentView" destination="a4v-ng-lm7" id="W1O-A7-6EP"/>
124− <outlet property="phoneTextField" destination="wBC-oa-ekQ" id="Btg-A3-tpm"/>
125− </connections>
126− </viewController>
127− <placeholder placeholderIdentifier="IBFirstResponder" id="hNg-aQ-v7C" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
128− </objects>
129− <point key="canvasLocation" x="1664.8" y="158.77061469265368"/>
130− </scene>
13167 </scenes>
13268</document>
Hookah Tau/Controllers/Admin/Reservations/List of reservations/AdminReservationsController.swift+3−4
@@ -123,8 +123,7 @@ class AdminReservationsController: BaseViewController {
123123 // MARK:- Button handler
124124
125125 @objc func book() {
126− guard let establishmentId = id else { return }
127− coordinator?.book(inEstablishment: establishmentId)
126+
128127 }
129128
130129 func deleteReservation(uuid: String, completion: @escaping (([ReservationWithUser]?) -> Void)) {
@@ -196,8 +195,8 @@ extension AdminReservationsController: UITableViewDelegate, UITableViewDataSourc
196195
197196 func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
198197
199− guard let uuid = activeReservations[indexPath.row].uuid else { return [] }
200− let cancelButton = UITableViewRowAction(style: .normal, title: "отменить бронь") { _,_ in
198+ let uuid = activeReservations[indexPath.row].uuid
199+ let cancelButton = UITableViewRowAction(style: .normal, title: "❌") { _,_ in
201200
202201 self.deleteReservation(uuid: uuid) { optionalNewVal in
203202 if let newval = optionalNewVal {
Hookah Tau/Controllers/Admin/Reservations/List of reservations/AdminReservationsCoordinator.swift−16
@@ -12,8 +12,6 @@ class AdminReservationsCoordinator: BaseCoordinator {
1212
1313 // MARK: - Properties
1414
15− var didFinish: (() -> Void)?
16−
1715 var establishmentId: Int?
1816
1917 // MARK: - Lifecycle
@@ -37,18 +35,4 @@ class AdminReservationsCoordinator: BaseCoordinator {
3735 }
3836 reservationCoordinator.start()
3937 }
40−
41− /// Сюда мы идем после нажатия кнопочки "Забронировать" или плюсика справа сверху
42− func book(inEstablishment establishmentId: Int) {
43− let reservationCoordinator = AdminFirstStepReservationViewCoordinator(navigationController: navigationController)
44− reservationCoordinator.establishment = establishmentId
45− addDependency(reservationCoordinator)
46− reservationCoordinator.didFinish = { [weak self] in
47− self?.navigationController?.popViewController(animated: false)
48− self?.removeDependency(reservationCoordinator)
49− self?.didFinish?()
50− }
51−
52− reservationCoordinator.start()
53− }
5438}
Hookah Tau/Controllers/Admin/Reservations/Making a reeservation/1/AdminFirstStepReservationViewCoordinator.swiftdeleted−108
@@ -1,108 +0,0 @@
1−//
2−// AdminFirstStepReservationViewCoordinator.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 13/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import UIKit
10−
11−enum UserType {
12− case admin
13− case client
14−}
15−
16−protocol FirstStepReservationProtocol: BaseCoordinator {
17−
18− var user: UserType { get }
19−
20− func makeReservation(model: SecondStepModel, mapView: MapImageScroll?)
21−}
22−
23−class AdminFirstStepReservationViewCoordinator: BaseCoordinator{
24−
25− // MARK: - Properties
26−
27− var didFinish: (() -> Void)?
28−
29− var establishment: Int = 1
30−
31− var phone: String?
32−
33− var fullUser: FullUser?
34−
35− var model: SecondStepModel?
36−
37− // MARK: - Lifecycle
38−
39− override func start() {
40− let storyboard = UIStoryboard(name: "Reservation", bundle: nil)
41− let reservationVC = storyboard.instantiateViewController(withIdentifier: "ReservationViewController") as! FirstStepReservationViewController
42−
43− reservationVC.coordinator = self
44− reservationVC.establishmentId = establishment
45−
46− navigationController?.pushViewController(reservationVC, animated: true)
47− }
48−
49−
50−}
51−
52−extension AdminFirstStepReservationViewCoordinator: FirstStepReservationProtocol {
53−
54− var user: UserType {
55− get {
56− return .admin
57− }
58− }
59−
60− func makeReservation(model: SecondStepModel, mapView: MapImageScroll?) {
61− self.model = model
62−
63− if let p = phone {
64− goToFinalStep(with: fullUser, phone: p)
65− } else {
66− goToSecondStep(model: model, mapView: mapView)
67− }
68− }
69−
70− func goToFinalStep(with user: FullUser?, phone phoneNumber: String) {
71− let finalStepCoordinator = AdminFinalStepReservationCoordinator(navigationController: navigationController)
72− finalStepCoordinator.model = self.model
73−
74− addDependency(finalStepCoordinator)
75− finalStepCoordinator.didFinish = { [weak self] in
76− self?.navigationController?.popViewController(animated: false)
77− self?.removeDependency(finalStepCoordinator)
78− self?.didFinish?()
79− }
80−
81− if let u = user {
82− finalStepCoordinator.user = u
83− } else {
84− finalStepCoordinator.user = FullUser(uuid: nil,
85− name: nil,
86− phoneNumber: phoneNumber,
87− isAdmin: true)
88− }
89−
90− finalStepCoordinator.start()
91− }
92−
93− func goToSecondStep(model: SecondStepModel, mapView: MapImageScroll?) {
94− let reservationCoordinaotor = AdminSecondStepReservationViewCoordinator(navigationController: navigationController)
95− reservationCoordinaotor.model = model
96− reservationCoordinaotor.map = mapView
97−
98− addDependency(reservationCoordinaotor)
99− reservationCoordinaotor.didFinish = { [weak self] in
100− self?.navigationController?.popViewController(animated: false)
101− self?.removeDependency(reservationCoordinaotor)
102− self?.didFinish?()
103− }
104−
105− reservationCoordinaotor.start()
106− }
107−}
108−
Hookah Tau/Controllers/Admin/Reservations/Making a reeservation/2/AdminSecondStepReservationViewController.swiftdeleted−124
@@ -1,124 +0,0 @@
1−//
2−// AdminSecondStepReservationViewController.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 13/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import UIKit
10−
11−class AdminSecondStepReservationViewController: BaseViewController {
12−
13− // MARK: - IBAOutlets
14−
15− @IBOutlet weak var mapContainerView: UIView!
16−
17− @IBOutlet weak var heightConstraint: NSLayoutConstraint!
18−
19− @IBOutlet weak var phoneTextField: PhoneTextField!
20−
21− @IBOutlet weak var phoneContentView: UIView!
22−
23− // MARK: - Properties
24−
25− var table: Int?
26−
27− var mapScrollView: MapImageScroll?
28−
29− var clientsService: ClientsService?
30−
31− weak var coordinator: AdminSecondStepReservationViewCoordinator?
32−
33− let continueButton: Button = {
34− let button = Button()
35− let style = BlackButtonStyle()
36− style.apply(to: button, withTitle: "ДАЛЕЕ")
37− return button
38− }()
39−
40− let cancelButton: Button = {
41− let button = Button()
42− let style = BlackButtonStyle()
43− style.apply(to: button, withTitle: "ОТМЕНИТЬ")
44− return button
45− }()
46−
47− // MARK: - Lifecycle
48−
49− override func viewDidLoad() {
50− super.viewDidLoad()
51−
52− setupMap()
53− setupButtons()
54− setUpKeyboard()
55−
56− clientsService = ClientsService(apiClient: APIClient.shared)
57− phoneTextField.becomeFirstResponder()
58− }
59−
60− // MARK: - Set up
61−
62− func setupMap() {
63− guard let t = table else { return }
64− mapScrollView?.scrollToTable(table: t)
65− mapContainerView.addSubviewThatFills(mapScrollView)
66− }
67−
68− func setupButtons() {
69− addStackViewWithButtons(leftBtn: cancelButton,
70− rightBtn: continueButton,
71− constant: -phoneContentView.frame.height - 20)
72−
73− cancelButton.addTarget(self, action: #selector(cancel), for: .touchUpInside)
74− continueButton.addTarget(self, action: #selector(continueBooking), for: .touchUpInside)
75− }
76−
77− // MARK: - Keyboad
78−
79− @objc
80− override func handleKeyboardNotifications(notification: NSNotification) {
81− if let userInfo = notification.userInfo {
82− let keyBoardFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
83− heightConstraint?.constant = notification.name == UIResponder.keyboardWillShowNotification ? keyBoardFrame.height + view.safeAreaInsets.bottom + 120.5 : 120.5
84− bottomConstraint?.constant = notification.name == UIResponder.keyboardWillShowNotification ? -keyBoardFrame.height + view.safeAreaInsets.bottom - 140.5 : -140.5
85−
86− UIView.animate(withDuration: 0, delay: 0, options: .curveEaseOut, animations: {
87− self.view.layoutIfNeeded()
88− })
89− }
90− }
91−
92− // MARK: - Button handlers
93−
94− @objc func cancel() {
95− coordinator?.didEndFlow?()
96− }
97−
98− @objc func continueBooking() {
99− continueButton.loading = true
100−
101− guard let phone = phoneTextField.text?.toApiPhoneNumberFormat(), phone.count == 9 else {
102− displayAlert(with: "Сначала укажи номер!")
103− return
104− }
105−
106− clientsService?.getClientByPhoneNumber(userPhone: phone, completion: { [unowned self] (res) in
107− switch res {
108− case .failure(let err):
109− switch err {
110− case .notFound:
111− self.coordinator?.continueReservation(with: nil, phone: phone)
112− default:
113− self.displayAlert(with: "Что-то пошло не так! Попробуй еще раз :)")
114− }
115− case .success(let user):
116− self.coordinator?.continueReservation(with: user, phone: phone)
117− }
118−
119− self.continueButton.loading = false
120− })
121− }
122−
123−
124−}
Hookah Tau/Controllers/Admin/Reservations/Making a reeservation/2/AdminSecondStepReservationViewCoordinator.swiftdeleted−54
@@ -1,54 +0,0 @@
1−//
2−// AdminSecondStepReservationViewCoordinator.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 13/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import UIKit
10−
11−class AdminSecondStepReservationViewCoordinator: BaseCoordinator {
12−
13− // MARK: - Properties
14−
15− var didFinish: (() -> Void)?
16−
17− var map: MapImageScroll?
18−
19− var model: SecondStepModel?
20−
21− // MARK: - Lifecycle
22−
23− override func start() {
24− let storyboard = UIStoryboard(name: "AdminReservations", bundle: nil)
25− let reservationVC = storyboard.instantiateViewController(withIdentifier: "AdminSecondStepReservationViewController") as! AdminSecondStepReservationViewController
26− reservationVC.mapScrollView = map
27− reservationVC.table = model?.table
28− reservationVC.coordinator = self
29− navigationController?.pushViewController(reservationVC, animated: true)
30− }
31−
32− func continueReservation(with user: FullUser?, phone phoneNumber: String) {
33− let finalStepCoordinator = AdminFinalStepReservationCoordinator(navigationController: navigationController)
34− finalStepCoordinator.model = self.model
35−
36− addDependency(finalStepCoordinator)
37− finalStepCoordinator.didFinish = { [weak self] in
38− self?.navigationController?.popViewController(animated: false)
39− self?.removeDependency(finalStepCoordinator)
40− self?.didFinish?()
41− }
42−
43− if let u = user {
44− finalStepCoordinator.user = u
45− } else {
46− finalStepCoordinator.user = FullUser(uuid: nil,
47− name: nil,
48− phoneNumber: phoneNumber,
49− isAdmin: true)
50− }
51−
52− finalStepCoordinator.start()
53− }
54−}
Hookah Tau/Controllers/Admin/Reservations/Making a reeservation/3/AdminFinalStepReservationCoordinator.swiftdeleted−47
@@ -1,47 +0,0 @@
1−//
2−// AdminFinalStepReservationCoordinator.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 14/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import UIKit
10−
11−protocol ShowReservationCoordinator: BaseCoordinator {
12− var didFinish: (() -> Void)? { get }
13−}
14−
15−class AdminFinalStepReservationCoordinator: BaseCoordinator, ShowReservationCoordinator {
16−
17− // MARK: - Properties
18−
19− var didFinish: (() -> Void)?
20−
21− var user: FullUser?
22−
23− var model: SecondStepModel?
24−
25− // MARK: - Lifecycle
26−
27− override func start() {
28− let storyboard = UIStoryboard(name: "AdminReservations", bundle: nil)
29− let vc = storyboard.instantiateViewController(withIdentifier: "AdminReservationEditingViewController") as! AdminReservationEditingViewController
30−
31− guard
32− let model = model,
33− let u = user else { return }
34− vc.reservationData = ReservationWithUser(uuid: nil,
35− establishment: model.establishment,
36− startTime: model.startTime,
37− endTime: model.startTime.addHours(2),
38− numberOfGuests: 2,
39− reservedTable: model.table,
40− owner: u)
41−
42− vc.reservedPeriods = model.reservedintervals
43− vc.coordinator = self
44−
45− navigationController?.pushViewController(vc, animated: true)
46− }
47−}
Hookah Tau/Controllers/Admin/Reservations/Views/AdminReservationView.swift+4−11
@@ -39,13 +39,6 @@ class AdminReservationView: UIView {
3939
4040 @IBOutlet weak var intervalsStackView: UIStackView!
4141
42− @IBOutlet weak var saveButton: Button? {
43− didSet {
44− let style = BlackButtonStyle()
45− style.apply(to: saveButton, withTitle: "СОХРАНИТЬ")
46− }
47− }
48−
4942 // MARK: - Properties
5043
5144 // констрейнты начала и конца интервала
@@ -116,7 +109,7 @@ class AdminReservationView: UIView {
116109
117110 startDate = start
118111
119− setUpIntervals()
112+ setUpIntervals(model.owner.isAdmin)
120113
121114 guestSlider?.maximumValue = Float((TotalStorage.standard.getTable(establishment: model.establishment, table: model.reservedTable)?.maxGuestNumber ?? 2) + 1)
122115 }
@@ -165,11 +158,11 @@ class AdminReservationView: UIView {
165158 // MARK: - Setup
166159
167160 /// Тут происходит установка интервалов. Разное для клиента и админа
168− func setUpIntervals() {
161+ func setUpIntervals(_ isAdmin: Bool) {
169162 guard let startPoint = startDate else { return }
170163
171− let startingPoint = startPoint.getAdminsStartingPoint()
172− let endingPoint = Constants.adminDuration
164+ let startingPoint = isAdmin ? startPoint.getAdminsStartingPoint() : Constants.clientStartingPoint
165+ let endingPoint = startingPoint + (isAdmin ? Constants.adminDuration : Constants.clientDuration)
173166
174167 for period in startingPoint...endingPoint {
175168 let timePointView = TimePointView.loadFromNib()
Hookah Tau/Controllers/Admin/Reservations/Views/AdminReservationView.xib+21−36
@@ -11,14 +11,14 @@
1111 <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
1212 <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
1313 <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="AdminReservationView" customModule="Hookah_Tau" customModuleProvider="target">
14− <rect key="frame" x="0.0" y="0.0" width="414" height="385"/>
14+ <rect key="frame" x="0.0" y="0.0" width="414" height="441"/>
1515 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1616 <subviews>
17− <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="24" translatesAutoresizingMaskIntoConstraints="NO" id="AEf-R4-K1F">
18− <rect key="frame" x="0.0" y="16" width="414" height="349"/>
17+ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="48" translatesAutoresizingMaskIntoConstraints="NO" id="AEf-R4-K1F">
18+ <rect key="frame" x="0.0" y="16" width="414" height="404"/>
1919 <subviews>
2020 <stackView opaque="NO" contentMode="scaleToFill" alignment="top" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="oh7-ka-ctS">
21− <rect key="frame" x="21" y="0.0" width="372" height="136.5"/>
21+ <rect key="frame" x="21" y="0.0" width="372" height="143.5"/>
2222 <subviews>
2323 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="22" translatesAutoresizingMaskIntoConstraints="NO" id="IY6-F4-aln">
2424 <rect key="frame" x="0.0" y="0.0" width="129" height="136.5"/>
@@ -66,35 +66,21 @@
6666 <constraint firstItem="hEV-kW-bBH" firstAttribute="leading" secondItem="IY6-F4-aln" secondAttribute="leading" id="tsb-PN-YGB"/>
6767 </constraints>
6868 </stackView>
69− <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="bottom" spacing="28" translatesAutoresizingMaskIntoConstraints="NO" id="Kjb-P4-v2B">
70− <rect key="frame" x="133" y="0.0" width="239" height="136.5"/>
69+ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="bottom" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="59c-nG-5Fh">
70+ <rect key="frame" x="133" y="0.0" width="239" height="71.5"/>
7171 <subviews>
72− <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="bottom" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="59c-nG-5Fh">
73− <rect key="frame" x="65" y="0.0" width="174" height="71.5"/>
74− <subviews>
75− <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Стасик" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OoG-F4-OVu">
76− <rect key="frame" x="95.5" y="0.0" width="78.5" height="26.5"/>
77− <fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
78− <nil key="textColor"/>
79− <nil key="highlightedColor"/>
80− </label>
81− <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Xkd-xQ-cFd" customClass="Button" customModule="Hookah_Tau" customModuleProvider="target">
82− <rect key="frame" x="0.0" y="34.5" width="174" height="37"/>
83− <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
84− <constraints>
85− <constraint firstAttribute="height" constant="37" id="7Wj-WF-xzD"/>
86− <constraint firstAttribute="width" constant="174" id="ZYo-ko-rwn"/>
87− </constraints>
88− <state key="normal" title="Button"/>
89− </button>
90− </subviews>
91− </stackView>
92− <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="npC-AF-3pj" customClass="Button" customModule="Hookah_Tau" customModuleProvider="target">
93− <rect key="frame" x="103" y="99.5" width="136" height="37"/>
72+ <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="OoG-F4-OVu">
73+ <rect key="frame" x="160.5" y="0.0" width="78.5" height="26.5"/>
74+ <fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
75+ <nil key="textColor"/>
76+ <nil key="highlightedColor"/>
77+ </label>
78+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Xkd-xQ-cFd" customClass="Button" customModule="Hookah_Tau" customModuleProvider="target">
79+ <rect key="frame" x="65" y="34.5" width="174" height="37"/>
9480 <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
9581 <constraints>
96− <constraint firstAttribute="width" constant="136" id="jg5-lP-Ekd"/>
97− <constraint firstAttribute="height" constant="37" id="w98-8a-pmH"/>
82+ <constraint firstAttribute="height" constant="37" id="7Wj-WF-xzD"/>
83+ <constraint firstAttribute="width" constant="174" id="ZYo-ko-rwn"/>
9884 </constraints>
9985 <state key="normal" title="Button"/>
10086 </button>
@@ -103,7 +89,7 @@
10389 </subviews>
10490 </stackView>
10591 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="9RO-aK-yNh">
106− <rect key="frame" x="21" y="160.5" width="372" height="58.5"/>
92+ <rect key="frame" x="21" y="191.5" width="372" height="58.5"/>
10793 <subviews>
10894 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Количество гостей: 2" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yTM-U5-XjI">
10995 <rect key="frame" x="0.0" y="0.0" width="372" height="20.5"/>
@@ -120,7 +106,7 @@
120106 </subviews>
121107 </stackView>
122108 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vKS-ia-RxW">
123− <rect key="frame" x="0.0" y="243" width="414" height="106"/>
109+ <rect key="frame" x="0.0" y="298" width="414" height="106"/>
124110 <subviews>
125111 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EiP-QO-PbU">
126112 <rect key="frame" x="0.0" y="20" width="414" height="85"/>
@@ -196,10 +182,10 @@
196182 </subviews>
197183 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
198184 <constraints>
185+ <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="AEf-R4-K1F" secondAttribute="bottom" constant="21" id="4MN-Yl-hYv"/>
199186 <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="AEf-R4-K1F" secondAttribute="trailing" id="C1h-bA-S6p"/>
200187 <constraint firstItem="AEf-R4-K1F" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="H1o-ua-Tnn"/>
201− <constraint firstAttribute="top" secondItem="AEf-R4-K1F" secondAttribute="top" constant="-16" id="eYI-is-YLt"/>
202− <constraint firstAttribute="bottom" secondItem="AEf-R4-K1F" secondAttribute="bottom" constant="20" id="fdG-zZ-LeV"/>
188+ <constraint firstItem="vUN-kp-3ea" firstAttribute="top" secondItem="AEf-R4-K1F" secondAttribute="top" constant="-16" id="eYI-is-YLt"/>
203189 </constraints>
204190 <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
205191 <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
@@ -212,12 +198,11 @@
212198 <outlet property="intervalsStackView" destination="bpJ-pe-tQf" id="aF0-Qm-kuh"/>
213199 <outlet property="nameLabel" destination="OoG-F4-OVu" id="rnW-fG-jFs"/>
214200 <outlet property="numberOfGuestLabel" destination="yTM-U5-XjI" id="z0O-94-Mp7"/>
215− <outlet property="saveButton" destination="npC-AF-3pj" id="Rfm-Zl-zES"/>
216201 <outlet property="scrollView" destination="trF-VM-0qV" id="P5v-fg-hUW"/>
217202 <outlet property="tableLabel" destination="qNR-EO-oMK" id="63P-AS-fgf"/>
218203 <outlet property="timeLabel" destination="gau-aS-vtT" id="7Iy-Cz-zdY"/>
219204 </connections>
220− <point key="canvasLocation" x="137.59999999999999" y="95.802098950524751"/>
205+ <point key="canvasLocation" x="137.59999999999999" y="120.98950524737631"/>
221206 </view>
222207 </objects>
223208</document>
Hookah Tau/Controllers/Admin/Reservations/Views/No reserv/AdminNoReservationsView.swift−5
@@ -12,8 +12,6 @@ class AdminNoReservationsView: UIView {
1212
1313 // MARK: - IBAOutlets
1414
15− @IBOutlet weak var titleLabel: UILabel?
16−
1715 @IBOutlet weak var bookButton: Button? {
1816 didSet {
1917 let style = BlackButtonStyle()
@@ -21,7 +19,4 @@ class AdminNoReservationsView: UIView {
2119 }
2220 }
2321
24− func setup(withTitle title: String) {
25− titleLabel?.text = title
26− }
2722}
Hookah Tau/Controllers/Admin/Reservations/Views/No reserv/AdminNoReservationsView.xib−1
@@ -46,7 +46,6 @@
4646 <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
4747 <connections>
4848 <outlet property="bookButton" destination="y3F-ua-mLb" id="aC4-gz-Gqd"/>
49− <outlet property="titleLabel" destination="Svd-DB-3Zu" id="n8Z-Wq-vzC"/>
5049 </connections>
5150 <point key="canvasLocation" x="137.68115942028987" y="91.741071428571431"/>
5251 </view>
Hookah Tau/Controllers/BaseViewController.swift+1−1
@@ -97,7 +97,7 @@ class BaseViewController: UIViewController {
9797 }
9898
9999 @objc
100− func handleKeyboardNotifications(notification: NSNotification){
100+ private func handleKeyboardNotifications(notification: NSNotification){
101101 if let userInfo = notification.userInfo {
102102 let keyBoardFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
103103 bottomConstraint?.constant = notification.name == UIResponder.keyboardWillShowNotification ? -keyBoardFrame.height + view.safeAreaInsets.bottom - 20 : 0
Hookah Tau/Controllers/Client/Profile/ProfileChangeViewController.swift+3−3
@@ -23,7 +23,7 @@ class ProfileChangeViewController: BaseViewController {
2323
2424 var changeView: ChangeView?
2525
26− var settingsService: ClientsService?
26+ var settingsService: SettingsService?
2727
2828 var contentView: UIView = {
2929 let view = UIView()
@@ -60,7 +60,7 @@ class ProfileChangeViewController: BaseViewController {
6060 setUpView()
6161 setUpKeyboard()
6262
63− settingsService = ClientsService(apiClient: APIClient.shared)
63+ settingsService = SettingsService(apiClient: APIClient.shared)
6464 }
6565
6666 func setUpView() {
@@ -106,7 +106,7 @@ class ProfileChangeViewController: BaseViewController {
106106 func addNewAdmin(phone: String) {
107107 doneButton.loading = true
108108
109− settingsService?.changeAdmin(crud: CrudMethod.put, data: phone) { [weak self] res in
109+ settingsService?.addOtherAdmin(phone: phone) { [weak self] res in
110110 if res {
111111 self?.coordinator?.update(withModel: nil)
112112 } else {
Hookah Tau/Controllers/Client/Reservations/Active Reservations/ReservationsViewController.swift+1−1
@@ -192,7 +192,7 @@ extension ReservationsViewController: UITableViewDelegate, UITableViewDataSource
192192 func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
193193
194194 let uuid = activeReservations[indexPath.row].uuid
195− let cancelButton = UITableViewRowAction(style: .normal, title: "отменить бронь") { _,_ in
195+ let cancelButton = UITableViewRowAction(style: .normal, title: "❌") { _,_ in
196196
197197 self.deleteReservation(uuid: uuid) { optionalNewVal in
198198 if let newval = optionalNewVal {
Hookah Tau/Controllers/Client/Reservations/Steps/1/FirstStepReservationCoordinator.swift+1−8
@@ -8,7 +8,7 @@
88
99import UIKit
1010
11−class FirstStepReservationCoordinator: BaseCoordinator, FirstStepReservationProtocol {
11+class FirstStepReservationCoordinator: BaseCoordinator {
1212
1313 // MARK: - Properties
1414
@@ -28,13 +28,6 @@ class FirstStepReservationCoordinator: BaseCoordinator, FirstStepReservationProt
2828 navigationController?.pushViewController(reservationVC, animated: true)
2929 }
3030
31− var user: UserType {
32− get {
33− return .client
34− }
35− }
36−
37−
3831 func makeReservation(model: SecondStepModel,
3932 mapView: MapImageScroll?) {
4033
Hookah Tau/Controllers/Client/Reservations/Steps/1/FirstStepReservationViewController.swift+6−15
@@ -13,7 +13,7 @@ class FirstStepReservationViewController: BaseViewController {
1313
1414 // MARK: - Properties
1515
16− weak var coordinator: FirstStepReservationProtocol?
16+ weak var coordinator: FirstStepReservationCoordinator?
1717
1818 @IBOutlet weak var childContentView: UIView!
1919
@@ -82,21 +82,12 @@ class FirstStepReservationViewController: BaseViewController {
8282 }
8383
8484 func setupButtons() {
85−
86− guard let coord = coordinator else { return }
87−
88− if coord.user == .admin {
89− addStackViewWithButtons(rightBtn: continueButton,
90− constant: -childContentView.frame.height - 20)
91− } else {
92− addStackViewWithButtons(leftBtn: callButton,
93− rightBtn: continueButton,
94− constant: -childContentView.frame.height - 20)
95−
96− callButton.addTarget(self, action: #selector(call), for: .touchUpInside)
97− }
85+ addStackViewWithButtons(leftBtn: callButton,
86+ rightBtn: continueButton,
87+ constant: -childContentView.frame.height - 20)
9888
9989 continueButton.addTarget(self, action: #selector(continueBooking), for: .touchUpInside)
90+ callButton.addTarget(self, action: #selector(call), for: .touchUpInside)
10091 }
10192
10293 func performUpdate() {
@@ -187,7 +178,7 @@ extension FirstStepReservationViewController: MapUpdater {
187178 let areBooked = allReservations?.intervals[date] ?? []
188179
189180 let isAdmin = DataStorage.standard.getUserModel()?.isAdmin ?? false
190− let closed = !isAdmin && date.isInClosingHours()
181+ let closed = isAdmin || date.isInClosingHours()
191182
192183 if Set(areBooked).contains(tableId) || closed {
193184 continueButton.availiable = false
Hookah Tau/Controllers/Client/Reservations/Steps/1/FirstStepView.xib+18−18
@@ -1,9 +1,9 @@
11<?xml version="1.0" encoding="UTF-8"?>
2−<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3− <device id="retina5_5" orientation="portrait" appearance="light"/>
2+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+ <device id="retina4_7" orientation="portrait" appearance="light"/>
44 <dependencies>
55 <deployment identifier="iOS"/>
6− <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
6+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
77 <capability name="Safe area layout guides" minToolsVersion="9.0"/>
88 <capability name="Stack View standard spacing" minToolsVersion="9.0"/>
99 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -106,14 +106,14 @@
106106 </constraints>
107107 </view>
108108 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="TriangleDown" translatesAutoresizingMaskIntoConstraints="NO" id="5dC-Lq-opV">
109− <rect key="frame" x="184.66666666666666" y="0.0" width="45" height="29"/>
109+ <rect key="frame" x="184.5" y="0.0" width="45" height="29"/>
110110 <constraints>
111111 <constraint firstAttribute="width" constant="45" id="Tsw-fS-8qs"/>
112112 <constraint firstAttribute="height" constant="29" id="YWD-ja-gD5"/>
113113 </constraints>
114114 </imageView>
115115 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="TriangleUp" translatesAutoresizingMaskIntoConstraints="NO" id="Igw-O9-W92">
116− <rect key="frame" x="184.66666666666666" y="196" width="45" height="29"/>
116+ <rect key="frame" x="184.5" y="196" width="45" height="29"/>
117117 <constraints>
118118 <constraint firstAttribute="height" constant="29" id="AdE-yJ-WLL"/>
119119 <constraint firstAttribute="width" constant="45" id="Eaa-P8-3mv"/>
@@ -159,16 +159,16 @@
159159 <rect key="frame" x="0.0" y="29" width="414" height="59"/>
160160 <subviews>
161161 <stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="OEF-Kc-d38">
162− <rect key="frame" x="8" y="5.0000000000000009" width="398" height="14.333333333333336"/>
162+ <rect key="frame" x="8" y="5" width="398" height="14.5"/>
163163 <subviews>
164164 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="November" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5Mn-Mn-qaI">
165− <rect key="frame" x="0.0" y="0.0" width="58.333333333333336" height="14.333333333333334"/>
165+ <rect key="frame" x="0.0" y="0.0" width="58.5" height="14.5"/>
166166 <fontDescription key="fontDescription" type="system" pointSize="12"/>
167167 <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
168168 <nil key="highlightedColor"/>
169169 </label>
170170 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="January" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Rfg-Ts-DX0">
171− <rect key="frame" x="353" y="0.0" width="45" height="14.333333333333334"/>
171+ <rect key="frame" x="353" y="0.0" width="45" height="14.5"/>
172172 <fontDescription key="fontDescription" type="system" pointSize="12"/>
173173 <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
174174 <nil key="highlightedColor"/>
@@ -176,7 +176,7 @@
176176 </subviews>
177177 </stackView>
178178 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="December" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fbc-VX-43f">
179− <rect key="frame" x="176.66666666666666" y="5.0000000000000009" width="60.666666666666657" height="14.333333333333336"/>
179+ <rect key="frame" x="176.5" y="5" width="61" height="14.5"/>
180180 <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="12"/>
181181 <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
182182 <nil key="highlightedColor"/>
@@ -204,28 +204,28 @@
204204 <constraints>
205205 <constraint firstItem="Y9G-UI-WV7" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" id="22z-Ck-vsZ"/>
206206 <constraint firstItem="a6N-9A-8y5" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="5c8-YB-dSB"/>
207− <constraint firstAttribute="bottom" secondItem="954-g3-FZD" secondAttribute="bottom" constant="37" id="C3k-Mb-wT4"/>
207+ <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="954-g3-FZD" secondAttribute="bottom" constant="37" id="C3k-Mb-wT4"/>
208208 <constraint firstItem="Y9G-UI-WV7" firstAttribute="top" secondItem="5dC-Lq-opV" secondAttribute="bottom" id="E97-Lg-K2s"/>
209209 <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="fvt-zf-8tU" secondAttribute="trailing" id="Eeh-zB-KWe"/>
210210 <constraint firstItem="a6N-9A-8y5" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" id="F03-yv-41V"/>
211211 <constraint firstItem="pgz-8G-Kx4" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="G0y-2f-SkS"/>
212212 <constraint firstItem="5dC-Lq-opV" firstAttribute="centerX" secondItem="vUN-kp-3ea" secondAttribute="centerX" id="If5-v7-UAj"/>
213− <constraint firstAttribute="bottom" secondItem="pgz-8G-Kx4" secondAttribute="bottom" constant="137" id="Lgn-Nv-wjD"/>
213+ <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="pgz-8G-Kx4" secondAttribute="bottom" constant="137" id="Lgn-Nv-wjD"/>
214214 <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="954-g3-FZD" secondAttribute="trailing" id="MGt-d4-Win"/>
215215 <constraint firstItem="fvt-zf-8tU" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="SaI-rP-2em"/>
216216 <constraint firstItem="Igw-O9-W92" firstAttribute="centerX" secondItem="vUN-kp-3ea" secondAttribute="centerX" id="TtM-Bc-V1U"/>
217− <constraint firstItem="Igw-O9-W92" firstAttribute="bottom" secondItem="iN0-l3-epB" secondAttribute="bottom" id="V9u-Eu-VME"/>
217+ <constraint firstItem="Igw-O9-W92" firstAttribute="bottom" secondItem="vUN-kp-3ea" secondAttribute="bottom" id="V9u-Eu-VME"/>
218218 <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="pgz-8G-Kx4" secondAttribute="trailing" id="Z6D-PY-Jrh"/>
219219 <constraint firstItem="Igw-O9-W92" firstAttribute="top" secondItem="a6N-9A-8y5" secondAttribute="bottom" constant="8" id="f4D-nq-HMa"/>
220220 <constraint firstItem="Y9G-UI-WV7" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="gZw-8a-dTG"/>
221221 <constraint firstItem="954-g3-FZD" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="itw-0z-3i7"/>
222− <constraint firstAttribute="bottom" secondItem="fvt-zf-8tU" secondAttribute="bottom" constant="137" id="lOx-ke-O6a"/>
222+ <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="fvt-zf-8tU" secondAttribute="bottom" constant="137" id="lOx-ke-O6a"/>
223223 <constraint firstItem="z9p-OK-tL7" firstAttribute="top" secondItem="52e-LM-cF6" secondAttribute="bottom" constant="9" id="ldj-Qh-p0k"/>
224− <constraint firstItem="fvt-zf-8tU" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="29" id="pSg-dd-INI"/>
225− <constraint firstItem="pgz-8G-Kx4" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="29" id="vfO-LG-tqR"/>
226− <constraint firstItem="954-g3-FZD" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="97" id="vhK-2E-j3k"/>
227− <constraint firstItem="5dC-Lq-opV" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="xOt-l0-Vzy"/>
228− <constraint firstItem="a6N-9A-8y5" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="97" id="yyf-QB-vfF"/>
224+ <constraint firstItem="fvt-zf-8tU" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="29" id="pSg-dd-INI"/>
225+ <constraint firstItem="pgz-8G-Kx4" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="29" id="vfO-LG-tqR"/>
226+ <constraint firstItem="954-g3-FZD" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="97" id="vhK-2E-j3k"/>
227+ <constraint firstItem="5dC-Lq-opV" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="xOt-l0-Vzy"/>
228+ <constraint firstItem="a6N-9A-8y5" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="97" id="yyf-QB-vfF"/>
229229 </constraints>
230230 <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
231231 <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
Hookah Tau/Controllers/Client/Reservations/Steps/2/SecondStepView.xib+2−2
@@ -123,7 +123,7 @@
123123 </subviews>
124124 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
125125 <constraints>
126− <constraint firstAttribute="bottom" secondItem="RJE-Hk-KNh" secondAttribute="bottom" constant="36" id="0W3-e2-hCU"/>
126+ <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="RJE-Hk-KNh" secondAttribute="bottom" constant="36" id="0W3-e2-hCU"/>
127127 <constraint firstItem="9c7-IZ-n2p" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="94y-7J-ksb"/>
128128 <constraint firstItem="9c7-IZ-n2p" firstAttribute="top" secondItem="bJ1-1q-VXq" secondAttribute="bottom" constant="20" id="9TT-vO-7PZ"/>
129129 <constraint firstItem="RJE-Hk-KNh" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" id="AgS-kP-UNE"/>
@@ -131,7 +131,7 @@
131131 <constraint firstAttribute="trailing" secondItem="bJ1-1q-VXq" secondAttribute="trailing" constant="20" id="OCH-eC-kP5"/>
132132 <constraint firstItem="bJ1-1q-VXq" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="PCm-nY-M6p"/>
133133 <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="9c7-IZ-n2p" secondAttribute="trailing" constant="20.5" id="Rh7-V2-v2u"/>
134− <constraint firstItem="bJ1-1q-VXq" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="20" id="SnG-Cy-hHq"/>
134+ <constraint firstItem="bJ1-1q-VXq" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="20" id="SnG-Cy-hHq"/>
135135 <constraint firstItem="RJE-Hk-KNh" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="fW0-Tt-MpN"/>
136136 </constraints>
137137 <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
Hookah Tau/Controllers/Client/Reservations/Steps/3/ThirdStepView.xib+3−3
@@ -1,9 +1,9 @@
11<?xml version="1.0" encoding="UTF-8"?>
2−<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33 <device id="retina4_7" orientation="portrait" appearance="light"/>
44 <dependencies>
55 <deployment identifier="iOS"/>
6− <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
6+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
77 <capability name="Safe area layout guides" minToolsVersion="9.0"/>
88 <capability name="Stack View standard spacing" minToolsVersion="9.0"/>
99 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -120,7 +120,7 @@
120120 <constraint firstItem="0H2-jJ-gOj" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="GR6-gI-ecm"/>
121121 <constraint firstItem="ByV-f1-mVO" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="KKj-7n-eQf"/>
122122 <constraint firstItem="0H2-jJ-gOj" firstAttribute="top" secondItem="DL4-0a-WxC" secondAttribute="bottom" constant="30" id="VbN-sb-Pko"/>
123− <constraint firstItem="DL4-0a-WxC" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="20" id="cm0-tz-ta4"/>
123+ <constraint firstItem="DL4-0a-WxC" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="20" id="cm0-tz-ta4"/>
124124 <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="0H2-jJ-gOj" secondAttribute="trailing" constant="20" id="i3D-sP-KlI"/>
125125 <constraint firstAttribute="trailing" secondItem="DL4-0a-WxC" secondAttribute="trailing" constant="20" id="kHp-8n-OTp"/>
126126 <constraint firstItem="DL4-0a-WxC" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="vOg-X1-y93"/>
Hookah Tau/HFunc.swift−7
@@ -15,9 +15,6 @@ class HFunc {
1515
1616 static let main = HFunc()
1717
18− func exportClientsToCSV(_ arr: [Client]) -> String {
19− return arr.reduce(Client.csvHeading) { return funcToMapClientsIntoString($0, $1) }
20− }
2118
2219 /// Filtering function to get every periods which intersects with given date
2320 /// - Parameter periods: all periods of bookings (for a particular table)
@@ -61,8 +58,4 @@ class HFunc {
6158
6259 return { (period: ReservationPeriod) in intervalChecking(period.startTime, period.endTime) }
6360 }
64−
65− private func funcToMapClientsIntoString(_ acc: String, _ el: Client) -> String {
66− return acc + el.toString + "\n"
67− }
6861}
Hookah Tau/Models/Reservation.swift+1−15
@@ -51,7 +51,7 @@ struct ReservationData: MyCodable {
5151/// Структура для получения респонса на `GET /admin/reservations/{establishment id}`
5252struct ReservationWithUser: MyCodable {
5353
54− var uuid: String?
54+ var uuid: String
5555 var establishment: Int
5656 var startTime: Date
5757 var endTime: Date
@@ -68,20 +68,6 @@ struct ReservationWithUser: MyCodable {
6868 self.reservedTable = reservation.reservedTable
6969 self.owner = user
7070 }
71−
72− init(uuid: String?, establishment: Int, startTime: Date, endTime: Date, numberOfGuests: Int, reservedTable: Int, owner: FullUser) {
73− self.uuid = uuid
74− self.establishment = establishment
75− self.startTime = startTime
76− self.endTime = endTime
77− self.numberOfGuests = numberOfGuests
78− self.reservedTable = reservedTable
79− self.owner = owner
80− }
8171}
8272
83−struct AdminCreateReservation: MyCodable {
84− var reservation: ReservationData
85− var user: String
86−}
8773
Hookah Tau/Models/User.swift+1−10
@@ -17,7 +17,7 @@ struct User: MyCodable {
1717
1818/// При запросах на список пользователей в аккаунте администратора.
1919struct FullUser: MyCodable {
20− var uuid: String?
20+ var uuid: String
2121 var name: String?
2222 var phoneNumber: String
2323 var isAdmin: Bool
@@ -30,13 +30,4 @@ struct Client: MyCodable {
3030 var phoneNumber: String
3131 var isAdmin: Bool
3232 var reservationCount: Int
33− var isBlocked: Bool
34−
35− static var csvHeading: String {
36− return "uuid, имя, телефон, админ, количество активных бронирований, в черном списке\n"
37− }
38−
39− var toString: String {
40− return "\(uuid), \(name ?? "❔"), +79\(phoneNumber), \(isAdmin), \(reservationCount), \(isBlocked)"
41− }
4233}
Hookah Tau/Supporting Files/Assets.xcassets/admin.imageset/Contents.jsondeleted−12
@@ -1,12 +0,0 @@
1−{
2− "images" : [
3− {
4− "idiom" : "universal",
5− "filename" : "admin.pdf"
6− }
7− ],
8− "info" : {
9− "version" : 1,
10− "author" : "xcode"
11− }
12−}
Hookah Tau/Supporting Files/Assets.xcassets/admin.imageset/admin.pdfdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/blacklist.imageset/Contents.jsondeleted−15
@@ -1,15 +0,0 @@
1−{
2− "images" : [
3− {
4− "idiom" : "universal",
5− "filename" : "blacklist.pdf"
6− }
7− ],
8− "info" : {
9− "version" : 1,
10− "author" : "xcode"
11− },
12− "properties" : {
13− "preserves-vector-representation" : true
14− }
15−}
Hookah Tau/Supporting Files/Assets.xcassets/blacklist.imageset/blacklist.pdfdeleted

Binary file not shown.