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

315 lines
9.3 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="#">Master</li>
<li class="active">Client</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<div id="flexigridDiv" class="table-responsive">
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="pdf_action" id="pdf_action" value="pdf_contractor_list.php" />
<input type="hidden" name="excel_action" id="excel_action" value="excel_contractor_list.php" />
</form>
<form name="f1" method="post" action="" id="flex_form_patient">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_patient_id" id="flex_patient_id" />
</form>
</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: 'client_list_script.php',
dataType: 'json',
colModel: [{
display: 'Sr',
name: 'count',
width: w * .04,
sortable: false,
align: 'left'
},
{
display: '',
name: '',
width: w * .1,
sortable: false,
align: 'left'
},
{
display: 'Client Name',
name: 'client_name',
width: w * .2,
sortable: true,
align: 'left'
},
{
display: 'Contact',
name: 'contact',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Email',
name: 'email',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Remarks',
name: 'remarks',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Last Modified',
name: 'last_modified',
width: w * .12,
sortable: true,
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: 'Client Name',
name: 'client_name',
isdefault: true
},
{
display: 'Client Contact',
name: 'client_contact',
isdefault: true
},
{
display: 'Client Email',
name: 'client_email',
isdefault: true
},
{
display: 'Remarks',
name: 'remarks',
isdefault: true
}
],
sortname: "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();
$("#id").val("");
$("#client_name").val("");
$("#client_location").val("");
$('#client_location').trigger('chosen:updated');
$("#client_contact").val("");
$("#client_email").val("");
$("#remarks").val("");
$('#modal-add-client').modal("show");
}
function save_client() {
$.ajax({
url: 'save_client.php',
type: "POST",
data: $("#client_form").serialize(),
success: function(data) {
BootstrapDialog.alert('Client Saved Successfully.');
$("#flex1").flexReload();
return;
},
error: function(data) {
BootstrapDialog.alert('Error In Saving Client');
return;
}
});
$('.close').click();
}
function excel() {
window.open('client_list_excel.php');
}
function pdf() {
window.open('client_list_pdf.php');
}
function open_employer_contractor(id, action) {
if (action == "V") {
$(".save_button").hide();
} else {
$(".save_button").show();
}
$.ajax({
url: 'select_client_master.php',
type: 'POST',
data: {
id: id
},
dataType: 'json',
success: function(data) {
$("#id").val(data.id);
$("#client_name").val(data.client_name);
$("#client_contact").val(data.client_contact);
if (data.client_location != null) {
var client_location = data.client_location
dataarray = client_location.split(",");
$("#client_location").val(dataarray);
$('#client_location').trigger('chosen:updated');
}
$("#client_email").val(data.client_email);
$("#remarks").val(data.remarks);
$("#modified_by").val(data.modified_by);
$('#modal-add-client').modal("show");
},
error: function(data) {
BootstrapDialog.alert('Error Populating Patient Category');
return;
}
});
}
function delete_employer_contractor(id) {
BootstrapDialog.confirm('Are you sure to delete the Client?', function(result) {
if (result) {
$.ajax({
url: 'delete_client_master.php',
data: {
id: id
},
type: 'POST',
dataType: 'json',
success: function(data) {
if (data == 'SUCCESS') {
BootstrapDialog.alert('Deleted Client Details Successfully');
$("#flex1").flexReload();
return;
}
},
error: function(data) {
BootstrapDialog.alert('Error deleting Details ');
return;
}
});
}
});
}
</script>
<?php include('techsyn_footer.php'); ?>
<?php include('form/client_master_form.php'); ?>