823 lines
42 KiB
PHP
823 lines
42 KiB
PHP
<style>
|
|
.register-row {
|
|
position: relative;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.passwrd-icon1 {
|
|
position: absolute;
|
|
top: 5px !important;
|
|
right: 8px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.upload-doc-btn-wrap {
|
|
position: relative;
|
|
}
|
|
|
|
.error {
|
|
color: red;
|
|
padding-top: 5px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.col-md-6.col-height {
|
|
height: 50px !important;
|
|
}
|
|
|
|
select.form-control:not([size]):not([multiple]) {
|
|
height: 33.1px;
|
|
}
|
|
</style>
|
|
<div class="wraper responsive-width">
|
|
|
|
<main class="container px-0" id="main">
|
|
|
|
<!----admin template section---->
|
|
<div class="admin_tempblock">
|
|
<div class="admin_tempsec">
|
|
<div class="admin_sec">
|
|
<?php
|
|
if (!empty($this->session->flashdata('success'))) { ?>
|
|
<div class="alert alert-success">
|
|
<a href="#" class="close" data-dismiss="alert">×</a>
|
|
<strong>Success!</strong> <?php echo $this->session->flashdata('success'); ?>
|
|
</div>
|
|
<?php
|
|
}
|
|
if (!empty($this->session->flashdata('error'))) {
|
|
?>
|
|
<div class="alert alert-danger">
|
|
<a href="#" class="close" data-dismiss="alert">×</a>
|
|
<strong>Failed!</strong> <?php echo $this->session->flashdata('error'); ?>
|
|
</div>
|
|
<?php } ?>
|
|
<form id="addEditBatchForm" method="post" action="<?php echo base_url(); ?>admin/add-new-student" enctype="multipart/form-data">
|
|
<div class="col-md-12 px-0">
|
|
<div class="register-form">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="h4"><?php echo $title; ?></div>
|
|
</div>
|
|
</div>
|
|
<br>
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5 class="card-title h6">Student Details</h5>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="row">
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="sname" class="sname form-control" id="sname" placeholder="Student Full name" />
|
|
<span> Full Name <b class="text-danger">*</b> </span>
|
|
</label>
|
|
<label id="sname-error" class="error my-0 px-1 py-0" style="display:none;" for="sname"></label>
|
|
</div>
|
|
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="sdob" id='sdob' class="nepal-date sdob form-control" placeholder=" DOB (YYYY-mm-dd)" width="100%">
|
|
<span> Date Of Birth (B.S.) <b class="text-danger">*</b> </span>
|
|
</label>
|
|
<label id="sdob-error" class="error my-0 px-1 py-0" style="display:none;" for="sdob"></label>
|
|
</div>
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="siemis" class="siemis form-control" id="siemis" placeholder="Student IEMIS Number" />
|
|
<span> IEMIS </span>
|
|
</label>
|
|
</div>
|
|
<div class="w-100 mt-3"></div>
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="smobile" class="smobile form-control" id="smobile" placeholder="Contact Number" />
|
|
<span> Contact Number </span>
|
|
</label>
|
|
<label id="smobile-error" class="error my-0 px-1 py-0" style="display:none;" for="smobile"></label>
|
|
</div>
|
|
<div class="col">
|
|
<div class="d-flex align-items-center pt-1">
|
|
|
|
<label for="Male" class="mb-0 pr-2"> Gender:</label>
|
|
<div class="register-radio">
|
|
<label for="Male" class="mb-0 px-1"><input type="radio" id="Male" name="sgender" value="Male" style="height: 12px; width: 15px;"> Male </label>
|
|
</div>
|
|
<div class="register-radio">
|
|
<label for="Female" class="mb-0 px-1"><input type="radio" id="Female" name="sgender" value="Female" style="height: 12px; width: 15px;"> Female</label>
|
|
</div>
|
|
<div class="register-radio">
|
|
<label for="Other" class="mb-0 px-1"><input type="radio" id="Other" name="sgender" value="Other" style="height: 12px; width: 15px;"> Other</label>
|
|
</div>
|
|
</div>
|
|
<label id="sgender-error" class="error" style="display:none;" for="sgender"></label>
|
|
</div>
|
|
<div class="col">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mt-3">
|
|
<div class="card-body">
|
|
<h5 class="card-title h6">Course Details</h5>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="row">
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<select name="sbatch" class="sbatch form-control custom-select" id="sbatch">
|
|
<option value="">Select Batch</option>
|
|
<?php foreach ($batch as $c) { ?>
|
|
<option value="<?= $c['id'] ?>"><?= $c['b_name'] ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
<span> Batch <b class="text-danger">*</b> </span>
|
|
</label>
|
|
<label id="sbatch-error" class="error my-0 px-1 py-0" style="display:none;" for="sbatch"></label>
|
|
</div>
|
|
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<select name="scourse" class="scourse form-control custom-select" id="scourse">
|
|
<option value="">Select Course</option>
|
|
<?php foreach ($courses as $c) { ?>
|
|
<option value="<?php echo $c['id'] ?>"><?php echo $c['course_name'] ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
<span> Course <b class="text-danger">*</b> </span>
|
|
</label>
|
|
<label id="scourse-error" class="error my-0 px-1 py-0" style="display:none;" for="scourse"></label>
|
|
</div>
|
|
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<select name="s_section" class="s_section form-control custom-select" id="s_section">
|
|
<option value=''> Select Section </option>
|
|
</select>
|
|
<span> Section <b class="text-danger">*</b> </span>
|
|
</label>
|
|
<label id="s_section-error" class="error my-0 px-1 py-0" style="display:none;" for="s_section"></label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mt-3">
|
|
<div class="card-body">
|
|
<h5 class="card-title h6">Guardian Details</h5>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="row">
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="sfathername" class="sfathername form-control" id="sfathername" placeholder="Student Father name" />
|
|
<span> Father Name </span>
|
|
</label>
|
|
<label id="sfathername-error" class="error my-0 px-1 py-0" style="display:none;" for="sfathername"></label>
|
|
</div>
|
|
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="sfcontact" class="sfcontact form-control" id="sfcontact" placeholder="Father Contact Number" />
|
|
<span> Contact Number </span>
|
|
</label>
|
|
<label id="sfcontact-error" class="error my-0 px-1 py-0" style="display:none;" for="sfcontact"></label>
|
|
</div>
|
|
<div class="w-100 mt-3"></div>
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="smothername" class="smothername form-control" id="smothername" placeholder="Student Mother name" />
|
|
<span> Mother Name </span>
|
|
</label>
|
|
<label id="smothername-error" class="error my-0 px-1 py-0" style="display:none;" for="smothername"></label>
|
|
</div>
|
|
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="smcontact" class="smcontact form-control" id="smcontact" placeholder="Mother Contact Number" />
|
|
<span> Contact Number </span>
|
|
</label>
|
|
<label id="smcontact-error" class="error my-0 px-1 py-0" style="display:none;" for="smcontact"></label>
|
|
</div>
|
|
|
|
<div class="w-100 mt-4"></div>
|
|
<h5 class="card-title h6 w-100 px-3">Local Guardian (If any)</h5>
|
|
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="slgname" class="slgname form-control" id="slgname" placeholder="Full Name" />
|
|
<span> Full Name </span>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="slgaddress" class="slgaddress form-control" id="slgaddress" placeholder="Address" />
|
|
<span> Address </span>
|
|
</label>
|
|
</div>
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="slgcontact" class="slgcontact form-control" id="slgcontact" placeholder="Contact Number" />
|
|
<span> Contact Number </span>
|
|
</label>
|
|
<label id="smcontact-error" class="error my-0 px-1 py-0" style="display:none;" for="smcontact"></label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mt-3">
|
|
<div class="card-body">
|
|
<h5 class="card-title h6">Permanent Address</h5>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="row">
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="p_ward_no" class="p_ward_no form-control" id="p_ward_no" placeholder="Ward No." />
|
|
<span> Ward No. </span>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="p_saddress1" class="p_saddress1 form-control" id="p_saddress1" placeholder="Ward No." />
|
|
<span> Address </span>
|
|
</label>
|
|
</div>
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="p_district" class="p_district form-control" id="p_district" placeholder="District" />
|
|
<span> District </span>
|
|
</label>
|
|
</div>
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<select name="p_province" class="p_province form-control custom-select" id="p_province">
|
|
<option value="">Select Province</option>
|
|
<?php foreach ($provinces as $province) { ?>
|
|
<option value="<?= $province['name'] ?>" <?= $province['id'] == 7 ? 'selected' : '' ?>><?= $province['name'] ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
<span> Province </span>
|
|
</label>
|
|
</div>
|
|
<div class="w-100 mt-3"></div>
|
|
<h5 class="card-title h6 w-100 px-3 mt-3">Local Address</h5>
|
|
|
|
|
|
<div class="col">
|
|
<input type="checkbox" name="same_as_per_add" id="sameAsPermanentAddress" checked /> Same as Permanent Address
|
|
</div>
|
|
|
|
|
|
<div class="w-100 mt-3" id="localAddress">
|
|
<div class="row px-3">
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="t_ward_no" class="p_ward_no form-control" id="t_ward_no" placeholder="Ward No." />
|
|
<span> Ward No. </span>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="t_saddress" class="t_saddress form-control" id="t_saddress" placeholder="Ward No." />
|
|
<span> Address </span>
|
|
</label>
|
|
</div>
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<input type="text" name="t_district" class="t_district form-control" id="t_district" placeholder="District" />
|
|
<span> District </span>
|
|
</label>
|
|
</div>
|
|
<div class="col">
|
|
<label class="has-float-label mb-0">
|
|
<select name="t_province" class="t_province form-control custom-select" id="t_province">
|
|
<option value="">Select Province</option>
|
|
<?php foreach ($provinces as $province) { ?>
|
|
<option value="<?= $province['name'] ?>" <?= $province['id'] == 7 ? 'selected' : '' ?>><?= $province['name'] ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
<span> Province </span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card my-3">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Documents</h5>
|
|
<label class="text-danger "> ** Accepted Only JPG and PNG</label>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="upload-doc">
|
|
<label>Passport size photo</label>
|
|
<!-- <span id="uploaded-file"> </span> -->
|
|
<div class="upload-doc-btn-wrap">
|
|
<input type="file" name="photo" id="photo" name="No file uploaded" />
|
|
<label for="photo" class="upload-btn" id="uploadBtn1">Upload</label>
|
|
<label for="photo" class="upload-btn re-upload-btn" id="uploadBtn2">Upload</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="upload-doc">
|
|
<label>School certificate</label>
|
|
|
|
<!-- <span id="uploaded-file"> </span> -->
|
|
<div class="upload-doc-btn-wrap">
|
|
|
|
<input type="file" name="school" id="school" name="No file uploaded" accept=".png,.jpg*" />
|
|
<label for="school" class="upload-btn" id="uploadBtn3">Upload</label>
|
|
<label for="school" class="upload-btn re-upload-btn" id="uploadBtn4">Upload</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="upload-doc">
|
|
<label>Exam Results</label>
|
|
<!-- <span id="uploaded-file"> </span> -->
|
|
<div class="upload-doc-btn-wrap">
|
|
<input type="file" name="exam" id="exam" name="No file uploaded" accept=".png,.jpg*" />
|
|
<label for="exam" class="upload-btn" id="uploadBtn5">Upload</label>
|
|
<label for="exam" class="upload-btn re-upload-btn" id="uploadBtn6">Upload</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<div class="upload-doc">
|
|
<label>Medical Certificate</label>
|
|
<!-- <span id="uploaded-file"> </span> -->
|
|
<div class="upload-doc-btn-wrap">
|
|
<input type="file" name="medical" id="medical" name="No file uploaded" accept=".png,.jpg*" />
|
|
<label for="medical" class="upload-btn" id="uploadBtn7">Upload</label>
|
|
<label for="medical" class="upload-btn re-upload-btn" id="uploadBtn8">Upload</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class=" my-2">
|
|
<div class="card-body">
|
|
|
|
<div class="row text-center justify-content-center">
|
|
<div class="col-md-8 align-self-center ">
|
|
<div class="register-btn">
|
|
<button class="btn btn-success btn-sm pr-5 pl-5" type="submit" id="">Add</button>
|
|
<a href="<?= base_url(); ?>admin/student" class="btn btn-sm pr-5 pl-5" style="background-color:#032da1;color:white;">Back</a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<!----admin template section end---->
|
|
</main>
|
|
<!--End right-top side-->
|
|
|
|
</div>
|
|
<script>
|
|
// if ($("#sameAsPermanentAddress").is(':checked'))
|
|
// $("#localAddress").show(); // checked
|
|
// else
|
|
$("#localAddress").hide(); // unchecked
|
|
|
|
$('#sameAsPermanentAddress').change(function() {
|
|
if ($(this).is(":checked")) {
|
|
// it is checked
|
|
$("#localAddress").hide();
|
|
} else {
|
|
$("#localAddress").show();
|
|
}
|
|
});
|
|
|
|
|
|
|
|
$("#p_icon3").click(function() {
|
|
|
|
$(this).toggleClass("icon-y");
|
|
|
|
var input = $("#password3");
|
|
if (input.attr("type") == "password") {
|
|
input.attr("type", "text");
|
|
} else {
|
|
input.attr("type", "password");
|
|
}
|
|
});
|
|
$("#p_icon4").click(function() {
|
|
|
|
$(this).toggleClass("icon-y");
|
|
|
|
var input = $("#password4");
|
|
if (input.attr("type") == "password") {
|
|
input.attr("type", "text");
|
|
} else {
|
|
input.attr("type", "password");
|
|
}
|
|
});
|
|
|
|
// $('#sbatch').change(function() {
|
|
// var sbatch = $(this).val();
|
|
// $('#totalfee').val('');
|
|
// var divData='';
|
|
// if (sbatch != '' && sbatch != 0) {
|
|
// $('#batch_error').addClass("d-none");
|
|
// $.ajax({
|
|
// url: "<?php //echo base_url();
|
|
?>Admin/get_batch_course",
|
|
// method: "post",
|
|
// data: {
|
|
// batch_id: sbatch,
|
|
// },
|
|
// dataType: "json",
|
|
// success: function(response) {
|
|
|
|
// divData += "<option value=''> Select Course </option>";
|
|
// if(response != ''){
|
|
// $.each(response, function(i, coursedata) {
|
|
// divData += "<option value='"+coursedata.id+"'>"+coursedata.course_name+"</option>";
|
|
// });
|
|
// }
|
|
// else {
|
|
// divData += "<option value=''> -- No course's Found --</option>";
|
|
// // $('#course_error_msg').text("Please create application fee for particular course");
|
|
// }
|
|
// $('#scourse').empty().append(divData);
|
|
// }
|
|
// });
|
|
// } else {
|
|
// $('#batch_error').removeClass("d-none");
|
|
// }
|
|
// });
|
|
|
|
|
|
$('#scourse').change(function() {
|
|
var course = $('#scourse option:selected').val();
|
|
var batch = $('#sbatch option:selected').val();
|
|
var divData = '';
|
|
var div_data = '';
|
|
var total_fee = '';
|
|
$('#fee-section').html("");
|
|
$('#total-fee').text();
|
|
if (course != '' && course != 0) {
|
|
$('#course_error').addClass("d-none");
|
|
$.ajax({
|
|
url: "<?php echo base_url(); ?>Admin/get_section_by_course",
|
|
method: "post",
|
|
data: {
|
|
course_id: course,
|
|
batch_id: batch
|
|
},
|
|
dataType: "json",
|
|
success: function(response) {
|
|
|
|
|
|
// section options code and start from here
|
|
|
|
divData += "<option value=''> Select Section </option>";
|
|
if (response.sections != '') {
|
|
$.each(response.sections, function(i, sectiondata) {
|
|
divData += "<option value='" + sectiondata.section_id + "'>" + sectiondata.section_name + "</option>";
|
|
});
|
|
}
|
|
// $('#course_error_msg').text();
|
|
else {
|
|
divData += "<option value=''> -- No Section's Found --</option>";
|
|
|
|
}
|
|
$('#s_section').empty().append(divData);
|
|
// section options code here End from here
|
|
|
|
}
|
|
});
|
|
} else {
|
|
$('#course_error').removeClass("d-none");
|
|
}
|
|
});
|
|
</script>
|
|
<script>
|
|
jQuery.validator.addMethod("fullnameregex", function(value, element) {
|
|
return this.optional(element) || /^[a-zA-Z]{3,30}$/.test(value);
|
|
}, 'Please enter alpha characters only ');
|
|
|
|
jQuery.validator.addMethod("passwordregex", function(value, element) {
|
|
return this.optional(element) || /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$#!%*?&])[A-Za-z\d@$!%*#?&]{6,16}$/.test(value);
|
|
}, 'Your password must be atleast 6 characters long, which inculdes one upper case, one numerical value and one special character.');
|
|
|
|
jQuery.validator.addMethod("emailregex", function(value, element) {
|
|
return this.optional(element) || /^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,8}$/.test(value);
|
|
}, 'Email Address is invalid: Please enter a valid email address.');
|
|
|
|
|
|
jQuery.validator.addMethod("phonenumberregex", function(value, element) {
|
|
return this.optional(element) || /^[0-9]{8,14}$/.test(value);
|
|
}, 'Please enter a 8-14 digits vaild phone number.');
|
|
|
|
jQuery.validator.addMethod("zipregex", function(value, element) {
|
|
return this.optional(element) || /^[0-9]{3,8}$/.test(value);
|
|
}, 'Please enter 3 - 8 digits number: digits only allowed');
|
|
|
|
jQuery.validator.addMethod("genral_regex", function(value, element) {
|
|
return this.optional(element) || /^[a-zA-Z -#]{1,50}$/.test(value);
|
|
}, 'Please enter alpha characters only');
|
|
|
|
jQuery.validator.addMethod("alphanumeric_regex", function(value, element) {
|
|
return this.optional(element) || /^[a-zA-Z0-9 -#]{1,50}$/.test(value);
|
|
}, 'Please enter alpha characters only');
|
|
|
|
var v = $("#addEditBatchForm").validate({
|
|
|
|
ignore: ':hidden',
|
|
|
|
rules: {
|
|
sname: {
|
|
required: true,
|
|
minlength: 3,
|
|
maxlength: 30,
|
|
},
|
|
ssname: {
|
|
required: true,
|
|
minlength: 1,
|
|
genral_regex: true
|
|
},
|
|
semail: {
|
|
required: true,
|
|
email: true,
|
|
emailregex: true
|
|
},
|
|
semailre: {
|
|
required: true,
|
|
equalTo: '[name="semail"]'
|
|
},
|
|
spaswd: {
|
|
required: true,
|
|
minlength: 6,
|
|
maxlength: 12,
|
|
passwordregex: true
|
|
},
|
|
spaswdre: {
|
|
required: true,
|
|
equalTo: '[name="spaswd"]'
|
|
},
|
|
scontact: {
|
|
required: true,
|
|
minlength: 8,
|
|
maxlength: 14,
|
|
phonenumberregex: true
|
|
},
|
|
sdob: "required",
|
|
sgender: {
|
|
required: true
|
|
},
|
|
scourse: {
|
|
required: true
|
|
},
|
|
sbatch: {
|
|
required: true
|
|
},
|
|
s_section: {
|
|
required: true
|
|
},
|
|
semfname: {
|
|
required: true,
|
|
genral_regex: true
|
|
},
|
|
semlname: {
|
|
required: true,
|
|
minlength: 1,
|
|
genral_regex: true
|
|
},
|
|
semphone: {
|
|
required: true,
|
|
minlength: 8,
|
|
maxlength: 14,
|
|
phonenumberregex: true
|
|
},
|
|
scountry: {
|
|
required: true,
|
|
genral_regex: true
|
|
|
|
},
|
|
sstate: {
|
|
required: true,
|
|
genral_regex: true
|
|
},
|
|
saddress1: {
|
|
required: true
|
|
},
|
|
szipcode: {
|
|
required: true,
|
|
zipregex: true
|
|
},
|
|
sibling_id: {
|
|
required: true,
|
|
alphanumeric_regex: true
|
|
},
|
|
// school: {
|
|
// required: true,
|
|
// },
|
|
// photo: {
|
|
// required: true,
|
|
// },
|
|
// exam: {
|
|
// required: true,
|
|
// },
|
|
// medical: {
|
|
// required: true,
|
|
// },
|
|
amount: {
|
|
required: true
|
|
},
|
|
totalfee: 'required',
|
|
payment_method: 'required'
|
|
|
|
},
|
|
messages: {
|
|
|
|
semailre: {
|
|
required: "Enter your Email",
|
|
equalTo: "Please enter the same email address again.",
|
|
},
|
|
spaswdre: {
|
|
equalTo: "Please enter the same password again.",
|
|
},
|
|
semphone: {
|
|
minlength: "Please Enter a 8 digits valid phone Number",
|
|
maxlength: "Please Enter a 14 digits valid phone Number",
|
|
|
|
},
|
|
scontact: {
|
|
minlength: "Please Enter a 8 digits valid phone Number",
|
|
maxlength: "Please Enter a 14 digits valid phone Number",
|
|
|
|
},
|
|
payment_method: {
|
|
required: "Please Select Payment Method",
|
|
},
|
|
totalfee: {
|
|
required: "Fees required",
|
|
}
|
|
|
|
|
|
|
|
},
|
|
submitHandler: function(form, e) {
|
|
e.preventDefault();
|
|
var appFee = $('#totalfee').val();
|
|
var cash = $("#payment_method option:selected").val();
|
|
var dic = $("#dicount_scholar option:selected").val();
|
|
|
|
if (cash === 'cash' && (dic === 'discount' || dic === 'scholarship')) {
|
|
if (!$('.dynamic_discount').val()) {
|
|
$('.item_err').empty();
|
|
$('.dynamic_discount').after(
|
|
'<span class="item_err" style="color:red">Please enter amount </span>');
|
|
|
|
} else if (parseInt($('.dynamic_discount').val()) > parseInt(appFee)) {
|
|
$('.item_err').empty();
|
|
$('.dynamic_discount').after(
|
|
'<span class="item_err" style="color:red">Please enter amount which is less than the current fee (' +
|
|
appFee + ')</span>');
|
|
|
|
} else {
|
|
$('.item_err').empty();
|
|
form.submit();
|
|
|
|
}
|
|
|
|
} else {
|
|
$('.item_err').empty();
|
|
form.submit();
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
function add_dicount_scholar(ele) {
|
|
|
|
$('#discount_scholarship_div').empty();
|
|
if (ele.value == 'discount' || ele.value == 'scholarship') {
|
|
$('#discount_scholarship_div').append(
|
|
'<input type="text" onkeypress="return numbersOnlyValidation(event)" min="0" onkeyup="deductAmountFromTotalFee(this)" name="scOrDesc" class="dynamic_discount form-control" placeholder="Enter the amount" class="form-control" />'
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
const deductAmountFromTotalFee = (input_item) => {
|
|
let deductAmt = (input_item.value) ? input_item.value : 0
|
|
let totalfee = $('#totalfee').val();
|
|
let TotalpayableAmt = (totalfee) ? totalfee : 0;
|
|
|
|
if (parseInt(deductAmt) > parseInt(TotalpayableAmt)) {
|
|
$('.item_err').empty();
|
|
$(input_item).after(
|
|
'<span class="item_err" style="color:red">Please enter amount which is less than the current fee (' +
|
|
TotalpayableAmt + ')</span>');
|
|
} else {
|
|
$('.item_err').empty();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function numbersOnlyValidation(e) {
|
|
|
|
var keyCode = e.keyCode || e.which;
|
|
|
|
//Regex for Valid Characters i.e. Alphabets and Numbers.
|
|
var regex = /^[0-9]+$/;
|
|
|
|
//Validate TextBox value against the Regex.
|
|
var isValid = regex.test(String.fromCharCode(keyCode));
|
|
|
|
return isValid;
|
|
}
|
|
</script>
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
$("#sibling").change(function() {
|
|
if (this.checked) {
|
|
$('#sibling_outer_div').show();
|
|
} else {
|
|
$('#sibling_outer_div').hide();
|
|
}
|
|
});
|
|
|
|
$('#sibling_id').change(function() {
|
|
let val = $(this).val();
|
|
|
|
if (val.length > 0) {
|
|
$.ajax({
|
|
url: '<?php echo base_url() ?>' + 'admin/ajax_check_if_exists',
|
|
data: {
|
|
value: val,
|
|
column: 'studentId',
|
|
table: 'students',
|
|
required: 'parent_username'
|
|
},
|
|
type: 'POST',
|
|
async: false,
|
|
success: function(data) {
|
|
console.log(data);
|
|
$('#sibling_id_err').empty();
|
|
if (data == 'failed') {
|
|
console.log('failed');
|
|
$('#sibling_id_err').text('There is no student with provided Id : ' + val);
|
|
$('#sibling_id').val('');
|
|
} else {
|
|
console.log(data);
|
|
$('#sibling_parent').val(data);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
})
|
|
|
|
})
|
|
</script>
|