ohctech_p8/task_header_master.php
2024-10-16 19:18:52 +05:30

218 lines
6.0 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="#">Task List</li>
<!-- <li class="#">Company Setup</li> -->
<li class="active">Task Header Master</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_task">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_task_id" id="flex_task_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: 'task_header_script.php',
dataType: 'json',
colModel: [{
display: 'Sr',
name: 'count',
width: w * .04,
sortable: false,
align: 'left'
},
{
display: 'task Name',
name: 'task_name_header',
width: w * .2,
sortable: true,
align: 'left'
},
{
display: '',
name: '',
width: w * .2,
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: 'task Name',
name: 'task_name_header',
isdefault: true
},
],
sortname: "task_id_header",
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 pdf() {
window.open('pdf_task.php');
}
function excel() {
window.location = 'excel_task.php';
}
function add() {
$(".save_button").show();
$("#task_id_header").val("");
$("#task_name_header").val("");
$('#modal-add-task-header').modal("show");
}
function delete_task(taskId) {
$("#flex_task_id").val(taskId);
BootstrapDialog.confirm('Are you sure to delete the task?', function (result) {
if (result) {
$.ajax({
url: 'delete_task_header.php',
type: "POST",
data: $("#flex_form_task").serialize(),
success: function (data) {
if (data.indexOf("SUCCESS") != -1) {
BootstrapDialog.alert('task Deleted Successfully.');
$("#flex1").flexReload();
} else {
BootstrapDialog.alert('Error Deleting task');
}
return;
},
error: function (data) {
BootstrapDialog.alert('Error Deleting task');
return;
}
});
}
});
}
function save_task() {
$.ajax({
url: 'save_task_header.php ',
type: "POST",
data: $("#task_header_form").serialize(),
success: function (data) {
BootstrapDialog.alert('task Saved Successfully.');
$("#flex1").flexReload();
return;
},
error: function (data) {
BootstrapDialog.alert('Error Saving task');
return;
}
});
$('.close').click();
}
function open_task(taskId, action) {
if (action == "V") {
$(".save_button").hide();
} else {
$(".save_button").show();
}
$.ajax({
url: 'select_task_header.php?taskId=' + taskId + ' ',
type: 'POST',
success: function (data) {
var data = $.parseJSON(data);
$("#task_id_header").val(data.task_id_header);
$("#task_name_header").val(data.task_name_header);
$('#modal-add-task-header').modal("show");
},
error: function (data) {
BootstrapDialog.alert('Error Populating task');
return;
}
});
}
</script>
<?php include ('techsyn_footer.php'); ?>
<?php include ('form/add_task_header.php'); ?>