257 lines
7.8 KiB
PHP
257 lines
7.8 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">Program Subject</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_program_subject_list.php" />
|
|
<input type="hidden" name="excel_action" id="excel_action" value="excel_program_subject_list.php" />
|
|
</form>
|
|
|
|
<form name="f1" method="post" action="" id="flex_form_program_subject">
|
|
<div id="flex1" style="width:100%">
|
|
</div>
|
|
<input type="hidden" name="flex_program_subject_id" id="flex_program_subject_id" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div><!-- /.page-content -->
|
|
</div>
|
|
</div><!-- /.main-content -->
|
|
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
var w = screen.width * .90;
|
|
var h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
|
|
|
|
$("#flex1").flexigrid({
|
|
url: 'program_script.php',
|
|
dataType: 'json',
|
|
colModel: [
|
|
{
|
|
display: 'Sr no.',
|
|
name: 'count',
|
|
width: w * .04,
|
|
sortable: false,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Program Name',
|
|
name: 'program_name',
|
|
width: w * .2,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Subject Name',
|
|
name: 'subject_name',
|
|
width: w * .2,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Max Marks',
|
|
name: 'max_marks',
|
|
width: w * .15,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Passing Marks',
|
|
name: 'passing_marks',
|
|
width: w * .15,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: '',
|
|
name: '',
|
|
width: w * .1,
|
|
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: 'Program Name',
|
|
name: 'program_name',
|
|
isdefault: true
|
|
},
|
|
{
|
|
display: 'Subject Name',
|
|
name: 'subject_name',
|
|
isdefault: true
|
|
},
|
|
],
|
|
sortname: "subject_id",
|
|
sortorder: "asc",
|
|
usepager: true, //pagination
|
|
useRp: true,
|
|
rp: 50, //records per page
|
|
showTableToggleBtn: false, //toggle button for the whole table
|
|
resizable: true,
|
|
height: h,
|
|
singleSelect: true
|
|
});
|
|
});
|
|
|
|
function excel() {
|
|
window.open('excel_program.php', 'Program Subject List');
|
|
}
|
|
|
|
function pdf() {
|
|
window.open('pdf_program.php', 'Program Subject List');
|
|
}
|
|
|
|
function add() {
|
|
$(".save_button").show();
|
|
$("#program_id").val("");
|
|
$("#program_name").val("");
|
|
$("#subject_name").val("");
|
|
$("#max_marks").val("");
|
|
$("#passing_marks").val("");
|
|
|
|
$("#program_name").prop('disabled', false);
|
|
$("#subject_name").prop('disabled', false);
|
|
$("#max_marks").prop('disabled', false);
|
|
$("#passing_marks").prop('disabled', false);
|
|
|
|
$('#modal-add-program').modal("show");
|
|
}
|
|
|
|
function delete_section(subject_id) {
|
|
$("#flex_program_subject_id").val(subject_id);
|
|
|
|
BootstrapDialog.confirm('Are you sure to delete the program subject?', function(result) {
|
|
if (result) {
|
|
$.ajax({
|
|
url: 'delete_program.php',
|
|
type: "POST",
|
|
data: $("#flex_form_program_subject").serialize(),
|
|
success: function(data) {
|
|
if (data.indexOf("SUCCESS") != -1) {
|
|
BootstrapDialog.alert('Program Subject Deleted Successfully.');
|
|
$("#flex1").flexReload();
|
|
} else {
|
|
BootstrapDialog.alert('Error Deleting Program Subject');
|
|
}
|
|
return;
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Deleting Program Subject');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function save_section() {
|
|
$.ajax({
|
|
url: 'save_program.php',
|
|
type: "POST",
|
|
data: $("#program_form").serialize(),
|
|
success: function(data) {
|
|
BootstrapDialog.alert('Program Subject Saved Successfully.');
|
|
$("#flex1").flexReload();
|
|
return;
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Saving Program Subject');
|
|
return;
|
|
}
|
|
});
|
|
$('.close').click();
|
|
}
|
|
|
|
function open_section(subject_id, action) {
|
|
|
|
if (action == "V") {
|
|
$(".save_button").hide();
|
|
$("#program_name").prop('disabled', true);
|
|
$("#subject_name").prop('disabled', true);
|
|
$("#max_marks").prop('disabled', true);
|
|
$("#passing_marks").prop('disabled', true);
|
|
} else {
|
|
$("#program_name").prop('disabled', false);
|
|
$("#subject_name").prop('disabled', false);
|
|
$("#max_marks").prop('disabled', false);
|
|
$("#passing_marks").prop('disabled', false);
|
|
$(".save_button").show();
|
|
}
|
|
|
|
$.ajax({
|
|
url: 'select_program.php?subject_id=' + subject_id,
|
|
type: 'POST',
|
|
success: function(data) {
|
|
var data = $.parseJSON(data);
|
|
console.log(data); // Log the data for debugging
|
|
if (data.message !== "Data not found!") {
|
|
$("#subject_id").val(data.subject_id);
|
|
$("#program_name").val(data.program_name);
|
|
$("#subject_name").val(data.subject_name);
|
|
$("#max_marks").val(data.max_marks);
|
|
$("#passing_marks").val(data.passing_marks);
|
|
$('#modal-add-program').modal("show");
|
|
} else {
|
|
BootstrapDialog.alert(data.message);
|
|
}
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Populating Program Subject Details');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<?php include('add_program.php'); ?>
|