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,136 +1,130 @@
<!-- 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($) {
$('#people').multiSelect();
});
jQuery(document).ready(function($) {
$('#people').multiSelect();
});
</script>
<style type="text/css">
.multi-select-container {
display: inline-block;
position: relative;
width: 100%;
}
.multi-select-container {
display: inline-block;
position: relative;
width: 100%;
}
.multi-select-menu {
position: absolute;
left: 0;
top: 2em;
z-index: 1;
float: left;
min-width: 100%;
background: #fff;
margin: 1em 0;
border: 1px solid #aaa;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
display: none;
}
.multi-select-menu {
position: absolute;
left: 0;
top: 2em;
z-index: 1;
float: left;
min-width: 100%;
background: #fff;
margin: 1em 0;
border: 1px solid #aaa;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
display: none;
}
.multi-select-menuitem {
display: block;
font-size: 0.875em;
padding: 0.6em 1em 0.6em 30px;
white-space: nowrap;
}
.multi-select-menuitem {
display: block;
font-size: 0.875em;
padding: 0.6em 1em 0.6em 30px;
white-space: nowrap;
}
.multi-select-menuitem--titled:before {
display: block;
font-weight: bold;
content: attr(data-group-title);
margin: 0 0 0.25em -20px;
}
.multi-select-menuitem--titled:before {
display: block;
font-weight: bold;
content: attr(data-group-title);
margin: 0 0 0.25em -20px;
}
.multi-select-menuitem--titledsr:before {
display: block;
font-weight: bold;
content: attr(data-group-title);
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.multi-select-menuitem--titledsr:before {
display: block;
font-weight: bold;
content: attr(data-group-title);
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.multi-select-menuitem+.multi-select-menuitem {
padding-top: 0;
}
.multi-select-menuitem+.multi-select-menuitem {
padding-top: 0;
}
.multi-select-presets {
border-bottom: 1px solid #ddd;
}
.multi-select-presets {
border-bottom: 1px solid #ddd;
}
.multi-select-menuitem input {
position: absolute;
margin-top: 0.25em;
margin-left: -20px;
}
.multi-select-menuitem input {
position: absolute;
margin-top: 0.25em;
margin-left: -20px;
}
.multi-select-button {
display: block;
margin-top: 2px;
width: 100%;
max-width: 100% !important;
font-size: 0.875em;
padding: 0.85em 0.6em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: -0.5em;
background-color: #fff;
border: 1px solid #aaa;
cursor: default;
}
.multi-select-button {
display: block;
margin-top: 2px;
width: 100%;
max-width: 100% !important;
font-size: 0.875em;
padding: 0.85em 0.6em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: -0.5em;
background-color: #fff;
border: 1px solid #aaa;
cursor: default;
}
.multi-select-button:after {
content: "";
position: absolute;
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-width: 0.4em 0.4em 0 0.4em;
border-color: #999 transparent transparent transparent;
margin-left: 0.4em;
vertical-align: 0.1em;
right: 5px;
top: 17px;
}
.multi-select-button:after {
content: "";
position: absolute;
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-width: 0.4em 0.4em 0 0.4em;
border-color: #999 transparent transparent transparent;
margin-left: 0.4em;
vertical-align: 0.1em;
right: 5px;
top: 17px;
}
.multi-select-container--open .multi-select-menu {
display: block;
}
.multi-select-container--open .multi-select-menu {
display: block;
}
.multi-select-container--open .multi-select-button:after {
border-width: 0 0.4em 0.4em 0.4em;
border-color: transparent transparent #999 transparent;
}
.multi-select-container--open .multi-select-button:after {
border-width: 0 0.4em 0.4em 0.4em;
border-color: transparent transparent #999 transparent;
}
.multi-select-container--positioned .multi-select-menu {
/* Avoid border/padding on menu messing with JavaScript width calculation */
box-sizing: border-box;
}
.multi-select-container--positioned .multi-select-menu {
/* Avoid border/padding on menu messing with JavaScript width calculation */
box-sizing: border-box;
}
.multi-select-container--positioned .multi-select-menu label {
/* Allow labels to line wrap when menu is artificially narrowed */
white-space: normal;
}
.multi-select-container--positioned .multi-select-menu label {
/* Allow labels to line wrap when menu is artificially narrowed */
white-space: normal;
}
#errMessage {
color: red;
}
#errMessage {
color: red;
}
</style>
@ -143,24 +137,20 @@
<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>
</ul>
<h6>Add Employee Information</h6>
<div class="clearfix"></div>
</div> -->
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i id="chevron" class="fa fa-chevron-up"></i></a></li>
</li>
</ul>
<h6>Add Employee Information</h6>
<div class="clearfix"></div>
</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,22 +180,23 @@ 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>
<option value="<?php echo $value->name; ?>"><?php echo $value->name; ?></option>
<?php } ?>
</select>
</div>
@ -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>
@ -232,7 +218,7 @@ class="form-control" type="email"
<select id="manager" name="manager" class="form-control">
<option value="">--Select--</option>
<?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 } ?>
</select>
</div>
@ -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,24 +333,27 @@ 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">
<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">
<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">
<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">
</div>
</div>
<!-- ----------------------------------------------------------------------------------->
<div class="x_panel">
@ -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>
@ -445,18 +424,18 @@ class="form-control typeFile" onchange="validateFile(this)"
<div class="col-md-5 col-sm-5 ">
<select id="people" name="group_id[]" class="form-control select2_multiple" multiple>
<?php foreach ($get_group_list as $key => $value) { ?>
<option value="<?php echo $value->id; ?>"><?php echo $value->group_name; ?></option>
<option value="<?php echo $value->id; ?>"><?php echo $value->group_name; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
<!-- ----------------------------------------- -->
<div class="x_panel"><br>
<div class="item form-group">
<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>
</div>
</div>
@ -468,207 +447,214 @@ class="form-control typeFile" onchange="validateFile(this)"
</div>
<!-- /Body page content -->
<script>
function matchnum(event) {
var charcode;
function matchnum(event) {
var charcode;
charcode = event.which || event.keyCode;
charcode = event.which || event.keyCode;
if (charcode >= 48 && charcode <= 57) return true; //only numbers
return false;
if (charcode >= 48 && charcode <= 57) return true; //only numbers
return false;
}
function validateKeyPress(event) {
var key = event.key;
var allowedCharacters = /^[A-Za-z.]$/;
if (!allowedCharacters.test(key)) {
event.preventDefault();
}
}
function validateKeyPress(event) {
var key = event.key;
var allowedCharacters = /^[A-Za-z.]$/;
$(document).ready(function() {
// $('.fa fa-chevron-up').click();
// setTimeout(() => { $('#chevron1').click(); }, 500);
});
$(document).on('change', '#image', function() {
const file = this.files[0];
if (file) {
let reader = new FileReader();
reader.onload = function(event) {
$('#image').attr('src', event.target.result);
$('.profilepic__image').attr('src', event.target.result);
if (!allowedCharacters.test(key)) {
event.preventDefault();
}
reader.readAsDataURL(file);
}
});
</script>
<script>
var dateFormat = "dd-mm-yy";
var fromDateInput = $("#j_date");
console.log(fromDateInput);
fromDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
yearRange: "1990:c",
maxDate: new Date(),
onSelect: function(dateText, inst) {
}
});
function validateKeyPress(event) {
var key = event.key;
var allowedCharacters = /^[A-Za-z._/]$/;
if (!allowedCharacters.test(key)) {
event.preventDefault();
}
}
</script>
<script>
function validateFile(input) {
const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
const fileExtension = file.name.split(".").pop().toLowerCase();
if (!allowedExtensions.includes(fileExtension)) {
// Invalid file type
new PNotify({
text: 'Invalid file type. Only JPG, JPEG, PNG, and PDF files are allowed.',
type: 'error',
styling: 'bootstrap3'
});
input.value = "";
return;
}
if (fileExtension === "pdf") {
// Preview PDF
const reader = new FileReader();
reader.onload = function(e) {
const pdfObject = `<embed src="${e.target.result}" width="500" height="600" type="application/pdf">`;
document.getElementById("previewContainer").innerHTML = pdfObject;
};
reader.readAsDataURL(file);
} else {
// Preview image
const reader = new FileReader();
reader.onload = function(e) {
const imageObject = `<img src="${e.target.result}" alt="Preview" width="500">`;
document.getElementById("previewContainer").innerHTML = imageObject;
};
reader.readAsDataURL(file);
}
}
</script>
<script>
// Get the select element
var select = document.getElementById("module");
// Add event listener to handle checkbox selection
select.addEventListener("change", function() {
var selectedOptions = Array.from(this.selectedOptions).map(option => option.value);
console.log(selectedOptions); // You can perform further operations with the selected values
});
</script>
$(document).ready(function() {
// $('.fa fa-chevron-up').click();
// setTimeout(() => { $('#chevron1').click(); }, 500);
});
<script>
function check_if_exists(id, value, name) {
// alert(name);
// var data = $(this).val();
$.ajax({
type:"get",
url: "<?php echo base_url(); ?>Employee/checkUniqueValue",
data: { value: value, name: name },
success:function(response)
{
if (response == true)
{
new PNotify({
title: 'Warning',
text: 'That given details Already Exists',
styling: 'bootstrap3'
});
$("#"+id).val('');
$(document).on('change', '#image', function() {
const file = this.files[0];
if (file) {
let reader = new FileReader();
reader.onload = function(event) {
$('#image').attr('src', event.target.result);
$('.profilepic__image').attr('src', event.target.result);
}
reader.readAsDataURL(file);
}
});
}
$('#password').keyup(function() {
if ($('#confirm_password').val() == "") {
$('#errMessage').html('Please Enter confirm password');
} else {
$('#errMessage').html('');
}
});
$('#confirm_password').keyup(function() {
if ($('#confirm_password').val() == "") {
$('#errMessage').html('Please Enter confirm password');
} else {
$('#errMessage').html('');
}
});
</script>
<script>
document.getElementById('state').addEventListener('input', function(event) {
var stateInput = event.target.value;
var regex = /^[A-Za-z\s]+$/; // Allows only letters and spaces
if (!regex.test(stateInput)) {
// Remove any special characters or numbers
event.target.value = stateInput.replace(/[^A-Za-z\s]/g, '');
<script>
var dateFormat = "dd-mm-yy";
var fromDateInput = $("#j_date");
console.log(fromDateInput);
fromDateInput.datepicker({
dateFormat: dateFormat,
changeYear: true,
changeMonth: true,
yearRange: "1990:c",
maxDate: new Date(),
onSelect: function(dateText, inst) {
}
});
function validateKeyPress(event) {
var key = event.key;
var allowedCharacters = /^[A-Za-z._/]$/;
if (!allowedCharacters.test(key)) {
event.preventDefault();
}
}
});
</script>
<script>
document.getElementById('city').addEventListener('input', function(event) {
var cityInput = event.target.value;
var regex = /^[A-Za-z\s]+$/; // Allows only letters and spaces
if (!regex.test(cityInput)) {
// Remove any special characters or numbers
event.target.value = cityInput.replace(/[^A-Za-z\s]/g, '');
<script>
function validateFile(input) {
const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
const fileExtension = file.name.split(".").pop().toLowerCase();
if (!allowedExtensions.includes(fileExtension)) {
// Invalid file type
new PNotify({
text: 'Invalid file type. Only JPG, JPEG, PNG, and PDF files are allowed.',
type: 'error',
styling: 'bootstrap3'
});
input.value = "";
return;
}
if (fileExtension === "pdf") {
// Preview PDF
const reader = new FileReader();
reader.onload = function(e) {
const pdfObject = `<embed src="${e.target.result}" width="500" height="600" type="application/pdf">`;
document.getElementById("previewContainer").innerHTML = pdfObject;
};
reader.readAsDataURL(file);
} else {
// Preview image
const reader = new FileReader();
reader.onload = function(e) {
const imageObject = `<img src="${e.target.result}" alt="Preview" width="500">`;
document.getElementById("previewContainer").innerHTML = imageObject;
};
reader.readAsDataURL(file);
}
}
});
</script>
<script>
function validateEmail(email) {
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
return regex.test(email);
}
// Get the select element
var select = document.getElementById("module");
$(document).on('blur', '#email', function() {
const emailValue = $(this).val();
// Add event listener to handle checkbox selection
select.addEventListener("change", function() {
var selectedOptions = Array.from(this.selectedOptions).map(option => option.value);
console.log(selectedOptions); // You can perform further operations with the selected values
});
</script>
if (!validateEmail(emailValue)) {
new PNotify({
text: 'Enter a valid email address.',
type: 'error',
styling: 'bootstrap3'
<script>
function check_if_exists(id, value, name) {
// alert(name);
// var data = $(this).val();
$.ajax({
type: "get",
url: "<?php echo base_url(); ?>Employee/checkUniqueValue",
data: {
value: value,
name: name
},
success: function(response) {
if (response == true) {
new PNotify({
title: 'Warning',
text: 'That given details Already Exists',
styling: 'bootstrap3'
});
$("#" + id).val('');
}
}
});
$(this).val('');
}
});
</script>
$('#password').keyup(function() {
if ($('#confirm_password').val() == "") {
$('#errMessage').html('Please Enter confirm password');
} else {
$('#errMessage').html('');
}
});
$('#confirm_password').keyup(function() {
if ($('#confirm_password').val() == "") {
$('#errMessage').html('Please Enter confirm password');
} else {
$('#errMessage').html('');
}
});
</script>
<script>
document.getElementById('state').addEventListener('input', function(event) {
var stateInput = event.target.value;
var regex = /^[A-Za-z\s]+$/; // Allows only letters and spaces
if (!regex.test(stateInput)) {
// Remove any special characters or numbers
event.target.value = stateInput.replace(/[^A-Za-z\s]/g, '');
}
});
</script>
<script>
document.getElementById('city').addEventListener('input', function(event) {
var cityInput = event.target.value;
var regex = /^[A-Za-z\s]+$/; // Allows only letters and spaces
if (!regex.test(cityInput)) {
// Remove any special characters or numbers
event.target.value = cityInput.replace(/[^A-Za-z\s]/g, '');
}
});
</script>
<script>
function validateEmail(email) {
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
return regex.test(email);
}
$(document).on('blur', '#email', function() {
const emailValue = $(this).val();
if (!validateEmail(emailValue)) {
new PNotify({
text: 'Enter a valid email address.',
type: 'error',
styling: 'bootstrap3'
});
$(this).val('');
}
});
</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>

File diff suppressed because it is too large Load Diff

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>
@ -65,39 +66,43 @@ 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>
<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>
<?php foreach ($business_dropdown as $key => $value) { ?>
<option value="<?php echo $value->uid; ?>">
<?php echo $value->business_name; echo $value->uid; ?></option>
<?php } ?>
</select>
<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>
<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>
<?php foreach ($business_dropdown as $key => $value) { ?>
<option value="<?php echo $value->uid; ?>">
<?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>
<div class="col-md-5 col-sm-5 ">
<select id="role" name="role" required="required" class="form-control">
<option value="">Select role</option>
<option value="admin">Admin</option>
<option value="user">user</option>
</select>
</div>
</div>
<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>
<option value="admin">Admin</option>
<option value="user">user</option>
</select>
<?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="role" name="role" value="user" class="form-control " hidden>
</div>
</div>
<?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="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>
@ -193,26 +181,41 @@ class="fa fa-fw fa-eye field-icon toggle-password"></span>
<!-- /Body page content -->
<script>
function check_if_exists(id, value, name) {
// alert(name);
// var data = $(this).val();
$.ajax({
type:"get",
url: "<?php echo base_url(); ?>User/checkUniqueValue",
data: { value: value, name: name },
success:function(response)
{
if (response == true)
{
new PNotify({
title: 'Warning',
text: 'That given details Already Exists',
styling: 'bootstrap3'
});
$("#"+id).val('');
function check_if_exists(id, value, name) {
// alert(name);
// var data = $(this).val();
$.ajax({
type: "get",
url: "<?php echo base_url(); ?>User/checkUniqueValue",
data: {
value: value,
name: name
},
success: function(response) {
if (response == true) {
new PNotify({
title: 'Warning',
text: 'That given details Already Exists',
styling: 'bootstrap3'
});
$("#" + id).val('');
}
}
});
}
</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,54 +23,46 @@
<!-- </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
<?php
if ($editData->action_permit == "all") {
?>
<option value="view">view</option>
<?php
}
else{
?>
<option value="all">all</option>
<?php
?>
<option value="view">view</option>
<?php
} else {
?>
<option value="all">all</option>
<?php
}
?>
</select>
@ -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>
@ -118,26 +103,41 @@ class="form-control ">
<script>
function check_if_exists(id, value, name) {
// alert(name);
// var data = $(this).val();
$.ajax({
type:"get",
url: "<?php echo base_url(); ?>User/checkUniqueValue",
data: { value: value, name: name },
success:function(response)
{
if (response == true)
{
new PNotify({
title: 'Warning',
text: 'That given details Already Exists',
styling: 'bootstrap3'
});
$("#"+id).val('');
function check_if_exists(id, value, name) {
// alert(name);
// var data = $(this).val();
$.ajax({
type: "get",
url: "<?php echo base_url(); ?>User/checkUniqueValue",
data: {
value: value,
name: name
},
success: function(response) {
if (response == true) {
new PNotify({
title: 'Warning',
text: 'That given details Already Exists',
styling: 'bootstrap3'
});
$("#" + id).val('');
}
}
});
}
</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,113 +1,113 @@
<head>
<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.6.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<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.6.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.status-success {
background-color: #c1ffc1;
color: #008000;
border-radius:1px;
font-weight: bold;
width: 300px;
height: 200px;
}
<style>
.status-success {
background-color: #c1ffc1;
color: #008000;
border-radius: 1px;
font-weight: bold;
width: 300px;
height: 200px;
}
.status-danger {
background-color: #ffb6c1;
color: #ff0000;
border-radius: 1px;
font-weight: bold;
width: 300px;
height: 200px;
}
.status-danger {
background-color: #ffb6c1;
color: #ff0000;
border-radius: 1px;
font-weight: bold;
width: 300px;
height: 200px;
}
div.dataTables_wrapper div.dataTables_filter {
margin-top: -30px !important;
}
</style>
div.dataTables_wrapper div.dataTables_filter {
margin-top: -30px !important;
}
</style>
</head>
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<h2>User Details </h2>
<ul class="nav navbar-right panel_toolbox">
<?php if(user()->action_permit != 'view' ) { ?>
<a href="<?php echo base_url();?>User/addUser" class="btn btn-sm btn-primary">Add User</a>
<?php } ?>
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<th class="column-title">Name </th>
<?php if (is_superadmin()) { ?>
<th class="column-title">Company </th>
<?php
} ?>
<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" >Action </th>
</tr>
</thead>
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<tr class="even pointer">
<td class=" "> <?php echo $value->name; ?> </td>
<?php if (is_superadmin()) { ?>
<td class=" "> <?php echo $value->business ?> </td>
<?php
} ?>
<td class=" "><?php echo $value->email; ?> </td>
<td class=" "><?php echo $value->mobile; ?></td>
<td class=" "><?php echo $value->role; ?></td>
<td class=" "><?php echo $value->action_permit; ?></td>
<td class=" ">
<div class="x_panel">
<div class="x_title">
<h2>User Details </h2>
<ul class="nav navbar-right panel_toolbox">
<?php if (user()->action_permit != 'view') { ?>
<a href="<?php echo base_url(); ?>User/addUser" class="btn btn-sm btn-primary">Add User</a>
<?php } ?>
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<table id="datatables" class="table table-striped table-bordered" width="100%">
<thead>
<tr class="headings">
<th class="column-title">Name </th>
<?php if (is_superadmin()) { ?>
<th class="column-title">Company </th>
<?php
} ?>
<th class="column-title">Email </th>
<th class="column-title">Mobile </th>
<th class="column-title">Role </th>
<th class="column-title">Permission </th>
<th class="column-title">Status </th>
<th class="column-title">Action </th>
</tr>
</thead>
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<tr class="even pointer">
<td class=" "> <?php echo $value->name; ?> </td>
<?php if (is_superadmin()) { ?>
<td class=" "> <?php echo $value->business ?> </td>
<?php
} ?>
<td class=" "><?php echo $value->email; ?> </td>
<td class=" "><?php echo $value->mobile; ?></td>
<td class=" "><?php echo $value->role; ?></td>
<td class=" "><?php echo $value->action_permit; ?></td>
<td class=" ">
<?php if ($value->is_active == 1) { ?>
<span class="status-success">Active</span>
<?php } else if ($value->is_active == 0){ ?>
<span class="status-danger">In-active</span>
<span class="status-success">Active</span>
<?php } else if ($value->is_active == 0) { ?>
<span class="status-danger">In-active</span>
<?php } ?>
</td>
<td style=" text-align: center; font-size: 16px;">
<?php if ($value->is_active == 1) { ?>
<?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>
&nbsp;
<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>
&nbsp;
</td>
<td style=" text-align: center; font-size: 16px;">
<?php if ($value->is_active == 1) { ?>
<?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>
&nbsp;
<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>
&nbsp;
<?php } ?>
<!-- <a> <i id="<?php echo md5($value->id); ?>" class="bi bi-card-list" title="History"></i></a> -->
<?php } ?>
<?php if ($value->is_active == 0) { ?>
<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>
&nbsp;
<!-- <a> <i id="<?php echo md5($value->id); ?>" class="bi bi-card-list" title="History"></i></a> -->
&nbsp;
<?php } ?>
</td>
</tr>
<?php } ?>
<!-- <a> <i id="<?php echo md5($value->id);?>" class="bi bi-card-list" title="History"></i></a> -->
<?php } ?>
<?php if ($value->is_active == 0) { ?>
<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>
&nbsp;
<!-- <a> <i id="<?php echo md5($value->id);?>" class="bi bi-card-list" title="History"></i></a> -->
&nbsp;
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br/>
<br />
<!-- Large modal -->
<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg" hidden>Large modal</button> -->
@ -117,51 +117,50 @@
</div>
<script>
$(document).on('click','.bi-card-list',function(){
var id = $(this).attr("id")
$.ajax({
$(document).on('click', '.bi-card-list', function() {
var id = $(this).attr("id")
$.ajax({
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) {
response = JSON.parse(response);
console.log(response);
$('.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>
<script>
$(document).ready(function() {
$('#datatables').DataTable({
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
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);
row.pop();
});
}
},
{
extend: 'excelHtml5',
text: 'Excel',
title: 'Users',
exportOptions: {
columns: ':not(:last-child)'
}
}
]
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
buttons: [{
extend: 'pdfHtml5',
title: 'Users',
text: 'PDF',
customize: function(doc) {
doc.content[1].table.body.forEach(function(row) {
// Remove the last column
row.pop();
});
}
},
{
extend: 'excelHtml5',
text: 'Excel',
title: 'Users',
exportOptions: {
columns: ':not(:last-child)'
}
}
]
});
});
</script>
});
</script>