From 6860a87c59b662eb8625f337075c27216c6b9f13 Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Sun, 13 Feb 2022 18:15:51 +0000 Subject: [PATCH] Move network edit modal data processing to AJAX --- client_network_edit_modal.php | 30 +++++---------- client_networks.php | 71 +++++++++++++++++++++++++++++++---- post.php | 21 +++++++++++ 3 files changed, 94 insertions(+), 28 deletions(-) diff --git a/client_network_edit_modal.php b/client_network_edit_modal.php index c266e6b5..f334b73a 100644 --- a/client_network_edit_modal.php +++ b/client_network_edit_modal.php @@ -1,14 +1,14 @@ - @@ -47,7 +47,7 @@
- + @@ -57,7 +57,7 @@
- + @@ -67,20 +67,8 @@
- - '$network_created_at' OR location_archived_at IS NULL) AND location_client_id = $client_id ORDER BY location_name ASC"); - while($row = mysqli_fetch_array($sql_locations)){ - $location_id_select = $row['location_id']; - $location_name_select = $row['location_name']; - ?> - - - diff --git a/client_networks.php b/client_networks.php index 1bd91231..5907ed83 100644 --- a/client_networks.php +++ b/client_networks.php @@ -1,4 +1,58 @@ - + + + + - + )" data-target="#editNetworkModal"> @@ -138,7 +191,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); @@ -147,8 +200,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); @@ -160,4 +212,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); - \ No newline at end of file + \ No newline at end of file diff --git a/post.php b/post.php index 76dfa945..ac2b760a 100644 --- a/post.php +++ b/post.php @@ -4889,6 +4889,27 @@ if(isset($_POST['edit_network'])){ } +if(isset($_GET['network_get_json_details'])){ + $network_id = intval($_GET['network_id']); + $client_id = intval($_GET['client_id']); + + $network_sql = mysqli_query($mysqli,"SELECT * FROM networks + WHERE network_id = $network_id + AND network_client_id = $client_id"); + while($row = mysqli_fetch_array($network_sql)){ + $response['network'][] = $row; + } + + $locations_sql = mysqli_query($mysqli, "SELECT location_id, location_name FROM locations + WHERE location_client_id = '$client_id' + AND company_id = '$session_company_id'"); + while($row = mysqli_fetch_array($locations_sql)){ + $response['locations'][] = $row; + } + + echo json_encode($response); +} + if(isset($_GET['delete_network'])){ $network_id = intval($_GET['delete_network']);