1076 lines
44 KiB
PHP
1076 lines
44 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>
|
|
<i class="ace-icon fa fa-home home-icon"></i>
|
|
<a href="#">Home</a>
|
|
</li>
|
|
<li class="#">Program's</li>
|
|
</ul>
|
|
|
|
</div>
|
|
<!-- End of breadcrumb -->
|
|
<?php
|
|
$csr_id = $_REQUEST['csr_id'];
|
|
$sqlSelect = "SELECT * FROM csr_program where csr_id = '$csr_id'";
|
|
$querySELECT = mysqli_query($conn, $sqlSelect);
|
|
$fetchCSR = mysqli_fetch_assoc($querySELECT);
|
|
@extract($fetchCSR);
|
|
?>
|
|
|
|
<div class="page-content">
|
|
<div class="box box-primary" style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; ">
|
|
<form id="PRC_form" method="post">
|
|
<!-- box-body-->
|
|
<div class="box-body">
|
|
<input type="hidden" name="csr_id" id="csr_id" value="<?php echo $csr_id ?>">
|
|
<input type="hidden" name="emailPart" id="emailPart" value="YES">
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label>Program Name</label>
|
|
<input type="text" class="form-control" name="program_name" id="program_name" value="<?php echo $program_name ?>" placeholder="Enter Program Name">
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label>Program Code</label>
|
|
<input type="text" class="form-control" name="program_code" id="program_code" value="<?php echo $program_code ?>" placeholder="Enter Program Code">
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label>Program Details</label>
|
|
<input type="text" class="form-control" name="program_details" id="program_details" value="<?php echo $program_details ?>" placeholder="Enter Program Details">
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label>Program Active Location</label>
|
|
<select class="form-control chosen-select" multiple name="program_location[]" id="program_location" placeholder="Enter Program Location">
|
|
<?php echo generateOptionWithWhereClause('ohc_type', 'ohc_type_name', 'ohc_type_id', '', '', 'ohc_category', '"IP"'); ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<br>
|
|
<div class="row">
|
|
<!-- <div class="col-sm-3">
|
|
<label>Start Date</label>
|
|
<input type="datetime-local" class="form-control" name="start_date_time" value="<?php echo $start_date_time ?>" id="start_date_time">
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label>End Date Time</label>
|
|
<input type="datetime-local" class="form-control" name="end_date_time" value="<?php echo $end_date_time ?>" id="end_date_time">
|
|
</div> -->
|
|
<div class="col-sm-3">
|
|
<label>Purpose</label>
|
|
<input type="text" class="form-control" name="purpose" id="purpose" value="<?php echo $purpose ?>" placeholder="Enter Program Details">
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label>Coordinator Name</label>
|
|
<input type="text" class="form-control" name="coordinator" id="coordinator" value="<?php echo $coordinator_name ?>" placeholder="Enter Coordinator Name">
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label>Sub-Coordinator Name</label>
|
|
<input type="text" class="form-control" name="sub_coordinator" value="<?php echo $sub_coordinator_name ?>" id="sub_coordinator" placeholder="Enter Sub-Coordinator Name">
|
|
</div>
|
|
|
|
</div>
|
|
<br>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<label>Including Activity</label>
|
|
<select class="form-control chosen-select" multiple name="activity[]" id="activity" placeholder="Enter Select Activity">
|
|
<?php echo generateOptionWithWhereClause('program_master', 'program_name', 'program_id', '', '', 'program_status', '"Active"'); ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="row">
|
|
|
|
<div class="col-sm-3">
|
|
<label>Request Budget</label>
|
|
<input type="number" class="form-control" name="total_budget" id="total_budget">
|
|
<div id="budget_alert" style="color: red; display: none;">For the year 2024, the budget cannot exceed 100,000.</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-3">
|
|
<label>Target Beneficiary Count</label>
|
|
<input type="number" class="form-control" name="target_beneficiary_count" value="<?php echo $target_beneficiary_count ?>" id="target_beneficiary_count" placeholder="Target Beneficiary Count">
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label>Remarks</label>
|
|
<textarea placeholder="Enter Remarks" class="form-control" name="remarks" id="remarks"><?php echo $remarks ?></textarea>
|
|
</div>
|
|
</div> -->
|
|
<br>
|
|
<?php
|
|
// if($_SESSION['RoleCode']!='DISC' && $_SESSION['RoleCode']!='TRAC') {
|
|
?>
|
|
<!-- <div class="row">
|
|
<div class="col-sm-3">
|
|
<label>Approval Date</label>
|
|
<input type="date" class="form-control" name="approval_date_time" value="<?php echo $approval_date_time ?>" id="approval_date_time">
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label>Total Approved Budget</label>
|
|
<input type="number" class="form-control" name="approved_total_budget" id="approved_total_budget" value="<?php if (isset($approved_total_budget)) echo $approved_total_budget;
|
|
else echo $total_budget; ?>" placeholder="Enter Program Details">
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-3">
|
|
<label>Approved Target Beneficiary Count</label>
|
|
<input type="number" class="form-control" name="approved_target_beneficiary_count" value="<?php if (isset($approved_target_beneficiary_count)) echo $approved_target_beneficiary_count;
|
|
else echo $target_beneficiary_count ?>" id="approved_target_beneficiary_count" placeholder="Target Beneficiary Count">
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label>Approver Remarks</label>
|
|
<textarea placeholder="Enter Remarks" class="form-control" name="approver_remarks" id="approver_remarks"><?php echo $approver ?></textarea>
|
|
</div>
|
|
</div>
|
|
<br> -->
|
|
<?php
|
|
// }
|
|
?>
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label>Type</label>
|
|
|
|
<select class="form-control" name="type" id="type">
|
|
<option value="CSR" <?php if ($type == 'CSR') { ?>selected<?php } ?>>
|
|
CSR Program
|
|
</option>
|
|
|
|
<option value="TRA" <?php if ($type == 'TRA') { ?>selected<?php } ?>>
|
|
Training Program
|
|
</option>
|
|
|
|
</select>
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-3">
|
|
<label for="saleing">Saleing/issuing Items</label>
|
|
<select class="form-control " name="saleing" onchange="" id="saleing" >
|
|
<option disabled selected>Please select Saleing Status</option>
|
|
<option value="Y" <?php if ($saleing == 'Y') { ?>selected<?php } ?>>Yes</option>
|
|
<option value="N" <?php if ($saleing == 'N') { ?>selected<?php } ?>>No</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label>Status</label>
|
|
|
|
<select class="form-control" name="status" id="status">
|
|
<option value="Active" <?php if ($status == 'Active') { ?>selected<?php } ?>>
|
|
Active
|
|
</option>
|
|
<option value="Inactive" <?php if ($status == 'Inactive') { ?>selected<?php } ?>>
|
|
Inactive
|
|
</option>
|
|
|
|
|
|
</select>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<br>
|
|
<br>
|
|
|
|
|
|
</div>
|
|
|
|
<!-- End box-body-->
|
|
<!--box-footer-->
|
|
<div class="widget-toolbox padding-8 clearfix">
|
|
<!--
|
|
<button class="btn btn-success save_button" id="save_button" type="button" onclick="validate();">
|
|
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
|
|
Save & Forward
|
|
</button> -->
|
|
<button class="btn btn-success save_button" id="save_button" type="button" onclick="validate();">
|
|
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
|
|
Save
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-danger " data-dismiss="modal" onclick="window.location='csr_pro_list.php'"><i class="ace-icon fa fa-times bigger-110"></i>Back</button>
|
|
|
|
</div>
|
|
<!--End box-footer-->
|
|
|
|
</form>
|
|
<br>
|
|
<br>
|
|
<?php
|
|
// include 'support_csr_document.php'
|
|
?>
|
|
<?php
|
|
// include 'image_popup_csr.php'
|
|
?>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
function delete_client_location(id) {
|
|
BootstrapDialog.confirm('Are you sure to delete?', function(result) {
|
|
$.ajax({
|
|
url: 'delete_client_location_list.php',
|
|
data: {
|
|
id: id
|
|
},
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
|
|
if (data == 'SUCCESS') {
|
|
|
|
BootstrapDialog.alert('Deleted client location Successfully');
|
|
$("#flex1").flexReload();
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error deleting client location');
|
|
return;
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
function show_save_button() {
|
|
$("#save_button").show();
|
|
$("")
|
|
}
|
|
|
|
|
|
function open_frequency(id, access) {
|
|
if (access == 'V') {
|
|
$("#save_button").hide()
|
|
} else if (access == 'E')
|
|
$("#save_button").show()
|
|
|
|
$.ajax({
|
|
url: 'select_client_location.php',
|
|
data: {
|
|
id: id
|
|
},
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
console.log(data.client_name);
|
|
$("#client_name").val(data.client_id);
|
|
$("#client_id").val(data.client_id);
|
|
$("#client_location_id").val(data.client_location_id);
|
|
$("#client_location0").val(data.client_location);
|
|
$("#id0").val(data.id);
|
|
$("#client_city0").val(data.client_city);
|
|
$("#client_state0").val(data.client_state);
|
|
$("#client_contact0").val(data.client_contact);
|
|
$("#client_email0").val(data.client_email);
|
|
// $(".select2").select2();
|
|
// $('#modal-add-frequency-form').modal("show");
|
|
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Populating client location');
|
|
return;
|
|
}
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
function pdf() {
|
|
window.open('client_location_pdf.php', 'Task Frequency List');
|
|
}
|
|
|
|
function excel() {
|
|
window.open('client_location_excel.php', 'Task Frequency List');
|
|
}
|
|
|
|
function myDateFormat(date) {
|
|
|
|
var d = new Date(date);
|
|
var day = d.getDate();
|
|
var m = d.getMonth() + 1;
|
|
var y = d.getFullYear();
|
|
|
|
|
|
return day + "-" + m + "-" + y;
|
|
|
|
|
|
}
|
|
</script>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- End of page-content -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function findMiddleYear(startDateStr, endDateStr) {
|
|
var startDate = new Date(startDateStr);
|
|
var endDate = new Date(endDateStr);
|
|
|
|
var startYear = startDate.getFullYear();
|
|
var endYear = endDate.getFullYear();
|
|
|
|
var middleYear = Math.floor((startYear + endYear) / 2);
|
|
|
|
var midpointDate = new Date((startYear + endYear) / 2, 0, 1);
|
|
|
|
if (endDate < midpointDate) {
|
|
middleYear--;
|
|
}
|
|
|
|
return middleYear;
|
|
}
|
|
|
|
// function validateBudget() {
|
|
// var startDateStr = document.getElementById('start_date_time').value;
|
|
// var endDateStr = document.getElementById('end_date_time').value;
|
|
// var totalBudget = parseFloat(document.getElementById('total_budget').value);
|
|
// var budgetAlert = document.getElementById('budget_alert');
|
|
|
|
// if (startDateStr && endDateStr && !isNaN(totalBudget)) {
|
|
// var middleYear = findMiddleYear(startDateStr, endDateStr);
|
|
|
|
// if (middleYear === 2024 && totalBudget > 100000) {
|
|
// budgetAlert.style.display = 'block';
|
|
// } else {
|
|
// budgetAlert.style.display = 'none';
|
|
// }
|
|
// } else {
|
|
// budgetAlert.style.display = 'none';
|
|
// }
|
|
// }
|
|
|
|
// document.getElementById('start_date_time').addEventListener('input', validateBudget);
|
|
// document.getElementById('end_date_time').addEventListener('input', validateBudget);
|
|
// document.getElementById('total_budget').addEventListener('input', validateBudget);
|
|
|
|
|
|
function validate() {
|
|
|
|
|
|
|
|
var program_name = $('#program_name').val();
|
|
console.log(program_name);
|
|
if (program_name == "" || program_name == null) {
|
|
BootstrapDialog.alert('Please Enter Program Name.!!!');
|
|
return false;
|
|
}
|
|
|
|
var program_code = $('#program_code').val();
|
|
console.log(program_code);
|
|
if (program_code == "" || program_code == null) {
|
|
BootstrapDialog.alert('Please Enter Program Code.!!!');
|
|
return false;
|
|
}
|
|
|
|
var program_location = $('#program_location').val();
|
|
console.log(program_location);
|
|
if (program_location == "" || program_location == null) {
|
|
BootstrapDialog.alert('Please Enter Program Active Location.!!!');
|
|
return false;
|
|
}
|
|
|
|
var activity = $('#activity').val();
|
|
console.log(activity);
|
|
if (activity == "" || activity == null) {
|
|
BootstrapDialog.alert('Please Enter Program Including Activity.!!!');
|
|
return false;
|
|
}
|
|
// var count = $("#count_items").val();
|
|
// for (let i = 0; i < count; i++) {
|
|
// var participate_nameone = $('#participate_nameone'+i).val();
|
|
// var participate_nametwo = $('#participate_nametwo'+i).val();
|
|
// if (participate_nameone == '') {
|
|
// BootstrapDialog.alert('Enter client location.!!!');
|
|
// return false;
|
|
// }
|
|
// }
|
|
|
|
|
|
// var count = $("#count_items").val();
|
|
// for (let i = 0; i < count; i++) {
|
|
// var client_city = $('#client_city'+i).val();
|
|
// if (client_city == null) {
|
|
// BootstrapDialog.alert('select client city.!!!');
|
|
// return false;
|
|
// }
|
|
// }
|
|
|
|
// var count = $("#count_items").val();
|
|
// for (let i = 0; i < count; i++) {
|
|
// var client_state = $('#client_state'+i).val();
|
|
// if (client_state == null) {
|
|
// BootstrapDialog.alert('select client state.!!!');
|
|
// return false;
|
|
// }
|
|
// }
|
|
|
|
|
|
// var count = $("#count_items").val();
|
|
// for (let i = 0; i < count; i++) {
|
|
// var client_contact = $('#client_contact'+i).val();
|
|
// if (client_contact == '') {
|
|
// BootstrapDialog.alert('Enter client contact.!!!');
|
|
// return false;
|
|
// }
|
|
// }
|
|
|
|
|
|
// var count = $("#count_items").val();
|
|
// for (let i = 0; i < count; i++) {
|
|
// var client_email = $('#client_email'+i).val();
|
|
// if (client_email == '') {
|
|
// BootstrapDialog.alert('Enter client email.!!!');
|
|
// return false;
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
// var client_name = ("#client_name").val();
|
|
// if (client_name == '') {
|
|
// BootstrapDialog.alert("Enter select client Name");
|
|
// return false;
|
|
// }
|
|
// var count = $("#count_items").val();
|
|
// alert(count);
|
|
// for (let i = 0; i < count; i++) {
|
|
// let client_location = ("#client_location"+i).val();
|
|
// if (client_location == null) {
|
|
// BootstrapDialog.alert("Enter Client Location");
|
|
// return false;
|
|
// }
|
|
// }
|
|
|
|
// for (let i = 0; i < count; i++) {
|
|
// let client_city = ("#client_city"+i).val();
|
|
// if (client_city == null) {
|
|
// BootstrapDialog.alert("Enter Client City");
|
|
// return false;
|
|
// }
|
|
// }
|
|
|
|
// for (let i = 0; i < count; i++) {
|
|
// let client_state = ("client_state"+i).val();
|
|
// if (client_state == null) {
|
|
// BootstrapDialog.alert("Enter Client State");
|
|
// return false;
|
|
// }
|
|
// }
|
|
save();
|
|
}
|
|
|
|
|
|
// window.onload=checkMulti();
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<script type="text/javascript">
|
|
$('.select2').select2()
|
|
// jQuery(function($) {
|
|
|
|
// var myTable =
|
|
// $('#dynamic-table')
|
|
|
|
// .DataTable({
|
|
// bAutoWidth: false,
|
|
// "aoColumns": [{
|
|
// "bSortable": false
|
|
// },
|
|
// null, null, null, null, null,
|
|
// {
|
|
// "bSortable": false
|
|
// }
|
|
// ],
|
|
// "aaSorting": [],
|
|
|
|
|
|
|
|
|
|
|
|
// select: {
|
|
// style: 'multi'
|
|
// }
|
|
// });
|
|
|
|
|
|
|
|
|
|
// var defaultCopyAction = myTable.button(1).action();
|
|
// myTable.button(1).action(function(e, dt, button, config) {
|
|
// defaultCopyAction(e, dt, button, config);
|
|
// $('.dt-button-info').addClass('gritter-item-wrapper gritter-info gritter-center white');
|
|
// });
|
|
|
|
|
|
// var defaultColvisAction = myTable.button(0).action();
|
|
// myTable.button(0).action(function(e, dt, button, config) {
|
|
|
|
// defaultColvisAction(e, dt, button, config);
|
|
|
|
|
|
// if ($('.dt-button-collection > .dropdown-menu').length == 0) {
|
|
// $('.dt-button-collection')
|
|
// .wrapInner('<ul class="dropdown-menu dropdown-light dropdown-caret dropdown-caret" />')
|
|
// .find('a').attr('href', '#').wrap("<li />")
|
|
// }
|
|
// $('.dt-button-collection').appendTo('.tableTools-container .dt-buttons')
|
|
// });
|
|
|
|
|
|
|
|
// setTimeout(function() {
|
|
// $($('.tableTools-container')).find('a.dt-button').each(function() {
|
|
// var div = $(this).find(' > div').first();
|
|
// if (div.length == 1) div.tooltip({
|
|
// container: 'body',
|
|
// title: div.parent().text()
|
|
// });
|
|
// else $(this).tooltip({
|
|
// container: 'body',
|
|
// title: $(this).text()
|
|
// });
|
|
// });
|
|
// }, 500);
|
|
|
|
|
|
|
|
|
|
|
|
// myTable.on('select', function(e, dt, type, index) {
|
|
// if (type === 'row') {
|
|
// $(myTable.row(index).node()).find('input:checkbox').prop('checked', true);
|
|
// }
|
|
// });
|
|
// myTable.on('deselect', function(e, dt, type, index) {
|
|
// if (type === 'row') {
|
|
// $(myTable.row(index).node()).find('input:checkbox').prop('checked', false);
|
|
// }
|
|
// });
|
|
|
|
|
|
|
|
|
|
// $('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);
|
|
|
|
|
|
// $('#dynamic-table > thead > tr > th input[type=checkbox], #dynamic-table_wrapper input[type=checkbox]').eq(
|
|
// 0).on('click', function() {
|
|
// var th_checked = this.checked;
|
|
|
|
// $('#dynamic-table').find('tbody > tr').each(function() {
|
|
// var row = this;
|
|
// if (th_checked) myTable.row(row).select();
|
|
// else myTable.row(row).deselect();
|
|
// });
|
|
// });
|
|
|
|
|
|
// $('#dynamic-table').on('click', 'td input[type=checkbox]', function() {
|
|
// var row = $(this).closest('tr').get(0);
|
|
// if (this.checked) myTable.row(row).deselect();
|
|
// else myTable.row(row).select();
|
|
// });
|
|
|
|
|
|
|
|
// $(document).on('click', '#dynamic-table .dropdown-toggle', function(e) {
|
|
// e.stopImmediatePropagation();
|
|
// e.stopPropagation();
|
|
// e.preventDefault();
|
|
// });
|
|
|
|
|
|
|
|
|
|
// var active_class = 'active';
|
|
// $('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function() {
|
|
// var th_checked = this.checked;
|
|
|
|
// $(this).closest('table').find('tbody > tr').each(function() {
|
|
// var row = this;
|
|
// if (th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0)
|
|
// .prop('checked', true);
|
|
// else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop(
|
|
// 'checked', false);
|
|
// });
|
|
// });
|
|
|
|
// $('#simple-table').on('click', 'td input[type=checkbox]', function() {
|
|
// var $row = $(this).closest('tr');
|
|
// if ($row.is('.detail-row ')) return;
|
|
// if (this.checked) $row.addClass(active_class);
|
|
// else $row.removeClass(active_class);
|
|
// });
|
|
|
|
|
|
|
|
|
|
// $('[data-rel="tooltip"]').tooltip({
|
|
// placement: tooltip_placement
|
|
// });
|
|
|
|
|
|
// function tooltip_placement(context, source) {
|
|
// var $source = $(source);
|
|
// var $parent = $source.closest('table')
|
|
// var off1 = $parent.offset();
|
|
// var w1 = $parent.width();
|
|
|
|
// var off2 = $source.offset();
|
|
|
|
|
|
// if (parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
|
|
// return 'left';
|
|
// }
|
|
|
|
|
|
|
|
|
|
// /***************/
|
|
// $('.show-details-btn').on('click', function(e) {
|
|
// e.preventDefault();
|
|
// $(this).closest('tr').next().toggleClass('open');
|
|
// $(this).find(ace.vars['.icon']).toggleClass('fa-angle-double-down').toggleClass(
|
|
// 'fa-angle-double-up');
|
|
// });
|
|
// /***************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// })
|
|
|
|
function save() {
|
|
$.ajax({
|
|
url: 'save_csr_form.php',
|
|
type: "POST",
|
|
data: $("#PRC_form").serialize(),
|
|
success: function(data) {
|
|
// alert(data);
|
|
BootstrapDialog.alert('Program Saved Successfully.');
|
|
$("#client_name").val("");
|
|
|
|
$("#flex1").flexReload();
|
|
setTimeout(function() {
|
|
window.location = "csr_pro_list.php";
|
|
}, 2000);
|
|
return;
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Saving CSR Program');
|
|
return;
|
|
}
|
|
});
|
|
$('.close').click();
|
|
// location.href="procurement_list.php";
|
|
}
|
|
$('.date-picker').datepicker({
|
|
autoclose: true,
|
|
format: 'dd/mm/yyyy'
|
|
}).next().on(ace.click_event, function() {
|
|
$(this).prev().focus();
|
|
});
|
|
</script>
|
|
<!-- bootstrap & fontawesome -->
|
|
<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
|
|
|
|
<!-- page specific plugin styles -->
|
|
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
|
|
<link rel="stylesheet" href="assets/css/chosen.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css" />
|
|
<script type="text/javascript" src="js/typeahead.bundle.js"></script>
|
|
<script src="assets/js/jquery-ui.custom.min.js"></script>
|
|
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
|
|
<script src="assets/js/chosen.jquery.min.js"></script>
|
|
<script src="assets/js/spinbox.min.js"></script>
|
|
<script src="assets/js/bootstrap-datepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-timepicker.min.js"></script>
|
|
<script src="assets/js/jquery.dataTables.min.js"></script>
|
|
<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
|
|
<script src="assets/js/dataTables.buttons.min.js"></script>
|
|
<script src="assets/js/buttons.flash.min.js"></script>
|
|
<script src="assets/js/buttons.html5.min.js"></script>
|
|
<script src="assets/js/buttons.print.min.js"></script>
|
|
<script src="assets/js/buttons.colVis.min.js"></script>
|
|
<script src="assets/js/dataTables.select.min.js"></script>
|
|
|
|
|
|
<script src="assets/js/moment.min.js"></script>
|
|
<script src="assets/js/daterangepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
|
|
<script src="assets/js/jquery.knob.min.js"></script>
|
|
<script src="assets/js/autosize.min.js"></script>
|
|
<script src="assets/js/jquery.inputlimiter.min.js"></script>
|
|
<script src="assets/js/jquery.maskedinput.min.js"></script>
|
|
<script src="assets/js/bootstrap-tag.min.js"></script>
|
|
<script src="assets/js/ace-elements.min.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
// $("#participant2").hide();
|
|
var counter = $("#count_items").val();
|
|
//alert (counter);
|
|
// $("#addrow").on("click", function() {
|
|
// var newRow = $("<tr>");
|
|
// var cols = "";
|
|
// cols += "<td><select onchange='SelectPart(this.value," + counter +
|
|
// ")' class='form-control select2' name='participate_type" + counter +
|
|
// "' id='participate_type" + counter +
|
|
// "'><option selected disabled>PLEASE SELECT OPTION</option><option value='e'>Employee</option><option value='g'>Guest</option></select></td>";
|
|
// cols +=
|
|
// "<td><input placeholder='Enter Participate Name' type='text' name='participate_nameone" +
|
|
// counter + "' id='participate_nameone" + counter +
|
|
// "' class='form-control' /><select class='form-control' style='display: none;' name='participate_nametwo" +
|
|
// counter + "' id='participate_nametwo" + counter +
|
|
// "'><option selected disabled>PLEASE SELECT OPTION</option><?php
|
|
// echo generateOption('patient_master', 'patient_name', 'id', $row['patient_id'], '');
|
|
?></select></td>";
|
|
// cols += "<td><input placeholder='Enter Address' type='text' name='address" + counter +
|
|
// "' id='address" + counter + "' class='form-control' /></td>";
|
|
// cols += '<td><input placeholder="Enter Phone No" type="number" name="contact' + counter +
|
|
// '" id="contact' + counter + '" class="form-control" /></td>';
|
|
// cols += '<td><input placeholder="Enter Vitals" type="text" name="vitals' + counter +
|
|
// '" id="vitals' + counter + '" class="form-control" /></td>';
|
|
// // cols += "<td><select multiple class='select2' id='item_id" + counter + "' name='item_id" +
|
|
// // counter + "[]' onchange='setItemBatchNo(this.value," + counter +
|
|
// // "); getUnitForChildItem('child_item_unit',this.value," + counter +
|
|
// // ")' data-placeholder='Choose a item...' style='width: 100%;'><?php
|
|
// echo generate_options("SELECT item_id,trim(concat(ifnull(form_name,''),' ',item_name)) item_name FROM tbl_items i left join medicine_form f on i.item_form_id=f.form_id where status='1' and is_group_item!='P' order by item_name", '', 'item_id', 'item_name', '', '');
|
|
?></select></td>";
|
|
// cols += '<input placeholder="Enter Item Details" type="text" name="item_id' + counter +
|
|
// '" id="item_id' + counter + '" maxlength="50" class="form-control" />';
|
|
// // cols += '<td><div class="input-group"><input placeholder="Enter QTY" type="number" oninput="chk_issue_qty(this.value,0)" name="qty'+counter+'" id="qty'+counter+'" maxlength="50" class="form-control" /><span style="font-size: 10px" id="child_item_unit'+counter+'" class="input-group-addon"></span></div></td>';
|
|
// cols += '<td><input placeholder="Total Cost" type="number" name="total_cost' + counter +
|
|
// '" id="total_cost' + counter + '" maxlength="50" class="form-control" /></td>';
|
|
// cols += '<td><input placeholder="Enter Remarks" type="text" name="remarks' + counter +
|
|
// '" id="remarks' + counter + '" class="form-control" /></td>';
|
|
// cols +=
|
|
// '<td align="center"><a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" title="Delete"><span class="glyphicon glyphicon-trash"></span></a></td>';
|
|
|
|
// newRow.append(cols);
|
|
// $("#myTable").append(newRow);
|
|
// /*$('#item_id'+counter).chosen({allow_single_deselect:true});
|
|
// $('#item_id'+counter).next().css({'width': $('#item_id'+counter).parent().width()});*/
|
|
// counter++;
|
|
// $('.select2').select2()
|
|
// $("#count_items").val(counter);
|
|
// $('.date-picker').datepicker({
|
|
// autoclose: true,
|
|
// todayHighlight: true
|
|
// })
|
|
// });
|
|
|
|
|
|
|
|
|
|
$("#myTable").on("click", "#deletebtn", function(event) {
|
|
$(this).closest("tr").remove();
|
|
counter -= 1
|
|
$("#count_items").val(counter);
|
|
});
|
|
|
|
|
|
});
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
jQuery(function($) {
|
|
$('#id-disable-check').on('click', function() {
|
|
var inp = $('#form-input-readonly').get(0);
|
|
if (inp.hasAttribute('disabled')) {
|
|
inp.setAttribute('readonly', 'true');
|
|
inp.removeAttribute('disabled');
|
|
inp.value = "This text field is readonly!";
|
|
} else {
|
|
inp.setAttribute('disabled', 'disabled');
|
|
inp.removeAttribute('readonly');
|
|
inp.value = "This text field is disabled!";
|
|
}
|
|
});
|
|
|
|
|
|
if (!ace.vars['touch']) {
|
|
$('.chosen-select').chosen({
|
|
allow_single_deselect: true
|
|
});
|
|
|
|
|
|
$(window)
|
|
.off('resize.chosen')
|
|
.on('resize.chosen', function() {
|
|
$('.chosen-select').each(function() {
|
|
var $this = $(this);
|
|
$this.next().css({
|
|
'width': $this.parent().width()
|
|
});
|
|
})
|
|
}).trigger('resize.chosen');
|
|
//resize chosen on sidebar collapse/expand
|
|
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
|
|
if (event_name != 'sidebar_collapsed') return;
|
|
$('.chosen-select').each(function() {
|
|
var $this = $(this);
|
|
$this.next().css({
|
|
'width': $this.parent().width()
|
|
});
|
|
})
|
|
});
|
|
|
|
|
|
$('#chosen-multiple-style .btn').on('click', function(e) {
|
|
var target = $(this).find('input[type=radio]');
|
|
var which = parseInt(target.val());
|
|
if (which == 2) $('#form-field-select-4').addClass('tag-input-style');
|
|
else $('#form-field-select-4').removeClass('tag-input-style');
|
|
});
|
|
}
|
|
|
|
|
|
$('[data-rel=tooltip]').tooltip({
|
|
container: 'body'
|
|
});
|
|
$('[data-rel=popover]').popover({
|
|
container: 'body'
|
|
});
|
|
|
|
autosize($('textarea[class*=autosize]'));
|
|
|
|
$('textarea.limited').inputlimiter({
|
|
remText: '%n character%s remaining...',
|
|
limitText: 'max allowed : %n.'
|
|
});
|
|
|
|
|
|
|
|
|
|
//"jQuery UI Slider"
|
|
//range slider tooltip example
|
|
$("#slider-range").css('height', '200px').slider({
|
|
orientation: "vertical",
|
|
range: true,
|
|
min: 0,
|
|
max: 100,
|
|
values: [17, 67],
|
|
slide: function(event, ui) {
|
|
var val = ui.values[$(ui.handle).index() - 1] + "";
|
|
|
|
if (!ui.handle.firstChild) {
|
|
$("<div class='tooltip right in' style='display:none;left:16px;top:-6px;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>")
|
|
.prependTo(ui.handle);
|
|
}
|
|
$(ui.handle.firstChild).show().children().eq(1).text(val);
|
|
}
|
|
}).find('span.ui-slider-handle').on('blur', function() {
|
|
$(this.firstChild).hide();
|
|
});
|
|
|
|
|
|
$("#slider-range-max").slider({
|
|
range: "max",
|
|
min: 1,
|
|
max: 10,
|
|
value: 2
|
|
});
|
|
|
|
$("#slider-eq > span").css({
|
|
width: '90%',
|
|
'float': 'left',
|
|
margin: '15px'
|
|
}).each(function() {
|
|
// read initial values from markup and remove that
|
|
var value = parseInt($(this).text(), 10);
|
|
$(this).empty().slider({
|
|
value: value,
|
|
range: "min",
|
|
animate: true
|
|
|
|
});
|
|
});
|
|
|
|
$("#slider-eq > span.ui-slider-purple").slider('disable'); //disable third item
|
|
|
|
|
|
$('#id-input-file-1 , #id-input-file-2').ace_file_input({
|
|
no_file: 'No File ...',
|
|
btn_choose: 'Choose',
|
|
btn_change: 'Change',
|
|
droppable: false,
|
|
onchange: null,
|
|
thumbnail: false //| true | large
|
|
//whitelist:'gif|png|jpg|jpeg'
|
|
//blacklist:'exe|php'
|
|
//onchange:''
|
|
//
|
|
});
|
|
//pre-show a file name, for example a previously selected file
|
|
//$('#id-input-file-1').ace_file_input('show_file_list', ['myfile.txt'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//datepicker plugin
|
|
//link
|
|
$('.date-picker').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true
|
|
})
|
|
//show datepicker when clicking on the icon
|
|
.next().on(ace.click_event, function() {
|
|
$(this).prev().focus();
|
|
});
|
|
|
|
|
|
|
|
//chosen plugin inside a modal will have a zero width because the select element is originally hidden
|
|
//and its width cannot be determined.
|
|
//so we set the width after modal is show
|
|
$('#modal-form').on('shown.bs.modal', function() {
|
|
if (!ace.vars['touch']) {
|
|
$(this).find('.chosen-container').each(function() {
|
|
$(this).find('a:first-child').css('width', '210px');
|
|
$(this).find('.chosen-drop').css('width', '210px');
|
|
$(this).find('.chosen-search input').css('width', '200px');
|
|
});
|
|
}
|
|
})
|
|
/**
|
|
//or you can activate the chosen plugin after modal is shown
|
|
//this way select element becomes visible with dimensions and chosen works as expected
|
|
$('#modal-form').on('shown', function () {
|
|
$(this).find('.modal-chosen').chosen();
|
|
})
|
|
*/
|
|
|
|
|
|
|
|
$(document).one('ajaxloadstart.page', function(e) {
|
|
autosize.destroy('textarea[class*=autosize]')
|
|
|
|
$('.limiterBox,.autosizejs').remove();
|
|
$('.daterangepicker.dropdown-menu,.colorpicker.dropdown-menu,.bootstrap-datetimepicker-widget.dropdown-menu')
|
|
.remove();
|
|
});
|
|
|
|
});
|
|
|
|
var complaint_names = '<?= $location ?>';
|
|
dataarray = complaint_names.split(",");
|
|
$("#program_location").val(dataarray);
|
|
$('#program_location').trigger('chosen:updated');
|
|
|
|
var activity = '<?= $activity ?>';
|
|
dataarrayactivity = activity.split(",");
|
|
$("#activity").val(dataarrayactivity);
|
|
$('#activity').trigger('chosen:updated');
|
|
|
|
function SelectPart(value, count) {
|
|
console.log(value + " " + count);
|
|
if (value == 'e') {
|
|
console.log("IF " + count);
|
|
$("#participate_nametwo" + count).show();
|
|
$("#participate_nameone" + count).hide();
|
|
} else {
|
|
console.log("ELSE " + count);
|
|
$("#participate_nametwo" + count).hide();
|
|
$("#participate_nameone" + count).show();
|
|
}
|
|
}
|
|
|
|
function chk_issue_qty(value, count) {
|
|
var issue_qty = eval($("#qty" + count).val());
|
|
var item_id = $("#item_id" + count).val();
|
|
var batch_no = $("#item_batch_no" + count).val();
|
|
var batch_qty = '';
|
|
$.ajax({
|
|
url: 'select_item_stock.php',
|
|
type: "GET",
|
|
data: {
|
|
item_id: item_id,
|
|
item_batch_no: batch_no
|
|
},
|
|
success: function(data) {
|
|
batch_qty = JSON.parse(data);
|
|
// alert(batch_qty);
|
|
if (issue_qty > batch_qty) {
|
|
BootstrapDialog.alert('Given quantity cannot be greater than available Quantity');
|
|
$("#qty" + count).val("");
|
|
}
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error pulling Item Details');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
function setItemBatchNo(item_id, count) {
|
|
$.ajax({
|
|
url: 'get_item_batch_nos.php',
|
|
type: 'POST',
|
|
data: {
|
|
item_id: item_id
|
|
},
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
var content_item_batch =
|
|
"<option value=\"\" selected disabled >Please Select Batch No</option>";
|
|
if (data != null && data != "") {
|
|
item_batch = data;
|
|
for (var i = 0; i < data.length; i++) {
|
|
content_item_batch += "<option value='" + data[i].item_batch_no + "'>" + data[i]
|
|
.item_batch_no + " (Expiry Date:" + myDateFormaterMonthYear(data[i].expiry_date) +
|
|
", Stock Qty:" + data[i].stock_qty + ")</option>"
|
|
}
|
|
}
|
|
$("#item_batch_no" + count).html(content_item_batch);
|
|
},
|
|
error: function(data) {}
|
|
});
|
|
}
|
|
</script>
|