BBnepal-Accounts/application/views/admin/edit-student-info.php

292 lines
11 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<style>
.error {
color: red;
}
</style>
<main class="wrapper responsive-width" id="main">
<!----admin template section---->
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<?php
if ($student) {
foreach ($student as $app) { ?>
<form action="<?php echo base_url() ?>Admin/editInfo_Student" method="post" id="studentForm">
<div class="subsec_sec">
<div class="subject_l">
<div class="subject_lsec">
<div class="subject_lhead">Edit Student Info</div>
<div class="subject_lformarea">
<div class="form-group">
<label for="">First Name</label>
<input type="text" name="first_name" value="<?= $app['first_name']; ?>" class="form-control" placeholder="Name of your Student">
<input type="hidden" name="student_Id" value="<?php echo $student_id ?>">
</div>
<div class="form-group">
<label for="">Last Name</label>
<input type="text" name="last_name" value="<?= $app['last_name']; ?>" class="form-control" placeholder="Name of your Student">
<input type="hidden" name="student_Id" value="<?php echo $student_id ?>">
</div>
<div class="form-group">
<label for="">Course</label>
<input type="text" name="corse_name" value="<?php echo $app['course_name'] ?>" class="form-control" placeholder="Name of your course" disabled>
</div>
<div class="form-group">
<label for="">IEMIS No.</label>
<input type="text" name="iemis" value="<?php echo $app['iemis'] ?>" class="form-control" placeholder="IEMIS No.">
</div>
<div class="form-group">
<label for="">Email</label>
<input type="email" name="email" value="<?php echo $app['email'] ?>" class="form-control" placeholder="Enter Email">
</div>
<div class="form-group">
<label for="">Contact Number</label>
<input type="Number" name="contact" value="<?php echo $app['mobile'] ?>" class="form-control" placeholder="Enter mobile number">
</div>
<div class="form-group">
<label for="">Parent/Guardian Name</label>
<input type="text" name="pname" value="<?php echo $app['emergency_contact_name'] ?>" class="form-control" placeholder="Enter Name">
</div>
<div class="form-group">
<label for="">Father Name</label>
<input type="text" name="fname" value="<?php echo $app['father_name'] ?>" class="form-control" placeholder="Enter Father Name">
</div>
<div class="form-group">
<label for="">Mother Name</label>
<input type="text" name="mname" value="<?php echo $app['mother_name'] ?>" class="form-control" placeholder="Enter Mother Name">
</div>
<div class="form-group">
<label for="">Parent/Guardian Contact Number</label>
<input type="text" name="pcontact" value="<?php echo $app['emergency_contact_number'] ?>" class="form-control" placeholder="Enter Name">
</div>
<div class="form-group">
<label for="">Parent PAN Number</label>
<input type="text" name="pan" value="<?php echo $app['parent_pan'] ?>" class="form-control" placeholder="Enter parent PAN number" style="text-transform:uppercase" maxlength="10">
</div>
<div class="form-group">
<label for="">Date Of Birth</label>
<!-- <input type="date" name="dob" value="<?php echo $app['dob'] ?>" class="form-control" placeholder=""> -->
<div class="po-calendar">
<input type="text" readonly style="background-color: transparent;" name="dob" class="nepal-date form-control" value="<?php echo $app['dob'] ?>" placeholder="">
<i class="fas fa-calendar-alt cal-icon"></i>
</div>
</div>
<div class="form-group">
<label for="">Gender : </label>
<div class="form-check ml-2 mt-2 form-check-inline" style="top:1px">
<?php if ($app['gender'] == 'Male') { ?>
<input class="form-check-input" checked name="gender" type="radio" id="inlineCheckbox1" value="Male">
<?php } else { ?>
<input class="form-check-input" name="gender" type="radio" id="inlineCheckbox1" value="Male">
<?php } ?>
<label class="form-check-label" for="inlineCheckbox1">Male</label>
</div>
<div class="form-check mt-2 form-check-inline" style="top:1px">
<?php if ($app['gender'] == 'Female') { ?>
<input class="form-check-input" checked name="gender" type="radio" id="inlineCheckbox1" value="Female">
<?php } else { ?>
<input class="form-check-input" name="gender" type="radio" id="inlineCheckbox1" value="Female">
<?php } ?>
<label class="form-check-label" for="inlineCheckbox2">Female</label>
</div>
<div class="form-check mt-2 form-check-inline" style="top:1px">
<?php if ($app['gender'] == 'Other') { ?>
<input class="form-check-input" checked name="gender" type="radio" id="inlineCheckbox1" value="Other">
<?php } else { ?>
<input class="form-check-input" name="gender" type="radio" id="inlineCheckbox1" value="Other">
<?php } ?>
<label class="form-check-label" for="inlineCheckbox2">Other</label>
</div>
</div>
<div class="form-group">
<label for="">Address1</label>
<textarea name="address1" class="form-control"><?= $app['address1'] ?></textarea>
</div>
<div class="form-group">
<label>Address2</label>
<textarea name="address2" class="form-control"><?= $app['address2']; ?> </textarea>
</div>
<div class="form-group">
<label>State</label>
<input type="text" name="state" value="<?= $app['state'] ?>" class="form-control">
</div>
<div class="form-group">
<label>Country</label>
<select name="country" class="form-control">
<?php if (strtolower($app['country']) == 'nepal') {
echo '<option selected value="' . $app['country'] . '">' . $app['country'] . '</option>';
} else {
echo '<option value="Nepal">Nepal</option>';
} ?>
<?php if (strtolower($app['country']) == 'india') {
echo '<option selected value="' . $app['country'] . '">' . $app['country'] . '</option>';
} else {
echo '<option value="India">India</option>';
} ?>
</select>
<!-- <input type="text" name="country" value="<?= $app['country']; ?>" class="form-control"> -->
</div>
<div class="form-group">
<label>Pin Code</label>
<input type="text" name="zipcode" value="<?= $app['zipcode']; ?>" class="form-control">
</div>
<div class="form-group">
<label for="">Applied on</label>
<input type="text" name="section_name" value="<?= $app['registered_on']; ?>" class="form-control" placeholder="Name of your course" disabled>
</div>
<input type="submit" class="subject_addbtn" value="Update Info" name="submit_info">
<a href="<?= base_url(); ?>admin/view_student/<?php echo $student_id ?>"><button type="button" class="subject_addbtn bg-dark ml-2">Back</button></a>
</div>
</div>
</div>
</div>
</form>
<?php }
} ?>
</div>
</div>
</div>
<!----admin template section end---->
</main>
<!--End right-top side-->
<script>
$(document).ready(function() {
jQuery.validator.addMethod("lettersonly", function(value, element) {
return this.optional(element) || /^[a-zA-z ]+$/i.test(value);
}, "please enter only alphabets");
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,5}$/.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 to 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("pannumberregex", function(value, element) {
// return this.optional(element) || /^[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}$/.test(value);
// }, 'Please enter correct PAN numner.');
$("#studentForm").validate({
ignore: ':hidden',
rules: {
first_name: {
required: true,
minlength: 3,
maxlength: 30,
lettersonly: true,
},
last_name: {
required: true,
minlength: 1,
maxlength: 30,
lettersonly: true,
},
email: {
required: true,
email: true,
emailregex: true
},
contact: {
required: true,
minlength: 8,
maxlength: 14,
phonenumberregex: true
},
dob: "required",
gender_name: {
required: true
},
country: {
required: true,
genral_regex: true
},
pan: {
required: false,
minlength: 2
},
state: {
required: true,
genral_regex: true
},
address1: {
required: true
},
zipcode: {
required: true,
minlength: 3,
maxlength: 8,
},
},
messages: {
email: {
required: "Enter your Email",
equalTo: "Please enter the same email address again.",
},
contact: {
minlength: "Please Enter a 10 digits valid phone Number",
maxlength: "Please Enter a 10 digits valid phone Number",
},
zipcode: {
minlength: "Please enter atleast 3 numbers",
maxlength: "Please enter below 8 numbers"
}
},
submitHandler: function(form) {
form.submit();
}
});
});
</script>