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

301 lines
14 KiB
PHP

<style>
.w-60 {
width: 70%;
}
.user-info-row-one {
margin-bottom: 30px !important;
}
.title p {
font-weight: 500;
font-size: 20px;
padding-bottom: 3px;
border-bottom: 1px solid #c6c6c6;
display: inline-block;
}
input {
overflow: visible;
border-color: #fff;
border: none;
width: 130px;
}
input.withB {
border : 1px solid #c6c6c6 !important;
}
.error {
color: red;
}
.discountBox label {
margin-bottom: 0 !important;
margin-top: 10px;
}
</style>
<div class="wraper responsive-width">
<main class="long-tbl-main" id="main">
<div class="from-group">
<a href="<?= base_url(); ?>admin/get_application"><button type="button" class="btn btn-success btn-sm btn-dark">Back</button></a>
</div>
<!-- admin template section -->
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="subsec_sec">
<div class="subject_r">
<div class="subject_lsec">
<div class="subject_lhead">
</div>
<div class="student-little-info mb-4">
<div class="row mt-2">
<div class="col-md-2 col-12">
<span style="font-weight : 600">Student Name : </span>
</div>
<div class="col-md-6 col-12">
<span class="ml-3"><?= $student_info_array['name'] ?></span>
</div>
</div>
<div class="row mt-2">
<div class="col-md-2">
<span style="font-weight : 600">Email : </span>
</div>
<div class="col-md-6 col-12">
<span class="ml-3"><?= $student_info_array['email'] ?></span>
</div>
</div>
<div class="row mt-2">
<div class="col-md-2">
<span style="font-weight : 600">Application-id : </span>
</div>
<div class="col-md-6 col-12">
<span class="ml-3"><?= $student_info_array['applicationid'] ?></span>
</div>
</div>
</div>
<hr>
<form method="POST" action="<?= base_url(); ?>Admin/feecollectionFromStudent" id="feecollectionForm">
<div class="row">
<div class="col-md-12">
<h5><?= (isset($feetypeName) && !empty($feetypeName)) ? $feetypeName : 'Fees '; ?></h5>
</div>
<div class="col-md-8">
<div class="row pt-4">
<div class="col-md-6"><label style='font-weight:500'>Fee Amount : </label></div>
<div class="col-md-6">N- <?php echo (isset($course_fees['amount']) && !empty($course_fees['amount'])) ? $course_fees['amount'] : "No Fees Assigned to Class"; ?> </div>
</div>
<div class="row pt-4">
<?php
// echo '<pre>';
$due_amount_date = (isset($installment['due_amount_date']) && !empty($installment['due_amount_date'])) ? $installment['due_amount_date'] : '';
$installment_data = json_decode($due_amount_date);
$applicationid = (isset($studentinfo['applicationid']) && !empty($studentinfo['applicationid'])) ? $studentinfo['applicationid'] : 0;
?>
<div class="col-md-6"><label style='font-weight:500'>Payment Options : </label></div>
<div class="col-md-6">
<input type="hidden" name="application_id" id="application_id" value="<?php echo $applicationid; ?>">
<input type="hidden" name="installment_id" id="installment_id" value="<?php echo (isset($installment['id']) && !empty($installment['id'])) ? $installment['id'] : 0; ?>">
<input type="hidden" name="course_fee_id" id="course_fee_id" value="<?php echo (isset($installment['course_fee_id']) && !empty($installment['course_fee_id'])) ? $installment['course_fee_id'] : 0; ?>">
<input type="hidden" name="fees_type" id="fees_type" value="<?php echo (isset($feetypeName) && !empty($feetypeName)) ? $feetypeName : ''; ?>">
<select name="payment_options" id="payment_options" class="form-control">
<option value=""> -- Select Payment Option -- </option>
<?php
foreach ($installment_data as $key => $value) {
$paytypesname = $this->db->get_where('payment_types', array('id' => $key))->row_array();
?>
<option value="<?= $key; ?>"><?php echo $paytypesname['payment_type_name']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="row">
<div class="col-md-6 pt-4"><label style='font-weight:500'>Payment Details:</label></div>
<div class="col-md-6 pt-4">
<div class="instalments-cover">
</div>
</div>
</div>
</div>
<div class="col-md-4"></div>
</div>
<div class="row mt-4">
<div class="col-md-4 pt-2"><label style='font-weight:500'>Fee Amount</label></div>
<div class="col-md-4 ">
<input type="text" name="totalAmount" id="totalAmount" readonly>
<div class="discountBox" style="display:none">
<div>
<label>Choose one option</label>
<select class="form-control" onChange="showDiscountBox(this)" name="deduction_type">
<option value="" Selected>Choose type of reimbursement</option>
<option value="discount">Discount</option>
<option value="scholarship">Scholarship</option>
</select>
</div>
<div id="discount_amount" style="display:none">
<label>Reimbursement Amount<span style="color:red">*</span></label>
<input type="number" name="deduction_amount" id="" class="form-control withB">
</div>
</div>
</div>
<div class="col-md-4 "></div>
</div>
<div class="row mt-4">
<div class="col-md-4 pt-2"><label style='font-weight:500'>Payment Method</label></div>
<div class="col-md-4 ">
<select name="payment_method" class="payment_method form-control valid" id="payment_method">
<option value="">-- Select Payment Method --</option>
<option value="cash">Cash</option>
<option value="bank-transfer">Bank Transfer</option>
</select>
</div>
<div class="col-md-4 ">
<div class="register-row description_section d-none">
<input type="text" name="description" id="description" class="description form-control" placeholder="DD No./Transaction Id">
</div>
<p class="error" id="description-error"></p>
</div>
</div>
<div class="row mt-4">
<div class="col-md-4 pt-2"></div>
<div class="col-md-4 ">
<input type="submit" name="make_payment" class="btn btn-success btn-sm w-100" id="make_payment" value="Make Payment">
</div>
<div class="col-md-4 pt-2"></div>
</div>
</form>
</div>
</div>
</div>
<!-- admin template section end -->
</main>
<!--End right-top side-->
</div>
<script>
const showDiscountBox = (ele) => {
let value = ele.value;
if(value !== "") {
$('#discount_amount').show();
} else {
$('#discount_amount').hide();
}
}
$(document).ready(function() {
$("#payment_options").on('change', function() {
//alert("hiii");
var amt = 0;
var install_typeId = $('#payment_options option:selected').val();
var installmentId = $('#installment_id').val();
var application_id = $('#application_id').val();
$.ajax({
type: 'post',
url: '<?php echo base_url(); ?>Admin/get_installdetails',
data: {
installment_id: installmentId,
install_type: install_typeId,
applicationid: application_id
},
success: function(resposne) {
console.log(resposne);
$('.instalments-cover').html(resposne);
amt = $('#feeamount').data('amt');
$('#totalAmount').val(amt);
$('.discountBox').show();
}
});
});
var description_section_validation = false;
$('#payment_method').change(function() {
var payment = $('#payment_method :selected').val();
if (payment == 'bank-transfer') {
$('.description_section').removeClass('d-none');
description_section_validation = true;
} else {
$('.description_section').addClass('d-none');
description_section_validation = false;
}
});
});
jQuery.validator.addMethod("validate_amount", function(value, element) {
let feeAmount = $('#totalAmount').val();
let returnValue = (parseInt(value) <= parseInt(feeAmount));
return returnValue;
}, "Please enter amount which is less than fee amount");
$("#feecollectionForm").validate({
// ignore: "input[type='text']:hidden",
ignore: ":hidden",
rules: {
payment_options: {
required: true,
},
payment_method: {
required: true,
},
deduction_amount : {
required : true,
validate_amount : true
}
},
messages: {
payment_options: {
required: "Please Select Payment Installment ",
},
payment_method: {
required: "Please Select Payment Method",
}
},
submitHandler: function(form) {
var payment1 = $('#payment_method :selected').val();
var description_length = $("input#description").val().length;
if (payment1 == 'bank-transfer') {
if (description_length < 3) {
$('#description-error').text('Length is short, minimum 3 Characters required.');
} else {
form.submit();
}
} else {
form.submit();
}
}
});
</script>