mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Convert quote edit modal to be dynamically populated
This commit is contained in:
37
ajax.php
37
ajax.php
@@ -120,7 +120,7 @@ if (isset($_GET['merge_ticket_get_json_details'])) {
|
||||
} else {
|
||||
//Return ticket, client and contact details for the given ticket number
|
||||
$response = mysqli_fetch_array($sql);
|
||||
|
||||
|
||||
echo json_encode($response);
|
||||
}
|
||||
}
|
||||
@@ -308,6 +308,41 @@ if (isset($_GET['scheduled_ticket_get_json_details'])) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Looks up info for a given quote ID from the database, used to dynamically populate modal fields
|
||||
*/
|
||||
if (isset($_GET['quote_get_json_details'])) {
|
||||
$quote_id = intval($_GET['quote_id']);
|
||||
|
||||
// Get quote details
|
||||
$quote_sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM quotes
|
||||
LEFT JOIN clients ON quote_client_id = client_id
|
||||
WHERE quote_id = $quote_id LIMIT 1"
|
||||
);
|
||||
|
||||
while ($row = mysqli_fetch_array($quote_sql)) {
|
||||
$response['quote'][] = $row;
|
||||
}
|
||||
|
||||
|
||||
// Get all income-related categories for quoting
|
||||
$quote_created_at = $response['quote'][0]['quote_created_at'];
|
||||
$category_sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT category_id, category_name FROM categories
|
||||
WHERE category_type = 'Income' AND (category_archived_at > '$quote_created_at' OR category_archived_at IS NULL)
|
||||
ORDER BY category_name");
|
||||
|
||||
while ($row = mysqli_fetch_array($category_sql)) {
|
||||
$response['categories'][] = $row;
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Dynamic TOTP for client login page
|
||||
* When provided with a TOTP secret, returns a 6-digit code
|
||||
|
||||
Reference in New Issue
Block a user