87 lines
2.5 KiB
PHP
87 lines
2.5 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
// Start the template and output buffering
|
|
startTemplate();
|
|
$headerArgs = "";
|
|
|
|
|
|
// Get current order information
|
|
if (isset($entered_order_num) && $entered_order_num > 0) {
|
|
$order_num = $entered_order_num;
|
|
$query = "select * from hotlunch_order_header " .
|
|
"where school_num = $school_num " .
|
|
"and record_num = $entered_order_num";
|
|
$results = db_query($query);
|
|
|
|
if (db_num_rows($results) == 0) {
|
|
$error_message = "Invalid order number";
|
|
header("Location: /?action=order-lookup&error_message=".urlencode($error_message));
|
|
exit();
|
|
}
|
|
|
|
$row = db_fetch_array($results);
|
|
$ordered_by_num = $row['ordered_by_num'];
|
|
$ordered_by_type = $row['ordered_by_type'];
|
|
}
|
|
?>
|
|
<script>
|
|
$(document).ready(function() {
|
|
|
|
<?php include "include/ajax.Setup.php" ?>
|
|
|
|
$(document).on('click', '.delivered-flag', function() {
|
|
var Status = $(this).html();
|
|
var rnum = $(this).attr('rnum');
|
|
var spanID = $(this);
|
|
|
|
if (confirm("<?php displayLanguageText('TEXT-CONFIRM-STATUS-CHANGE'); ?>")) {
|
|
newStatus = 'Y';
|
|
if (Status == 'Y') newStatus = 'N';
|
|
|
|
var data = "table_name=hotlunch_order_header"+
|
|
"&sequence_flag=N"+
|
|
"&record_num="+rnum+
|
|
"&delivered="+newStatus;
|
|
$.getJSON("ajax.DataRecord.Update.php", data,
|
|
function(results) {
|
|
$(spanID).html(newStatus);
|
|
}
|
|
);
|
|
}
|
|
});
|
|
|
|
$(document).on('click', '.delivered-icon', function(e) {
|
|
e.preventDefault();
|
|
var rnum = $(this).attr('rnum');
|
|
var Status = $("#delivered_"+rnum).html();
|
|
var spanID = $("#delivered_"+rnum);
|
|
|
|
if (confirm("<?php displayLanguageText('TEXT-CONFIRM-STATUS-CHANGE'); ?>")) {
|
|
newStatus = 'Y';
|
|
if (Status == 'Y') newStatus = 'N';
|
|
|
|
var data = "table_name=hotlunch_order_header"+
|
|
"&sequence_flag=N"+
|
|
"&record_num="+rnum+
|
|
"&delivered="+newStatus;
|
|
$.getJSON("ajax.DataRecord.Update.php", data,
|
|
function(results) {
|
|
$(spanID).html(newStatus);
|
|
}
|
|
);
|
|
}
|
|
});
|
|
|
|
});
|
|
</script>
|
|
<?php
|
|
endTemplate();
|
|
?>
|