298 lines
10 KiB
PHP
Executable File

<!--sidebar end-->
<!--main content start-->
<div class="app-content content">
<section class="content-wrapper">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-6">
<h3 class="font-weight-bold"><?php echo lang('Schedule'); ?></h3>
</div>
<div class="col-md-6 no-print pull-right">
<a data-toggle="modal" href="#myModal">
<div class="btn-group float-right">
<button id="" class="btn btn-info btn-min-width mr-1 mb-1">
<i class="fa fa-plus-circle"></i> <?php echo lang('add_new'); ?>
</button>
</div>
</a>
</div>
</div>
</div>
<hr class="mt-0 mb-0" />
<div class="card-content collapse show">
<div class="card-body card-dashboard">
<div class="panel-body">
<div class="adv-table editable-table ">
<div class="space15"></div>
<table class="table table-striped table-bordered dom-jQuery-events" id="editable-sample" cellspacing="0" width="100%">
<thead>
<tr>
<th>Sl.no</th>
<th>Weekday</th>
<th>From Time</th>
<th>To Time</th>
<th>status</th>
<th class="no-print">Actions</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!--main content end-->
<!--footer start-->
<div class="modal fade text-left" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"> <?php echo lang('Master Schedule'); ?></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form role="form" action="master_schedule/addnew" onsubmit="return validateForm()" class="clearfix" method="post" enctype="multipart/form-data">
<div class="form-group col-md-12">
<label for="exampleInputEmail1" class="required"><?php echo lang('Week day'); ?></label>
<select class="form-control" name="slot_week_day" id="slot_week_day">
<option value="" selected>Choose...</option>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednessday">Wednessday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
</select>
</div>
<div class="form-group col-md-6">
<label for="exampleInputEmail1" class="required"><?php echo lang('From Time'); ?></label>
<input type="time" class="form-control" name="slot_from_time" id="slot_from_time" value='' placeholder="">
<!-- </div>
<div class="col-md-6"> -->
<label for="exampleInputEmail1" class="required"><?php echo lang('To Time'); ?></label>
<input type="time" class="form-control" name="slot_to_time" id="slot_to_time" value='' placeholder="">
</div>
<section class="col-md-12" id="msg_rm">
</section>
<section class="col-md-12">
<button type="submit" name="submit" class="btn btn-info pull-right"><?php echo lang('submit'); ?></button>
</section>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- Add Patient Modal-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
function changeStatus(_this){
$(_this).attr("value", _this.checked ? 1 : 0);
var rid = $(_this).attr('attrid');
var fldval = $(_this).val();
$.ajax('master_schedule/statusChange', {
type: 'POST', // http method
data: { id: rid, val: fldval}, // data to submit
async: false,
success: function (data, status, xhr) {
// $('p').append('status: ' + status + ', data: ' + data);
},
error: function (jqXhr, textStatus, errorMessage) {
// $('p').append('Error' + errorMessage);
alert("error duc");
}
});
}
function validateConfirm(){
var r = confirm("Are you sure you want to delete this item?");
return r;
}
function validateForm(){
var fldval = $("#slot_week_day").val();
if(fldval == ""){
$("#msg_rm").html("<div class='alert alert-danger' role='alert'> Please select a weekday</div>");
return false;
}
// var fldval = $("#slot_name1").val();
// var msgs = '';
// $.ajax('master_schedule/duplicateCheck', {
// type: 'POST', // http method
// data: { val: fldval }, // data to submit
// async: false,
// success: function (data, status, xhr) {
// // $('p').append('status: ' + status + ', data: ' + data);
// // alert(data);
// msgs = data;
// },
// error: function (jqXhr, textStatus, errorMessage) {
// // $('p').append('Error' + errorMessage);
// alert("error duc");
// }
// });
// if(msgs == 'exist'){
// $("#msg_rm").html("<div class='alert alert-danger' role='alert'> Value already exist in the list</div>");
// return false;
// }
// else{
// return true;
// }
}
</script>
<script>
$(document).ready(function () {
var table = $('#editable-sample').DataTable({
responsive: true,
"processing": true,
"serverSide": true,
"searchable": true,
"ajax": {
url: "master_schedule/getList",
type: 'POST',
},
scroller: {
loadingIndicator: true
},
dom: "<'row'<'col-sm-5 data-table-pagelimit'l><'col-sm-6 data-table-search'f><'col-sm-1 text-center data-table-button-collection'B>>" +
"<'row'<'col-sm-12 data-table-body'tr>>" +
"<'row'<'col-sm-5 data-table-pagecountsummary'i><'col-sm-7 data-table-pagination'p>>",
buttons: [
{
extend: 'collection',
text: '...',
buttons: [
'copyHtml5',
'excelHtml5',
'csvHtml5',
'pdfHtml5',
{
extend: 'print',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6],
}
}
]
},
],
aLengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
],
iDisplayLength: 10,
"order": [[1, "asc"]],
"language": {
"lengthMenu": "_MENU_",
search: "_INPUT_",
"url": "common/assets/DataTables/languages/<?php echo $this->language; ?>.json"
}
});
table.buttons().container().appendTo('.custom_buttons');
});
</script>
<?php
if(isset($_SESSION['deleted'])){
?>
<script>
$(function(){
Swal.fire({
position: 'center',
icon: 'success',
title: 'Successfully Deleted',
showConfirmButton: false,
timer: 2000
})
})
</script>
<?php
}
?>
<?php
if(isset($_SESSION['edited'])){
?>
<script>
$(function(){
Swal.fire({
position: 'center',
icon: 'success',
title: 'Successfully Edited',
showConfirmButton: false,
timer: 2000
})
})
</script>
<?php
}
?>
<?php
if(isset($_SESSION['added'])){
?>
<script>
$(function(){
Swal.fire({
position: 'center',
icon: 'success',
title: 'Successfully Added',
showConfirmButton: false,
timer: 2000
})
})
</script>
<?php
}
?>