git.iko.soy/dashared/hookah-tau
on cd3732f help sign in
84 files changed+346−1885
since splitsnapshots
unifiedsplit
Hookah Tau.xcodeproj/project.pbxproj+25−91 Hookah Tau/API/APIClient.swift−2 Hookah Tau/API/ClientsService/ClientsService.swift+1−64 Hookah Tau/API/ClientsService/Resolvers/BlocklistPutResolver.swift−33 Hookah Tau/API/ClientsService/Resolvers/ClientsListResolver.swift+1−1 Hookah Tau/API/ClientsService/Resolvers/DeleteOtherAdminResolver.swift−35 Hookah Tau/API/ClientsService/Resolvers/GetClientByPhoneNumberResolver.swift−35 Hookah Tau/API/Reservations api/ReservationsService.swift+2−31 Hookah Tau/API/Reservations api/Resolvers/Admin/ACreateReservationResolver.swift−37 Hookah Tau/API/Reservations api/Resolvers/Admin/ADeleteReservationResolver.swift−34 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−12 Hookah Tau/Controllers/Admin/Clients/ClientList.storyboard+63−110 Hookah Tau/Controllers/Admin/Clients/ClientsCoordinator.swift+1−1 Hookah Tau/Controllers/Admin/Clients/ClientsViewController.swift+8−175 Hookah Tau/Controllers/Admin/Clients/Profile/ClientProfileCoordinator.swift+2−25 Hookah Tau/Controllers/Admin/Clients/Profile/ProfileTableViewController.swift+21−180 Hookah Tau/Controllers/Admin/Reservations/AdminReservationEditingCoordinator.swift+1−3 Hookah Tau/Controllers/Admin/Reservations/AdminReservationEditingViewController.swift+18−66 Hookah Tau/Controllers/Admin/Reservations/AdminReservations.storyboard+3−67 Hookah Tau/Controllers/Admin/Reservations/List of reservations/AdminReservationsController.swift+2−76 Hookah Tau/Controllers/Admin/Reservations/List of reservations/AdminReservationsCoordinator.swift−16 Hookah Tau/Controllers/Admin/Reservations/List of reservations/Cell/AdminReservationCellView.xib+20−10 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/Admin/Tab bar/Admin.storyboard+8−13 Hookah Tau/Controllers/BaseTableViewController.swift−28 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+2−23 Hookah Tau/Controllers/Client/Reservations/Maps/1/MapView1.xib+14−14 Hookah Tau/Controllers/Client/Reservations/Reservation.storyboard+4−4 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.swift+7 Hookah Tau/Controllers/Client/Reservations/Steps/2/SecondStepView.xib+19−12 Hookah Tau/Controllers/Client/Reservations/Steps/3/ThirdStepReservationViewController.swift+1−1 Hookah Tau/Controllers/Client/Reservations/Steps/3/ThirdStepView.xib+3−3 Hookah Tau/Controllers/Client/Tab bar/Client.storyboard+6−10 Hookah Tau/HFunc.swift−7 Hookah Tau/Info.plist+3−5 Hookah Tau/Models/Reservation.swift+1−24 Hookah Tau/Models/User.swift+1−19 Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/1024.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/120-1.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/120.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/152.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/167.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/180.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/20.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/29.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/40-1.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/40-2.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/40.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/58-1.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/58.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/60.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/76.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/80-1.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/80.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/87.png Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json+18−36 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/Supporting Files/Assets.xcassets/peoplee.imageset/Contents.json−15 Hookah Tau/Supporting Files/Assets.xcassets/peoplee.imageset/peoplee.pdf Hookah Tau/Supporting Files/Assets.xcassets/person.imageset/Contents.json−15 Hookah Tau/Supporting Files/Assets.xcassets/person.imageset/person.pdf Hookah Tau/Supporting Files/Assets.xcassets/stack.imageset/Contents.json−15 Hookah Tau/Supporting Files/Assets.xcassets/stack.imageset/Light-S.pdf Hookah Tau/Supporting Files/Assets.xcassets/stack2.imageset/Contents.json−15 Hookah Tau/Supporting Files/Assets.xcassets/stack2.imageset/stack2.pdf
Hookah Tau.xcodeproj/project.pbxproj+25−91
@@ -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 */; };
@@ -101,9 +95,6 @@
10195 12D8FA2D237F003800305F57 /* DateView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 12D8FA2C237F003800305F57 /* DateView.xib */; };
10296 12D8FA2F237F00E200305F57 /* DateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D8FA2E237F00E200305F57 /* DateView.swift */; };
10397 12D8FA31237F08C700305F57 /* AllReservations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D8FA30237F08C700305F57 /* AllReservations.swift */; };
104− 12D928AF23C47DCF0051724D /* ADeleteReservationResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D928AE23C47DCF0051724D /* ADeleteReservationResolver.swift */; };
105− 12D928B123C486380051724D /* BaseTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D928B023C486380051724D /* BaseTableViewController.swift */; };
106− 12D928B323C7464B0051724D /* BlocklistPutResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D928B223C7464B0051724D /* BlocklistPutResolver.swift */; };
10798 12DBEEB223539F2100AF1BB6 /* Client.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 12DBEEB123539F2100AF1BB6 /* Client.storyboard */; };
10899 12E35071239FA8CA004BB188 /* Extensions+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E35070239FA8CA004BB188 /* Extensions+String.swift */; };
109100 12E35074239FAF52004BB188 /* ClientsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E35073239FAF52004BB188 /* ClientsService.swift */; };
@@ -121,7 +112,6 @@
121112 12F9652A23868E6000FCA696 /* SecondStepView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 12F9652923868E6000FCA696 /* SecondStepView.xib */; };
122113 12F9652C23868E7200FCA696 /* SecondStepView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12F9652B23868E7200FCA696 /* SecondStepView.swift */; };
123114 12F9652E23869F3100FCA696 /* SecondStepReservationCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12F9652D23869F3100FCA696 /* SecondStepReservationCoordinator.swift */; };
124− 12FC07B923C8D17600EDC55B /* DeleteOtherAdminResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12FC07B823C8D17600EDC55B /* DeleteOtherAdminResolver.swift */; };
125115 12FC40382382C93D00AB593B /* TableButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12FC40372382C93C00AB593B /* TableButtonStyle.swift */; };
126116 12FC403A2382CB6F00AB593B /* TableButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12FC40392382CB6F00AB593B /* TableButton.swift */; };
127117 F30369B5233679EA00A8EA84 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F30369B4233679EA00A8EA84 /* LaunchScreen.storyboard */; };
@@ -182,9 +172,6 @@
182172 12118B9D23682049006BAEE3 /* PhoneCodeResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneCodeResolver.swift; sourceTree = "<group>"; };
183173 1212048B23914CFD00CAF162 /* DeleteReservationResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteReservationResolver.swift; sourceTree = "<group>"; };
184174 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>"; };
188175 12219CEE2353A63E0057DDEE /* ReservationsCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReservationsCoordinator.swift; sourceTree = "<group>"; };
189176 12230AE9238FD8B3004A01E5 /* MapView2.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MapView2.xib; sourceTree = "<group>"; };
190177 12230AEB238FD8C5004A01E5 /* MapView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapView2.swift; sourceTree = "<group>"; };
@@ -208,7 +195,6 @@
208195 124D007B23721FD400AE76B9 /* Reservation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Reservation.swift; sourceTree = "<group>"; };
209196 124D007E237222B200AE76B9 /* ReservationsResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReservationsResolver.swift; sourceTree = "<group>"; };
210197 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>"; };
212198 125AE51C2395583E00F847BD /* ChangeReservationCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeReservationCoordinator.swift; sourceTree = "<group>"; };
213199 125AE51E2395585300F847BD /* ChangeReservationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeReservationViewController.swift; sourceTree = "<group>"; };
214200 125AE5202395753400F847BD /* HFunc.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HFunc.swift; sourceTree = "<group>"; };
@@ -219,9 +205,6 @@
219205 12838EB3236779C700CEF108 /* ApiResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiResolver.swift; sourceTree = "<group>"; };
220206 12838EB523677FB900CEF108 /* ApiRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiRequest.swift; sourceTree = "<group>"; };
221207 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>"; };
225208 12A075F62373535C00D749BB /* FirstStepReservationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstStepReservationViewController.swift; sourceTree = "<group>"; };
226209 12A075F8237353F500D749BB /* MapView1.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MapView1.xib; sourceTree = "<group>"; };
227210 12A075FA2373561A00D749BB /* Reservation.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Reservation.storyboard; sourceTree = "<group>"; };
@@ -240,6 +223,7 @@
240223 12B3A7AE23AC1872009E2FA6 /* AdminNoReservationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminNoReservationsView.swift; sourceTree = "<group>"; };
241224 12B3A7B023AC1885009E2FA6 /* AdminNoReservationsView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AdminNoReservationsView.xib; sourceTree = "<group>"; };
242225 12B3A7B323AC1D09009E2FA6 /* AdminReservationCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AdminReservationCellView.xib; sourceTree = "<group>"; };
226+ 12B3A7B623ACCD07009E2FA6 /* SettingsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsService.swift; sourceTree = "<group>"; };
243227 12B3A7B823ACCD83009E2FA6 /* AddOtherAdminResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddOtherAdminResolver.swift; sourceTree = "<group>"; };
244228 12B3A7BB23ACFD75009E2FA6 /* ReservationsAroundResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReservationsAroundResolver.swift; sourceTree = "<group>"; };
245229 12B3A7BD23AD0048009E2FA6 /* AdminReservationEditingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminReservationEditingViewController.swift; sourceTree = "<group>"; };
@@ -265,9 +249,6 @@
265249 12D8FA2C237F003800305F57 /* DateView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DateView.xib; sourceTree = "<group>"; };
266250 12D8FA2E237F00E200305F57 /* DateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateView.swift; sourceTree = "<group>"; };
267251 12D8FA30237F08C700305F57 /* AllReservations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllReservations.swift; sourceTree = "<group>"; };
268− 12D928AE23C47DCF0051724D /* ADeleteReservationResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ADeleteReservationResolver.swift; sourceTree = "<group>"; };
269− 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>"; };
271252 12DBEEB123539F2100AF1BB6 /* Client.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Client.storyboard; sourceTree = "<group>"; };
272253 12E35070239FA8CA004BB188 /* Extensions+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extensions+String.swift"; sourceTree = "<group>"; };
273254 12E35073239FAF52004BB188 /* ClientsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientsService.swift; sourceTree = "<group>"; };
@@ -285,7 +266,6 @@
285266 12F9652923868E6000FCA696 /* SecondStepView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SecondStepView.xib; sourceTree = "<group>"; };
286267 12F9652B23868E7200FCA696 /* SecondStepView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondStepView.swift; sourceTree = "<group>"; };
287268 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>"; };
289269 12FC40372382C93C00AB593B /* TableButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableButtonStyle.swift; sourceTree = "<group>"; };
290270 12FC40392382CB6F00AB593B /* TableButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableButton.swift; sourceTree = "<group>"; };
291271 F30369B4233679EA00A8EA84 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
@@ -406,31 +386,6 @@
406386 path = Reservations;
407387 sourceTree = "<group>";
408388 };
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− };
434389 12230AED238FD8D5004A01E5 /* 1 */ = {
435390 isa = PBXGroup;
436391 children = (
@@ -507,7 +462,6 @@
507462 123D25ED239E3D50002FA32B /* Reservations */ = {
508463 isa = PBXGroup;
509464 children = (
510− 129F162523CC836600EE13FC /* Making a reeservation */,
511465 12B3A79623ABAD9A009E2FA6 /* Views */,
512466 12B3A7C123AD0751009E2FA6 /* Editing */,
513467 12B3A7C223AD0762009E2FA6 /* List of reservations */,
@@ -589,6 +543,7 @@
589543 12838EB923679AEB00CEF108 /* API */ = {
590544 isa = PBXGroup;
591545 children = (
546+ 12B3A7B523ACCCD0009E2FA6 /* Settings */,
592547 12838EA8236764A600CEF108 /* APIClient.swift */,
593548 12838EB3236779C700CEF108 /* ApiResolver.swift */,
594549 12838EAF236777D400CEF108 /* ServerError.swift */,
@@ -602,27 +557,9 @@
602557 path = API;
603558 sourceTree = "<group>";
604559 };
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− };
622560 12B3A79623ABAD9A009E2FA6 /* Views */ = {
623561 isa = PBXGroup;
624562 children = (
625− 129F162823CC89EA00EE13FC /* Phone number */,
626563 12B3A7B223AC1A1F009E2FA6 /* No reserv */,
627564 12B3A79723ABADB9009E2FA6 /* AdminReservationView.xib */,
628565 12B3A79E23ABCA21009E2FA6 /* AdminReservationView.swift */,
@@ -653,8 +590,6 @@
653590 children = (
654591 12B3A7AC23ABEABF009E2FA6 /* AReservationsResolver.swift */,
655592 12B3A7C323AD2FCD009E2FA6 /* AChangeReservationResolver.swift */,
656− 12D928AE23C47DCF0051724D /* ADeleteReservationResolver.swift */,
657− 1252D9E423CDCDB300446B6F /* ACreateReservationResolver.swift */,
658593 );
659594 path = Admin;
660595 sourceTree = "<group>";
@@ -668,6 +603,23 @@
668603 path = "No reserv";
669604 sourceTree = "<group>";
670605 };
606+ 12B3A7B523ACCCD0009E2FA6 /* Settings */ = {
607+ isa = PBXGroup;
608+ children = (
609+ 12B3A7B623ACCD07009E2FA6 /* SettingsService.swift */,
610+ 12B3A7BA23ACCD88009E2FA6 /* Resolvers */,
611+ );
612+ path = Settings;
613+ sourceTree = "<group>";
614+ };
615+ 12B3A7BA23ACCD88009E2FA6 /* Resolvers */ = {
616+ isa = PBXGroup;
617+ children = (
618+ 12B3A7B823ACCD83009E2FA6 /* AddOtherAdminResolver.swift */,
619+ );
620+ path = Resolvers;
621+ sourceTree = "<group>";
622+ };
671623 12B3A7C123AD0751009E2FA6 /* Editing */ = {
672624 isa = PBXGroup;
673625 children = (
@@ -752,12 +704,8 @@
752704 12E35075239FAF8F004BB188 /* Resolvers */ = {
753705 isa = PBXGroup;
754706 children = (
755− 12FC07B823C8D17600EDC55B /* DeleteOtherAdminResolver.swift */,
756− 12B3A7B823ACCD83009E2FA6 /* AddOtherAdminResolver.swift */,
757707 12E35077239FAFA4004BB188 /* ClientsListResolver.swift */,
758708 12E3507C239FD1F3004BB188 /* ClientReservationsResolver.swift */,
759− 12D928B223C7464B0051724D /* BlocklistPutResolver.swift */,
760− 1220A6F323CDB1AD00365E36 /* GetClientByPhoneNumberResolver.swift */,
761709 );
762710 path = Resolvers;
763711 sourceTree = "<group>";
@@ -844,7 +792,6 @@
844792 F3FC7DFC2315C4710080D851 /* BaseCoordinator.swift */,
845793 F3FC7DFA2315C25D0080D851 /* ApplicationCoordinator.swift */,
846794 12B6A612235B9B4300898B31 /* BaseViewController.swift */,
847− 12D928B023C486380051724D /* BaseTableViewController.swift */,
848795 12B3A79D23ABB8F4009E2FA6 /* Picker view */,
849796 F30369BB2336845F00A8EA84 /* Admin */,
850797 F30369BA2336845400A8EA84 /* Client */,
@@ -872,7 +819,6 @@
872819 F3DC5A04233E89D500B5E751 /* Button.swift */,
873820 12FC40372382C93C00AB593B /* TableButtonStyle.swift */,
874821 12FC40392382CB6F00AB593B /* TableButton.swift */,
875− 129F162F23CC8EF600EE13FC /* PhoneTextField.swift */,
876822 );
877823 path = Components;
878824 sourceTree = "<group>";
@@ -1197,14 +1143,11 @@
11971143 files = (
11981144 12EA99482362B684005D9FE9 /* AddresViewController.swift in Sources */,
11991145 124D007F237222B200AE76B9 /* ReservationsResolver.swift in Sources */,
1200− 129F163023CC8EF600EE13FC /* PhoneTextField.swift in Sources */,
1201− 129F162C23CC8D2E00EE13FC /* AdminSecondStepReservationViewCoordinator.swift in Sources */,
12021146 12230AF723900D44004A01E5 /* EstablishmentResolver.swift in Sources */,
12031147 1246B719235CD3AD004CBFA1 /* NoReservationsView.swift in Sources */,
12041148 F3895F4A233D323700FA6A37 /* CodeCoordinator.swift in Sources */,
12051149 12B3A7B923ACCD83009E2FA6 /* AddOtherAdminResolver.swift in Sources */,
12061150 12E3507F239FDFC2004BB188 /* ClientProfileCoordinator.swift in Sources */,
1207− 12D928B323C7464B0051724D /* BlocklistPutResolver.swift in Sources */,
12081151 12838EB4236779C700CEF108 /* ApiResolver.swift in Sources */,
12091152 12838EA9236764A600CEF108 /* APIClient.swift in Sources */,
12101153 123615D12355141600D1122A /* ProfileView.swift in Sources */,
@@ -1228,12 +1171,10 @@
12281171 12B3A7BE23AD0049009E2FA6 /* AdminReservationEditingViewController.swift in Sources */,
12291172 12BE4B352399A60A00FC974B /* AdminTabbarController.swift in Sources */,
12301173 12FC403A2382CB6F00AB593B /* TableButton.swift in Sources */,
1231− 12D928AF23C47DCF0051724D /* ADeleteReservationResolver.swift in Sources */,
12321174 12EB698123661CB300E4D1CE /* AddressCell.swift in Sources */,
12331175 F3895F48233D2EEA00FA6A37 /* CodeSmsViewController.swift in Sources */,
12341176 12219CEF2353A63F0057DDEE /* ReservationsCoordinator.swift in Sources */,
12351177 12230AF423900BCB004A01E5 /* EstablishmentService.swift in Sources */,
1236− 129F162723CC838200EE13FC /* AdminFirstStepReservationViewCoordinator.swift in Sources */,
12371178 12A07601237359BB00D749BB /* MapView1.swift in Sources */,
12381179 125AE5212395753400F847BD /* HFunc.swift in Sources */,
12391180 12BD95B8237EDB01009614D8 /* TimePointView.swift in Sources */,
@@ -1259,13 +1200,10 @@
12591200 12B3A7A323ABD594009E2FA6 /* AdminReservationsController.swift in Sources */,
12601201 F3FC7DCD2315BE610080D851 /* AppDelegate.swift in Sources */,
12611202 12838EB623677FB900CEF108 /* ApiRequest.swift in Sources */,
1262− 1220A6FA23CDBE7E00365E36 /* AdminFinalStepReservationCoordinator.swift in Sources */,
12631203 12118B9E23682049006BAEE3 /* PhoneCodeResolver.swift in Sources */,
12641204 F30369BE2336924D00A8EA84 /* ClientTabbarCoordinator.swift in Sources */,
12651205 F3FC7DFD2315C4710080D851 /* BaseCoordinator.swift in Sources */,
1266− 1220A6F723CDB64A00365E36 /* AdminSecondStepReservationViewController.swift in Sources */,
12671206 12E35071239FA8CA004BB188 /* Extensions+String.swift in Sources */,
1268− 12FC07B923C8D17600EDC55B /* DeleteOtherAdminResolver.swift in Sources */,
12691207 F3DC59FF233E893400B5E751 /* Extensions+UIFont.swift in Sources */,
12701208 F3895F53233D5EEB00FA6A37 /* BlackButtonStyle.swift in Sources */,
12711209 12F9652C23868E7200FCA696 /* SecondStepView.swift in Sources */,
@@ -1279,14 +1217,13 @@
12791217 F3851B302340A513009EE0B6 /* RegistationViewModel.swift in Sources */,
12801218 12B3A7AF23AC1872009E2FA6 /* AdminNoReservationsView.swift in Sources */,
12811219 12838EAE2367701300CEF108 /* AuthorizationService.swift in Sources */,
1220+ 12B3A7B723ACCD07009E2FA6 /* SettingsService.swift in Sources */,
12821221 12C72EDF23537D1B00AD7004 /* ProfileCoordinator.swift in Sources */,
12831222 12E3507D239FD1F3004BB188 /* ClientReservationsResolver.swift in Sources */,
12841223 12EA994E2362FCE8005D9FE9 /* AddressView.swift in Sources */,
1285− 1220A6F423CDB1AD00365E36 /* GetClientByPhoneNumberResolver.swift in Sources */,
12861224 F3895F4C233D347E00FA6A37 /* PhoneNumberViewController.swift in Sources */,
12871225 12EE4A76234BB8FE005B4D1A /* CodeView.swift in Sources */,
12881226 12230AF123900974004A01E5 /* TotalStorage.swift in Sources */,
1289− 1252D9E523CDCDB300446B6F /* ACreateReservationResolver.swift in Sources */,
12901227 12BD95B2237EC22B009614D8 /* FirstStepView.swift in Sources */,
12911228 F3EBE2472340FE87000FEE1A /* NameTextView.swift in Sources */,
12921229 120BFC7723891925001EBE89 /* ThirdStepReservationViewController.swift in Sources */,
@@ -1299,7 +1236,6 @@
12991236 1212048E23915A0A00CAF162 /* ChangeReservationResolver.swift in Sources */,
13001237 12230AFC239034D3004A01E5 /* SecondStepReservationViewController.swift in Sources */,
13011238 F3851B2923409F8A009EE0B6 /* PhoneView.swift in Sources */,
1302− 12D928B123C486380051724D /* BaseTableViewController.swift in Sources */,
13031239 12C72EE3235380EB00AD7004 /* ReservationsViewController.swift in Sources */,
13041240 12B6A611235B8EC500898B31 /* User.swift in Sources */,
13051241 12B3A7AD23ABEABF009E2FA6 /* AReservationsResolver.swift in Sources */,
@@ -1466,15 +1402,14 @@
14661402 buildSettings = {
14671403 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
14681404 CODE_SIGN_STYLE = Automatic;
1469− CURRENT_PROJECT_VERSION = 5;
1470− DEVELOPMENT_TEAM = 23S94LRHD8;
1405+ DEVELOPMENT_TEAM = 9Z6LFGKA9G;
14711406 INFOPLIST_FILE = "Hookah Tau/Info.plist";
14721407 IPHONEOS_DEPLOYMENT_TARGET = 11.0;
14731408 LD_RUNPATH_SEARCH_PATHS = (
14741409 "$(inherited)",
14751410 "@executable_path/Frameworks",
14761411 );
1477− PRODUCT_BUNDLE_IDENTIFIER = "com.hookahtau.Hookah-Tau1";
1412+ PRODUCT_BUNDLE_IDENTIFIER = "com.hookahtau.Hookah-Tau";
14781413 PRODUCT_NAME = "$(TARGET_NAME)";
14791414 SWIFT_VERSION = 5.0;
14801415 TARGETED_DEVICE_FAMILY = "1,2";
@@ -1486,15 +1421,14 @@
14861421 buildSettings = {
14871422 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
14881423 CODE_SIGN_STYLE = Automatic;
1489− CURRENT_PROJECT_VERSION = 5;
1490− DEVELOPMENT_TEAM = 23S94LRHD8;
1424+ DEVELOPMENT_TEAM = 9Z6LFGKA9G;
14911425 INFOPLIST_FILE = "Hookah Tau/Info.plist";
14921426 IPHONEOS_DEPLOYMENT_TARGET = 11.0;
14931427 LD_RUNPATH_SEARCH_PATHS = (
14941428 "$(inherited)",
14951429 "@executable_path/Frameworks",
14961430 );
1497− PRODUCT_BUNDLE_IDENTIFIER = "com.hookahtau.Hookah-Tau1";
1431+ PRODUCT_BUNDLE_IDENTIFIER = "com.hookahtau.Hookah-Tau";
14981432 PRODUCT_NAME = "$(TARGET_NAME)";
14991433 SWIFT_VERSION = 5.0;
15001434 TARGETED_DEVICE_FAMILY = "1,2";
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+1−64
@@ -15,7 +15,7 @@ class ClientsService {
1515 self.apiClient = apiClient
1616 }
1717
18− func loadClientsList(completion: @escaping ((Result<[Client], GeneralError>) -> Void)) {
18+ func loadClientsList(completion: @escaping ((Result<[FullUser], GeneralError>) -> Void)) {
1919 let resolver = ClientsListResolver<ClientsResponce>()
2020 let request = ApiRequest(resolver: resolver, httpMethod: .get)
2121
@@ -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/ClientsListResolver.swift+1−1
@@ -9,7 +9,7 @@
99import Foundation
1010
1111struct ClientsResponce: MyCodable {
12− var clients: [Client]
12+ var clients: [FullUser]
1313}
1414
1515class ClientsListResolver<Responce: MyCodable>: ApiResolver {
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+2−31
@@ -40,14 +40,8 @@ class ReservationsService {
4040 }
4141 }
4242
43− func deleteReservation(isAdmin: Bool, uuid: String, completion: @escaping ((Bool) -> Void)) {
44− var resolver: ApiResolver!
45− if isAdmin {
46− resolver = ADeleteReservationResolver(uuid: uuid)
47− } else {
48− resolver = DeleteReservationResolver(uuid: uuid)
49− }
50−
43+ func deleteReservation(uuid: String, completion: @escaping ((Bool) -> Void)) {
44+ let resolver = DeleteReservationResolver(uuid: uuid)
5145 let request = ApiRequest(resolver: resolver, httpMethod: .delete)
5246
5347 apiClient.load(request: request.request) { result in
@@ -205,27 +199,4 @@ class ReservationsService {
205199 }
206200 }
207201 }
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− }
231202}
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/Reservations api/Resolvers/Admin/ADeleteReservationResolver.swiftdeleted−34
@@ -1,34 +0,0 @@
1−//
2−// ADeleteReservationResolver.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 07/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import Foundation
10−
11−class ADeleteReservationResolver: ApiResolver {
12−
13− struct Request: MyCodable {
14− var reservation: String
15− }
16−
17− var name: String {
18− return "/reservations"
19− }
20−
21− var groupName: String? {
22− return "/admin"
23− }
24−
25− var uuid: String
26−
27− init(uuid: String) {
28− self.uuid = uuid
29− }
30−
31− func parameters() -> MyCodable? {
32− return Request(reservation: uuid)
33− }
34−}
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−12
@@ -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() {
@@ -42,12 +35,10 @@ class ClientTableViewCell: UITableViewCell {
4235
4336 // MARK: - Bind
4437
45− func bind(withModel model: Client) {
46− blockListLabel.isHidden = !model.isBlocked
47− isAdminLabel.isHidden = !model.isAdmin
48− nameLabel.text = model.name ?? "❔"
38+ func bind(withModel model: FullUser) {
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)"
5142 }
5243
5344}
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+1−1
@@ -21,7 +21,7 @@ class ClientsCoordinator: BaseCoordinator {
2121 }
2222
2323 /// TODO
24− func openUserProfile(_ profile: Client) {
24+ func openUserProfile(_ profile: FullUser) {
2525 let profileCoordinator = ClientProfileCoordinator(navigationController: navigationController)
2626 profileCoordinator.user = profile
2727
Hookah Tau/Controllers/Admin/Clients/ClientsViewController.swift+8−175
@@ -8,70 +8,34 @@
88
99import UIKit
1010
11−class ClientsViewController: BaseTableViewController {
11+class ClientsViewController: UITableViewController {
1212
1313 // MARK: - Properties
1414
15− var dataSource: [Client] = [] {
15+ var dataSource: [FullUser] = [] {
1616 didSet {
17+ print(dataSource)
1718 tableView.reloadData()
1819 }
1920 }
2021
21− var filteredDataSource: [Client] = []
22−
2322 var clientsService: ClientsService?
2423
2524 weak var coordinator: ClientsCoordinator?
2625
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−
3726 // MARK: - Lifecycle
3827
3928 override func viewDidLoad() {
4029 super.viewDidLoad()
4130
42− setupNavigationBar()
43− setupSearchController()
31+ navigationItem.title = "Клиенты"
4432 clientsService = ClientsService(apiClient: APIClient.shared)
4533 }
4634
47− override func viewWillAppear(_ animated: Bool) {
48− super.viewWillAppear(animated)
49− tabBarController?.tabBar.isHidden = false
50− }
51−
5235 override func viewDidAppear(_ animated: Bool) {
5336 super.viewDidAppear(animated)
5437 loadClients()
5538 }
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
7539
7640 /// Загружаем клиентов кальянки
7741 func loadClients() {
@@ -85,155 +49,24 @@ class ClientsViewController: BaseTableViewController {
8549 })
8650 }
8751
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− }
14352
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 {
53+ // MARK: - Tableview
17754
17855 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
17956 let cell = tableView.dequeueReusableCell(withIdentifier: clientTableViewCellId, for: indexPath) as! ClientTableViewCell
18057
181− let userModel = isFiltering ? filteredDataSource[indexPath.row] : dataSource[indexPath.row]
58+ let userModel = dataSource[indexPath.row]
18259 cell.bind(withModel: userModel)
18360
18461 return cell
18562 }
18663
18764 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
188− return isFiltering ? filteredDataSource.count : dataSource.count
65+ return dataSource.count
18966 }
19067
19168 override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
192− let user = isFiltering ? filteredDataSource[indexPath.row] : dataSource[indexPath.row]
69+ let user = dataSource[indexPath.row]
19370 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 ?? "")
23871 }
23972}
Hookah Tau/Controllers/Admin/Clients/Profile/ClientProfileCoordinator.swift+2−25
@@ -11,42 +11,19 @@ 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)
1818 let viewController = storyboard.instantiateViewController(withIdentifier: "ProfileTableViewController") as? ProfileTableViewController
1919 viewController?.user = user
20− viewController?.coodinator = self
2120 guard let vc = viewController else { return }
2221 navigationController?.pushViewController(vc, animated: true)
2322 }
2423
2524
2625 // Создание бронирования из профиля клиента
27− func createReservation(forUserWithPhone phoneNumber: String, user fullUser: FullUser) {
28− let coordinator = AdminFirstStepReservationViewCoordinator(navigationController: navigationController)
29− coordinator.phone = phoneNumber
30− coordinator.fullUser = fullUser
26+ func createReservation(forUserWithPhone phoneNumber: String) {
3127
32− addDependency(coordinator)
33− coordinator.didFinish = { [weak self] in
34− self?.removeDependency(coordinator)
35− self?.navigationController?.popViewController(animated: true)
36− }
37−
38− coordinator.start()
39− }
40−
41− // Просмотр (и редактирование) брони
42− func seeExistingReservation(data: ReservationWithUser) {
43− let reservationCoordinator = AdminReservationEditingCoordinator(navigationController: navigationController)
44− addDependency(reservationCoordinator)
45− reservationCoordinator.reservationData = data
46− reservationCoordinator.didEndFlow = { [weak self] in
47− self?.removeDependency(reservationCoordinator)
48− self?.navigationController?.popViewController(animated: true)
49− }
50− reservationCoordinator.start()
5128 }
5229}
Hookah Tau/Controllers/Admin/Clients/Profile/ProfileTableViewController.swift+21−180
@@ -8,7 +8,7 @@
88
99import UIKit
1010
11−class ProfileTableViewController: BaseViewController {
11+class ProfileTableViewController: UITableViewController {
1212
1313 // MARK: - IBAOutlets
1414
@@ -26,45 +26,25 @@ class ProfileTableViewController: BaseViewController {
2626 didSet {
2727 let style = BlackButtonStyle()
2828 style.apply(to: copyButton, withTitle: "СКОПИРОВАТЬ")
29− copyButton.addTarget(self, action: #selector(copyNumber(_:)), for: .touchUpInside)
3029 }
3130 }
3231
33−
34− @IBOutlet weak var contentView: UIView!
35−
3632 // MARK: - properties
3733
38− var tableView: UITableView?
39−
4034 var clientsService: ClientsService?
4135
42− var reservationsService: ReservationsService?
43−
44− var user: Client?
36+ var user: FullUser? {
37+ didSet {
38+ guard let u = user else { return }
39+ navigationItem.title = u.name
40+ }
41+ }
4542
4643 weak var coodinator: ClientProfileCoordinator?
4744
48− var noReserationsYetView: AdminNoReservationsView?
49−
50− var activityIndicator: UIActivityIndicatorView?
51−
52− var refreshControl: UIRefreshControl?
53−
5445 var dataSource: [Reservation] = [] {
5546 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()
47+ tableView.reloadData()
6848 }
6949 }
7050
@@ -73,143 +53,32 @@ class ProfileTableViewController: BaseViewController {
7353 override func viewDidLoad() {
7454 super.viewDidLoad()
7555
76− clientsService = ClientsService(apiClient: APIClient.shared)
77− reservationsService = ReservationsService(apiClient: APIClient.shared)
78−
79− setupNavBar()
80− setupTable()
81− setupActivityIndicator()
82− //loadReservations()
83− }
84−
85− override func viewWillAppear(_ animated: Bool) {
86− super.viewWillAppear(animated)
87− tabBarController?.tabBar.isHidden = true
88− }
89−
90− override func viewDidAppear(_ animated: Bool) {
91− 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−
12156 tableView?.register(ReservationCell.self, forCellReuseIdentifier: reservationCell)
12257
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−
58+ clientsService = ClientsService(apiClient: APIClient.shared)
59+ loadReservations()
13460 }
13561
136− // MARK: - Api calls
137−
13862 func loadReservations() {
13963 guard let uuid = user?.uuid else { return }
14064 clientsService?.loadReservationsForUser(withUUID: uuid,
14165 completion: { [weak self] (res) in
14266 switch res {
14367 case .failure(let err):
144− self?.displayAlert(forError: err)
68+ print(err)
14569 case .success(let data):
14670 self?.dataSource = data
14771 }
14872 })
14973 }
15074
151−
152− func deleteReservation(uuid: String, completion: @escaping (([Reservation]?) -> Void)) {
153− reservationsService?.deleteReservation(isAdmin: true, uuid: uuid) { result in
154− if result {
155− let newReservations = self.dataSource.filter { $0.uuid != uuid }
156− completion(newReservations)
157− return
158− }
159−
160− completion(nil)
161− }
162− }
163−
164− // MARK: - Button handlers
165−
166− @objc func callUser() {
167− guard
168− let u = user,
169− let urlPhone = URL(string: "tel://79\(u.phoneNumber)")
170− else { return }
171−
172− UIApplication.shared.open(urlPhone)
173− }
174−
175− @objc func copyNumber(_ sender: UIButton) {
176− guard
177− let u = user
178− else { return }
179− //Copy a string to the pasteboard.
180− UIPasteboard.general.string = "79\(u.phoneNumber)"
181−
182− //Alert
183− self.displayAlert(with: "Номер скопирован!")
184− }
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− }
202−}
203−
204−// MARK: - Table view data source
205−
206−extension ProfileTableViewController: UITableViewDelegate, UITableViewDataSource {
75+ // MARK: - Table view data source
20776
208− func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
77+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
20978 return dataSource.count
21079 }
21180
212− func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
81+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
21382 let cell = tableView.dequeueReusableCell(withIdentifier: reservationCell, for: indexPath) as! ReservationCell
21483
21584 cell.bind(withModel: dataSource[indexPath.row])
@@ -217,41 +86,13 @@ extension ProfileTableViewController: UITableViewDelegate, UITableViewDataSource
21786 return cell
21887 }
21988
220− // tap
221−
222− func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
223− guard let u = user else { return }
224− 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)
227− coodinator?.seeExistingReservation(data: reservation)
228− }
229−
230− // Update
231−
232− func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
233− return true
234− }
235−
236− func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
237−
238− let uuid = dataSource[indexPath.row].uuid
239− let cancelButton = UITableViewRowAction(style: .normal, title: "отменить бронь") { _,_ in
240−
241− self.deleteReservation(uuid: uuid) { optionalNewVal in
242− if let newval = optionalNewVal {
243− self.tableView?.beginUpdates()
244− self.tableView?.deleteRows(at: [indexPath], with: .automatic)
245− self.dataSource = newval
246− self.tableView?.endUpdates()
247− } else {
248− self.displayAlert(with: "Не удалось удалить вашу бронь! Попробуйте еще раз!")
249− }
250− }
251− }
252−
253− cancelButton.backgroundColor = .black
89+ @objc func callUser() {
90+ guard
91+ let u = user,
92+ let urlPhone = URL(string: "tel://79\(u.phoneNumber)")
93+ else { return }
25494
255− return [cancelButton]
95+ UIApplication.shared.open(urlPhone)
25696 }
97+
25798}
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+18−66
@@ -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,9 +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)
64− reservationView?.cancelButton?.addTarget(self, action: #selector(cancelReservation), for: .touchUpInside)
70+ saveButton.addTarget(self, action: #selector(saveReservation), for: .touchUpInside)
6571 }
6672
6773 func setupContentViews() {
@@ -75,8 +81,6 @@ class AdminReservationEditingViewController: BaseViewController {
7581 mapView = MapView2.loadFromNib()
7682 }
7783
78− navigationItem.title = TotalStorage.standard.getEstablishment(model.establishment)?.address
79−
8084 mapView?.isUserInteractionEnabled = false
8185
8286 tableContentView.addSubviewThatFills(mapView)
@@ -93,14 +97,9 @@ class AdminReservationEditingViewController: BaseViewController {
9397 }
9498
9599 func loadReservedPeriods() {
96− guard
97− let model = reservationData,
98− let uuid = model.uuid
99− else {
100− setupReservationViewWithIntervals()
101− return }
100+ guard let model = reservationData else { return }
102101
103− reservationService?.getReservationsAround(uuid: uuid, completion: { [weak self] (res) in
102+ reservationService?.getReservationsAround(uuid: model.uuid, completion: { [weak self] (res) in
104103 switch res {
105104 case .failure(let err):
106105 self?.displayAlert(forError: err)
@@ -118,12 +117,9 @@ class AdminReservationEditingViewController: BaseViewController {
118117 guard
119118 let r = reservationView?.data,
120119 let uuid = reservationData?.uuid
121− else {
122− createReservation()
123− return
124− }
120+ else { return }
125121
126− reservationView?.saveButton?.loading = true
122+ saveButton.loading = true
127123
128124 reservationService?.updateReservation(startTime: r.startTime,
129125 numberOfGuests: r.numberOfGuests,
@@ -132,56 +128,12 @@ class AdminReservationEditingViewController: BaseViewController {
132128 isAdmin: true,
133129 completion: { [weak self] (res) in
134130 if res {
135− self?.coordinator?.didFinish?()
131+ self?.coordinator?.didEndFlow?()
136132 } else {
137133 self?.displayAlert(with: "Что-то пошло не так! Попробуешь еще раз?")
138134 }
139135
140− self?.reservationView?.saveButton?.loading = false
136+ self?.saveButton.loading = false
141137 })
142138 }
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− }
165− })
166− }
167−
168− @objc func cancelReservation() {
169− guard
170− let uuid = reservationData?.uuid
171− else {
172− cancelPrereservation()
173− return }
174−
175− reservationService?.deleteReservation(isAdmin: true, uuid: uuid, completion: { [weak self] (res) in
176− if res {
177− self?.coordinator?.didFinish?()
178− } else {
179− self?.displayAlert(with: "Что-то пошло не так!\nПопробуешь еще раз?")
180− }
181− })
182− }
183−
184− func cancelPrereservation() {
185− coordinator?.didFinish?()
186− }
187139}
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+2−76
@@ -33,10 +33,6 @@ class AdminReservationsController: BaseViewController {
3333
3434 weak var coordinator: AdminReservationsCoordinator?
3535
36− var refrControl: UIRefreshControl?
37−
38− var activityIndicator: UIActivityIndicatorView?
39−
4036 var activeReservations: [ReservationWithUser] = [] {
4137 didSet {
4238 guard let empty = noReservationsView else { return }
@@ -47,7 +43,7 @@ class AdminReservationsController: BaseViewController {
4743 contentView.sendSubviewToBack(empty)
4844 tableView?.alpha = 1
4945 }
50− activityIndicator?.stopAnimating()
46+
5147 tableView?.reloadData()
5248 }
5349 }
@@ -56,7 +52,6 @@ class AdminReservationsController: BaseViewController {
5652 super.viewDidLoad()
5753
5854 reservationsService = ReservationsService(apiClient: APIClient.shared)
59− setupRefreshControl()
6055 setUpContentView()
6156 setupNavBar()
6257 }
@@ -72,17 +67,12 @@ class AdminReservationsController: BaseViewController {
7267
7368 func setupNavBar() {
7469 self.navigationItem.title = "Брони"
75− navigationController?.navigationBar.prefersLargeTitles = true
7670 navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(book))
7771 }
7872
7973 func setUpContentView() {
8074 self.view.addSubviewThatFills(contentView)
8175
82− activityIndicator = UIActivityIndicatorView()
83− contentView.addSubviewThatFills(activityIndicator)
84− activityIndicator?.startAnimating()
85−
8676 // empty
8777 noReservationsView = AdminNoReservationsView.loadFromNib()
8878 contentView.addSubviewThatFills(noReservationsView)
@@ -116,39 +106,13 @@ class AdminReservationsController: BaseViewController {
116106 case .failure(let err):
117107 self?.displayAlert(forError: err)
118108 }
119− self?.refrControl?.endRefreshing()
120109 })
121110 }
122111
123112 // MARK:- Button handler
124113
125114 @objc func book() {
126− guard let establishmentId = id else { return }
127− coordinator?.book(inEstablishment: establishmentId)
128− }
129−
130− func deleteReservation(uuid: String, completion: @escaping (([ReservationWithUser]?) -> Void)) {
131− reservationsService?.deleteReservation(isAdmin: true, uuid: uuid) { result in
132− if result {
133− let newReservations = self.activeReservations.filter { $0.uuid != uuid }
134− completion(newReservations)
135− return
136− }
137−
138− completion(nil)
139− }
140− }
141−
142− // MARK: - Refresh control
143−
144− @objc func refreshData( _ ff: UIRefreshControl) {
145− performUpdate()
146− }
147−
148− func setupRefreshControl() {
149− refrControl = UIRefreshControl()
150− tableView?.refreshControl = refrControl
151− refrControl?.addTarget(self, action: #selector(refreshData(_:)), for: .valueChanged)
115+
152116 }
153117
154118}
@@ -177,43 +141,5 @@ extension AdminReservationsController: UITableViewDelegate, UITableViewDataSourc
177141 let reservation = activeReservations[indexPath.row]
178142 coordinator?.seeExistingReservation(data: reservation)
179143 }
180−
181− // Dimesions
182−
183− func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
184− return UITableView.automaticDimension
185− }
186−
187− func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
188− return 180.0
189− }
190−
191− // Update
192−
193− func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
194− return true
195− }
196−
197− func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
198−
199− guard let uuid = activeReservations[indexPath.row].uuid else { return [] }
200− let cancelButton = UITableViewRowAction(style: .normal, title: "отменить бронь") { _,_ in
201−
202− self.deleteReservation(uuid: uuid) { optionalNewVal in
203− if let newval = optionalNewVal {
204− self.tableView?.beginUpdates()
205− self.tableView?.deleteRows(at: [indexPath], with: .automatic)
206− self.activeReservations = newval
207− self.tableView?.endUpdates()
208− } else {
209− self.displayAlert(with: "Не удалось удалить вашу бронь! Попробуйте еще раз!")
210− }
211− }
212− }
213−
214− cancelButton.backgroundColor = .black
215−
216− return [cancelButton]
217− }
218144
219145}
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/List of reservations/Cell/AdminReservationCellView.xib+20−10
@@ -12,14 +12,14 @@
1212 <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
1313 <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
1414 <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="AdminReservationCellView" customModule="Hookah_Tau" customModuleProvider="target">
15− <rect key="frame" x="0.0" y="0.0" width="414" height="180"/>
15+ <rect key="frame" x="0.0" y="0.0" width="414" height="136"/>
1616 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1717 <subviews>
1818 <stackView opaque="NO" contentMode="scaleToFill" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="au9-nK-XbR">
19− <rect key="frame" x="20" y="20" width="374" height="140"/>
19+ <rect key="frame" x="17" y="3" width="380" height="133"/>
2020 <subviews>
2121 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="top" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="rCf-m8-E3w">
22− <rect key="frame" x="0.0" y="0.0" width="248" height="140"/>
22+ <rect key="frame" x="0.0" y="0.0" width="254" height="133"/>
2323 <subviews>
2424 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Стасик" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KV8-UG-2ws">
2525 <rect key="frame" x="0.0" y="0.0" width="54" height="19.5"/>
@@ -28,7 +28,7 @@
2828 <nil key="highlightedColor"/>
2929 </label>
3030 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="nsQ-SE-3vW">
31− <rect key="frame" x="0.0" y="47" width="102" height="45"/>
31+ <rect key="frame" x="0.0" y="43.5" width="102" height="45"/>
3232 <subviews>
3333 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="27 марта" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9k3-E5-XKR">
3434 <rect key="frame" x="0.0" y="0.0" width="76.5" height="20.5"/>
@@ -45,7 +45,7 @@
4545 </subviews>
4646 </stackView>
4747 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="3 человека" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VhL-qH-zM9">
48− <rect key="frame" x="0.0" y="119.5" width="89" height="20.5"/>
48+ <rect key="frame" x="0.0" y="112.5" width="89" height="20.5"/>
4949 <fontDescription key="fontDescription" type="system" pointSize="17"/>
5050 <nil key="textColor"/>
5151 <nil key="highlightedColor"/>
@@ -53,17 +53,27 @@
5353 </subviews>
5454 </stackView>
5555 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="1_7" translatesAutoresizingMaskIntoConstraints="NO" id="Oa6-n7-joV">
56− <rect key="frame" x="256" y="0.0" width="118" height="140"/>
56+ <rect key="frame" x="262" y="0.0" width="118" height="133"/>
5757 </imageView>
5858 </subviews>
5959 </stackView>
60+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3u6-xl-ioO">
61+ <rect key="frame" x="20" y="135" width="394" height="1"/>
62+ <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
63+ <constraints>
64+ <constraint firstAttribute="height" constant="1" id="YCb-84-2qo"/>
65+ </constraints>
66+ </view>
6067 </subviews>
6168 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
6269 <constraints>
63− <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="au9-nK-XbR" secondAttribute="trailing" constant="20" id="Afx-VC-Cb6"/>
64− <constraint firstItem="au9-nK-XbR" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="20" id="P5E-WG-AYe"/>
65− <constraint firstItem="au9-nK-XbR" firstAttribute="bottom" secondItem="vUN-kp-3ea" secondAttribute="bottom" constant="-20" id="Z6h-RB-tvj"/>
66− <constraint firstItem="au9-nK-XbR" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="fJE-La-qC6"/>
70+ <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="au9-nK-XbR" secondAttribute="trailing" constant="17" id="Afx-VC-Cb6"/>
71+ <constraint firstItem="3u6-xl-ioO" firstAttribute="bottom" secondItem="vUN-kp-3ea" secondAttribute="bottom" id="Lpw-A9-AcM"/>
72+ <constraint firstItem="au9-nK-XbR" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="3" id="P5E-WG-AYe"/>
73+ <constraint firstItem="au9-nK-XbR" firstAttribute="bottom" secondItem="vUN-kp-3ea" secondAttribute="bottom" id="Z6h-RB-tvj"/>
74+ <constraint firstItem="au9-nK-XbR" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="17" id="fJE-La-qC6"/>
75+ <constraint firstItem="3u6-xl-ioO" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="pqq-kW-AFb"/>
76+ <constraint firstItem="3u6-xl-ioO" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" id="zrd-Ir-hU2"/>
6777 </constraints>
6878 <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
6979 <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
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/Admin/Tab bar/Admin.storyboard+8−13
@@ -1,14 +1,14 @@
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="retina6_1" 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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
99 </dependencies>
1010 <scenes>
11− <!--Клиенты-->
11+ <!--Navigation Controller-->
1212 <scene sceneID="Q3i-Bo-7ns">
1313 <objects>
1414 <viewController id="Ifn-72-mgx" customClass="UINavigationController" sceneMemberID="viewController">
@@ -18,13 +18,13 @@
1818 <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
1919 <viewLayoutGuide key="safeArea" id="yHG-bf-ndj"/>
2020 </view>
21− <tabBarItem key="tabBarItem" title="Клиенты" image="peoplee" id="9K1-uc-72H"/>
21+ <tabBarItem key="tabBarItem" systemItem="downloads" id="9K1-uc-72H"/>
2222 </viewController>
2323 <placeholder placeholderIdentifier="IBFirstResponder" id="8X9-ca-bCi" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
2424 </objects>
2525 <point key="canvasLocation" x="1061" y="-327"/>
2626 </scene>
27− <!--Профиль-->
27+ <!--Navigation Controller-->
2828 <scene sceneID="cAb-sw-24k">
2929 <objects>
3030 <viewController id="Jsm-cH-XbJ" customClass="UINavigationController" sceneMemberID="viewController">
@@ -34,13 +34,13 @@
3434 <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
3535 <viewLayoutGuide key="safeArea" id="f96-UV-eoi"/>
3636 </view>
37− <tabBarItem key="tabBarItem" title="Профиль" image="person" id="ziF-T0-lg1"/>
37+ <tabBarItem key="tabBarItem" systemItem="contacts" id="ziF-T0-lg1"/>
3838 </viewController>
3939 <placeholder placeholderIdentifier="IBFirstResponder" id="qqi-vY-Mog" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
4040 </objects>
4141 <point key="canvasLocation" x="1061" y="433"/>
4242 </scene>
43− <!--Брони-->
43+ <!--Navigation Controller-->
4444 <scene sceneID="p6D-Gs-DUK">
4545 <objects>
4646 <viewController id="Tc3-UW-Fwi" customClass="UINavigationController" sceneMemberID="viewController">
@@ -50,7 +50,7 @@
5050 <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
5151 <viewLayoutGuide key="safeArea" id="z8c-Ub-USh"/>
5252 </view>
53− <tabBarItem key="tabBarItem" title="Брони" image="stack" id="szW-oN-ixR"/>
53+ <tabBarItem key="tabBarItem" systemItem="mostViewed" id="szW-oN-ixR"/>
5454 </viewController>
5555 <placeholder placeholderIdentifier="IBFirstResponder" id="1ST-zr-4Zs" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
5656 </objects>
@@ -76,9 +76,4 @@
7676 <point key="canvasLocation" x="-817" y="-251"/>
7777 </scene>
7878 </scenes>
79− <resources>
80− <image name="peoplee" width="51" height="25"/>
81− <image name="person" width="25" height="24"/>
82− <image name="stack" width="25" height="24"/>
83− </resources>
8479</document>
Hookah Tau/Controllers/BaseTableViewController.swiftdeleted−28
@@ -1,28 +0,0 @@
1−//
2−// BaseTableViewController.swift
3−// Hookah Tau
4−//
5−// Created by cstore on 07/01/2020.
6−// Copyright © 2020 Daria Rednikina. All rights reserved.
7−//
8−
9−import UIKit
10−
11−class BaseTableViewController: UITableViewController {
12−
13− // MARK: - Alert
14−
15− func displayAlert(forError error: GeneralError = GeneralError.noData, with message: String? = nil) {
16− var title: String? = message == nil ? error.localizedDescription : message
17− switch error {
18− case .serverError(let se):
19− title = se.error
20− fallthrough // да тоже произведение искусства
21− default:
22− let alert = UIAlertController(title: title, message: nil, preferredStyle: .alert)
23− alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
24− self.present(alert, animated: true, completion: nil)
25− }
26− }
27−
28−}
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+2−23
@@ -23,7 +23,6 @@ class ReservationsViewController: BaseViewController {
2323 tableView?.alpha = 1
2424 }
2525
26− activityIndicator.stopAnimating()
2726 tableView?.reloadData()
2827 }
2928 }
@@ -46,8 +45,6 @@ class ReservationsViewController: BaseViewController {
4645 return tableView
4746 }()
4847
49− var activityIndicator = UIActivityIndicatorView()
50−
5148 // MARK: - Lifecycle
5249
5350 override func viewDidLoad() {
@@ -77,9 +74,6 @@ class ReservationsViewController: BaseViewController {
7774 func setUpContentView() {
7875 self.view.addSubviewThatFills(contentView)
7976
80− contentView.addSubviewThatFills(activityIndicator)
81− activityIndicator.startAnimating()
82−
8377 // empty
8478 noReservationsView = NoReservationsView.loadFromNib()
8579 contentView.addSubviewThatFills(noReservationsView)
@@ -91,7 +85,6 @@ class ReservationsViewController: BaseViewController {
9185 contentView.addSubviewThatFills(tableView)
9286
9387 setUpTableView()
94− setupRefreshControl()
9588 }
9689
9790 func setUpTableView() {
@@ -127,12 +120,11 @@ class ReservationsViewController: BaseViewController {
127120 case .failure(let err):
128121 self?.displayAlert(forError: err)
129122 }
130− self?.refrControl?.endRefreshing()
131123 })
132124 }
133125
134126 func deleteReservation(uuid: String, completion: @escaping (([Reservation]?) -> Void)) {
135− reservationsService?.deleteReservation(isAdmin: false, uuid: uuid) { result in
127+ reservationsService?.deleteReservation(uuid: uuid) { result in
136128 if result {
137129 let newReservations = self.activeReservations.filter { $0.uuid != uuid }
138130 completion(newReservations)
@@ -143,19 +135,6 @@ class ReservationsViewController: BaseViewController {
143135 }
144136 }
145137
146− // MARK: - Refresh control
147−
148− var refrControl: UIRefreshControl?
149−
150− func setupRefreshControl() {
151− refrControl = UIRefreshControl()
152− tableView?.refreshControl = refrControl
153− refrControl?.addTarget(self, action: #selector(refreshData(_:)), for: .valueChanged)
154− }
155−
156− @objc func refreshData( _ ff: UIRefreshControl) {
157− performUpdate()
158− }
159138}
160139
161140extension ReservationsViewController: UITableViewDelegate, UITableViewDataSource {
@@ -192,7 +171,7 @@ extension ReservationsViewController: UITableViewDelegate, UITableViewDataSource
192171 func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
193172
194173 let uuid = activeReservations[indexPath.row].uuid
195− let cancelButton = UITableViewRowAction(style: .normal, title: "отменить бронь") { _,_ in
174+ let cancelButton = UITableViewRowAction(style: .normal, title: "❌") { _,_ in
196175
197176 self.deleteReservation(uuid: uuid) { optionalNewVal in
198177 if let newval = optionalNewVal {
Hookah Tau/Controllers/Client/Reservations/Maps/1/MapView1.xib+14−14
@@ -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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
99 </dependencies>
@@ -21,22 +21,22 @@
2121 <rect key="frame" x="0.0" y="0.0" width="536" height="636"/>
2222 </imageView>
2323 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Y23-Wu-4BW" customClass="TableButton" customModule="Hookah_Tau" customModuleProvider="target">
24− <rect key="frame" x="44" y="37" width="102" height="119"/>
24+ <rect key="frame" x="44" y="37" width="102" height="117"/>
2525 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
2626 <constraints>
2727 <constraint firstAttribute="width" constant="102" id="EKZ-Ny-4RQ"/>
28− <constraint firstAttribute="height" constant="119" id="u1N-5d-cFR"/>
28+ <constraint firstAttribute="height" constant="117" id="u1N-5d-cFR"/>
2929 </constraints>
3030 <connections>
3131 <action selector="chooseFirstTable:" destination="iN0-l3-epB" eventType="touchUpInside" id="1O9-7Q-a8g"/>
3232 </connections>
3333 </button>
3434 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xsw-fJ-8cN" customClass="TableButton" customModule="Hookah_Tau" customModuleProvider="target">
35− <rect key="frame" x="209" y="116" width="131" height="117"/>
35+ <rect key="frame" x="209" y="113" width="131" height="119"/>
3636 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
3737 <constraints>
3838 <constraint firstAttribute="width" constant="131" id="2xi-Oz-ceC"/>
39− <constraint firstAttribute="height" constant="117" id="xPD-fh-9Zg"/>
39+ <constraint firstAttribute="height" constant="119" id="xPD-fh-9Zg"/>
4040 </constraints>
4141 <connections>
4242 <action selector="chooseSecondTable:" destination="iN0-l3-epB" eventType="touchUpInside" id="5XE-gZ-DyJ"/>
@@ -54,10 +54,10 @@
5454 </connections>
5555 </button>
5656 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Fw9-l6-N8a" customClass="TableButton" customModule="Hookah_Tau" customModuleProvider="target">
57− <rect key="frame" x="60" y="350" width="102" height="120"/>
57+ <rect key="frame" x="60" y="350" width="102" height="118"/>
5858 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
5959 <constraints>
60− <constraint firstAttribute="height" constant="120" id="2Vp-Ip-7cO"/>
60+ <constraint firstAttribute="height" constant="118" id="2Vp-Ip-7cO"/>
6161 <constraint firstAttribute="width" constant="102" id="2hI-75-UCM"/>
6262 </constraints>
6363 <connections>
@@ -65,10 +65,10 @@
6565 </connections>
6666 </button>
6767 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KJZ-Nl-7hH" customClass="TableButton" customModule="Hookah_Tau" customModuleProvider="target">
68− <rect key="frame" x="222" y="273" width="104" height="120"/>
68+ <rect key="frame" x="222" y="272" width="104" height="119"/>
6969 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
7070 <constraints>
71− <constraint firstAttribute="height" constant="120" id="Ifu-kd-YHH"/>
71+ <constraint firstAttribute="height" constant="119" id="Ifu-kd-YHH"/>
7272 <constraint firstAttribute="width" constant="104" id="phm-aP-6dx"/>
7373 </constraints>
7474 <connections>
@@ -76,7 +76,7 @@
7676 </connections>
7777 </button>
7878 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mUw-im-1BC" customClass="TableButton" customModule="Hookah_Tau" customModuleProvider="target">
79− <rect key="frame" x="222" y="433" width="92" height="67"/>
79+ <rect key="frame" x="222" y="431" width="92" height="67"/>
8080 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
8181 <constraints>
8282 <constraint firstAttribute="width" constant="92" id="AJ6-ku-4R3"/>
@@ -87,10 +87,10 @@
8787 </connections>
8888 </button>
8989 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aIM-Qn-Uhl" customClass="TableButton" customModule="Hookah_Tau" customModuleProvider="target">
90− <rect key="frame" x="386" y="116" width="131" height="119"/>
90+ <rect key="frame" x="386" y="116" width="130" height="119"/>
9191 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
9292 <constraints>
93− <constraint firstAttribute="width" constant="131" id="Lhq-jM-PQ0"/>
93+ <constraint firstAttribute="width" constant="130" id="Lhq-jM-PQ0"/>
9494 <constraint firstAttribute="height" constant="119" id="vsx-u8-L6o"/>
9595 </constraints>
9696 <connections>
@@ -123,7 +123,7 @@
123123 <constraint firstItem="mUw-im-1BC" firstAttribute="top" secondItem="KJZ-Nl-7hH" secondAttribute="bottom" constant="40" id="GaI-BE-NZy"/>
124124 <constraint firstItem="btD-Wl-3P6" firstAttribute="width" secondItem="FuE-LV-NBR" secondAttribute="width" priority="250" id="MDs-kk-aza"/>
125125 <constraint firstItem="btD-Wl-3P6" firstAttribute="top" secondItem="aIM-Qn-Uhl" secondAttribute="bottom" constant="-235" id="NwR-U0-V6F"/>
126− <constraint firstItem="mUw-im-1BC" firstAttribute="top" secondItem="btD-Wl-3P6" secondAttribute="bottom" constant="-203" id="UXz-DD-dPH"/>
126+ <constraint firstItem="mUw-im-1BC" firstAttribute="top" secondItem="btD-Wl-3P6" secondAttribute="bottom" constant="-205" id="UXz-DD-dPH"/>
127127 <constraint firstItem="mUw-im-1BC" firstAttribute="leading" secondItem="Fw9-l6-N8a" secondAttribute="trailing" constant="60" id="V4u-ko-iFV"/>
128128 <constraint firstItem="KJZ-Nl-7hH" firstAttribute="top" secondItem="xsw-fJ-8cN" secondAttribute="bottom" constant="40" id="XFV-l2-chC"/>
129129 <constraint firstItem="btD-Wl-3P6" firstAttribute="top" secondItem="onR-hl-Q2x" secondAttribute="bottom" constant="-332" id="XNT-i4-1l8"/>
Hookah Tau/Controllers/Client/Reservations/Reservation.storyboard+4−4
@@ -1,9 +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="retina6_1" 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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
99 </dependencies>
@@ -49,10 +49,10 @@
4949 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
5050 <subviews>
5151 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NBJ-7w-vpV">
52− <rect key="frame" x="0.0" y="544" width="414" height="352"/>
52+ <rect key="frame" x="0.0" y="502" width="414" height="394"/>
5353 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
5454 <constraints>
55− <constraint firstAttribute="height" constant="352" id="KKm-d5-Srx"/>
55+ <constraint firstAttribute="height" constant="394" id="KKm-d5-Srx"/>
5656 </constraints>
5757 </view>
5858 </subviews>
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.swift+7
@@ -23,6 +23,8 @@ class SecondStepView: UIView {
2323
2424 @IBOutlet weak var totalBookingLabel: UILabel!
2525
26+ @IBOutlet weak var infoLabel: UILabel!
27+
2628 @IBOutlet weak var specialLabel: UILabel! {
2729 didSet {
2830 let m = NSMutableAttributedString(string: "Если Вам нужно что-то особенное, Вы можете связаться с администратором ")
@@ -129,6 +131,7 @@ class SecondStepView: UIView {
129131 @IBAction func sliderValueChanged(_ sender: UISlider) {
130132 let value = Int(sender.value)
131133 numberOfGuestsLabel.text = "Количество гостей: \(value)"
134+ infoLabel.text = getNumberOfCalians(value)
132135
133136 guard let d = data else { return }
134137
@@ -148,6 +151,10 @@ class SecondStepView: UIView {
148151 UIApplication.shared.open(urlPhone)
149152 }
150153
154+ func getNumberOfCalians(_ sliderValue: Int) -> String {
155+ return "Минимальное количество кальянов: \(sliderValue > 6 ? 2 : 1)"
156+ }
157+
151158 // MARK: - Setup
152159
153160 /// Тут происходит установка интервалов. Разное для клиента и админа
Hookah Tau/Controllers/Client/Reservations/Steps/2/SecondStepView.xib+19−12
@@ -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"/>
@@ -12,14 +12,14 @@
1212 <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
1313 <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
1414 <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="SecondStepView" customModule="Hookah_Tau" customModuleProvider="target">
15− <rect key="frame" x="0.0" y="0.0" width="414" height="352"/>
15+ <rect key="frame" x="0.0" y="0.0" width="414" height="394"/>
1616 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1717 <subviews>
1818 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="bJ1-1q-VXq">
19− <rect key="frame" x="20" y="20" width="374" height="80"/>
19+ <rect key="frame" x="20" y="20" width="374" height="131.5"/>
2020 <subviews>
2121 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="center" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="Dkh-B7-3Dl">
22− <rect key="frame" x="16.5" y="0.0" width="341.5" height="41"/>
22+ <rect key="frame" x="16.5" y="0.0" width="341.5" height="92.5"/>
2323 <subviews>
2424 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Забронировать 7 столик на 3 человека 29 марта с 3:00 до 5:30?" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7M9-lI-egu">
2525 <rect key="frame" x="0.0" y="0.0" width="341.5" height="41"/>
@@ -27,10 +27,16 @@
2727 <nil key="textColor"/>
2828 <nil key="highlightedColor"/>
2929 </label>
30+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Минимальное количество кальянов: 2" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zMP-Wa-N6b">
31+ <rect key="frame" x="11" y="72" width="319" height="20.5"/>
32+ <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
33+ <nil key="textColor"/>
34+ <nil key="highlightedColor"/>
35+ </label>
3036 </subviews>
3137 </stackView>
3238 <label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PHb-Nt-9I2">
33− <rect key="frame" x="47" y="51" width="280.5" height="29"/>
39+ <rect key="frame" x="47" y="102.5" width="280.5" height="29"/>
3440 <string key="text">Если Вам нужно что-то особенное, Вы можете
3541связаться с администратором. </string>
3642 <fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="12"/>
@@ -40,7 +46,7 @@
4046 </subviews>
4147 </stackView>
4248 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="9c7-IZ-n2p">
43− <rect key="frame" x="20" y="120" width="373.5" height="70"/>
49+ <rect key="frame" x="20" y="171.5" width="373.5" height="60.5"/>
4450 <subviews>
4551 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Количество гостей: 3" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QuY-68-2ax">
4652 <rect key="frame" x="0.0" y="0.0" width="373.5" height="20.5"/>
@@ -49,7 +55,7 @@
4955 <nil key="highlightedColor"/>
5056 </label>
5157 <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="3" minValue="1" maxValue="10" translatesAutoresizingMaskIntoConstraints="NO" id="TrY-MC-Ty0">
52− <rect key="frame" x="-2" y="30.5" width="377.5" height="40.5"/>
58+ <rect key="frame" x="-2" y="30.5" width="377.5" height="31"/>
5359 <connections>
5460 <action selector="sliderValueChanged:" destination="iN0-l3-epB" eventType="valueChanged" id="ekZ-3h-EeB"/>
5561 </connections>
@@ -57,7 +63,7 @@
5763 </subviews>
5864 </stackView>
5965 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RJE-Hk-KNh">
60− <rect key="frame" x="0.0" y="210" width="414" height="106"/>
66+ <rect key="frame" x="0.0" y="252" width="414" height="106"/>
6167 <subviews>
6268 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dmc-2e-y3T">
6369 <rect key="frame" x="0.0" y="21" width="414" height="85"/>
@@ -123,7 +129,7 @@
123129 </subviews>
124130 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
125131 <constraints>
126− <constraint firstAttribute="bottom" secondItem="RJE-Hk-KNh" secondAttribute="bottom" constant="36" id="0W3-e2-hCU"/>
132+ <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="RJE-Hk-KNh" secondAttribute="bottom" constant="36" id="0W3-e2-hCU"/>
127133 <constraint firstItem="9c7-IZ-n2p" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="94y-7J-ksb"/>
128134 <constraint firstItem="9c7-IZ-n2p" firstAttribute="top" secondItem="bJ1-1q-VXq" secondAttribute="bottom" constant="20" id="9TT-vO-7PZ"/>
129135 <constraint firstItem="RJE-Hk-KNh" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" id="AgS-kP-UNE"/>
@@ -131,20 +137,21 @@
131137 <constraint firstAttribute="trailing" secondItem="bJ1-1q-VXq" secondAttribute="trailing" constant="20" id="OCH-eC-kP5"/>
132138 <constraint firstItem="bJ1-1q-VXq" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="PCm-nY-M6p"/>
133139 <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"/>
140+ <constraint firstItem="bJ1-1q-VXq" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="20" id="SnG-Cy-hHq"/>
135141 <constraint firstItem="RJE-Hk-KNh" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="fW0-Tt-MpN"/>
136142 </constraints>
137143 <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
138144 <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
139145 <connections>
140146 <outlet property="guestSlider" destination="TrY-MC-Ty0" id="mR0-wv-AM7"/>
147+ <outlet property="infoLabel" destination="zMP-Wa-N6b" id="htu-ql-T0O"/>
141148 <outlet property="intervalsStackView" destination="IIO-je-eBt" id="gaP-LX-Xed"/>
142149 <outlet property="numberOfGuestsLabel" destination="QuY-68-2ax" id="DvK-dr-c3J"/>
143150 <outlet property="scrollView" destination="zk1-3E-2kS" id="b8R-jY-2Q3"/>
144151 <outlet property="specialLabel" destination="PHb-Nt-9I2" id="hXL-Je-dax"/>
145152 <outlet property="totalBookingLabel" destination="7M9-lI-egu" id="7YU-yI-Gm4"/>
146153 </connections>
147− <point key="canvasLocation" x="-8" y="88.15592203898052"/>
154+ <point key="canvasLocation" x="-8" y="70"/>
148155 </view>
149156 </objects>
150157</document>
Hookah Tau/Controllers/Client/Reservations/Steps/3/ThirdStepReservationViewController.swift+1−1
@@ -139,7 +139,7 @@ class ThirdStepReservationViewController: BaseViewController {
139139 guard let res = reservation else { return }
140140
141141 cancelButton.loading = true
142− reservationService?.deleteReservation(isAdmin: false, uuid: res.uuid, completion: { [weak self] (result) in
142+ reservationService?.deleteReservation(uuid: res.uuid, completion: { [weak self] (result) in
143143 self?.cancelButton.loading = false
144144
145145 if result {
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/Controllers/Client/Tab bar/Client.storyboard+6−10
@@ -1,14 +1,14 @@
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="retina6_1" 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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
99 </dependencies>
1010 <scenes>
11− <!--Профиль-->
11+ <!--Navigation Controller-->
1212 <scene sceneID="b0t-Wu-VhQ">
1313 <objects>
1414 <viewController id="qqN-qg-VJ7" customClass="UINavigationController" sceneMemberID="viewController">
@@ -18,13 +18,13 @@
1818 <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
1919 <viewLayoutGuide key="safeArea" id="WgY-fu-N23"/>
2020 </view>
21− <tabBarItem key="tabBarItem" title="Профиль" image="person" id="vPo-1j-5WO"/>
21+ <tabBarItem key="tabBarItem" systemItem="contacts" id="vPo-1j-5WO"/>
2222 </viewController>
2323 <placeholder placeholderIdentifier="IBFirstResponder" id="zv0-gE-V7c" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
2424 </objects>
2525 <point key="canvasLocation" x="-166" y="195"/>
2626 </scene>
27− <!--Брони-->
27+ <!--Navigation Controller-->
2828 <scene sceneID="nQv-Ks-RjM">
2929 <objects>
3030 <viewController id="MGt-zZ-AbL" customClass="UINavigationController" sceneMemberID="viewController">
@@ -34,7 +34,7 @@
3434 <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
3535 <viewLayoutGuide key="safeArea" id="vjZ-Ji-o7T"/>
3636 </view>
37− <tabBarItem key="tabBarItem" title="Брони" image="stack" id="B7T-zH-VfU"/>
37+ <tabBarItem key="tabBarItem" systemItem="mostViewed" id="B7T-zH-VfU"/>
3838 </viewController>
3939 <placeholder placeholderIdentifier="IBFirstResponder" id="W83-e1-iNk" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
4040 </objects>
@@ -59,8 +59,4 @@
5959 <point key="canvasLocation" x="-1081" y="-130"/>
6060 </scene>
6161 </scenes>
62− <resources>
63− <image name="person" width="25" height="24"/>
64− <image name="stack" width="25" height="24"/>
65− </resources>
6662</document>
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/Info.plist+3−5
@@ -2,6 +2,8 @@
22<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33<plist version="1.0">
44<dict>
5+ <key>UIUserInterfaceStyle</key>
6+ <string>Ligth</string>
57 <key>CFBundleDevelopmentRegion</key>
68 <string>$(DEVELOPMENT_LANGUAGE)</string>
79 <key>CFBundleExecutable</key>
@@ -17,9 +19,7 @@
1719 <key>CFBundleShortVersionString</key>
1820 <string>1.0</string>
1921 <key>CFBundleVersion</key>
20− <string>$(CURRENT_PROJECT_VERSION)</string>
21− <key>ITSAppUsesNonExemptEncryption</key>
22− <false/>
22+ <string>1</string>
2323 <key>LSRequiresIPhoneOS</key>
2424 <true/>
2525 <key>UILaunchStoryboardName</key>
@@ -39,7 +39,5 @@
3939 <string>UIInterfaceOrientationLandscapeLeft</string>
4040 <string>UIInterfaceOrientationLandscapeRight</string>
4141 </array>
42− <key>UIUserInterfaceStyle</key>
43− <string>Light</string>
4442</dict>
4543</plist>
Hookah Tau/Models/Reservation.swift+1−24
@@ -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
@@ -59,29 +59,6 @@ struct ReservationWithUser: MyCodable {
5959 var reservedTable: Int
6060 var owner: FullUser
6161
62− init(reservation: Reservation, user: FullUser) {
63− self.uuid = reservation.uuid
64− self.establishment = reservation.establishment
65− self.startTime = reservation.startTime
66− self.endTime = reservation.endTime
67− self.numberOfGuests = reservation.numberOfGuests
68− self.reservedTable = reservation.reservedTable
69− self.owner = user
70− }
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− }
8162}
8263
83−struct AdminCreateReservation: MyCodable {
84− var reservation: ReservationData
85− var user: String
86−}
8764
Hookah Tau/Models/User.swift+1−19
@@ -15,28 +15,10 @@ struct User: MyCodable {
1515 var isAdmin: Bool
1616}
1717
18−/// При запросах на список пользователей в аккаунте администратора.
18+/// При запросах на список пользователей в аккаунте администратора
1919struct FullUser: MyCodable {
20− var uuid: String?
21− var name: String?
22− var phoneNumber: String
23− var isAdmin: Bool
24−}
25−
26−/// `GET /admin/clients`
27−struct Client: MyCodable {
2820 var uuid: String
2921 var name: String?
3022 var phoneNumber: String
3123 var isAdmin: Bool
32− 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− }
4224}
Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/1024.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/120-1.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/120.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/152.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/167.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/180.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/20.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/29.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/40-1.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/40-2.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/40.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/58-1.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/58.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/60.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/76.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/80-1.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/80.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/87.pngdeleted

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json+18−36
@@ -1,111 +1,93 @@
11{
22 "images" : [
33 {
4− "size" : "20x20",
54 "idiom" : "iphone",
6− "filename" : "40-1.png",
5+ "size" : "20x20",
76 "scale" : "2x"
87 },
98 {
10− "size" : "20x20",
119 "idiom" : "iphone",
12− "filename" : "60.png",
10+ "size" : "20x20",
1311 "scale" : "3x"
1412 },
1513 {
16− "size" : "29x29",
1714 "idiom" : "iphone",
18− "filename" : "58-1.png",
15+ "size" : "29x29",
1916 "scale" : "2x"
2017 },
2118 {
22− "size" : "29x29",
2319 "idiom" : "iphone",
24− "filename" : "87.png",
20+ "size" : "29x29",
2521 "scale" : "3x"
2622 },
2723 {
28− "size" : "40x40",
2924 "idiom" : "iphone",
30− "filename" : "80.png",
25+ "size" : "40x40",
3126 "scale" : "2x"
3227 },
3328 {
34− "size" : "40x40",
3529 "idiom" : "iphone",
36− "filename" : "120.png",
30+ "size" : "40x40",
3731 "scale" : "3x"
3832 },
3933 {
40− "size" : "60x60",
4134 "idiom" : "iphone",
42− "filename" : "120-1.png",
35+ "size" : "60x60",
4336 "scale" : "2x"
4437 },
4538 {
46− "size" : "60x60",
4739 "idiom" : "iphone",
48− "filename" : "180.png",
40+ "size" : "60x60",
4941 "scale" : "3x"
5042 },
5143 {
52− "size" : "20x20",
5344 "idiom" : "ipad",
54− "filename" : "20.png",
45+ "size" : "20x20",
5546 "scale" : "1x"
5647 },
5748 {
58− "size" : "20x20",
5949 "idiom" : "ipad",
60− "filename" : "40.png",
50+ "size" : "20x20",
6151 "scale" : "2x"
6252 },
6353 {
64− "size" : "29x29",
6554 "idiom" : "ipad",
66− "filename" : "29.png",
55+ "size" : "29x29",
6756 "scale" : "1x"
6857 },
6958 {
70− "size" : "29x29",
7159 "idiom" : "ipad",
72− "filename" : "58.png",
60+ "size" : "29x29",
7361 "scale" : "2x"
7462 },
7563 {
76− "size" : "40x40",
7764 "idiom" : "ipad",
78− "filename" : "40-2.png",
65+ "size" : "40x40",
7966 "scale" : "1x"
8067 },
8168 {
82− "size" : "40x40",
8369 "idiom" : "ipad",
84− "filename" : "80-1.png",
70+ "size" : "40x40",
8571 "scale" : "2x"
8672 },
8773 {
88− "size" : "76x76",
8974 "idiom" : "ipad",
90− "filename" : "76.png",
75+ "size" : "76x76",
9176 "scale" : "1x"
9277 },
9378 {
94− "size" : "76x76",
9579 "idiom" : "ipad",
96− "filename" : "152.png",
80+ "size" : "76x76",
9781 "scale" : "2x"
9882 },
9983 {
100− "size" : "83.5x83.5",
10184 "idiom" : "ipad",
102− "filename" : "167.png",
85+ "size" : "83.5x83.5",
10386 "scale" : "2x"
10487 },
10588 {
106− "size" : "1024x1024",
10789 "idiom" : "ios-marketing",
108− "filename" : "1024.png",
90+ "size" : "1024x1024",
10991 "scale" : "1x"
11092 }
11193 ],
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.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

Hookah Tau/Supporting Files/Assets.xcassets/stack2.imageset/Contents.jsondeleted−15
@@ -1,15 +0,0 @@
1−{
2− "images" : [
3− {
4− "idiom" : "universal",
5− "filename" : "stack2.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/stack2.imageset/stack2.pdfdeleted

Binary file not shown.