657 lines
20 KiB
PHP
657 lines
20 KiB
PHP
|
|
// Participants custom loadData
|
|
function loadData(custom) {
|
|
var show_type = $("#show_type").val();
|
|
var dataset = $("#dataset").val();
|
|
var subset = $("#subset").val();
|
|
var match = $("#match").val();
|
|
var custom_data = custom;
|
|
|
|
if (show_type.length) {
|
|
custom_data += "&show_type="+show_type;
|
|
}
|
|
|
|
if (subset.length) {
|
|
custom_data += "&naction="+subset;
|
|
}
|
|
|
|
if (match.length) {
|
|
custom_data += "&match="+match;
|
|
}
|
|
|
|
if (custom_data.length == 0 && dataset.length) {
|
|
custom_data += dataset;
|
|
}
|
|
|
|
if (custom_data.length == 0) return;
|
|
$("#dataset").val(custom_data);
|
|
$("#clear-screen").val('N');
|
|
|
|
loadDynamicData(tableName, tableAction, sequenceFlag, tableID, '', custom_data);
|
|
}
|
|
|
|
$("#orders-dialog").dialog({
|
|
autoOpen: false,
|
|
minWidth: 850,
|
|
minHeight: 450,
|
|
modal: true,
|
|
position: { my: 'center', at: 'center' }
|
|
});
|
|
|
|
$("#grade-dialog").dialog({
|
|
autoOpen: false,
|
|
minWidth: 500,
|
|
minHeight: 400,
|
|
modal: true,
|
|
position: { my: 'center', at: 'center' }
|
|
});
|
|
|
|
$("#meal-location-dialog").dialog({
|
|
autoOpen: false,
|
|
minWidth: 500,
|
|
minHeight: 400,
|
|
modal: true,
|
|
position: { my: 'center', at: 'center' }
|
|
});
|
|
|
|
$("#students-mass-update-dialog").dialog({
|
|
autoOpen: false,
|
|
minWidth: 400,
|
|
minHeight: 400,
|
|
modal: true,
|
|
position: { my: 'center', at: 'center' }
|
|
});
|
|
|
|
$("#adjust-student-order-category-dialog").dialog({
|
|
autoOpen: false,
|
|
minWidth: 400,
|
|
minHeight: 400,
|
|
modal: true,
|
|
position: { my: 'center', at: 'center' }
|
|
});
|
|
|
|
|
|
<?php
|
|
echo("// naction: $naction\n");
|
|
switch ($naction) {
|
|
case 'edit-student':
|
|
if (array_key_exists('student_num', $_GET)) $student_num = intval($_GET['student_num']);
|
|
echo(" // nation: $naction\n");
|
|
echo(" editData($student_num);\n");
|
|
break;
|
|
}
|
|
|
|
?>
|
|
<?php if (in_array($_SESSION['UserInfo']['type'], array('Parent', 'Staff', 'Guest', 'Application Volunteer', 'Administration Team', 'Schedule Team', 'Financial Team'))) { ?>
|
|
loadData("");
|
|
<?php } else { ?>
|
|
$("#clear-screen").val('Y');
|
|
|
|
$("#student-search-field").autocomplete({
|
|
source: "ajax.StudentSearch.php",
|
|
minLength: 3,
|
|
width: 750,
|
|
selectFirst: false,
|
|
select: function( event, results ) {
|
|
var student_num = results.item.student_num;
|
|
clearScreen();
|
|
$("#student-search-field").val('');
|
|
$("#match").val('display-current');
|
|
editData(student_num);
|
|
}
|
|
});
|
|
|
|
$("#view-matching-students").click(function(e) {
|
|
var match = $("#student-search-field").val();
|
|
|
|
if (match.length < 3) {
|
|
$("#student-search-field").focus();
|
|
return;
|
|
}
|
|
|
|
$("#selected-class").val('0');
|
|
$("#match").val(match);
|
|
loadData("&match="+match);
|
|
});
|
|
|
|
|
|
$("#view-unverified-participants").click(function(e) {
|
|
e.preventDefault();
|
|
$("#student-search-field").val('');
|
|
$("#match").val('');
|
|
clearScreen();
|
|
loadData("&naction=view-unverified");
|
|
});
|
|
|
|
$("#view-inactive-participants").click(function(e) {
|
|
e.preventDefault();
|
|
$("#student-search-field").val('');
|
|
$("#match").val('');
|
|
clearScreen();
|
|
loadData("&naction=view-inactive");
|
|
});
|
|
|
|
$("#view-unassigned").click(function(e) {
|
|
e.preventDefault();
|
|
$("#student-search-field").val('');
|
|
$("#match").val('');
|
|
clearScreen();
|
|
loadData("&naction=view-unassigned");
|
|
});
|
|
|
|
$("#view-students").click(function(e) {
|
|
e.preventDefault();
|
|
$("#student-search-field").val('');
|
|
$("#match").val('');
|
|
clearScreen();
|
|
loadData("&naction=view-students");
|
|
});
|
|
|
|
$("#view-staff").click(function(e) {
|
|
e.preventDefault();
|
|
$("#student-search-field").val('');
|
|
$("#match").val('');
|
|
clearScreen();
|
|
loadData("&naction=view-staff");
|
|
$("#selected-class").val('Staff');
|
|
});
|
|
|
|
$("#view-customers").click(function(e) {
|
|
e.preventDefault();
|
|
$("#student-search-field").val('');
|
|
$("#match").val('');
|
|
clearScreen();
|
|
loadData("&naction=view-customers");
|
|
$("#selected-class").val('Customer');
|
|
});
|
|
|
|
|
|
$(document).on('click','.grade-entry', function() {
|
|
var cnum = $(this).attr('cnum');
|
|
var rnum = $(this).attr('rnum');
|
|
var gfield = $(this).attr('gfield');
|
|
|
|
$("#rnum").val(rnum);
|
|
$("#sgrade").val(cnum);
|
|
$("#gfield").val(gfield);
|
|
$("#grade-dialog").dialog("open");
|
|
});
|
|
|
|
$("#save-grade").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
var rnum = $("#rnum").val();
|
|
var cnum = $("#sgrade").val();
|
|
var gfield = $("#gfield").val();
|
|
|
|
if (cnum > 0) {
|
|
$("#grade-dialog").dialog("close");
|
|
|
|
$.getJSON("ajax.updateGrade.php",
|
|
{
|
|
record_num: rnum,
|
|
class_num: cnum,
|
|
gfield: gfield
|
|
},
|
|
function(results) {
|
|
var class_text = results.class;
|
|
var class_info = results.class_info;
|
|
|
|
$("#span-grade-"+rnum).html("<span title='"+class_info+"'>"+class_text+"</span>");
|
|
$("#span-grade-"+rnum).attr('cnum',cnum);
|
|
}
|
|
);
|
|
}
|
|
});
|
|
|
|
$(document).on("click", ".student-status", function() {
|
|
var Status = $(this).attr('status');
|
|
var snum = $(this).attr('snum');
|
|
var spanID = $(this);
|
|
|
|
var data = "table_name=people"+
|
|
"&sequence_flag=N"+
|
|
"&record_num="+snum+
|
|
"&status=";
|
|
|
|
switch (Status) {
|
|
case 'Unverified':
|
|
data = data+"Verified";
|
|
var newText = "<?php displayLanguageText('TEXT-VERIFIED') ?>";
|
|
var newCode = "Verified";
|
|
break;
|
|
|
|
case 'Verified':
|
|
data = data+"Inactive";
|
|
var newText = "<?php displayLanguageText('TEXT-INACTIVE') ?>";
|
|
var newCode = "Inactive";
|
|
break;
|
|
|
|
case 'Inactive':
|
|
data = data+"Unverified";
|
|
var newText = "<?php displayLanguageText('TEXT-UNVERIFIED') ?>";
|
|
var newCode = "Unverified";
|
|
break;
|
|
}
|
|
|
|
$.getJSON("ajax.DataRecord.Update.php", data,
|
|
function(results) {
|
|
$(spanID).html(newText);
|
|
$(spanID).attr('status', newCode);
|
|
}
|
|
);
|
|
});
|
|
|
|
$(document).on("click", ".flex-pricing", function() {
|
|
var flex = $(this).html();
|
|
var new_flex = 'Y';
|
|
var snum = $(this).attr('snum');
|
|
var spanID = $(this);
|
|
|
|
if (flex == 'Y') new_flex = 'N';
|
|
|
|
var data = "table_name=people"+
|
|
"&sequence_flag=N"+
|
|
"&record_num="+snum+
|
|
"&access_to_multiple_item_prices="+new_flex;
|
|
|
|
$.getJSON("ajax.DataRecord.Update.php", data,
|
|
function(results) {
|
|
$(spanID).html(new_flex);
|
|
}
|
|
);
|
|
});
|
|
|
|
$(document).on("click", ".display-flag", function() {
|
|
var display = $(this).html();
|
|
var new_display = 'Y';
|
|
var snum = $(this).attr('snum');
|
|
var spanID = $(this);
|
|
|
|
if (display == 'Y') new_display = 'N';
|
|
|
|
var data = "table_name=people"+
|
|
"&sequence_flag=N"+
|
|
"&record_num="+snum+
|
|
"&display="+new_display;
|
|
|
|
$.getJSON("ajax.DataRecord.Update.php", data,
|
|
function(results) {
|
|
$(spanID).html(new_display);
|
|
}
|
|
);
|
|
});
|
|
|
|
<?php if ($school_record['special_item_prices'] == 'Y') { ?>
|
|
$(document).on("click", ".price-category", function() {
|
|
var mcat = $(this).attr('mcat');
|
|
var snum = $(this).attr('snum');
|
|
var spanID = $(this);
|
|
|
|
var Regular = "Regular";
|
|
var Special1 = "<span class='warning'><?php echo($Special1_Title) ?></span>";
|
|
var Special2 = "<span class='warning'><?php echo($Special2_Title) ?></span>";
|
|
var Special3 = "<span class='warning'><?php echo($Special3_Title) ?></span>";
|
|
var newText;
|
|
|
|
var data = "table_name=people"+
|
|
"&sequence_flag=N"+
|
|
"&school_num=<?php echo($base_school_num) ?>"+
|
|
"&record_num="+snum+
|
|
"&menu_price_category=";
|
|
|
|
switch (mcat) {
|
|
case 'regular':
|
|
var cat = "Special 1";
|
|
var ncat = "special1";
|
|
data = data+cat;
|
|
newText = Special1;
|
|
break;
|
|
|
|
case 'special1':
|
|
var cat = "Special 2";
|
|
var ncat = "special2";
|
|
data = data+cat;
|
|
newText = Special2;
|
|
break;
|
|
|
|
case 'special2':
|
|
var cat = "Special 3";
|
|
var ncat = "special3";
|
|
data = data+cat;
|
|
newText = Special3;
|
|
break;
|
|
|
|
case 'special3':
|
|
var cat = "Regular";
|
|
var ncat = "regular";
|
|
data = data+cat;
|
|
newText = Regular;
|
|
break;
|
|
}
|
|
|
|
$.getJSON("ajax.DataRecord.Update.php", data,
|
|
function(results) {
|
|
$(spanID).html(newText);
|
|
$(spanID).attr('mcat',ncat);
|
|
}
|
|
);
|
|
});
|
|
|
|
<?php } ?>
|
|
|
|
$(document).on('click touch', '.edit-user', function(e) {
|
|
e.preventDefault();
|
|
|
|
var unum = $(this).attr('unum');
|
|
window.location = "/?action=users&naction=edit-user&user_num="+unum;
|
|
});
|
|
|
|
$("#view-all-participants").click(function(e) {
|
|
e.preventDefault();
|
|
$("#student-search-field").val('');
|
|
$("#match").val('');
|
|
clearScreen();
|
|
loadData("&naction=view-all");
|
|
});
|
|
|
|
$("#selected-class").change(function() {
|
|
viewClassStudents();
|
|
});
|
|
|
|
$("#view-class-students").click(function(e) {
|
|
e.preventDefault();
|
|
viewClassStudents();
|
|
});
|
|
|
|
function viewClassStudents() {
|
|
var class_num = $("#selected-class").val();
|
|
if (class_num != '0') {
|
|
$("#student-search-field").val('');
|
|
$("#match").val('');
|
|
|
|
switch(class_num) {
|
|
case 'Staff':
|
|
loadData("&naction=view-staff");
|
|
break;
|
|
|
|
case 'Customer':
|
|
loadData("&naction=view-customers");
|
|
break;
|
|
|
|
default:
|
|
loadData("&naction=view-class-students&class_num="+class_num);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
$("#view-meal-locations").click(function(e) {
|
|
e.preventDefault();
|
|
var class_num = $("#selected-class").val();
|
|
$("#student-search-field").val('');
|
|
$("#match").val('');
|
|
loadData("&naction=view-meal-locations&class_num="+class_num);
|
|
});
|
|
|
|
$(".view-special-pricing").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
var price_category = $(this).attr('cat');
|
|
loadData("&naction=view-price-category&price_category="+price_category);
|
|
});
|
|
|
|
$("#view-flex-pricing").click(function(e) {
|
|
e.preventDefault();
|
|
loadData("&naction=view-flex-pricing");
|
|
});
|
|
|
|
$("#clear-screen").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
clearScreen();
|
|
});
|
|
|
|
function clearScreen() {
|
|
$("#show_type").val('');
|
|
$("#dataset").val('');
|
|
$("#subset").val('');
|
|
$("#selected-class").val('0');
|
|
$("#clear-screen").val('Y');
|
|
|
|
$("#dynamic-table-div").html("");
|
|
}
|
|
|
|
$("#insert-new").click(function(e) {
|
|
e.preventDefault();
|
|
insertNew();
|
|
});
|
|
|
|
$("#dialog_birthdate").datepicker({
|
|
dateFormat: 'yy-mm-dd',
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
maxDate: (new Date(<?php echo(date("Y", time() - 3 * 365 * 60 * 60 * 24)) ?>, 11, 31)),
|
|
numberOfMonths: [1,1]
|
|
});
|
|
<?php } ?>
|
|
|
|
$("#student-disclaimer-dialog").dialog({
|
|
autoOpen: false,
|
|
minWidth: 500,
|
|
minHeight: 200,
|
|
modal: true,
|
|
position: { my: 'center', at: 'center' }
|
|
});
|
|
|
|
$("#student-submit-button").click(function(e) {
|
|
e.preventDefault();
|
|
$("#student-disclaimer-dialog").dialog("open");
|
|
});
|
|
|
|
$("#accept-disclaimer").click(function() {
|
|
$("#student-form").submit();
|
|
$("#student-disclaimer-dialog").dialog("close");
|
|
});
|
|
|
|
$("#cancel-disclaimer").click(function() {
|
|
$("#student-disclaimer-dialog").dialog("close");
|
|
});
|
|
|
|
|
|
$(document).on('click', '.student-orders', function(e) {
|
|
e.preventDefault();
|
|
|
|
var snum = $(this).attr('rnum');
|
|
var num = $("#norders-"+snum).val();
|
|
|
|
if (num == 0) {
|
|
alert("<?php displayLanguageText('TEXT-NO-ORDERS-FOUND'); ?>");
|
|
return;
|
|
}
|
|
|
|
loadStudentOrders(snum);
|
|
});
|
|
|
|
function loadStudentOrders(snum) {
|
|
var data = "table_name=hotlunch_order_header"+
|
|
"&sequence_flag=N"+
|
|
"&action=student-orders"+
|
|
"&student_num="+snum+
|
|
"&display_mode=AllSchedules"+
|
|
"&table_id=student-orders-table";
|
|
$.getJSON( "ajax.DataTable.Fetch.php",data,
|
|
function(results) {
|
|
$("#orders-div").html(results.content);
|
|
|
|
$("#orders-dialog").dialog('option', 'title', "<?php displayLanguageText('TEXT-STUDENT-ORDERS'); ?>");
|
|
$("#orders-dialog").dialog('open');
|
|
|
|
$("#student-orders-name").val(results.name);
|
|
}
|
|
);
|
|
}
|
|
|
|
$("#closeOrdersDialogBtn").click(function(e) {
|
|
e.preventDefault();
|
|
$("#orders-dialog").dialog('close');
|
|
});
|
|
|
|
|
|
|
|
$(document).on('click', '.meal-location-span', function(e) {
|
|
e.preventDefault();
|
|
|
|
var rnum = $(this).attr('rnum');
|
|
var meal_location = $(this).attr('mlocation');
|
|
var class_num = $(this).attr('cnum');
|
|
|
|
$("#location-rnum").val(rnum);
|
|
$("#class-num").val(class_num);
|
|
$("#mlocation").val(meal_location);
|
|
|
|
$("#meal-location-dialog").dialog('open');
|
|
});
|
|
|
|
$("#reset-meal-location").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
var class_num = $("#class-num").val();
|
|
$("#mlocation").val(class_num);
|
|
});
|
|
|
|
$("#save-meal-location").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
var snum = $("#location-rnum").val();
|
|
var mlocation = $("#mlocation").val();
|
|
var class_num = $("#class-num").val();
|
|
var tdID = snum+"_2";
|
|
var spanID = "meal-location-"+snum;
|
|
var newText = $("#class-"+mlocation).val();
|
|
|
|
$('#'+tdID).removeClass("warning");
|
|
|
|
if (class_num == mlocation) mlocation = 0;
|
|
else $('#'+tdID).addClass('warning');
|
|
|
|
var data = "table_name=people"+
|
|
"&sequence_flag=N"+
|
|
"&school_num=<?php echo($base_school_num) ?>"+
|
|
"&record_num="+snum+
|
|
"&meal_location="+mlocation;
|
|
|
|
$.getJSON("ajax.DataRecord.Update.php", data,
|
|
function(results) {
|
|
$('#'+spanID).html(newText);
|
|
if (mlocation == 0) $("#meal-location-"+snum).attr('mlocation', class_num);
|
|
else $("#meal-location-"+snum).attr('mlocation', mlocation);
|
|
$("#meal-location-dialog").dialog('close');
|
|
}
|
|
);
|
|
});
|
|
|
|
$("#students-update").click(function(e) {
|
|
e.preventDefault();
|
|
var class_num = $("#selected-class").val();
|
|
var class_name = '<?php echo($GlobalText['AllStudents']) ?>';
|
|
|
|
if (class_num > 0) class_name = $("#class-"+class_num).val();
|
|
if (class_num == 'Staff') class_name = "<?php displayLanguageText('TEXT-ALL-STAFF'); ?>"
|
|
if (class_num == 'Customer') class_name = "<?php displayLanguageText('TEXT-CUSTOMERS'); ?>"
|
|
|
|
$("#class-name-span").html(class_name);
|
|
|
|
$("#selected-price-category").val('Regular');
|
|
$("#students-mass-update-dialog").dialog('open');
|
|
});
|
|
|
|
$(".update-all-people").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
var action = $(this).attr('action');
|
|
var class_num = $("#selected-class").val();
|
|
var class_name = '';
|
|
var price_category = '';
|
|
var msg = $(this).html();
|
|
var cat_msg = '';
|
|
|
|
if (class_num > 0) class_name = "\n- "+$("#class-"+class_num).val();
|
|
if (class_num == 'Staff') class_name = "\n- <?php displayLanguageText('TEXT-ALL-STAFF'); ?>"
|
|
if (class_num == 'Customer') class_name = "\n- <?php displayLanguageText('TEXT-CUSTOMERS'); ?>"
|
|
|
|
if (action == 'update-price-category') {
|
|
price_category = $("#selected-price-category").val();
|
|
switch (price_category) {
|
|
case 'Regular':
|
|
cat_msg = "<?php displayLanguageText('TEXT-REGULAR'); ?>";
|
|
break;
|
|
|
|
case 'Special 1':
|
|
cat_msg = "<?php displayLanguageText('TEXT-SPECIAL-1'); ?>";
|
|
if ("<?php echo($Special1_Title) ?>" != cat_msg) cat_msg += " - <?php echo($Special1_Title) ?>";
|
|
break;
|
|
|
|
case 'Special 2':
|
|
cat_msg = "<?php displayLanguageText('TEXT-SPECIAL-2'); ?>";
|
|
if ("<?php echo($Special2_Title) ?>" != cat_msg) cat_msg += " - <?php echo($Special2_Title) ?>";
|
|
break;
|
|
|
|
case 'Special 3':
|
|
cat_msg = "<?php displayLanguageText('TEXT-SPECIAL-3'); ?>";
|
|
if ("<?php echo($Special3_Title) ?>" != cat_msg) cat_msg += " - <?php echo($Special3_Title) ?>";
|
|
break;
|
|
}
|
|
cat_msg = "\n- <?php displayLanguageText('TEXT-SET-PRICE-CATEGORY'); ?>: "+cat_msg;
|
|
msg = "<?php displayLanguageText('TEXT-UPDATE-PRICE-CATEGORIES'); ?>";
|
|
}
|
|
|
|
msg = "<?php echo($GlobalText['UpdateAllStudents']) ?>"+class_name+cat_msg+"\n\n-- " + msg + " --";
|
|
|
|
if (confirm(msg)) {
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: "ajax.StudentUpdate.php",
|
|
data: {
|
|
action: action,
|
|
class_num: class_num,
|
|
price_category: price_category
|
|
}
|
|
}).done(function(){
|
|
alert("<?php displayLanguageText('TEXT-PROCESS-COMPLETED'); ?>");
|
|
if (class_num != '0') {
|
|
$("#student-search-field").val('');
|
|
$("#match").val('');
|
|
switch(class_num) {
|
|
case 'Staff':
|
|
loadData("&naction=view-staff");
|
|
break;
|
|
|
|
case 'Customer':
|
|
loadData("&naction=view-customers");
|
|
break;
|
|
|
|
default:
|
|
loadData("&naction=view-class-students&class_num="+class_num);
|
|
break;
|
|
}
|
|
}
|
|
else {
|
|
if ($("#clear-screen").val() == 'N') loadData("&naction=view-all");
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
$("#close-students-mass-update-dialog").click(function(e) {
|
|
e.preventDefault();
|
|
|
|
$("#students-mass-update-dialog").dialog('close');
|
|
});
|
|
|
|
<?php
|
|
$module = "students";
|
|
include "orders.js.php";
|
|
?>
|
|
|