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

244 lines
6.9 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="#">Company Setup</li><li class="active">Sub Section</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_sub_section">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_sub_section_id" id="flex_sub_section_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: 'sub_section_script.php',
dataType: 'json',
colModel: [
{display: 'Sr', name: 'count', width: w*.04, sortable: false, align: 'left'},
{display: 'Division', name: 'bu_id', width: w*.15, sortable: true, align: 'left'},
// {display: 'Department Name', name: 'dept_id', width: w*.150, sortable: true, align: 'left'},
// {display: 'Section Name', name: 'section_name', width: w*.15, sortable: true, align: 'left'},
{display: 'Station Name', name: 'sub_section_name', width: w*.15, sortable: true, align: 'left'},
{display: 'Station Head', name: 'sub_section_headname', width: w*.15, sortable: true, align: 'left'},
{display: 'Station Head Email', name: 'sub_section_headname', width: w*.15, 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: 'Station Name', name: 'sub_section_name', isdefault: true},
{display: 'Station Code', name: 'sub_section_code'}
],
sortname: "sub_section_name",
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_sub_section.php');
}
function excel(){
window.location = 'excel_sub_section.php';
}
function add(){
$(".save_button").show();
$("#sub_section_id").val("");
// $("#dept_id").val("");
// $("#dept_name").val("");
// $("#section_name").val("");
$("#sub_section_name").val("");
$("#head_name").val("");
$('#modal-add-sub_section').modal("show");
}
function delete_subsection(sectionId){
$("#flex_sub_section_id").val(sectionId);
BootstrapDialog.confirm('Are you sure to delete the Sub Section?', function(result){
if(result) {
$.ajax({
url : 'delete_sub_section.php',
type : "POST",
data : $("#flex_form_sub_section").serialize(),
success : function(data) {
if(data.indexOf("SUCCESS")!=-1){
BootstrapDialog.alert(' Sub Section Deleted Successfully.');
$("#flex1").flexReload();
}else{
BootstrapDialog.alert('Error Deleting Sub Section');
}
return;
},
error : function(data) {
BootstrapDialog.alert('Error Deleting Sub Section');
return;
}
});
}
});
}
function save_subsection(){
$.ajax({
url : 'save_sub_section.php',
type : "POST",
data : $("#sub_section_form").serialize(),
success : function(data) {
BootstrapDialog.alert(' Sub Section Saved Successfully');
$("#flex1").flexReload();
return;
},
error : function(data) {
BootstrapDialog.alert('Error Saving Sub Section');
return;
}
});
$('.close').click();
}
function open_subsection(sectionId, action) {
if(action=="V"){
$(".save_button").hide();
}else{
$(".save_button").show();
}
$.ajax({
url : 'select_sub_section.php?sectionId='+sectionId+' ',
type : 'POST',
success : function(data) {
var data = $.parseJSON(data);
$("#sub_section_id").val(data.sub_section_id);
$("#sub_section_name").val(data.sub_section_name);
$("#section_name").val(data.section_id);
$("#dept_name").val(data.dept_id);
$("#bu_id").val(data.bu_id);
$("#sub_section_head").val(data.sub_section_headname);
$("#sub_section_email").val(data.sub_section_email);
$('#modal-add-sub_section').modal("show");
},
error : function(data) {
BootstrapDialog.alert('Error Populating Section');
return;
}
});
}
// function loadSBUList(firm_id, selectId) {
// $("#"+selectId).empty();
// var o= new Option("","")
// $("#"+selectId).append(o);
// $.ajax({
// url : 'getDynamicData.php?tableName=sub_business_unit&where_clause_field=firm_id&where_clause_value='+firm_id,
// type : 'GET',
// success : function(data) {
// var data = $.parseJSON(data);
// for(i=0;i<data.length;i++){
// o= new Option(data[i].sbu_name,data[i].sbu_id)
// $("#"+selectId).append(o);
// }
// },
// error : function(data) {
// BootstrapDialog.alert('Error Populating Section');
// return;
// }
// });
// }
// function loadsectionlist(sbu_id, selectId) {
// $("#"+selectId).empty();
// $("#"+selectId).empty();
// var o= new Option("","")
// $.ajax({
// url : 'getDynamicData.php?tableName=section&where_clause_field=sbu_id&where_clause_value='+sbu_id,
// type : 'GET',
// success : function(data) {
// var data = $.parseJSON(data);
// for(i=0;i<data.length;i++){
// o= new Option(data[i].section_name,data[i].sbu_id)
// $("#"+selectId).append(o);
// }
// },
// error : function(data) {
// BootstrapDialog.alert('Error Populating Section');
// return;
// }
// });
// }
</script>
<?php include('techsyn_footer.php'); ?>
<?php include('form/add_sub_section.php');?>