BBnepal-Accounts/application/views/admin/course-fee-pay.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

187 lines
5.5 KiB
PHP

<style>
.error {
color: red;
padding-top: 2px;
}
</style>
<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/bootstrap-select.css">
<div class="wraper responsive-width">
<main class="" id="main">
<!----admin template section---->
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="subsec_sec">
<div class="subject_l subject_l_full_width ">
<div class="subject_lsec">
<?php
$statusArr = array('yes' => 'Yes', 'no' => 'No');
$bname = '';
$bfrom = '';
$bend = '';
$status = '';
//echo '<pre>'; print_r($batchDetails);exit;
if (isset($batchDetails) && !empty($batchDetails)) {
$bname = $batchDetails[0]['b_name'];
$bfrom = $batchDetails[0]['b_from'];
$bend = $batchDetails[0]['b_end'];
$status = $batchDetails[0]['is_active'];
}
?>
<div class="subject_lhead"><?php echo $title; ?></div>
<form id="addEditBatchForm" method="post" action="<?php echo base_url(); ?>admin/add-edit-batch/<?php echo $bid ?>">
<div class="subject_lformarea">
<div class="form-group">
<input type="hidden" name="id" id="id" class="form-control" value="<?= $bid; ?>">
<label>Batch Name <span class="text-danger">*</span></label>
<input type="text" name="b_name" id="b_name" class="form-control" value="<?php echo $bname; ?>" placeholder="Enter batch name">
<p id="error_b_name" style="color:red;"></p>
<label id="batcherror" class="error" style="display : none"></label>
</div>
<div class="form-group assign_subject">
<label>Batch Start Date <span class="text-danger">*</span></label>
<input type="date" name="b_from" id='b_from' class="form-control" value="<?php echo $bfrom; ?>" placeholder="Enter start date">
<p id="error_b_from" style="color:red;"></p>
</div>
<div class="form-group">
<label>Batch End Date <span class="text-danger">*</span></label>
<input type="date" name="b_end" id="b_end" class="form-control" value="<?php echo $bend; ?>" placeholder="Enter end date">
<p id="error_b_end" style="color:red;"></p>
</div>
<div class="form-group">
<label>Status <span class="text-danger">*</span></label>
<select name="is_active" id="is_active" class="form-control">
<option value=''>Select</option>
<?php
foreach ($statusArr as $key => $val) {
?>
<option <?php if ($status == $key) { ?> selected <?php } ?> value='<?php echo $key; ?>'><?php echo $val; ?></option>
<?php
}
?>
</select>
<p id="error_is_active" style="color:red;"></p>
</div>
<button type="submit" class="subject_addbtn"><?php echo $btn_value = (($bid > 0) ? 'Update' : 'Add'); ?>
</button>&nbsp;&nbsp;
<a href="<?= base_url(); ?>admin/batches"><button type="button" class="subject_addbtn bg-dark">Back</button></a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!----admin template section end---->
</main>
<!--End right-top side-->
</div>
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js"></script> -->
<script defer src="<?php echo base_url(); ?>assets_admin/js/bootstrap-select.min.js"></script>
<script>
$(document).ready(function() {
//multiple select js start
$('select').selectpicker();
//multiple select js end
var todaysDate = new Date();
var year = todaysDate.getFullYear();
var month = ("0" + (todaysDate.getMonth() + 1)).slice(-2);
var day = ("0" + todaysDate.getDate()).slice(-2);
var maxDate = (year + "-" + month + "-" + day);
$('input[type=date]').attr('min', maxDate);
$(document).on("change", "#b_from", function() {
var bdate = $(this).val();
// alert(bdate);
$('#b_end').attr('min', bdate);
$('#b_end').val('');
});
});
$(document).ready(function() {
jQuery.validator.addMethod("inputregx", function(value, element) {
return this.optional(element) || /^[a-zA-Z0-9 -]{3,50}$/.test(value);
}, 'Please enter alpha and numeric characters only ');
$("#addEditBatchForm").validate({
ignore: "input[type='text']:hidden",
rules: {
b_name: {
required: true,
rangelength: [2, 20],
inputregx: true,
},
b_from: {
required: true,
},
b_end: {
required: true,
},
is_active: {
required: true,
},
},
messages: {
b_name: {
required: "Please enter Batch name ",
},
b_from: {
required: "Please Select Batch From",
},
b_end: {
required: "Please Select Batch End",
},
is_active: {
required: "Please Select Status",
},
},
submitHandler: function(form) {
var EditId = "<?= $bid ?>";
if (EditId == 0) {
var inputValue = $("input[name='b_name']", form).val();
$.ajax({
url: "<?= base_url() ?>admin/checkname",
data: {
value: inputValue,
tablename: "batch",
column: "b_name"
},
type: 'POST',
async: false,
success: function(data) {
// console.log(data);
if (data == 0) {
form.submit();
} else {
$('#batcherror').show();
$('#batcherror').text('This Batch name already exists.');
}
}
});
} else {
form.submit();
}
}
});
});
</script>