Employee & User - Raised Issues fixes : ps

This commit is contained in:
VE10-Sanjeev 2024-03-18 16:52:54 +05:30
parent 73dcc84b80
commit b60f560653
5 changed files with 1102 additions and 1144 deletions

View File

@ -1,14 +1,8 @@
<!-- Body page content -->
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/assets/jquery.multi-select.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
@ -143,9 +137,7 @@
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 ">
<!-- <div class="x_title">
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i id="chevron" class="fa fa-chevron-up"></i></a></li>
</li>
@ -155,12 +147,10 @@
</div> -->
<!-- <div class="x_content"> -->
<br />
<form id="form" data-parsley-validate class="form-horizontal form-label-left" method="post"
action="<?php echo base_url();?>Employee/createEmp" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>"
value="<?php echo $this->security->get_csrf_hash();?>">
<form id="form" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url(); ?>Employee/createEmp" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
<!-- ----------------------------------------- -->
<div class="x_panel">
<div class="x_title">
<h5>Personal Information<a style="color:red;">*</a>
@ -168,23 +158,19 @@
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name"
value="<?php if(isset($editData)) { echo $editData->name; } ?>" required="required"
onkeypress="validateKeyPress(event)" class="form-control ">
<input type="text" id="name" name="name" value="<?php if (isset($editData)) {
echo $editData->name;
} ?>" required="required" onkeypress="validateKeyPress(event)" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Email<a style="color:red;">*</a>
</label>
<div class="col-md-5 col-sm-5 ">
<input id="email" name="email"
value="<?php if(isset($editData)){ echo $editData->email; } ?>" required="required"
class="form-control" type="email"
oninvalid="setCustomValidity('Enter a Valid E-mail Address.')"
oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input id="email" name="email" value="<?php if (isset($editData)) {
echo $editData->email;
} ?>" required="required" class="form-control" type="email" oninvalid="setCustomValidity('Enter a Valid E-mail Address.')" oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
</div>
@ -194,20 +180,21 @@ class="form-control" type="email"
<label class="control-label col-md-1 col-sm-1 " for="email"> Mobile<a style="color:red;">*</a>
</label>
<div class="col-md-5 col-sm-5 ">
<input id="mobile" name="mobile"
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>"
onkeypress="return matchnum(event)" required="required" class="form-control" type="text"
pattern="[6-9][0-9]{9}" minlength="10" maxlength="10"
oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')"
oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input id="mobile" name="mobile" value="<?php if (isset($editData)) {
echo $editData->mobile;
} ?>" onkeypress="return matchnum(event)" required="required" class="form-control" type="text" pattern="[6-9][0-9]{9}" minlength="10" maxlength="10" oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')" oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name">Department</label>
<div class="col-md-5 col-sm-5 ">
<select id="department" name="department" required="required" class="form-control">
<option value="">--Select--</option>
<!-- <option value="<?php if(isset($editData)) { echo $editData->department; } ?>"> -->
<?php if(isset($assetData)) { echo $editData->department; } ?></option>
<!-- <option value="<?php if (isset($editData)) {
echo $editData->department;
} ?>"> -->
<?php if (isset($assetData)) {
echo $editData->department;
} ?></option>
<?php foreach ($departmentData as $key => $value) { ?>
<option value="<?php echo $value->name; ?>"><?php echo $value->name; ?></option>
<?php } ?>
@ -221,10 +208,9 @@ class="form-control" type="email"
<label class="control-label col-md-1 col-sm-1 " for="email">Join date</label>
<div class="col-md-5 col-sm-5 ">
<input id="j_date" name="j_date"
value="<?php if(isset($editData)) { echo $editData->email; } ?>" class="form-control"
type="text" placeholder="DD-MM-YYYY" onkeypress="validateKeyPress(event)"
autocomplete="off">
<input id="j_date" name="j_date" value="<?php if (isset($editData)) {
echo $editData->email;
} ?>" class="form-control" type="text" placeholder="DD-MM-YYYY" onkeypress="validateKeyPress(event)" autocomplete="off">
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label>
@ -256,28 +242,20 @@ class="form-control" type="email"
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 ">
<input type="text" id="user_name" name="user_name" value="" required="required"
class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input type="text" id="user_name" name="user_name" value="" required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Password<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Password<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 ">
<input type="password" id="password" minlength="8" name="password" value=""
required="required" class="form-control "
title="password must have alphabets &#013;password requires 6 characters minimum">
<span toggle="#password" id="toggle-password"
class="fa fa-fw fa-eye field-icon toggle-password"></span>
<input type="password" id="password" minlength="8" name="password" value="" required="required" class="form-control " title="password must have alphabets &#013;password requires 6 characters minimum">
<span toggle="#password" id="toggle-password" class="fa fa-fw fa-eye field-icon toggle-password"></span>
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 ">
<input type="password" id="confirm_password" name="confirm_password" value=""
required="required" class="form-control ">
<input type="password" id="confirm_password" name="confirm_password" value="" required="required" class="form-control ">
<span id='message'></span><span id='errMessage'></span>
</div>
@ -293,16 +271,16 @@ class="fa fa-fw fa-eye field-icon toggle-password"></span>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_name" name="relation_name"
value="<?php if(isset($editData)) { echo $editData->name; } ?>"
onkeypress="validateKeyPress(event)" class="form-control ">
<input type="text" id="relation_name" name="relation_name" value="<?php if (isset($editData)) {
echo $editData->name;
} ?>" onkeypress="validateKeyPress(event)" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Relationship</label>
<div class="col-md-5 col-sm-5 ">
<input id="relationship" name="relationship"
value="<?php if(isset($editData)) { echo $editData->email; } ?>"
class="form-control" onkeypress="validateKeyPress(event)" type="text">
<input id="relationship" name="relationship" value="<?php if (isset($editData)) {
echo $editData->email;
} ?>" class="form-control" onkeypress="validateKeyPress(event)" type="text">
</div>
</div>
@ -311,19 +289,16 @@ class="form-control" onkeypress="validateKeyPress(event)" type="text">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_mobile" name="relation_mobile"
onkeypress="return matchnum(event)"
value="<?php if(isset($editData)) { echo $editData->name; } ?>"
class="form-control " pattern="[6-9][0-9]{9}" minlength="10" maxlength="10"
oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')"
oninput="setCustomValidity('')">
<input type="text" id="relation_mobile" name="relation_mobile" onkeypress="return matchnum(event)" value="<?php if (isset($editData)) {
echo $editData->name;
} ?>" class="form-control " pattern="[6-9][0-9]{9}" minlength="10" maxlength="10" oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')" oninput="setCustomValidity('')">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Home Tel</label>
<div class="col-md-5 col-sm-5 ">
<input id="relation_tel" name="relation_tel" onkeypress="return matchnum(event)"
value="<?php if(isset($editData)) { echo $editData->relation_tel; } ?>"
class="form-control" type="text">
<input id="relation_tel" name="relation_tel" onkeypress="return matchnum(event)" value="<?php if (isset($editData)) {
echo $editData->relation_tel;
} ?>" class="form-control" type="text">
</div>
</div>
@ -339,15 +314,16 @@ class="form-control" type="text">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Address</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="address" name="address"
value="<?php if(isset($editData)) { echo $editData->address; } ?>"
class="form-control ">
<input type="text" id="address" name="address" value="<?php if (isset($editData)) {
echo $editData->address;
} ?>" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> City</label>
<div class="col-md-5 col-sm-5 ">
<input id="city" name="city" value="<?php if(isset($editData)) { echo $editData->city; } ?>"
class="form-control" type="text">
<input id="city" name="city" value="<?php if (isset($editData)) {
echo $editData->city;
} ?>" class="form-control" type="text">
</div>
</div>
@ -357,25 +333,28 @@ class="form-control" type="text">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> State</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="state" name="state"
value="<?php if(isset($editData)) { echo $editData->state; } ?>" class="form-control ">
value="<?php if (isset($editData)) {
echo $editData->state;
} ?>" class="form-control ">
</div> -->
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1" for="first-name">State</label>
<div class="col-md-5 col-sm-5">
<input type="text" id="state" name="state" value="<?php if(isset($editData)) { echo $editData->state; } ?>" class="form-control">
<input type="text" id="state" name="state" value="<?php if (isset($editData)) {
echo $editData->state;
} ?>" class="form-control">
<span id="stateError" style="color: red;"></span>
</div>
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Pincode</label>
<div class="col-md-5 col-sm-5 ">
<input id="pincode" name="pincode" onkeypress="return matchnum(event)"
value="<?php if(isset($editData)) { echo $editData->pincode; } ?>" class="form-control"
type="text">
<input id="pincode" name="pincode" onkeypress="return matchnum(event)" value="<?php if (isset($editData)) {
echo $editData->pincode;
} ?>" class="form-control" type="text">
</div>
</div>
</div>
<!-- ----------------------------------------------------------------------------------->
<div class="x_panel">
<div class="x_title">
@ -387,15 +366,16 @@ class="form-control" type="text">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Employee Id</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="employee_id" name="emp_id"
value="<?php if(isset($editData)) { echo $editData->name; } ?>" class="form-control">
<input type="text" id="employee_id" name="emp_id" value="<?php if (isset($editData)) {
echo $editData->name;
} ?>" class="form-control">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Salary</label>
<div class="col-md-5 col-sm-5 ">
<input id="salary" name="salary"
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" class="form-control"
type="text">
<input id="salary" name="salary" value="<?php if (isset($editData)) {
echo $editData->mobile;
} ?>" class="form-control" type="text">
</div>
@ -405,9 +385,9 @@ class="form-control" type="text">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Comment</label>
<div class="col-md-5 col-sm-5 ">
<input id="comment" name="comment"
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" class="form-control"
type="text">
<input id="comment" name="comment" value="<?php if (isset($editData)) {
echo $editData->mobile;
} ?>" class="form-control" type="text">
</div>
@ -423,10 +403,9 @@ class="form-control" type="text">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Photo Upload</label>
<div class="col-md-5 col-sm-5 ">
<input type="file" id="image" name="image"
value="<?php if(isset($editData)) { echo $editData->profile_pic; } ?>"
class="form-control typeFile" onchange="validateFile(this)"
accept="image/png, image/jpeg, image/jpg, application/pdf">
<input type="file" id="image" name="image" value="<?php if (isset($editData)) {
echo $editData->profile_pic;
} ?>" class="form-control typeFile" onchange="validateFile(this)" accept="image/png, image/jpeg, image/jpg, application/pdf">
<img class="profilepic__image" style="width: 50%; display: block;padding:10px;" src="">
</div>
@ -452,7 +431,7 @@ class="form-control typeFile" onchange="validateFile(this)"
</div>
</div>
</div>
<!-- ----------------------------------------- -->
<div class="x_panel"><br>
<div class="item form-group">
<div class="offset-md-8">
@ -590,11 +569,12 @@ function check_if_exists(id, value, name) {
$.ajax({
type: "get",
url: "<?php echo base_url(); ?>Employee/checkUniqueValue",
data: { value: value, name: name },
success:function(response)
{
if (response == true)
{
data: {
value: value,
name: name
},
success: function(response) {
if (response == true) {
new PNotify({
title: 'Warning',
text: 'That given details Already Exists',
@ -622,11 +602,6 @@ function check_if_exists(id, value, name) {
$('#errMessage').html('');
}
});
</script>
<script>
document.getElementById('state').addEventListener('input', function(event) {
@ -638,7 +613,6 @@ function check_if_exists(id, value, name) {
event.target.value = stateInput.replace(/[^A-Za-z\s]/g, '');
}
});
</script>
<script>
document.getElementById('city').addEventListener('input', function(event) {
@ -650,7 +624,6 @@ function check_if_exists(id, value, name) {
event.target.value = cityInput.replace(/[^A-Za-z\s]/g, '');
}
});
</script>
<script>
function validateEmail(email) {
@ -671,4 +644,17 @@ function validateEmail(email) {
}
});
</script>
<script>
document.querySelector('form').addEventListener('submit', function(event) {
var form = event.target;
var submitBtn = form.querySelector('button[type="submit"]');
if (!form.checkValidity()) {
form.reportValidity(); // Display validation error messages
event.preventDefault(); // Prevent form submission if it's not valid
submitBtn.disabled = false;
} else {
submitBtn.disabled = true;
}
});
</script>

View File

@ -2,8 +2,6 @@
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/assets/jquery.multi-select.js"></script>
<script type="text/javascript">
@ -125,37 +123,20 @@
}
</style>
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Edit Employee</h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 ">
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url(); ?>Employee/editEmployees" enctype="multipart/form-data">
<div class="x_panel">
<!-- <div class="x_title">
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
</li>
</ul>
<h6>General Information</h6>
<div class="clearfix"></div>
</div>
<div class="x_content"> -->
<br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post"
action="<?php echo base_url();?>Employee/editEmployees" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>"
value="<?php echo $this->security->get_csrf_hash();?>">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
<input type="hidden" name="id" value="<?php echo $editData->id; ?>">
<input type="hidden" name="user_id" value="<?php echo $editData->user_id; ?>">
@ -165,23 +146,19 @@
</div><br />
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name"
value="<?php if(isset($editData)) { echo $editData->name; } ?>" required="required"
class="form-control " onkeypress="validateKeyPress(event)">
<input type="text" id="name" name="name" value="<?php if (isset($editData)) {
echo $editData->name;
} ?>" required="required" class="form-control " onkeypress="validateKeyPress(event)">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Email<a style="color:red;">*</a>
</label>
<div class="col-md-5 col-sm-5 ">
<input id="email" name="email"
value="<?php if(isset($editData)) { echo $editData->email; } ?>" required="required"
class="form-control" type="email"
pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
oninvalid="setCustomValidity('Enter a Valid E-mail Address.')"
oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input id="email" name="email" value="<?php if (isset($editData)) {
echo $editData->email;
} ?>" required="required" class="form-control" type="email" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}" oninvalid="setCustomValidity('Enter a Valid E-mail Address.')" oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
</div>
@ -191,23 +168,25 @@ class="form-control" type="email"
<label class="control-label col-md-1 col-sm-1 " for="email"> Mobile<a style="color:red;">*</a>
</label>
<div class="col-md-5 col-sm-5 ">
<input id="mobile" name="mobile"
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>"
onkeypress="return matchnum(event)" required="required" class="form-control" type="tel"
pattern="[6-9][0-9]{9}" minlength="10" maxlength="10"
oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')"
oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input id="mobile" name="mobile" value="<?php if (isset($editData)) {
echo $editData->mobile;
} ?>" onkeypress="return matchnum(event)" required="required" class="form-control" type="tel" pattern="[6-9][0-9]{9}" minlength="10" maxlength="10" oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')" oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name">Department</label>
<div class="col-md-5 col-sm-5 ">
<select id="department" name="department" class="form-control"
placeholder="choose" <?php if(isset($viewData)) { echo "readonly"; } ?>>
<option value="<?php echo $editData->department; ?>">
<?php echo $editData->department; ?></option>
<?php foreach ($departmentData as $key => $value) { ?>
<option value="<?php echo $value->name; ?>"><?php echo $value->name; ?></option>
<?php } ?>
<select id="department" name="department" class="form-control" placeholder="choose" <?php if (isset($viewData)) {
echo "readonly";
} ?>>
<?php if (count($departmentData) > 0) { ?>
<option value="">--Select--</option>
<?php foreach ($departmentData as $key => $value) {
$selected = (isset($editData->department) && $editData->department === $value->name) ? "selected" : ""; ?>
<option value="<?php echo $value->name; ?>" <?php echo $selected; ?>>
<?php echo $value->name; ?>
</option>
<?php }
} else { ?><option value="">--Select--</option><?php } ?>
</select>
</div>
@ -218,31 +197,41 @@ class="form-control" type="email"
<label class="control-label col-md-1 col-sm-1 " for="email"> Join Date</label>
<div class="col-md-5 col-sm-5 ">
<input id="j_date" name="j_date"
value="<?php if(isset($editData)) { echo $editData->j_date; } ?>" class="form-control"
type="text" placeholder="DD-MM-YYYY" onkeypress="validateKeyPress(event)"
autocomplete="off">
<input id="j_date" name="j_date" value="<?php if (isset($editData)) {
echo $editData->j_date;
} ?>" class="form-control" type="text" placeholder="DD-MM-YYYY" onkeypress="validateKeyPress(event)" autocomplete="off">
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label>
<div class="col-md-5 col-sm-5 ">
<select id="manager" name="manager" class="form-control">
<?php
if(isset($manager_name[0]->id))
{ foreach ($manager_name as $key => $val) { ?>
if (isset($manager_name[0]->id)) {
foreach ($manager_name as $key => $val) { ?>
<option value="<?php if($val->id !== ''){echo $val->id;}else{echo '';} ?>"><?php if($val->name !== ''){echo $val->name;}else{echo '--select--';} ?></option>
<option value="<?php if ($val->id !== '') {
echo $val->id;
} else {
echo '';
} ?>"><?php if ($val->name !== '') {
echo $val->name;
} else {
echo '--select--';
} ?></option>
<?php foreach ($manager as $key => $value) { ?>
<?php if ($val->name !== $value->name) { ?>
<option value="<?php echo $value->user_id; ?>"><?php echo $value->name; ?></option>
<?php } }?>
<?php }
} ?>
<?php } } else { ?>
<?php }
} else { ?>
<?php foreach ($manager as $key => $value) { ?>
<?php if ($val->name !== $value->name) { ?>
<option value="<?php echo $value->user_id; ?>"><?php echo $value->name; ?></option>
<?php } } } ?>
<?php }
}
} ?>
</select>
</div>
@ -252,24 +241,18 @@ class="form-control" type="email"
<label class="control-label col-md-1 col-sm-1 " for="first-name">Marital Status</label>
<div class="col-md-5 col-sm-5 ">
<select id="marital_status" name="marital_status" class="form-control"
placeholder="choose" <?php if(isset($viewData)) { echo "readonly"; } ?>>
<option value="<?php echo $editData->marital_status; ?>">
<?php echo ucfirst($editData->marital_status); ?></option>
<?php
if ($editData->marital_status != 'single')
{
echo '<option value="single">Single</option>';
}
if ($editData->marital_status != 'married')
{
echo '<option value="married">Married</option>';
}
if ($editData->marital_status != 'others')
{
echo '<option value="others">Others</option>';
}
<select id="marital_status" name="marital_status" class="form-control" placeholder="choose" <?php if (isset($viewData)) {
echo "readonly";
} ?>>
<option value="">--Select--</option>
<?php $MaritalStatusData = array('single', 'married', 'others');
foreach ($MaritalStatusData as $value) {
$selected = (isset($editData->marital_status) && $editData->marital_status === $value) ? "selected" : "";
?>
<option value="<?php echo $value; ?>" <?php echo $selected; ?>>
<?php echo ucfirst($value); ?>
</option>
<?php } ?>
</select>
</div>
@ -286,16 +269,16 @@ class="form-control" type="email"
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_name" name="relation_name"
value="<?php if(isset($editData)) { echo $editData->relation_name; } ?>"
onkeypress="validateKeyPress(event)" class="form-control ">
<input type="text" id="relation_name" name="relation_name" value="<?php if (isset($editData)) {
echo $editData->relation_name;
} ?>" onkeypress="validateKeyPress(event)" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Relationship</label>
<div class="col-md-5 col-sm-5 ">
<input id="relationship" name="relationship"
value="<?php if(isset($editData)) { echo $editData->relationship; } ?>" class="form-control"
type="text">
<input id="relationship" name="relationship" value="<?php if (isset($editData)) {
echo $editData->relationship;
} ?>" class="form-control" type="text">
</div>
</div>
@ -304,19 +287,16 @@ class="form-control" type="email"
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_mobile" name="relation_mobile"
value="<?php if(isset($editData)) { echo $editData->relation_mobile; } ?>"
class="form-control " onkeypress="return matchnum(event)" class="form-control" type="tel"
pattern="[6-9][0-9]{9}" minlength="10" maxlength="10"
oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')"
oninput="setCustomValidity('')">
<input type="text" id="relation_mobile" name="relation_mobile" value="<?php if (isset($editData)) {
echo $editData->relation_mobile;
} ?>" class="form-control " onkeypress="return matchnum(event)" class="form-control" type="tel" pattern="[6-9][0-9]{9}" minlength="10" maxlength="10" oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')" oninput="setCustomValidity('')">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Home Tel</label>
<div class="col-md-5 col-sm-5 ">
<input id="relation_tel" name="relation_tel"
value="<?php if(isset($editData)) { echo $editData->relation_tel; } ?>"
onkeypress="return matchnum(event)" class="form-control" type="text">
<input id="relation_tel" name="relation_tel" value="<?php if (isset($editData)) {
echo $editData->relation_tel;
} ?>" onkeypress="return matchnum(event)" class="form-control" type="text">
</div>
</div>
@ -331,14 +311,16 @@ class="form-control " onkeypress="return matchnum(event)" class="form-control" t
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Address</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="address" name="address"
value="<?php if(isset($editData)) { echo $editData->address; } ?>" class="form-control ">
<input type="text" id="address" name="address" value="<?php if (isset($editData)) {
echo $editData->address;
} ?>" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> City</label>
<div class="col-md-5 col-sm-5 ">
<input id="city" name="city" value="<?php if(isset($editData)) { echo $editData->city; } ?>"
class="form-control" type="text">
<input id="city" name="city" value="<?php if (isset($editData)) {
echo $editData->city;
} ?>" class="form-control" type="text">
</div>
</div>
@ -347,15 +329,16 @@ class="form-control" type="text">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> State</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="state" name="state"
value="<?php if(isset($editData)) { echo $editData->state; } ?>" class="form-control ">
<input type="text" id="state" name="state" value="<?php if (isset($editData)) {
echo $editData->state;
} ?>" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Pincode</label>
<div class="col-md-5 col-sm-5 ">
<input id="pincode" name="pincode"
value="<?php if(isset($editData)) { echo $editData->pincode; } ?>"
onkeypress="return matchnum(event)" class="form-control" type="text">
<input id="pincode" name="pincode" value="<?php if (isset($editData)) {
echo $editData->pincode;
} ?>" onkeypress="return matchnum(event)" class="form-control" type="text">
</div>
</div>
@ -370,15 +353,16 @@ class="form-control" type="text">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Employee Id</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="emp_id" name="emp_id"
value="<?php if(isset($editData)) { echo $editData->emp_id; } ?>" class="form-control ">
<input type="text" id="emp_id" name="emp_id" value="<?php if (isset($editData)) {
echo $editData->emp_id;
} ?>" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Salary</label>
<div class="col-md-5 col-sm-5 ">
<input id="salary" name="salary"
value="<?php if(isset($editData)) { echo $editData->salary; } ?>" class="form-control"
type="text">
<input id="salary" name="salary" value="<?php if (isset($editData)) {
echo $editData->salary;
} ?>" class="form-control" type="text">
</div>
</div>
@ -386,26 +370,15 @@ class="form-control" type="text">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Comment</label>
<div class="col-md-5 col-sm-5 ">
<input id="comment" name="comment"
value="<?php if(isset($editData)) { echo $editData->comment; } ?>" class="form-control"
type="text">
<input id="comment" name="comment" value="<?php if (isset($editData)) {
echo $editData->comment;
} ?>" class="form-control" type="text">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Gender</label>
<div class="col-md-5 col-sm-5 " style="padding:10px;">
<?php
if ($editData->gender == 'male')
{
echo '<input type="radio" name="gender" value="male" checked/>Male';
echo '&nbsp&nbsp';
echo '<input type="radio" name="gender" value="female" />Female';
}
else
{
echo '<input type="radio" name="gender" value="male"/>Male';
echo '&nbsp&nbsp';
echo '<input type="radio" name="gender" value="female" checked/>Female';
} ?>
<input type="radio" name="gender" value="male" <?php if ($value == 'male') echo 'checked'; ?> /> Male
<input type="radio" name="gender" value="female" <?php if ($value == 'female') echo 'checked'; ?> /> Female
</div>
</div>
@ -414,12 +387,10 @@ class="form-control" type="text">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Photo Upload</label>
<div class="col-md-5 col-sm-5 ">
<input type="file" id="image" name="image"
value="<?php if(isset($editData->profile_pic)) { echo $editData->profile_pic; } ?>"
class="form-control " onchange="validateFile(this)">
<img class="profilepic__image" style="width: 50%; display: block;padding:10px;"
src="<?php echo base_url();?>/assets/uploads/<?php echo $editData->profile_pic ?>"
alt="Avatar" title="Change the avatar">
<input type="file" id="image" name="image" value="<?php if (isset($editData->profile_pic)) {
echo $editData->profile_pic;
} ?>" class="form-control " onchange="validateFile(this)">
<img class="profilepic__image" style="width: 50%; display: block;padding:10px;" src="<?php echo base_url(); ?>/assets/uploads/<?php echo $editData->profile_pic ?>" alt="Avatar" title="Change the avatar">
</div>
</div>
@ -459,9 +430,7 @@ class="form-control " onchange="validateFile(this)">
</div>
</div>
<!-- <div class="ln_solid"></div> -->
<!-- ----------------------------------------- -->
<div class="x_panel"><br>
<div class="item form-group">
<div class=" offset-md-8">
@ -471,27 +440,13 @@ class="form-control " onchange="validateFile(this)">
</div>
</div>
</form>
</div>
</div>
</div>
<br />
<!-- <div id="sub-value" class="col-md-12 col-sm-12">
<?php echo $emp_sub_list_htmlPage; ?>
</div> -->
</div>
</div>
<!-- /Body page content -->
<script>
$('#myDatepicker').datetimepicker({
format: 'DD.MM.YYYY'
@ -592,11 +547,12 @@ function check_if_exists(id, value, name) {
$.ajax({
type: "get",
url: "<?php echo base_url(); ?>Employee/checkUniqueValue",
data: { value: value, name: name },
success:function(response)
{
if (response == true)
{
data: {
value: value,
name: name
},
success: function(response) {
if (response == true) {
new PNotify({
title: 'Warning',
text: 'That given details Already Exists',
@ -609,3 +565,17 @@ function check_if_exists(id, value, name) {
});
}
</script>
<script>
document.querySelector('form').addEventListener('submit', function(event) {
var form = event.target;
var submitBtn = form.querySelector('button[type="submit"]');
if (!form.checkValidity()) {
form.reportValidity(); // Display validation error messages
event.preventDefault(); // Prevent form submission if it's not valid
submitBtn.disabled = false;
} else {
submitBtn.disabled = true;
}
});
</script>

View File

@ -1,6 +1,4 @@
<!-- Body page content -->
<div class="">
<div class="page-title">
@ -8,7 +6,6 @@
<h3>Add User</h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
@ -25,13 +22,10 @@
<!-- </div> -->
<div class="x_content">
<br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post"
action="<?php echo base_url();?>User/createUser" enctype="multipart/form-data">
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url(); ?>User/createUser" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>"
value="<?php echo $this->security->get_csrf_hash();?>">
<input type="text" id="created_by" name="created_by" value="<?php echo $data->created_by ?>"
class="form-control " hidden>
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
<input type="text" id="created_by" name="created_by" value="<?php echo $data->created_by ?>" class="form-control " hidden>
<!-- <?php if (is_superadmin()) { ?>
@ -40,11 +34,18 @@ class="form-control " hidden>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Business<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<select id="business_id" name="business_id" required="required" class="form-control" >
<option value="<?php if(isset($businessData)) { echo $businessData->uid; } ?>">
<?php if(isset($businessData)) { echo $businessData->business_name; }else{ echo "Select business"; } ?>
<option value="<?php if (isset($businessData)) {
echo $businessData->uid;
} ?>">
<?php if (isset($businessData)) {
echo $businessData->business_name;
} else {
echo "Select business";
} ?>
</option>
<?php foreach ($business_dropdown as $key => $value) { ?>
<option value="<?php echo $value->uid; ?>"><?php echo $value->business_name; echo $value->uid; ?></option>
<option value="<?php echo $value->uid; ?>"><?php echo $value->business_name;
echo $value->uid; ?></option>
<?php } ?>
</select>
</div>
@ -66,23 +67,28 @@ class="form-control " hidden>
<?php if (is_superadmin()) { ?>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Business<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Business<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<select id="business_id" name="business_id" required="required" class="form-control">
<option value="<?php if(isset($businessData)) { echo $businessData->uid; } ?>">
<?php if(isset($businessData)) { echo $businessData->business_name; }else{ echo "Select business"; } ?>
<option value="<?php if (isset($businessData)) {
echo $businessData->uid;
} ?>">
<?php if (isset($businessData)) {
echo $businessData->business_name;
} else {
echo "Select business";
} ?>
</option>
<?php foreach ($business_dropdown as $key => $value) { ?>
<option value="<?php echo $value->uid; ?>">
<?php echo $value->business_name; echo $value->uid; ?></option>
<?php echo $value->business_name;
echo $value->uid; ?></option>
<?php } ?>
</select>
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Role<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Role<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<select id="role" name="role" required="required" class="form-control">
<option value="">Select role</option>
@ -94,8 +100,7 @@ class="form-control " hidden>
<?php } else if (is_admin() || user()->action_permit != 'view') { ?>
<div class="item form-group" hidden>
<input type="text" id="business_id" name="business_id"
value="<?php echo $data->business_id ?>" class="form-control " hidden>
<input type="text" id="business_id" name="business_id" value="<?php echo $data->business_id ?>" class="form-control " hidden>
<input type="text" id="role" name="role" value="user" class="form-control " hidden>
</div>
<?php } ?>
@ -105,37 +110,28 @@ class="form-control " hidden>
<!-- --------------------------- -->
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name" value="" required="required"
class="form-control ">
<input type="text" id="name" name="name" value="" required="required" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Email<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Email<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input type="email" id="email" name="email" value="" required="required"
class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input type="email" id="email" name="email" pattern="[^\s@]+@[^\s@]+\.[^\s@]+" value="" required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
</div>
<!-- --------------------------- -->
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input type="text" pattern="[6-9]{1}[0-9]{9}"
title="Phone number with 6-9 and remaing 9 digit with 0-9" id="mobile" name="mobile"
value="" required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input type="text" pattern="[6-9]{1}[0-9]{9}" title="Phone number with 6-9 and remaing 9 digit with 0-9" id="mobile" name="mobile" value="" required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Permission<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Permission<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<select id="action_permit" name="action_permit" required="required"
class="form-control">
<select id="action_permit" name="action_permit" required="required" class="form-control">
<option value="">Select Permission</option>
<option value="all">All</option>
<option value="view">View</option>
@ -149,28 +145,20 @@ class="form-control">
<div class="x_title"> </div> <br />
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 ">
<input type="text" id="user_name" name="user_name" value="" required="required"
class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input type="text" id="user_name" name="user_name" value="" required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Password<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Password<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 ">
<input type="password" id="password" minlength="8" name="password" value=""
required="required" class="form-control "
title="password must have alphabets &#013;password requires 6 characters minimum">
<span toggle="#password" id="toggle-password"
class="fa fa-fw fa-eye field-icon toggle-password"></span>
<input type="password" id="password" minlength="8" name="password" value="" required="required" class="form-control " title="password must have alphabets &#013;password requires 6 characters minimum">
<span toggle="#password" id="toggle-password" class="fa fa-fw fa-eye field-icon toggle-password"></span>
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password<a
style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 ">
<input type="password" id="confirm_password" name="confirm_password" value=""
required="required" class="form-control ">
<input type="password" id="confirm_password" name="confirm_password" value="" required="required" class="form-control ">
<span id='message'></span>
</div>
</div>
@ -178,7 +166,7 @@ class="fa fa-fw fa-eye field-icon toggle-password"></span>
<div class="ln_solid"></div>
<div class="item form-group">
<div class="offset-md-8">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button class="btn btn-secondary" onclick="onclick=" <?= base_url() . "User/userList"; ?>"">Cancel</button>
<button class="btn btn-primary" type="reset">Reset</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>
@ -199,11 +187,12 @@ function check_if_exists(id, value, name) {
$.ajax({
type: "get",
url: "<?php echo base_url(); ?>User/checkUniqueValue",
data: { value: value, name: name },
success:function(response)
{
if (response == true)
{
data: {
value: value,
name: name
},
success: function(response) {
if (response == true) {
new PNotify({
title: 'Warning',
text: 'That given details Already Exists',
@ -216,3 +205,17 @@ function check_if_exists(id, value, name) {
});
}
</script>
<script>
document.querySelector('form').addEventListener('submit', function(event) {
var form = event.target;
var submitBtn = form.querySelector('button[type="submit"]');
if (!form.checkValidity()) {
form.reportValidity(); // Display validation error messages
event.preventDefault(); // Prevent form submission if it's not valid
submitBtn.disabled = false;
} else {
submitBtn.disabled = true;
}
});
</script>

View File

@ -1,7 +1,4 @@
<!-- Body page content -->
<div class="">
<div class="page-title">
@ -26,42 +23,35 @@
<!-- </div> -->
<div class="x_content">
<br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post"
action="<?php echo base_url();?>User/editUsers" enctype="multipart/form-data">
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url(); ?>User/editUsers" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>"
value="<?php echo $this->security->get_csrf_hash();?>">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
<input type="hidden" name="id" value="<?php echo $editData->id; ?>">
<!-- --------------------------- -->
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name </label>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name" value="<?php echo $editData->name; ?>"
required="required" class="form-control ">
<input type="text" id="name" name="name" value="<?php echo $editData->name; ?>" required="required" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Email </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Email<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input type="email" id="email" name="email" value="<?php echo $editData->email; ?>"
required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input type="email" id="email" name="email" pattern="[^\s@]+@[^\s@]+\.[^\s@]+" value="<?php echo $editData->email; ?>" required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
</div>
<!-- --------------------------- -->
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile </label>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input type="text" pattern="[6-9]{1}[0-9]{9}"
title="Phone number with 6-9 and remaing 9 digit with 0-9" id="mobile" name="mobile"
value="<?php echo $editData->mobile; ?>" required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input type="text" pattern="[6-9]{1}[0-9]{9}" title="Phone number with 6-9 and remaing 9 digit with 0-9" id="mobile" name="mobile" value="<?php echo $editData->mobile; ?>" required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name">Permission </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name">Permission<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<select id="action_permit" name="action_permit" required="required"
class="form-control">
<select id="action_permit" name="action_permit" required="required" class="form-control">
<option value="<?php echo $editData->action_permit; ?>">
<?php echo $editData->action_permit; ?></option>
<?php
@ -69,8 +59,7 @@ class="form-control">
?>
<option value="view">view</option>
<?php
}
else{
} else {
?>
<option value="all">all</option>
<?php
@ -83,18 +72,14 @@ class="form-control">
<!-- --------------------------- -->
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Username </label>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="user_name" name="user_name"
value="<?php echo $editData->user_name; ?>" required="required"
class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
<input type="text" id="user_name" name="user_name" value="<?php echo $editData->user_name; ?>" required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name" hidden> Password </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name" hidden> Password<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input type="hidden" minlength="8" id="password" name="password"
value="<?php echo $editData->password; ?>" required="required"
class="form-control ">
<input type="hidden" minlength="8" id="password" name="password" value="<?php echo $editData->password; ?>" required="required" class="form-control ">
</div>
</div>
@ -104,7 +89,7 @@ class="form-control ">
<div class="ln_solid"></div>
<div class="item form-group">
<div class="col-md-6 col-sm-6 offset-md-10">
<button class="btn btn-primary" onclick="history.back()">Cancel</button>
<button class="btn btn-primary" onclick="<?= base_url() . "User/userList"; ?>">Cancel</button>
<button type="submit" class="btn btn-success">Update</button>
</div>
</div>
@ -124,11 +109,12 @@ function check_if_exists(id, value, name) {
$.ajax({
type: "get",
url: "<?php echo base_url(); ?>User/checkUniqueValue",
data: { value: value, name: name },
success:function(response)
{
if (response == true)
{
data: {
value: value,
name: name
},
success: function(response) {
if (response == true) {
new PNotify({
title: 'Warning',
text: 'That given details Already Exists',
@ -141,3 +127,17 @@ function check_if_exists(id, value, name) {
});
}
</script>
<script>
document.querySelector('form').addEventListener('submit', function(event) {
var form = event.target;
var submitBtn = form.querySelector('button[type="submit"]');
if (!form.checkValidity()) {
form.reportValidity(); // Display validation error messages
event.preventDefault(); // Prevent form submission if it's not valid
submitBtn.disabled = false;
} else {
submitBtn.disabled = true;
}
});
</script>

View File

@ -54,8 +54,8 @@
<th class="column-title">Email </th>
<th class="column-title">Mobile </th>
<th class="column-title">Role </th>
<th class="column-title" >Permit </th>
<th class="column-title" >status </th>
<th class="column-title">Permission </th>
<th class="column-title">Status </th>
<th class="column-title">Action </th>
</tr>
</thead>
@ -128,7 +128,9 @@
$('.bs-example-modal-lg').html(response);
$('.bs-example-modal-lg').modal("show");
},
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
error: function(jqXHR, textStatus, err) {
alert('text status ' + textStatus + ', err ' + err)
}
});
});
</script>
@ -139,15 +141,13 @@
[0, 'desc']
],
"dom": 'Bfrtip',
buttons: [
{
buttons: [{
extend: 'pdfHtml5',
title: 'Users',
text: 'PDF',
customize: function(doc) {
doc.content[1].table.body.forEach(function(row) {
// Remove the first and last columns
row.splice(0, 1);
// Remove the last column
row.pop();
});
}
@ -164,4 +164,3 @@
});
});
</script>