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,28 +1,22 @@
<!-- Body page content --> <!-- Body page content -->
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <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/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/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></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" src="<?php echo base_url(); ?>/assets/jquery.multi-select.js"></script>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
$('#people').multiSelect(); $('#people').multiSelect();
}); });
</script> </script>
<style type="text/css"> <style type="text/css">
.multi-select-container { .multi-select-container {
display: inline-block; display: inline-block;
position: relative; position: relative;
width: 100%; width: 100%;
} }
.multi-select-menu { .multi-select-menu {
position: absolute; position: absolute;
left: 0; left: 0;
top: 2em; top: 2em;
@ -34,23 +28,23 @@
border: 1px solid #aaa; border: 1px solid #aaa;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
display: none; display: none;
} }
.multi-select-menuitem { .multi-select-menuitem {
display: block; display: block;
font-size: 0.875em; font-size: 0.875em;
padding: 0.6em 1em 0.6em 30px; padding: 0.6em 1em 0.6em 30px;
white-space: nowrap; white-space: nowrap;
} }
.multi-select-menuitem--titled:before { .multi-select-menuitem--titled:before {
display: block; display: block;
font-weight: bold; font-weight: bold;
content: attr(data-group-title); content: attr(data-group-title);
margin: 0 0 0.25em -20px; margin: 0 0 0.25em -20px;
} }
.multi-select-menuitem--titledsr:before { .multi-select-menuitem--titledsr:before {
display: block; display: block;
font-weight: bold; font-weight: bold;
content: attr(data-group-title); content: attr(data-group-title);
@ -62,23 +56,23 @@
padding: 0; padding: 0;
position: absolute; position: absolute;
width: 1px; width: 1px;
} }
.multi-select-menuitem+.multi-select-menuitem { .multi-select-menuitem+.multi-select-menuitem {
padding-top: 0; padding-top: 0;
} }
.multi-select-presets { .multi-select-presets {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
.multi-select-menuitem input { .multi-select-menuitem input {
position: absolute; position: absolute;
margin-top: 0.25em; margin-top: 0.25em;
margin-left: -20px; margin-left: -20px;
} }
.multi-select-button { .multi-select-button {
display: block; display: block;
margin-top: 2px; margin-top: 2px;
width: 100%; width: 100%;
@ -92,9 +86,9 @@
background-color: #fff; background-color: #fff;
border: 1px solid #aaa; border: 1px solid #aaa;
cursor: default; cursor: default;
} }
.multi-select-button:after { .multi-select-button:after {
content: ""; content: "";
position: absolute; position: absolute;
display: inline-block; display: inline-block;
@ -107,30 +101,30 @@
vertical-align: 0.1em; vertical-align: 0.1em;
right: 5px; right: 5px;
top: 17px; top: 17px;
} }
.multi-select-container--open .multi-select-menu { .multi-select-container--open .multi-select-menu {
display: block; display: block;
} }
.multi-select-container--open .multi-select-button:after { .multi-select-container--open .multi-select-button:after {
border-width: 0 0.4em 0.4em 0.4em; border-width: 0 0.4em 0.4em 0.4em;
border-color: transparent transparent #999 transparent; border-color: transparent transparent #999 transparent;
} }
.multi-select-container--positioned .multi-select-menu { .multi-select-container--positioned .multi-select-menu {
/* Avoid border/padding on menu messing with JavaScript width calculation */ /* Avoid border/padding on menu messing with JavaScript width calculation */
box-sizing: border-box; box-sizing: border-box;
} }
.multi-select-container--positioned .multi-select-menu label { .multi-select-container--positioned .multi-select-menu label {
/* Allow labels to line wrap when menu is artificially narrowed */ /* Allow labels to line wrap when menu is artificially narrowed */
white-space: normal; white-space: normal;
} }
#errMessage { #errMessage {
color: red; color: red;
} }
</style> </style>
@ -143,24 +137,20 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="row"> <div class="row">
<div class="col-md-12 col-sm-12 "> <div class="col-md-12 col-sm-12 ">
<!-- <div class="x_title"> <!-- <div class="x_title">
<ul class="nav navbar-right panel_toolbox">
<ul class="nav navbar-right panel_toolbox"> <li><a class="collapse-link"><i id="chevron" class="fa fa-chevron-up"></i></a></li>
<li><a class="collapse-link"><i id="chevron" class="fa fa-chevron-up"></i></a></li> </li>
</li> </ul>
</ul> <h6>Add Employee Information</h6>
<h6>Add Employee Information</h6> <div class="clearfix"></div>
<div class="clearfix"></div> </div> -->
</div> -->
<!-- <div class="x_content"> --> <!-- <div class="x_content"> -->
<br /> <br />
<form id="form" data-parsley-validate class="form-horizontal form-label-left" method="post" <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">
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();?>">
<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_panel">
<div class="x_title"> <div class="x_title">
<h5>Personal Information<a style="color:red;">*</a> <h5>Personal Information<a style="color:red;">*</a>
@ -168,23 +158,19 @@
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a <label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name" <input type="text" id="name" name="name" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->name; } ?>" required="required" echo $editData->name;
onkeypress="validateKeyPress(event)" class="form-control "> } ?>" required="required" onkeypress="validateKeyPress(event)" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Email<a style="color:red;">*</a> <label class="control-label col-md-1 col-sm-1 " for="email"> Email<a style="color:red;">*</a>
</label> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="email" name="email" <input id="email" name="email" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)){ echo $editData->email; } ?>" required="required" echo $editData->email;
class="form-control" type="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)">
oninvalid="setCustomValidity('Enter a Valid E-mail Address.')"
oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div> </div>
</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 class="control-label col-md-1 col-sm-1 " for="email"> Mobile<a style="color:red;">*</a>
</label> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="mobile" name="mobile" <input id="mobile" name="mobile" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" echo $editData->mobile;
onkeypress="return matchnum(event)" required="required" class="form-control" type="text" } ?>" 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)">
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> </div>
<label class="control-label col-md-1 col-sm-1 " for="first-name">Department</label> <label class="control-label col-md-1 col-sm-1 " for="first-name">Department</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="department" name="department" required="required" class="form-control"> <select id="department" name="department" required="required" class="form-control">
<option value="">--Select--</option> <option value="">--Select--</option>
<!-- <option value="<?php if(isset($editData)) { echo $editData->department; } ?>"> --> <!-- <option value="<?php if (isset($editData)) {
<?php if(isset($assetData)) { echo $editData->department; } ?></option> echo $editData->department;
} ?>"> -->
<?php if (isset($assetData)) {
echo $editData->department;
} ?></option>
<?php foreach ($departmentData as $key => $value) { ?> <?php foreach ($departmentData as $key => $value) { ?>
<option value="<?php echo $value->name; ?>"><?php echo $value->name; ?></option> <option value="<?php echo $value->name; ?>"><?php echo $value->name; ?></option>
<?php } ?> <?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> <label class="control-label col-md-1 col-sm-1 " for="email">Join date</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="j_date" name="j_date" <input id="j_date" name="j_date" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->email; } ?>" class="form-control" echo $editData->email;
type="text" placeholder="DD-MM-YYYY" onkeypress="validateKeyPress(event)" } ?>" class="form-control" type="text" placeholder="DD-MM-YYYY" onkeypress="validateKeyPress(event)" autocomplete="off">
autocomplete="off">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label>
@ -232,7 +218,7 @@ class="form-control" type="email"
<select id="manager" name="manager" class="form-control"> <select id="manager" name="manager" class="form-control">
<option value="">--Select--</option> <option value="">--Select--</option>
<?php foreach ($manager as $key => $value) { ?> <?php foreach ($manager as $key => $value) { ?>
<option value="<?php echo $value->id;?>"><?php echo $value->name; ?></option> <option value="<?php echo $value->id; ?>"><?php echo $value->name; ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@ -256,28 +242,20 @@ class="form-control" type="email"
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a <label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 "> <div class="col-md-3 col-sm-3 ">
<input type="text" id="user_name" name="user_name" value="" required="required" <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)">
class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Password<a <label class="control-label col-md-1 col-sm-1 " for="last-name"> Password<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 "> <div class="col-md-3 col-sm-3 ">
<input type="password" id="password" minlength="8" name="password" value="" <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">
required="required" class="form-control " <span toggle="#password" id="toggle-password" class="fa fa-fw fa-eye field-icon toggle-password"></span>
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> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password<a <label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 "> <div class="col-md-3 col-sm-3 ">
<input type="password" id="confirm_password" name="confirm_password" value="" <input type="password" id="confirm_password" name="confirm_password" value="" required="required" class="form-control ">
required="required" class="form-control ">
<span id='message'></span><span id='errMessage'></span> <span id='message'></span><span id='errMessage'></span>
</div> </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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Name</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_name" name="relation_name" <input type="text" id="relation_name" name="relation_name" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->name; } ?>" echo $editData->name;
onkeypress="validateKeyPress(event)" class="form-control "> } ?>" onkeypress="validateKeyPress(event)" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Relationship</label> <label class="control-label col-md-1 col-sm-1 " for="email"> Relationship</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="relationship" name="relationship" <input id="relationship" name="relationship" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->email; } ?>" echo $editData->email;
class="form-control" onkeypress="validateKeyPress(event)" type="text"> } ?>" class="form-control" onkeypress="validateKeyPress(event)" type="text">
</div> </div>
</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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_mobile" name="relation_mobile" <input type="text" id="relation_mobile" name="relation_mobile" onkeypress="return matchnum(event)" value="<?php if (isset($editData)) {
onkeypress="return matchnum(event)" echo $editData->name;
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('')">
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> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Home Tel</label> <label class="control-label col-md-1 col-sm-1 " for="email"> Home Tel</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="relation_tel" name="relation_tel" onkeypress="return matchnum(event)" <input id="relation_tel" name="relation_tel" onkeypress="return matchnum(event)" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->relation_tel; } ?>" echo $editData->relation_tel;
class="form-control" type="text"> } ?>" class="form-control" type="text">
</div> </div>
</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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Address</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="address" name="address" <input type="text" id="address" name="address" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->address; } ?>" echo $editData->address;
class="form-control "> } ?>" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> City</label> <label class="control-label col-md-1 col-sm-1 " for="email"> City</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="city" name="city" value="<?php if(isset($editData)) { echo $editData->city; } ?>" <input id="city" name="city" value="<?php if (isset($editData)) {
class="form-control" type="text"> echo $editData->city;
} ?>" class="form-control" type="text">
</div> </div>
</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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> State</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="state" name="state" <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> -->
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1" for="first-name">State</label> <label class="control-label col-md-1 col-sm-1" for="first-name">State</label>
<div class="col-md-5 col-sm-5"> <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> <span id="stateError" style="color: red;"></span>
</div> </div>
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Pincode</label> <label class="control-label col-md-1 col-sm-1 " for="email"> Pincode</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="pincode" name="pincode" onkeypress="return matchnum(event)" <input id="pincode" name="pincode" onkeypress="return matchnum(event)" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->pincode; } ?>" class="form-control" echo $editData->pincode;
type="text"> } ?>" class="form-control" type="text">
</div> </div>
</div> </div>
</div>
<!-- -----------------------------------------------------------------------------------> <!-- ----------------------------------------------------------------------------------->
<div class="x_panel"> <div class="x_panel">
<div class="x_title"> <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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Employee Id</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="employee_id" name="emp_id" <input type="text" id="employee_id" name="emp_id" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->name; } ?>" class="form-control"> echo $editData->name;
} ?>" class="form-control">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Salary</label> <label class="control-label col-md-1 col-sm-1 " for="email"> Salary</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="salary" name="salary" <input id="salary" name="salary" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" class="form-control" echo $editData->mobile;
type="text"> } ?>" class="form-control" type="text">
</div> </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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Comment</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="comment" name="comment" <input id="comment" name="comment" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" class="form-control" echo $editData->mobile;
type="text"> } ?>" class="form-control" type="text">
</div> </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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Photo Upload</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="file" id="image" name="image" <input type="file" id="image" name="image" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->profile_pic; } ?>" echo $editData->profile_pic;
class="form-control typeFile" onchange="validateFile(this)" } ?>" class="form-control typeFile" onchange="validateFile(this)" accept="image/png, image/jpeg, image/jpg, application/pdf">
accept="image/png, image/jpeg, image/jpg, application/pdf">
<img class="profilepic__image" style="width: 50%; display: block;padding:10px;" src=""> <img class="profilepic__image" style="width: 50%; display: block;padding:10px;" src="">
</div> </div>
@ -452,11 +431,11 @@ class="form-control typeFile" onchange="validateFile(this)"
</div> </div>
</div> </div>
</div> </div>
<!-- ----------------------------------------- -->
<div class="x_panel"><br> <div class="x_panel"><br>
<div class="item form-group"> <div class="item form-group">
<div class="offset-md-8"> <div class="offset-md-8">
<a href="<?php echo base_url();?>Employee/empList" class="btn btn-secondary">Cancel</a> <a href="<?php echo base_url(); ?>Employee/empList" class="btn btn-secondary">Cancel</a>
<button id="submit" type="submit" class="btn btn-success">Submit</button> <button id="submit" type="submit" class="btn btn-success">Submit</button>
</div> </div>
</div> </div>
@ -468,7 +447,7 @@ class="form-control typeFile" onchange="validateFile(this)"
</div> </div>
<!-- /Body page content --> <!-- /Body page content -->
<script> <script>
function matchnum(event) { function matchnum(event) {
var charcode; var charcode;
charcode = event.which || event.keyCode; charcode = event.which || event.keyCode;
@ -476,26 +455,26 @@ function matchnum(event) {
if (charcode >= 48 && charcode <= 57) return true; //only numbers if (charcode >= 48 && charcode <= 57) return true; //only numbers
return false; return false;
} }
function validateKeyPress(event) { function validateKeyPress(event) {
var key = event.key; var key = event.key;
var allowedCharacters = /^[A-Za-z.]$/; var allowedCharacters = /^[A-Za-z.]$/;
if (!allowedCharacters.test(key)) { if (!allowedCharacters.test(key)) {
event.preventDefault(); event.preventDefault();
} }
} }
$(document).ready(function() { $(document).ready(function() {
// $('.fa fa-chevron-up').click(); // $('.fa fa-chevron-up').click();
// setTimeout(() => { $('#chevron1').click(); }, 500); // setTimeout(() => { $('#chevron1').click(); }, 500);
}); });
$(document).on('change', '#image', function() { $(document).on('change', '#image', function() {
const file = this.files[0]; const file = this.files[0];
if (file) { if (file) {
@ -506,15 +485,15 @@ function validateKeyPress(event) {
} }
reader.readAsDataURL(file); reader.readAsDataURL(file);
} }
}); });
</script> </script>
<script> <script>
var dateFormat = "dd-mm-yy"; var dateFormat = "dd-mm-yy";
var fromDateInput = $("#j_date"); var fromDateInput = $("#j_date");
console.log(fromDateInput); console.log(fromDateInput);
fromDateInput.datepicker({ fromDateInput.datepicker({
dateFormat: dateFormat, dateFormat: dateFormat,
changeYear: true, changeYear: true,
changeMonth: true, changeMonth: true,
@ -523,20 +502,20 @@ function validateKeyPress(event) {
onSelect: function(dateText, inst) { onSelect: function(dateText, inst) {
} }
}); });
function validateKeyPress(event) { function validateKeyPress(event) {
var key = event.key; var key = event.key;
var allowedCharacters = /^[A-Za-z._/]$/; var allowedCharacters = /^[A-Za-z._/]$/;
if (!allowedCharacters.test(key)) { if (!allowedCharacters.test(key)) {
event.preventDefault(); event.preventDefault();
} }
} }
</script> </script>
<script> <script>
function validateFile(input) { function validateFile(input) {
const file = input.files[0]; const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"]; const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
const fileExtension = file.name.split(".").pop().toLowerCase(); const fileExtension = file.name.split(".").pop().toLowerCase();
@ -569,67 +548,63 @@ function validateFile(input) {
}; };
reader.readAsDataURL(file); reader.readAsDataURL(file);
} }
} }
</script> </script>
<script> <script>
// Get the select element // Get the select element
var select = document.getElementById("module"); var select = document.getElementById("module");
// Add event listener to handle checkbox selection // Add event listener to handle checkbox selection
select.addEventListener("change", function() { select.addEventListener("change", function() {
var selectedOptions = Array.from(this.selectedOptions).map(option => option.value); var selectedOptions = Array.from(this.selectedOptions).map(option => option.value);
console.log(selectedOptions); // You can perform further operations with the selected values console.log(selectedOptions); // You can perform further operations with the selected values
}); });
</script> </script>
<script> <script>
function check_if_exists(id, value, name) { function check_if_exists(id, value, name) {
// alert(name); // alert(name);
// var data = $(this).val(); // var data = $(this).val();
$.ajax({ $.ajax({
type:"get", type: "get",
url: "<?php echo base_url(); ?>Employee/checkUniqueValue", url: "<?php echo base_url(); ?>Employee/checkUniqueValue",
data: { value: value, name: name }, data: {
success:function(response) value: value,
{ name: name
if (response == true) },
{ success: function(response) {
if (response == true) {
new PNotify({ new PNotify({
title: 'Warning', title: 'Warning',
text: 'That given details Already Exists', text: 'That given details Already Exists',
styling: 'bootstrap3' styling: 'bootstrap3'
}); });
$("#"+id).val(''); $("#" + id).val('');
} }
} }
}); });
} }
$('#password').keyup(function() { $('#password').keyup(function() {
if ($('#confirm_password').val() == "") { if ($('#confirm_password').val() == "") {
$('#errMessage').html('Please Enter confirm password'); $('#errMessage').html('Please Enter confirm password');
} else { } else {
$('#errMessage').html(''); $('#errMessage').html('');
} }
}); });
$('#confirm_password').keyup(function() { $('#confirm_password').keyup(function() {
if ($('#confirm_password').val() == "") { if ($('#confirm_password').val() == "") {
$('#errMessage').html('Please Enter confirm password'); $('#errMessage').html('Please Enter confirm password');
} else { } else {
$('#errMessage').html(''); $('#errMessage').html('');
} }
}); });
</script> </script>
<script> <script>
document.getElementById('state').addEventListener('input', function(event) { document.getElementById('state').addEventListener('input', function(event) {
var stateInput = event.target.value; var stateInput = event.target.value;
var regex = /^[A-Za-z\s]+$/; // Allows only letters and spaces var regex = /^[A-Za-z\s]+$/; // Allows only letters and spaces
@ -637,11 +612,10 @@ function check_if_exists(id, value, name) {
// Remove any special characters or numbers // Remove any special characters or numbers
event.target.value = stateInput.replace(/[^A-Za-z\s]/g, ''); event.target.value = stateInput.replace(/[^A-Za-z\s]/g, '');
} }
}); });
</script> </script>
<script> <script>
document.getElementById('city').addEventListener('input', function(event) { document.getElementById('city').addEventListener('input', function(event) {
var cityInput = event.target.value; var cityInput = event.target.value;
var regex = /^[A-Za-z\s]+$/; // Allows only letters and spaces var regex = /^[A-Za-z\s]+$/; // Allows only letters and spaces
@ -649,16 +623,15 @@ function check_if_exists(id, value, name) {
// Remove any special characters or numbers // Remove any special characters or numbers
event.target.value = cityInput.replace(/[^A-Za-z\s]/g, ''); event.target.value = cityInput.replace(/[^A-Za-z\s]/g, '');
} }
}); });
</script> </script>
<script> <script>
function validateEmail(email) { function validateEmail(email) {
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
return regex.test(email); return regex.test(email);
} }
$(document).on('blur', '#email', function() { $(document).on('blur', '#email', function() {
const emailValue = $(this).val(); const emailValue = $(this).val();
if (!validateEmail(emailValue)) { if (!validateEmail(emailValue)) {
@ -669,6 +642,19 @@ function validateEmail(email) {
}); });
$(this).val(''); $(this).val('');
} }
}); });
</script> </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,23 +2,21 @@
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <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/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/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 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" src="<?php echo base_url(); ?>/assets/jquery.multi-select.js"></script>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
$('#people').multiSelect(); $('#people').multiSelect();
}); });
</script> </script>
<style type="text/css"> <style type="text/css">
.multi-select-container { .multi-select-container {
display: inline-block; display: inline-block;
position: relative; position: relative;
width: 100%; width: 100%;
} }
.multi-select-menu { .multi-select-menu {
position: absolute; position: absolute;
left: 0; left: 0;
top: 2em; top: 2em;
@ -30,23 +28,23 @@
border: 1px solid #aaa; border: 1px solid #aaa;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
display: none; display: none;
} }
.multi-select-menuitem { .multi-select-menuitem {
display: block; display: block;
font-size: 0.875em; font-size: 0.875em;
padding: 0.6em 1em 0.6em 30px; padding: 0.6em 1em 0.6em 30px;
white-space: nowrap; white-space: nowrap;
} }
.multi-select-menuitem--titled:before { .multi-select-menuitem--titled:before {
display: block; display: block;
font-weight: bold; font-weight: bold;
content: attr(data-group-title); content: attr(data-group-title);
margin: 0 0 0.25em -20px; margin: 0 0 0.25em -20px;
} }
.multi-select-menuitem--titledsr:before { .multi-select-menuitem--titledsr:before {
display: block; display: block;
font-weight: bold; font-weight: bold;
content: attr(data-group-title); content: attr(data-group-title);
@ -58,23 +56,23 @@
padding: 0; padding: 0;
position: absolute; position: absolute;
width: 1px; width: 1px;
} }
.multi-select-menuitem+.multi-select-menuitem { .multi-select-menuitem+.multi-select-menuitem {
padding-top: 0; padding-top: 0;
} }
.multi-select-presets { .multi-select-presets {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
.multi-select-menuitem input { .multi-select-menuitem input {
position: absolute; position: absolute;
margin-top: 0.25em; margin-top: 0.25em;
margin-left: -20px; margin-left: -20px;
} }
.multi-select-button { .multi-select-button {
display: block; display: block;
margin-top: 2px; margin-top: 2px;
width: 100%; width: 100%;
@ -88,9 +86,9 @@
background-color: #fff; background-color: #fff;
border: 1px solid #aaa; border: 1px solid #aaa;
cursor: default; cursor: default;
} }
.multi-select-button:after { .multi-select-button:after {
content: ""; content: "";
position: absolute; position: absolute;
display: inline-block; display: inline-block;
@ -103,59 +101,42 @@
vertical-align: 0.1em; vertical-align: 0.1em;
right: 5px; right: 5px;
top: 17px; top: 17px;
} }
.multi-select-container--open .multi-select-menu { .multi-select-container--open .multi-select-menu {
display: block; display: block;
} }
.multi-select-container--open .multi-select-button:after { .multi-select-container--open .multi-select-button:after {
border-width: 0 0.4em 0.4em 0.4em; border-width: 0 0.4em 0.4em 0.4em;
border-color: transparent transparent #999 transparent; border-color: transparent transparent #999 transparent;
} }
.multi-select-container--positioned .multi-select-menu { .multi-select-container--positioned .multi-select-menu {
/* Avoid border/padding on menu messing with JavaScript width calculation */ /* Avoid border/padding on menu messing with JavaScript width calculation */
box-sizing: border-box; box-sizing: border-box;
} }
.multi-select-container--positioned .multi-select-menu label { .multi-select-container--positioned .multi-select-menu label {
/* Allow labels to line wrap when menu is artificially narrowed */ /* Allow labels to line wrap when menu is artificially narrowed */
white-space: normal; white-space: normal;
} }
</style> </style>
<div class=""> <div class="">
<div class="page-title"> <div class="page-title">
<div class="title_left"> <div class="title_left">
<h3>Edit Employee</h3> <h3>Edit Employee</h3>
</div> </div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="row"> <div class="row">
<div class="col-md-12 col-sm-12 "> <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_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 /> <br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
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="id" value="<?php echo $editData->id; ?>"> <input type="hidden" name="id" value="<?php echo $editData->id; ?>">
<input type="hidden" name="user_id" value="<?php echo $editData->user_id; ?>"> <input type="hidden" name="user_id" value="<?php echo $editData->user_id; ?>">
@ -165,23 +146,19 @@
</div><br /> </div><br />
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a <label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name" <input type="text" id="name" name="name" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->name; } ?>" required="required" echo $editData->name;
class="form-control " onkeypress="validateKeyPress(event)"> } ?>" required="required" class="form-control " onkeypress="validateKeyPress(event)">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Email<a style="color:red;">*</a> <label class="control-label col-md-1 col-sm-1 " for="email"> Email<a style="color:red;">*</a>
</label> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="email" name="email" <input id="email" name="email" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->email; } ?>" required="required" echo $editData->email;
class="form-control" type="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)">
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>
</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 class="control-label col-md-1 col-sm-1 " for="email"> Mobile<a style="color:red;">*</a>
</label> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="mobile" name="mobile" <input id="mobile" name="mobile" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" echo $editData->mobile;
onkeypress="return matchnum(event)" required="required" class="form-control" type="tel" } ?>" 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)">
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> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name">Department</label> <label class="control-label col-md-1 col-sm-1 " for="last-name">Department</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="department" name="department" class="form-control" <select id="department" name="department" class="form-control" placeholder="choose" <?php if (isset($viewData)) {
placeholder="choose" <?php if(isset($viewData)) { echo "readonly"; } ?>> echo "readonly";
<option value="<?php echo $editData->department; ?>"> } ?>>
<?php echo $editData->department; ?></option> <?php if (count($departmentData) > 0) { ?>
<?php foreach ($departmentData as $key => $value) { ?> <option value="">--Select--</option>
<option value="<?php echo $value->name; ?>"><?php echo $value->name; ?></option> <?php foreach ($departmentData as $key => $value) {
<?php } ?> $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> </select>
</div> </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> <label class="control-label col-md-1 col-sm-1 " for="email"> Join Date</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="j_date" name="j_date" <input id="j_date" name="j_date" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->j_date; } ?>" class="form-control" echo $editData->j_date;
type="text" placeholder="DD-MM-YYYY" onkeypress="validateKeyPress(event)" } ?>" class="form-control" type="text" placeholder="DD-MM-YYYY" onkeypress="validateKeyPress(event)" autocomplete="off">
autocomplete="off">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="manager" name="manager" class="form-control"> <select id="manager" name="manager" class="form-control">
<?php <?php
if(isset($manager_name[0]->id)) if (isset($manager_name[0]->id)) {
{ foreach ($manager_name as $key => $val) { ?> 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 foreach ($manager as $key => $value) { ?>
<?php if ($val->name !== $value->name) { ?> <?php if ($val->name !== $value->name) { ?>
<option value="<?php echo $value->user_id; ?>"><?php echo $value->name; ?></option> <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 foreach ($manager as $key => $value) { ?>
<?php if ($val->name !== $value->name) { ?> <?php if ($val->name !== $value->name) { ?>
<option value="<?php echo $value->user_id; ?>"><?php echo $value->name; ?></option> <option value="<?php echo $value->user_id; ?>"><?php echo $value->name; ?></option>
<?php } } } ?> <?php }
}
} ?>
</select> </select>
</div> </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> <label class="control-label col-md-1 col-sm-1 " for="first-name">Marital Status</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="marital_status" name="marital_status" class="form-control" <select id="marital_status" name="marital_status" class="form-control" placeholder="choose" <?php if (isset($viewData)) {
placeholder="choose" <?php if(isset($viewData)) { echo "readonly"; } ?>> echo "readonly";
<option value="<?php echo $editData->marital_status; ?>"> } ?>>
<?php echo ucfirst($editData->marital_status); ?></option> <option value="">--Select--</option>
<?php <?php $MaritalStatusData = array('single', 'married', 'others');
if ($editData->marital_status != 'single') foreach ($MaritalStatusData as $value) {
{ $selected = (isset($editData->marital_status) && $editData->marital_status === $value) ? "selected" : "";
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>';
}
?> ?>
<option value="<?php echo $value; ?>" <?php echo $selected; ?>>
<?php echo ucfirst($value); ?>
</option>
<?php } ?>
</select> </select>
</div> </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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Name</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_name" name="relation_name" <input type="text" id="relation_name" name="relation_name" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->relation_name; } ?>" echo $editData->relation_name;
onkeypress="validateKeyPress(event)" class="form-control "> } ?>" onkeypress="validateKeyPress(event)" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Relationship</label> <label class="control-label col-md-1 col-sm-1 " for="email"> Relationship</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="relationship" name="relationship" <input id="relationship" name="relationship" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->relationship; } ?>" class="form-control" echo $editData->relationship;
type="text"> } ?>" class="form-control" type="text">
</div> </div>
</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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_mobile" name="relation_mobile" <input type="text" id="relation_mobile" name="relation_mobile" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->relation_mobile; } ?>" echo $editData->relation_mobile;
class="form-control " onkeypress="return matchnum(event)" class="form-control" type="tel" } ?>" 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('')">
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> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Home Tel</label> <label class="control-label col-md-1 col-sm-1 " for="email"> Home Tel</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="relation_tel" name="relation_tel" <input id="relation_tel" name="relation_tel" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->relation_tel; } ?>" echo $editData->relation_tel;
onkeypress="return matchnum(event)" class="form-control" type="text"> } ?>" onkeypress="return matchnum(event)" class="form-control" type="text">
</div> </div>
</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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Address</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="address" name="address" <input type="text" id="address" name="address" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->address; } ?>" class="form-control "> echo $editData->address;
} ?>" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> City</label> <label class="control-label col-md-1 col-sm-1 " for="email"> City</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="city" name="city" value="<?php if(isset($editData)) { echo $editData->city; } ?>" <input id="city" name="city" value="<?php if (isset($editData)) {
class="form-control" type="text"> echo $editData->city;
} ?>" class="form-control" type="text">
</div> </div>
</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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> State</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="state" name="state" <input type="text" id="state" name="state" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->state; } ?>" class="form-control "> echo $editData->state;
} ?>" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Pincode</label> <label class="control-label col-md-1 col-sm-1 " for="email"> Pincode</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="pincode" name="pincode" <input id="pincode" name="pincode" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->pincode; } ?>" echo $editData->pincode;
onkeypress="return matchnum(event)" class="form-control" type="text"> } ?>" onkeypress="return matchnum(event)" class="form-control" type="text">
</div> </div>
</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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Employee Id</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="emp_id" name="emp_id" <input type="text" id="emp_id" name="emp_id" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->emp_id; } ?>" class="form-control "> echo $editData->emp_id;
} ?>" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Salary</label> <label class="control-label col-md-1 col-sm-1 " for="email"> Salary</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="salary" name="salary" <input id="salary" name="salary" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->salary; } ?>" class="form-control" echo $editData->salary;
type="text"> } ?>" class="form-control" type="text">
</div> </div>
</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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Comment</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="comment" name="comment" <input id="comment" name="comment" value="<?php if (isset($editData)) {
value="<?php if(isset($editData)) { echo $editData->comment; } ?>" class="form-control" echo $editData->comment;
type="text"> } ?>" class="form-control" type="text">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Gender</label> <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;"> <div class="col-md-5 col-sm-5 " style="padding:10px;">
<?php <input type="radio" name="gender" value="male" <?php if ($value == 'male') echo 'checked'; ?> /> Male
if ($editData->gender == 'male') <input type="radio" name="gender" value="female" <?php if ($value == 'female') echo 'checked'; ?> /> Female
{
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';
} ?>
</div> </div>
</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> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Photo Upload</label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="file" id="image" name="image" <input type="file" id="image" name="image" value="<?php if (isset($editData->profile_pic)) {
value="<?php if(isset($editData->profile_pic)) { echo $editData->profile_pic; } ?>" echo $editData->profile_pic;
class="form-control " onchange="validateFile(this)"> } ?>" class="form-control " onchange="validateFile(this)">
<img class="profilepic__image" style="width: 50%; display: block;padding:10px;" <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">
src="<?php echo base_url();?>/assets/uploads/<?php echo $editData->profile_pic ?>"
alt="Avatar" title="Change the avatar">
</div> </div>
</div> </div>
@ -446,11 +417,11 @@ class="form-control " onchange="validateFile(this)">
} }
foreach ($get_group_list as $key => $data) { ?> foreach ($get_group_list as $key => $data) { ?>
<?php if(in_array($data->group_name, $modulesArray)) { ?> <?php if (in_array($data->group_name, $modulesArray)) { ?>
<option value="<?php echo $data->id; ?>" selected> <?php echo $data->group_name; ?> <option value="<?php echo $data->id; ?>" selected> <?php echo $data->group_name; ?>
</option> </option>
<?php } else { ?> <?php } else { ?>
<option value="<?php echo $data->id; ?>"><?php echo $data->group_name;?> </option> <option value="<?php echo $data->id; ?>"><?php echo $data->group_name; ?> </option>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</select> </select>
@ -459,47 +430,31 @@ class="form-control " onchange="validateFile(this)">
</div> </div>
</div> </div>
<!-- ----------------------------------------- -->
<!-- <div class="ln_solid"></div> -->
<div class="x_panel"><br> <div class="x_panel"><br>
<div class="item form-group"> <div class="item form-group">
<div class=" offset-md-8"> <div class=" offset-md-8">
<a href="<?php echo base_url();?>Employee/empList" class="btn btn-secondary">Cancel</a> <a href="<?php echo base_url(); ?>Employee/empList" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-success">Update</button> <button type="submit" class="btn btn-success">Update</button>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </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 --> <!-- /Body page content -->
<script> <script>
$('#myDatepicker').datetimepicker({ $('#myDatepicker').datetimepicker({
format: 'DD.MM.YYYY' format: 'DD.MM.YYYY'
}); });
</script> </script>
<script> <script>
function matchnum(event) { function matchnum(event) {
var charcode; var charcode;
charcode = event.which || event.keyCode; charcode = event.which || event.keyCode;
@ -507,19 +462,19 @@ function matchnum(event) {
if (charcode >= 48 && charcode <= 57) return true; //only numbers if (charcode >= 48 && charcode <= 57) return true; //only numbers
return false; return false;
} }
function validateKeyPress(event) { function validateKeyPress(event) {
var key = event.key; var key = event.key;
var allowedCharacters = /^[A-Za-z.]$/; var allowedCharacters = /^[A-Za-z.]$/;
if (!allowedCharacters.test(key)) { if (!allowedCharacters.test(key)) {
event.preventDefault(); event.preventDefault();
} }
} }
$(document).on('change', '#image', function() { $(document).on('change', '#image', function() {
const file = this.files[0]; const file = this.files[0];
if (file) { if (file) {
@ -530,15 +485,15 @@ function validateKeyPress(event) {
} }
reader.readAsDataURL(file); reader.readAsDataURL(file);
} }
}); });
</script> </script>
<script> <script>
var dateFormat = "dd-mm-yy"; var dateFormat = "dd-mm-yy";
var fromDateInput = $("#j_date"); var fromDateInput = $("#j_date");
console.log(fromDateInput); console.log(fromDateInput);
fromDateInput.datepicker({ fromDateInput.datepicker({
dateFormat: dateFormat, dateFormat: dateFormat,
changeYear: true, changeYear: true,
changeMonth: true, changeMonth: true,
@ -546,10 +501,10 @@ function validateKeyPress(event) {
onSelect: function(dateText, inst) { onSelect: function(dateText, inst) {
} }
}); });
</script> </script>
<script> <script>
function validateFile(input) { function validateFile(input) {
const file = input.files[0]; const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"]; const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
const fileExtension = file.name.split(".").pop().toLowerCase(); const fileExtension = file.name.split(".").pop().toLowerCase();
@ -582,21 +537,22 @@ function validateFile(input) {
}; };
reader.readAsDataURL(file); reader.readAsDataURL(file);
} }
} }
</script> </script>
<script> <script>
function check_if_exists(id, value, name) { function check_if_exists(id, value, name) {
// alert(name); // alert(name);
// var data = $(this).val(); // var data = $(this).val();
$.ajax({ $.ajax({
type:"get", type: "get",
url: "<?php echo base_url(); ?>Employee/checkUniqueValue", url: "<?php echo base_url(); ?>Employee/checkUniqueValue",
data: { value: value, name: name }, data: {
success:function(response) value: value,
{ name: name
if (response == true) },
{ success: function(response) {
if (response == true) {
new PNotify({ new PNotify({
title: 'Warning', title: 'Warning',
text: 'That given details Already Exists', text: 'That given details Already Exists',
@ -609,3 +565,17 @@ function check_if_exists(id, value, name) {
}); });
} }
</script> </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 --> <!-- Body page content -->
<div class=""> <div class="">
<div class="page-title"> <div class="page-title">
@ -8,7 +6,6 @@
<h3>Add User</h3> <h3>Add User</h3>
</div> </div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="row"> <div class="row">
@ -25,13 +22,10 @@
<!-- </div> --> <!-- </div> -->
<div class="x_content"> <div class="x_content">
<br /> <br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" <form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url(); ?>User/createUser" enctype="multipart/form-data">
action="<?php echo base_url();?>User/createUser" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
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="text" id="created_by" name="created_by" value="<?php echo $data->created_by ?>"
class="form-control " hidden>
<!-- <?php if (is_superadmin()) { ?> <!-- <?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> <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 "> <div class="col-md-5 col-sm-5 ">
<select id="business_id" name="business_id" required="required" class="form-control" > <select id="business_id" name="business_id" required="required" class="form-control" >
<option value="<?php if(isset($businessData)) { echo $businessData->uid; } ?>"> <option value="<?php if (isset($businessData)) {
<?php if(isset($businessData)) { echo $businessData->business_name; }else{ echo "Select business"; } ?> echo $businessData->uid;
} ?>">
<?php if (isset($businessData)) {
echo $businessData->business_name;
} else {
echo "Select business";
} ?>
</option> </option>
<?php foreach ($business_dropdown as $key => $value) { ?> <?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 } ?> <?php } ?>
</select> </select>
</div> </div>
@ -66,23 +67,28 @@ class="form-control " hidden>
<?php if (is_superadmin()) { ?> <?php if (is_superadmin()) { ?>
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Business<a <label class="control-label col-md-1 col-sm-1 " for="first-name"> Business<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="business_id" name="business_id" required="required" class="form-control"> <select id="business_id" name="business_id" required="required" class="form-control">
<option value="<?php if(isset($businessData)) { echo $businessData->uid; } ?>"> <option value="<?php if (isset($businessData)) {
<?php if(isset($businessData)) { echo $businessData->business_name; }else{ echo "Select business"; } ?> echo $businessData->uid;
} ?>">
<?php if (isset($businessData)) {
echo $businessData->business_name;
} else {
echo "Select business";
} ?>
</option> </option>
<?php foreach ($business_dropdown as $key => $value) { ?> <?php foreach ($business_dropdown as $key => $value) { ?>
<option value="<?php echo $value->uid; ?>"> <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 } ?> <?php } ?>
</select> </select>
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Role<a <label class="control-label col-md-1 col-sm-1 " for="last-name"> Role<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="role" name="role" required="required" class="form-control"> <select id="role" name="role" required="required" class="form-control">
<option value="">Select role</option> <option value="">Select role</option>
@ -94,8 +100,7 @@ class="form-control " hidden>
<?php } else if (is_admin() || user()->action_permit != 'view') { ?> <?php } else if (is_admin() || user()->action_permit != 'view') { ?>
<div class="item form-group" hidden> <div class="item form-group" hidden>
<input type="text" id="business_id" name="business_id" <input type="text" id="business_id" name="business_id" value="<?php echo $data->business_id ?>" class="form-control " hidden>
value="<?php echo $data->business_id ?>" class="form-control " hidden>
<input type="text" id="role" name="role" value="user" class="form-control " hidden> <input type="text" id="role" name="role" value="user" class="form-control " hidden>
</div> </div>
<?php } ?> <?php } ?>
@ -105,37 +110,28 @@ class="form-control " hidden>
<!-- --------------------------- --> <!-- --------------------------- -->
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a <label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name" value="" required="required" <input type="text" id="name" name="name" value="" required="required" class="form-control ">
class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Email<a <label class="control-label col-md-1 col-sm-1 " for="last-name"> Email<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="email" id="email" name="email" value="" required="required" <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)">
class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div> </div>
</div> </div>
<!-- --------------------------- --> <!-- --------------------------- -->
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile<a <label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" pattern="[6-9]{1}[0-9]{9}" <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)">
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> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Permission<a <label class="control-label col-md-1 col-sm-1 " for="last-name"> Permission<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="action_permit" name="action_permit" required="required" <select id="action_permit" name="action_permit" required="required" class="form-control">
class="form-control">
<option value="">Select Permission</option> <option value="">Select Permission</option>
<option value="all">All</option> <option value="all">All</option>
<option value="view">View</option> <option value="view">View</option>
@ -149,28 +145,20 @@ class="form-control">
<div class="x_title"> </div> <br /> <div class="x_title"> </div> <br />
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a <label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 "> <div class="col-md-3 col-sm-3 ">
<input type="text" id="user_name" name="user_name" value="" required="required" <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)">
class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Password<a <label class="control-label col-md-1 col-sm-1 " for="last-name"> Password<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 "> <div class="col-md-3 col-sm-3 ">
<input type="password" id="password" minlength="8" name="password" value="" <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">
required="required" class="form-control " <span toggle="#password" id="toggle-password" class="fa fa-fw fa-eye field-icon toggle-password"></span>
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> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password<a <label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password<a style="color:red;">*</a> </label>
style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 "> <div class="col-md-3 col-sm-3 ">
<input type="password" id="confirm_password" name="confirm_password" value="" <input type="password" id="confirm_password" name="confirm_password" value="" required="required" class="form-control ">
required="required" class="form-control ">
<span id='message'></span> <span id='message'></span>
</div> </div>
</div> </div>
@ -178,7 +166,7 @@ class="fa fa-fw fa-eye field-icon toggle-password"></span>
<div class="ln_solid"></div> <div class="ln_solid"></div>
<div class="item form-group"> <div class="item form-group">
<div class="offset-md-8"> <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 class="btn btn-primary" type="reset">Reset</button>
<button type="submit" class="btn btn-success">Submit</button> <button type="submit" class="btn btn-success">Submit</button>
</div> </div>
@ -193,26 +181,41 @@ class="fa fa-fw fa-eye field-icon toggle-password"></span>
<!-- /Body page content --> <!-- /Body page content -->
<script> <script>
function check_if_exists(id, value, name) { function check_if_exists(id, value, name) {
// alert(name); // alert(name);
// var data = $(this).val(); // var data = $(this).val();
$.ajax({ $.ajax({
type:"get", type: "get",
url: "<?php echo base_url(); ?>User/checkUniqueValue", url: "<?php echo base_url(); ?>User/checkUniqueValue",
data: { value: value, name: name }, data: {
success:function(response) value: value,
{ name: name
if (response == true) },
{ success: function(response) {
if (response == true) {
new PNotify({ new PNotify({
title: 'Warning', title: 'Warning',
text: 'That given details Already Exists', text: 'That given details Already Exists',
styling: 'bootstrap3' styling: 'bootstrap3'
}); });
$("#"+id).val(''); $("#" + id).val('');
} }
} }
}); });
} }
</script> </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 --> <!-- Body page content -->
<div class=""> <div class="">
<div class="page-title"> <div class="page-title">
@ -26,42 +23,35 @@
<!-- </div> --> <!-- </div> -->
<div class="x_content"> <div class="x_content">
<br /> <br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" <form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url(); ?>User/editUsers" enctype="multipart/form-data">
action="<?php echo base_url();?>User/editUsers" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
value="<?php echo $this->security->get_csrf_hash();?>">
<input type="hidden" name="id" value="<?php echo $editData->id; ?>"> <input type="hidden" name="id" value="<?php echo $editData->id; ?>">
<!-- --------------------------- --> <!-- --------------------------- -->
<div class="item form-group"> <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 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name" value="<?php echo $editData->name; ?>" <input type="text" id="name" name="name" value="<?php echo $editData->name; ?>" required="required" class="form-control ">
required="required" class="form-control ">
</div> </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 "> <div class="col-md-5 col-sm-5 ">
<input type="email" id="email" name="email" value="<?php echo $editData->email; ?>" <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)">
required="required" class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div> </div>
</div> </div>
<!-- --------------------------- --> <!-- --------------------------- -->
<div class="item form-group"> <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 "> <div class="col-md-5 col-sm-5 ">
<input type="text" pattern="[6-9]{1}[0-9]{9}" <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)">
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> </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 "> <div class="col-md-5 col-sm-5 ">
<select id="action_permit" name="action_permit" required="required" <select id="action_permit" name="action_permit" required="required" class="form-control">
class="form-control">
<option value="<?php echo $editData->action_permit; ?>"> <option value="<?php echo $editData->action_permit; ?>">
<?php echo $editData->action_permit; ?></option> <?php echo $editData->action_permit; ?></option>
<?php <?php
@ -69,8 +59,7 @@ class="form-control">
?> ?>
<option value="view">view</option> <option value="view">view</option>
<?php <?php
} } else {
else{
?> ?>
<option value="all">all</option> <option value="all">all</option>
<?php <?php
@ -83,18 +72,14 @@ class="form-control">
<!-- --------------------------- --> <!-- --------------------------- -->
<div class="item form-group"> <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 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="user_name" name="user_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)">
value="<?php echo $editData->user_name; ?>" required="required"
class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
</div> </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 "> <div class="col-md-5 col-sm-5 ">
<input type="hidden" minlength="8" id="password" name="password" <input type="hidden" minlength="8" id="password" name="password" value="<?php echo $editData->password; ?>" required="required" class="form-control ">
value="<?php echo $editData->password; ?>" required="required"
class="form-control ">
</div> </div>
</div> </div>
@ -104,7 +89,7 @@ class="form-control ">
<div class="ln_solid"></div> <div class="ln_solid"></div>
<div class="item form-group"> <div class="item form-group">
<div class="col-md-6 col-sm-6 offset-md-10"> <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> <button type="submit" class="btn btn-success">Update</button>
</div> </div>
</div> </div>
@ -118,26 +103,41 @@ class="form-control ">
<script> <script>
function check_if_exists(id, value, name) { function check_if_exists(id, value, name) {
// alert(name); // alert(name);
// var data = $(this).val(); // var data = $(this).val();
$.ajax({ $.ajax({
type:"get", type: "get",
url: "<?php echo base_url(); ?>User/checkUniqueValue", url: "<?php echo base_url(); ?>User/checkUniqueValue",
data: { value: value, name: name }, data: {
success:function(response) value: value,
{ name: name
if (response == true) },
{ success: function(response) {
if (response == true) {
new PNotify({ new PNotify({
title: 'Warning', title: 'Warning',
text: 'That given details Already Exists', text: 'That given details Already Exists',
styling: 'bootstrap3' styling: 'bootstrap3'
}); });
$("#"+id).val(''); $("#" + id).val('');
} }
} }
}); });
} }
</script> </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,46 +1,46 @@
<head> <head>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'> <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style> <style>
.status-success { .status-success {
background-color: #c1ffc1; background-color: #c1ffc1;
color: #008000; color: #008000;
border-radius:1px; border-radius: 1px;
font-weight: bold; font-weight: bold;
width: 300px; width: 300px;
height: 200px; height: 200px;
} }
.status-danger { .status-danger {
background-color: #ffb6c1; background-color: #ffb6c1;
color: #ff0000; color: #ff0000;
border-radius: 1px; border-radius: 1px;
font-weight: bold; font-weight: bold;
width: 300px; width: 300px;
height: 200px; height: 200px;
} }
div.dataTables_wrapper div.dataTables_filter { div.dataTables_wrapper div.dataTables_filter {
margin-top: -30px !important; margin-top: -30px !important;
} }
</style> </style>
</head> </head>
<div class="col-md-12 col-sm-12 "> <div class="col-md-12 col-sm-12 ">
<div class="x_panel"> <div class="x_panel">
<div class="x_title"> <div class="x_title">
<h2>User Details </h2> <h2>User Details </h2>
<ul class="nav navbar-right panel_toolbox"> <ul class="nav navbar-right panel_toolbox">
<?php if(user()->action_permit != 'view' ) { ?> <?php if (user()->action_permit != 'view') { ?>
<a href="<?php echo base_url();?>User/addUser" class="btn btn-sm btn-primary">Add User</a> <a href="<?php echo base_url(); ?>User/addUser" class="btn btn-sm btn-primary">Add User</a>
<?php } ?> <?php } ?>
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li> <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="x_content"> <div class="x_content">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<table id="datatables" class="table table-striped table-bordered" width="100%"> <table id="datatables" class="table table-striped table-bordered" width="100%">
@ -53,10 +53,10 @@
} ?> } ?>
<th class="column-title">Email </th> <th class="column-title">Email </th>
<th class="column-title">Mobile </th> <th class="column-title">Mobile </th>
<th class="column-title" >Role </th> <th class="column-title">Role </th>
<th class="column-title" >Permit </th> <th class="column-title">Permission </th>
<th class="column-title" >status </th> <th class="column-title">Status </th>
<th class="column-title" >Action </th> <th class="column-title">Action </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -74,26 +74,26 @@
<td class=" "> <td class=" ">
<?php if ($value->is_active == 1) { ?> <?php if ($value->is_active == 1) { ?>
<span class="status-success">Active</span> <span class="status-success">Active</span>
<?php } else if ($value->is_active == 0){ ?> <?php } else if ($value->is_active == 0) { ?>
<span class="status-danger">In-active</span> <span class="status-danger">In-active</span>
<?php } ?> <?php } ?>
</td> </td>
<td style=" text-align: center; font-size: 16px;"> <td style=" text-align: center; font-size: 16px;">
<?php if ($value->is_active == 1) { ?> <?php if ($value->is_active == 1) { ?>
<?php if(user()->action_permit != 'view' ) { ?> <?php if (user()->action_permit != 'view') { ?>
<a href="<?php echo base_url()?>User/editUser/<?php echo md5($value->id);?>" ><i class="fa fa-pencil" title="Edit"></i></a> <a href="<?php echo base_url() ?>User/editUser/<?php echo md5($value->id); ?>"><i class="fa fa-pencil" title="Edit"></i></a>
&nbsp; &nbsp;
<a href="<?php echo base_url()?>User/deleteUser/<?php echo md5($value->id);?>" > <a href="<?php echo base_url() ?>User/deleteUser/<?php echo md5($value->id); ?>">
<i class="fa fa-times-circle-o" aria-hidden="true" style="font-size:20px;" title="deactivate"></i></a> <i class="fa fa-times-circle-o" aria-hidden="true" style="font-size:20px;" title="deactivate"></i></a>
&nbsp; &nbsp;
<?php } ?> <?php } ?>
<!-- <a> <i id="<?php echo md5($value->id);?>" class="bi bi-card-list" title="History"></i></a> --> <!-- <a> <i id="<?php echo md5($value->id); ?>" class="bi bi-card-list" title="History"></i></a> -->
<?php } ?> <?php } ?>
<?php if ($value->is_active == 0) { ?> <?php if ($value->is_active == 0) { ?>
<a href="<?php echo base_url()?>User/activateUser/<?php echo md5($value->id);?>" > <a href="<?php echo base_url() ?>User/activateUser/<?php echo md5($value->id); ?>">
<i class="green fa fa-check-circle" style="font-size:20px;" title="activate"></i></a> <i class="green fa fa-check-circle" style="font-size:20px;" title="activate"></i></a>
&nbsp; &nbsp;
<!-- <a> <i id="<?php echo md5($value->id);?>" class="bi bi-card-list" title="History"></i></a> --> <!-- <a> <i id="<?php echo md5($value->id); ?>" class="bi bi-card-list" title="History"></i></a> -->
&nbsp; &nbsp;
<?php } ?> <?php } ?>
</td> </td>
@ -103,11 +103,11 @@
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<br/> <br />
<!-- Large modal --> <!-- Large modal -->
<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg" hidden>Large modal</button> --> <!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg" hidden>Large modal</button> -->
@ -117,20 +117,22 @@
</div> </div>
<script> <script>
$(document).on('click','.bi-card-list',function(){ $(document).on('click', '.bi-card-list', function() {
var id = $(this).attr("id") var id = $(this).attr("id")
$.ajax({ $.ajax({
type: "get", type: "get",
url: "<?php echo base_url()?>User/view_user_history/"+id, url: "<?php echo base_url() ?>User/view_user_history/" + id,
success: function(response) { success: function(response) {
response = JSON.parse(response); response = JSON.parse(response);
console.log(response); console.log(response);
$('.bs-example-modal-lg').html(response); $('.bs-example-modal-lg').html(response);
$('.bs-example-modal-lg').modal("show"); $('.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> </script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
@ -139,15 +141,13 @@
[0, 'desc'] [0, 'desc']
], ],
"dom": 'Bfrtip', "dom": 'Bfrtip',
buttons: [ buttons: [{
{
extend: 'pdfHtml5', extend: 'pdfHtml5',
title: 'Users', title: 'Users',
text: 'PDF', text: 'PDF',
customize: function(doc) { customize: function(doc) {
doc.content[1].table.body.forEach(function(row) { doc.content[1].table.body.forEach(function(row) {
// Remove the first and last columns // Remove the last column
row.splice(0, 1);
row.pop(); row.pop();
}); });
} }
@ -162,6 +162,5 @@
} }
] ]
}); });
}); });
</script> </script>