154 lines
7.0 KiB
PHP
154 lines
7.0 KiB
PHP
<!-- Body page content -->
|
|
<div class="">
|
|
<div class="page-title">
|
|
|
|
<div class="title_left">
|
|
<h3>Edit User</h3>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<div class="clearfix"></div>
|
|
<div class="row">
|
|
<div class="col-md-12 col-sm-12 ">
|
|
<div class="x_panel">
|
|
<!-- <div class="x_title"> -->
|
|
|
|
<!-- <ul class="nav navbar-right panel_toolbox">
|
|
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
|
|
</li>
|
|
</ul> -->
|
|
<!-- <h6>General Information</h6> -->
|
|
<!-- <div class="clearfix"></div> -->
|
|
<!-- </div> -->
|
|
<div class="x_content">
|
|
<br />
|
|
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url(); ?>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="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<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 ">
|
|
</div>
|
|
|
|
<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" 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<a style="color:red;">*</a></label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input type="text" pattern="[6-9]{1}[0-9]{9}" minlength="10" maxlength="10" 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)" onkeypress="return matchnum(event)">
|
|
</div>
|
|
|
|
<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">
|
|
<option value="<?php echo $editData->action_permit; ?>">
|
|
<?php echo $editData->action_permit; ?></option>
|
|
<?php
|
|
if ($editData->action_permit == "all") {
|
|
?>
|
|
<option value="view">view</option>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<option value="all">all</option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- --------------------------- -->
|
|
<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>
|
|
<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)">
|
|
</div>
|
|
|
|
<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 ">
|
|
</div>
|
|
|
|
</div>
|
|
<!-- --------------------------- -->
|
|
|
|
|
|
<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="<?= base_url() . "User/userList"; ?>">Cancel</button>
|
|
<button type="submit" class="btn btn-success">Update</button>
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<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('');
|
|
|
|
}
|
|
}
|
|
});
|
|
}
|
|
</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>
|
|
<script>
|
|
function matchnum(event) {
|
|
var charcode;
|
|
|
|
charcode = event.which || event.keyCode;
|
|
|
|
if (charcode >= 48 && charcode <= 57) return true; //only numbers
|
|
return false;
|
|
|
|
}
|
|
</script>
|