From eb5076d91a543d7c00228cbf19be361a45fedc1e Mon Sep 17 00:00:00 2001 From: Juthatip McDevitt Date: Mon, 24 Jun 2024 15:50:27 -0500 Subject: [PATCH] created admin dashboard-users page and updated sidebar --- hotel_booking/admin/ajax/users.php | 112 ++++++++++++++++++ hotel_booking/admin/components/sidebar.php | 9 +- hotel_booking/admin/users.php | 127 +++++++++++++++++++++ 3 files changed, 245 insertions(+), 3 deletions(-) create mode 100644 hotel_booking/admin/ajax/users.php create mode 100644 hotel_booking/admin/users.php diff --git a/hotel_booking/admin/ajax/users.php b/hotel_booking/admin/ajax/users.php new file mode 100644 index 0000000..17af0ca --- /dev/null +++ b/hotel_booking/admin/ajax/users.php @@ -0,0 +1,112 @@ +Delete user"; + $verified = "No"; + + if($row['is_verified']){ + $verified = "Yes"; + $delete_btn = ""; + } + + $status = ""; + if(!$row['status']){ + $status = ""; + } + + $data.=" + + $i + $row[firstname] + $row[lastname] + $row[email] + $row[phone] + $row[address] + $row[birth] + $verified + $status + $date + $delete_btn + + "; + $i++; + } + echo $data; + } + + if(isset($_POST['toggleStatus'])){ + $frm_data = filteration($_POST); + $q = "UPDATE `user_creds` SET `status`=? WHERE `id`=?"; + $values = [$frm_data['value'], $frm_data['toggleStatus']]; + + if(update($q, $values, 'ii')){ + echo 1; + } else{ + echo 0; + } + } + + if(isset($_POST['remove_user'])){ + $frm_data = filteration($_POST); + + $res = delete("DELETE FROM `user_creds` WHERE `id`=? AND `is_verified`=?", [1, $frm_data['user_id'], 0], 'ii'); + + if($res){ + echo 1; + } else{ + echo 0; + } + } + + if(isset($_POST['search_users'])){ + $frm_data = filteration($_POST); + $query = "SELECT * FROM `user_creds` WHERE `firstname` LIKE ?"; + $res = select($query, ["%$frm_data[firstname]%"], 's'); + $i = 1; + $data = ""; + + while($row = mysqli_fetch_assoc($res)){ + $date = date("M-d-Y", strtotime($row['datentime'])); + $delete_btn = ""; + $verified = "No"; + + if($row['is_verified']){ + $verified = "Yes"; + $delete_btn = ""; + } + + $status = ""; + if(!$row['status']){ + $status = ""; + } + + $data.=" + + $i + $row[firstname] + $row[lastname] + $row[email] + $row[phone] + $row[address] + $row[birth] + $verified + $status + $date + $delete_btn + + "; + $i++; + } + echo $data; + } + +?> \ No newline at end of file diff --git a/hotel_booking/admin/components/sidebar.php b/hotel_booking/admin/components/sidebar.php index fc0fa5e..f4b10ce 100644 --- a/hotel_booking/admin/components/sidebar.php +++ b/hotel_booking/admin/components/sidebar.php @@ -19,15 +19,18 @@ + + - diff --git a/hotel_booking/admin/users.php b/hotel_booking/admin/users.php new file mode 100644 index 0000000..0b7ea5d --- /dev/null +++ b/hotel_booking/admin/users.php @@ -0,0 +1,127 @@ + + + + + + + Admin Dashboard-users | Midtown Hotel + + + + + +
+
+
+

Users

+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#FirstnameLastnameEmailPhoneAddressBirthdayVerifyStatusDateAction
+
+
+
+
+
+
+ + + + + + \ No newline at end of file