ESH/appointment_slots.php
2024-10-23 18:28:06 +05:30

252 lines
6.4 KiB
PHP

<?php include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try {
ace.settings.loadState('main-container')
} catch (e) {}
</script>
<?php include('techsyn_sidebar.php'); ?>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li class="#">Data Setup</li>
<li class="#">Masters</li>
<li class="active">Appoinment Slots</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<div id="flexigridDiv" class="table-responsive">
<form name="f1" method="post" action="" id="flex_form_slot">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_slot_id" id="flex_slot_id" />
</form>
</div>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<script type="text/javascript">
$(function() {
var w = screen.width * .90;
var h = 0;
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
$("#flex1").flexigrid({
url: 'appointment_slots_script.php',
dataType: 'json',
colModel: [{
display: 'Sr',
name: 'count',
width: w * .04,
sortable: false,
align: 'left'
},
{
display: 'Slot start',
name: 'slot',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Slot end',
name: 'slot_end',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Number of appointment',
name: 'slot_count',
width: w * .12,
sortable: true,
align: 'left'
},
{
display: '',
name: '',
width: w * .10,
sortable: false,
align: 'left'
},
],
buttons: [
{
name: 'Add',
bclass: 'add',
onpress: add
},
{
separator: true
},
{
name: 'PDF',
bclass: 'print',
onpress: pdf
},
{
separator: true
},
{
name: 'Excel',
bclass: 'print_excel',
onpress: excel
},
{
separator: true
}
],
searchitems: [
{
display: 'slot',
name: 'slot',
isdefault: true
}
],
sortname: "slot_id",
sortorder: "asc",
usepager: true, //pagination
useRp: true,
rp: 50, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
//width: w,
height: h,
singleSelect: true
});
});
function add() {
$(".save_button").show();
$("#slot_id").val("");
$("#slot").val("");
$("#slot_count").val("");
$("#slot_end").val("");
$('#modal-add-job_profile').modal("show");
}
function pdf() {
window.open('appointment_Slot_pdf.php');
}
function excel() {
window.location = 'appointment_Slot_excel.php';
}
function delete_job_profile(job_profileId) {
$("#flex_slot_id").val(job_profileId);
BootstrapDialog.confirm('Are you sure to delete the Appointment Slot?', function(result) {
if (result) {
$.ajax({
url: 'delete_appointment_slot.php',
type: "POST",
data: $("#flex_form_slot").serialize(),
success: function(data) {
if (data.indexOf("SUCCESS") != -1) {
BootstrapDialog.alert('Appointment Slot Deleted Successfully.');
$("#flex1").flexReload();
} else {
BootstrapDialog.alert('Error Deleting Appointment Slot');
}
return;
},
error: function(data) {
BootstrapDialog.alert('Error Deleting Appointment Slot');
return;
}
});
}
});
}
function validate() {
save_job_profile();
}
function save_job_profile() {
$.ajax({
url: 'save_appointment_slots.php ',
type: "POST",
data: $("#job_profile_form").serialize(),
success: function(data) {
BootstrapDialog.alert('Appointment Slot Saved Successfully.');
$("#flex1").flexReload();
return;
},
error: function(data) {
BootstrapDialog.alert('Error Saving Appointment Slot');
return;
}
});
$('.close').click();
}
var job_profile_id = "";
function open_job_profile(job_profileId, action) {
if (action == "V") {
$(".save_button").hide();
} else {
$(".save_button").show();
}
$.ajax({
url: 'select_appointment_slot.php',
type: 'POST',
data: {
id: job_profileId
},
success: function(data) {
//alert(data);
data = $.parseJSON(data);
//alert(data.job_profile_name);
$("#slot_id").val(data.slot_id);
$("#slot").val(data.slot);
$("#slot_end").val(data.slot_end);
$("#slot_count").val(data.slot_count);
$('#modal-add-job_profile').modal("show");
},
error: function(data) {
BootstrapDialog.alert('Error Populating Appointment Slot');
return;
}
});
}
</script>
<?php include('techsyn_footer.php'); ?>
<?php include('form/add_appointment_slots.php'); ?>