git.iko.soy/dashared/hookah-tau
on develop help sign in
Админ: можно тапать на ячейку бронирования в профиле клиента
e6902bbDarya Rednikina
Hookah Tau/Controllers/Admin/Clients/ClientsViewController.swift+5
@@ -31,6 +31,11 @@ class ClientsViewController: UITableViewController {
31 clientsService = ClientsService(apiClient: APIClient.shared)
31 clientsService = ClientsService(apiClient: APIClient.shared)
32 }
32 }
33
33
34+ override func viewWillAppear(_ animated: Bool) {
35+ super.viewWillAppear(animated)
36+ tabBarController?.tabBar.isHidden = false
37+ }
38+
34 override func viewDidAppear(_ animated: Bool) {
39 override func viewDidAppear(_ animated: Bool) {
35 super.viewDidAppear(animated)
40 super.viewDidAppear(animated)
36 loadClients()
41 loadClients()
Hookah Tau/Controllers/Admin/Clients/Profile/ClientProfileCoordinator.swift+13
@@ -17,6 +17,7 @@ class ClientProfileCoordinator: BaseCoordinator {
17 let storyboard = UIStoryboard(name: "ClientList", bundle: nil)
17 let storyboard = UIStoryboard(name: "ClientList", bundle: nil)
18 let viewController = storyboard.instantiateViewController(withIdentifier: "ProfileTableViewController") as? ProfileTableViewController
18 let viewController = storyboard.instantiateViewController(withIdentifier: "ProfileTableViewController") as? ProfileTableViewController
19 viewController?.user = user
19 viewController?.user = user
20+ viewController?.coodinator = self
20 guard let vc = viewController else { return }
21 guard let vc = viewController else { return }
21 navigationController?.pushViewController(vc, animated: true)
22 navigationController?.pushViewController(vc, animated: true)
22 }
23 }
@@ -26,4 +27,16 @@ class ClientProfileCoordinator: BaseCoordinator {
26 func createReservation(forUserWithPhone phoneNumber: String) {
27 func createReservation(forUserWithPhone phoneNumber: String) {
27
28
28 }
29 }
30+
31+ // Просмотр (и редактирование) брони
32+ func seeExistingReservation(data: ReservationWithUser) {
33+ let reservationCoordinator = AdminReservationEditingCoordinator(navigationController: navigationController)
34+ addDependency(reservationCoordinator)
35+ reservationCoordinator.reservationData = data
36+ reservationCoordinator.didEndFlow = { [weak self] in
37+ self?.removeDependency(reservationCoordinator)
38+ self?.navigationController?.popViewController(animated: true)
39+ }
40+ reservationCoordinator.start()
41+ }
29}
42}
Hookah Tau/Controllers/Admin/Clients/Profile/ProfileTableViewController.swift+14
@@ -63,6 +63,11 @@ class ProfileTableViewController: BaseTableViewController {
63 loadReservations()
63 loadReservations()
64 }
64 }
65
65
66+ override func viewWillAppear(_ animated: Bool) {
67+ super.viewDidAppear(animated)
68+ tabBarController?.tabBar.isHidden = true
69+ }
70+
66 func loadReservations() {
71 func loadReservations() {
67 guard let uuid = user?.uuid else { return }
72 guard let uuid = user?.uuid else { return }
68 clientsService?.loadReservationsForUser(withUUID: uuid,
73 clientsService?.loadReservationsForUser(withUUID: uuid,
@@ -129,6 +134,15 @@ extension ProfileTableViewController {
129 return cell
134 return cell
130 }
135 }
131
136
137+ // tap
138+
139+ override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
140+ guard let u = user else { return }
141+ let r = dataSource[indexPath.row]
142+ let reservation = ReservationWithUser(reservation: r, user: u)
143+ coodinator?.seeExistingReservation(data: reservation)
144+ }
145+
132 // Update
146 // Update
133
147
134 override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
148 override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
Hookah Tau/Models/Reservation.swift+9
@@ -59,6 +59,15 @@ struct ReservationWithUser: MyCodable {
59 var reservedTable: Int
59 var reservedTable: Int
60 var owner: FullUser
60 var owner: FullUser
61
61
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+ }
62}
71}
63
72
64
73