Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
vadivelJ96 2025-05-16 15:35:30 +05:30
commit 02946be654
12 changed files with 142 additions and 496 deletions

View File

@ -918,7 +918,7 @@ class Employeedetails extends BaseController
$empPayUpdate = $this->emppaydate_model->editemppay($emppay);
if ($result + $empPayUpdate > 0) {
$this->session->setFlashdata('success', 'You Have Successfully updated the Employee Record!');
$this->session->setFlashdata('success', 'You Have Successfully Updated the Employee Record!');
return json_encode(true);
} else {
$this->session->setFlashdata('error', 'Record Not Updated!');

View File

@ -813,7 +813,7 @@ function viewIGRDetails()
$DriverMobileNumber = $this->request->getPost('driver_mobile');
$PreIGRStatus = (int)$this->request->getPost('status') == 1 ? IGR_CREATED : IGR_DRAFT;
$IsThisOpenOrderPO = $this->request->getPost('hiddenIsOpenOrder');
$IsThisOpenOrderPO = $this->request->getPost('isOpenOrder');
$IGRStatus = ((int)$IsThisOpenOrderPO == 1) ? IGR_DRAFT : $PreIGRStatus;
# Here decode the tableData for IGRLineitem

View File

@ -2234,11 +2234,11 @@ join t_purchaseorder_master po on po.PONO = pl.PONO
join t_supplierdetailsn sup on sup.SupplierID=po.SupplierID
join t_materialmaster mm on mm.MaterialCode=pl.MaterialCode
join t_configdetails cd on cd.key = mm.Category
where po.Status != 'ST030' and po.Status = 'ST026 and po.IsOpenOrder != '1'
where po.Status != 'ST030' and po.Status = 'ST026' and (po.IsOpenOrder IS NULL OR po.IsOpenOrder = 1)
";
if ($cname != '') {
$sql .= "and sup.SupplierName = '" . $cname . "'";
$sql .= " and sup.SupplierName = '" . $cname . "'";
}
@ -2249,14 +2249,14 @@ where po.Status != 'ST030' and po.Status = 'ST026 and po.IsOpenOrder != '1'
}
if ($m != '') {
$sql .= "and monthname(po.PODate) = '" . $m . "'";
$sql .= " and monthname(po.PODate) = '" . $m . "'";
}
if ($frm and $t != '') {
$fromd = date("Y-m-d", strtotime($frm));
$tod = date("Y-m-d", strtotime($t));
$sql .= "and date(po.PODate) >= '" . $fromd . "'
$sql .= " and date(po.PODate) >= '" . $fromd . "'
and date(po.PODate) <= '" . $tod . "'";
}
if ($prod != '') {
@ -2272,7 +2272,7 @@ where po.Status != 'ST030' and po.Status = 'ST026 and po.IsOpenOrder != '1'
if ($purchaseorder_number != '') {
$sql .= " and po.PONO = '" . $purchaseorder_number . "' ";
}
$sql .= "order by date(po.PODate) desc";
$sql .= " order by date(po.PODate) desc";
$query = $this->db->query($sql);
//echo $sql;
return $query->getResult();

View File

@ -192,6 +192,7 @@
<th>Driver</th>
<th>Transporter</th>
<th>IGR Status</th>
<th>Remark</th>
<th>Action</th>
</tr>
</thead>
@ -253,9 +254,10 @@
}
?>
<td><?php echo $igrStatusUpdate; ?></td>
<td style="width: 3% !important;"><?php echo $record->Remark; ?></td>
<td>
<a target="_blank" data-toggle="modal" data-target="#Historyshow" data-id="<%=index%>" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>">
<a target="_blank" href="#" data-toggle="modal" data-target="#Historyshow" data-id="<%=index%>" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>">
<i class="fa fa-history" style="text-align: center;"></i>
</a>
@ -989,6 +991,7 @@
// $('#content').loader('show');
var igrno = $("#IGRNO1").val();
var pono = $("#PONO1").val();
var status = 0;
var tableData = [];
$('#tbleIGRAppend tr').each(function(index) {
@ -1025,6 +1028,7 @@
formData.append('status', status);
formData.append('tableData', JSON.stringify(tableData));
formData.append('isOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('hiddenIsOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
formData.append('file_name[]', $('#file_name').val());
var empFiles = $('#emp_file')[0] ? $('#emp_file')[0].files : null;
@ -1103,6 +1107,7 @@
formData.append('status', status);
formData.append('tableData', JSON.stringify(tableData));
formData.append('isOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('hiddenIsOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
$('input[name="file_name[]"]').each(function() {

View File

@ -73,8 +73,8 @@
<div class="form-group">
<div class="form-group">
<label for="Basic_Pay">No Of Due(s)</label>
<input type="text" value="0" class="form-control requried num"
id="no_of_due" name="no_of_due" value="" pattern="[0-9]{1,2}"
<input type="text" value="0.00" class="form-control requried num"
id="no_of_due" name="no_of_due" pattern="^[1-9][0-9]?$"
title="Minimum 1 digit,Maximum 2 Digit" onchange="duecalculation();">
</div>
</div>
@ -246,33 +246,35 @@
});
function duecalculation() {
var totaldue = 0;
var loan = document.getElementById('Loan_Amount').value;
var no_of_due = document.getElementById('no_of_due').value;
$('#remaining_due').val(no_of_due);
if (loan != 0) {
if (no_of_due == 0) {
alert("Enter No Of Due");
$('#no_of_due').focus();
} else {
totalDueAmt = loan / no_of_due;
document.getElementById('monthly_due').value = Math.ceil(totalDueAmt);
function duecalculation() {
var loan = parseFloat(document.getElementById('Loan_Amount').value);
var no_of_due_raw = document.getElementById('no_of_due').value.trim();
// Validate: not empty and matches 199 (no 0s or more than 2 digits)
if (no_of_due_raw !== '') {
if (!/^(?:[1-9]|[1-9][0-9])$/.test(no_of_due_raw)) {
alert("Please enter a valid Number of Dues (Minimum 1 digit,Maximum 2 Digit).");
document.getElementById('no_of_due').focus();
document.getElementById('no_of_due').value = '';
$('#monthly_due').val('');
$('#remaining_due').val('');
return;
}
}
var no_of_due = parseInt(no_of_due_raw, 10);
$('#remaining_due').val(no_of_due);
if (!isNaN(loan) && loan > 0) {
var totalDueAmt = loan / no_of_due;
document.getElementById('monthly_due').value = Math.ceil(totalDueAmt);
} else {
$('#monthly_due').val('');
}
dateCalulation(); // Update your dates
}
dateCalulation();
}
function dateCalulation() {
//alert('j');

View File

@ -7,10 +7,7 @@
}
.th-status{
text-align:center !important;
}
.th-status{}
.modal-dialog-centered {
display: flex;
@ -317,7 +314,7 @@
<th class="th-poLineItems">Po Line Items</th>
<th class="th-PartialPolineItems">Partial PO Line Items</th>
<th class="th-reqNewlineItems">New Line Items</th>
<th class="th-status">Status</th>
<th align="left">Status</th>
<th class="th-department">Department</th>
<th class="th-designation">Designation</th>
</tr>
@ -346,8 +343,7 @@
<td align="center"><?php echo $record->PolineItems; ?></td>
<td align="center"><?php echo $record->PartilallyLineItems; ?></td>
<td align="center"><?php echo $record->newLineItem; ?></td>
<td align="center"><?php echo $record->StatusName; ?></td>
<td align="left" style="padding-left: 0.7%;"><?php echo strtoupper($record->StatusName); ?></td>
<td align="center"><?php echo $record->DepartmentName; ?></td>
<td><?php echo $record->Designation; ?></td>
</tr>

View File

@ -1815,7 +1815,7 @@ if (!empty($EmpDetails)) {
reasonTextarea.setAttribute("required", "true");
reasonTextarea.focus(); // Auto-focus
alert("Please enter the Reason!");
alert("Please Enter the Reason!");

View File

@ -1,3 +1,9 @@
<!-- Include jQuery first -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Include jQuery Validation plugin -->
<script src="https://cdn.jsdelivr.net/jquery.validation/1.19.3/jquery.validate.min.js"></script>
<?php
$EmpId = '';
@ -75,17 +81,13 @@ if (!empty($EmpList)) {
<div class="col-md-3">
<label class="col-form-label">Role</label>
<select class="form-control required" id="role" name="role" required>
<option value="0">Select Role</option>
<?php
if (!empty($roles)) {
foreach ($roles as $rl) {
$selected = ($rl->roleId == $Role) ? 'selected' : '';
?>
<option value="<?php echo $rl->roleId ?>" <?php echo $selected; ?>><?php echo $rl->role ?></option>
<?php
}
}
?>
<option value="">Select Role</option>
<?php if (!empty($roles)) {
foreach ($roles as $rl): ?>
<option value="<?= $rl->roleId ?>" <?= ($rl->roleId == $Role) ? 'selected' : '' ?>>
<?= $rl->role ?>
</option>
<?php endforeach; } ?>
</select>
</div>
</div>
@ -313,4 +315,4 @@ if (!empty($EmpList)) {
alert("Invalid email address");
}
});
</script>>
</script>

View File

@ -195,7 +195,7 @@ if (!empty($emppay)) {
<div class="form-group">
<div class="form-group">
<label for="Basic_Pay">No Of Due(s)</label>
<input type="text" class="form-control requried num" id="no_of_due" name="no_of_due" value="<?php echo $No_of_dues; ?>" pattern="[0-9]{1,2}" title="Minimum 1 digit,Maximum 2 Digit" onchange="duecalculation();">
<input type="text" class="form-control requried num" id="no_of_due" name="no_of_due" value="<?php echo $No_of_dues; ?>" pattern="^[1-9][0-9]?$" title="Minimum 1 digit,Maximum 2 Digit" onchange="duecalculation();">
</div>
</div>
</div>
@ -440,7 +440,21 @@ if (!empty($emppay)) {
function duecalculation() {
var totaldue = 0;
var loan = document.getElementById('Loan_Amount').value;
var no_of_due = document.getElementById('no_of_due').value;
var no_of_due_raw = document.getElementById('no_of_due').value.trim();
if (no_of_due_raw !== '') {
if (!/^(?:[1-9]|[1-9][0-9])$/.test(no_of_due_raw)) {
alert("Please enter a valid Number of Dues (Minimum 1 digit,Maximum 2 Digit).");
document.getElementById('no_of_due').focus();
document.getElementById('no_of_due').value = '';
$('#monthly_due').val('');
$('#remaining_due').val('');
$('#balance_due_amount').val('');
return;
}
}
var no_of_due = parseInt(no_of_due_raw, 10);
if (loan != 0) {
if (no_of_due == 0) {

View File

@ -25,7 +25,8 @@
<div class="col-12">
<div class="card">
<div class="card-body">
<table id="datatable" class="table dt-responsive nowrap w-100 ria_data_table">
<table id="datatable" class="table table-hover dt-responsive nowrap w-100" style="background-color:#fff;">
<!-- <table id="datatable" class="table dt-responsive nowrap w-100 ria_data_table"> any doubts ask about datable plugin ask VV-->
<thead>
<tr>
<th width="15%">Employee</th>

View File

@ -234,7 +234,7 @@
<th>Driver</th>
<th>Transporter</th>
<th>IGR Status</th>
<!-- <th>Remark</th> -->
<th>Remark</th>
<th>Action</th>
</tr>
</thead>
@ -297,12 +297,12 @@
<td><?php echo $record->DriverName ?></td>
<td><?php echo $record->TransporterName ?></td>
<td><?php if($record->IGRStatus == 'ST029'){ echo 'Cancel'; } elseif($record->IGRStatus == 'ST074'){ echo 'Draft'; } else{ echo 'Completed'; } ?></td>
<!-- <td style="width: 3% !important;"><?php // echo $record->Remark; ?></td> -->
<td style="width: 3% !important;"><?php echo $record->Remark; ?></td>
<td>
<a target="_blank" data-toggle="modal" data-target="#Historyshow" data-id="<%=index%>" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>">
<a target="_blank" data-toggle="modal" href="#" data-target="#Historyshow" data-id="<%=index%>" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>">
<i class="fa fa-history" style="text-align: center;"></i>
</a>
@ -1507,6 +1507,7 @@
formData.append('status', status);
formData.append('tableData', JSON.stringify(tableData));
formData.append('isOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('hiddenIsOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
formData.append('file_name[]', $('#file_name').val());
var empFiles = $('#emp_file')[0] ? $('#emp_file')[0].files : null;
@ -1579,6 +1580,7 @@
formData.append('status', status);
formData.append('tableData', JSON.stringify(tableData));
formData.append('isOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('hiddenIsOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
formData.append('MasterRemarks', $("#MasterRemarks").val());
@ -2469,421 +2471,6 @@
<!-- 28/02/2025 -->
<!-- add gas shortage calculator -->
<script>
$('#grossWeightId, #tareWeightId,#actualWeightId').change(function() {
console.log("fine here ");
let grossWeightVal = $('#grossWeightId').val().trim();
let tareWeightVal = $('#tareWeightId').val().trim();
// Ensure both fields have values before calculation
if (grossWeightVal === '' || tareWeightVal === '') {
return;
}
let grossWeight = validateNumber(grossWeightVal);
let tareWeight = validateNumber(tareWeightVal);
let netWeight = grossWeight - tareWeight;
$('#netWeightId').val(netWeight);
let actualWeightVal = $('#actualWeightId').val().trim();
// Ensure both fields have values before calculation
if (actualWeightVal === '' || netWeight === '') {
return;
}
let actualWeight = validateNumber(actualWeightVal);
let shortage = actualWeight - netWeight;
$('#shortageId').val(shortage);
});
function validateNumber(givenValue) {
givenValue = givenValue.trim();
if (/^\d+$/.test(givenValue)) {
return parseInt(givenValue, 10); // Convert string to number
} else {
alert('Please Enter a Valid Number..!!');
return 0; // Invalid number
}
}
</script>
<!-- while opening add gas shortage modal -->
<script>
$(document).ready(function(){
$('#gasShortageCalculator').on("shown.bs.modal", function(e){
//invoice needed to store it in the shortage table ,
// coz based on this we can limit the addition of shortage must not exceed than given qty
let invoiceNo = $('#Invoice_No').val();
let materialReceivedDate = $('#MaterialRcvdDate').val().split("-");
//converting it to y-m-d format;
console.log(`${materialReceivedDate[2]}-${materialReceivedDate[1]}-${materialReceivedDate[0]}`);
$('#invoiceNoId').val(invoiceNo);
$('#fullCylinderDateId').val(`${materialReceivedDate[2]}-${materialReceivedDate[1]}-${materialReceivedDate[0]}`);
});
});
</script>
<!-- while closing add gas shortage modal -->
<script>
$(document).ready(function(){
$('#gasShortageCalculator').on("hide.bs.modal", function(e){
$('#invoiceNoId').val(' ');
$('#fullCylinderDateId').val(" ");
$('#emptyCylinderDateId').val(" ");
$('#cylinderNoId').val(" ");
$('#grossWeightId').val(" ");
$('#tareWeightId').val(" ");
$('#actualWeightId').val(" ");
$('#netWeightId').val(" ");
$('#shortageId').val(" ");
});
});
</script>
<!-- end of add gas shortage calculator -->
<!-- edit gasShortageCalculator -->
<script>
$('#editGrossWeightId,#editTareWeightId,#editActualWeightId').change(function() {
let grossWeightVal = $('#editGrossWeightId').val().trim();
let tareWeightVal = $('#editTareWeightId').val().trim();
// Ensure both fields have values before calculation
if (grossWeightVal === '' || tareWeightVal === '') {
return;
}
let grossWeight = validateNumber(grossWeightVal);
let tareWeight = validateNumber(tareWeightVal);
let netWeight = grossWeight - tareWeight;
$('#editNetWeightId').val(netWeight);
let actualWeightVal = $('#editActualWeightId').val().trim();
// Ensure both fields have values before calculation
if (actualWeightVal === '' || netWeight === '') {
return;
}
let actualWeight = validateNumber(actualWeightVal);
let shortage = actualWeight - netWeight;
$('#editShortageId').val(shortage);
});
</script>
<!-- while opening edit gas shortage modal -->
<script>
$(document).ready(function(){
$('#editGasShortageCalculator').on("shown.bs.modal", function(e){
//invoice needed to store it in the shortage table ,
// coz based on this we can limit the addition of shortage must not exceed than given qty
let invoiceNo = $('#Invoice_No').val();
let materialReceivedDate = $('#MaterialRcvdDate').val().split("-");
//converting it to y-m-d format;
console.log(`${materialReceivedDate[2]}-${materialReceivedDate[1]}-${materialReceivedDate[0]}`);
$('#editInvoiceNoId').val(invoiceNo);
$('#editFullCylinderDateId').val(`${materialReceivedDate[2]}-${materialReceivedDate[1]}-${materialReceivedDate[0]}`);
});
});
</script>
<!-- while closing edit gas shortage modal -->
<script>
$(document).ready(function(){
$('#editGasShortageCalculator').on("hide.bs.modal", function(e){
$('#editInvoiceNoId').val(' ');
$('#editFullCylinderDateId').val(" ");
$('#editEmptyCylinderDateId').val(" ");
$('#editCylinderNoId').val(" ");
$('#editGrossWeightId').val(" ");
$('#editTareWeightId').val(" ");
$('#editActualWeightId').val(" ");
$('#editNetWeightId').val(" ");
$('#editShortageId').val(" ");
});
});
</script>
<!-- end of edit gasShortageCalculator -->
<!-- while opening gasShortageList -->
<script>
$(document).ready(function(){
$('#gasShortageList').on("shown.bs.modal",function(e){
let invoiceNo = $('#Invoice_No').val();
console.log("invoice no", invoiceNo);
$('#loader').show();
$.ajax({
type: "POST",
url: "<?php echo base_url()?>/gasShortageList", // 🔹 Change this to your actual backend endpoint
data: {invoiceNo},
dataType: "json",
success: function (response) {
if (response.status === "success") {
let data = response.data ;
let tableData = '';
data.forEach((val) => {
let fullCylinderDate = val.fullCylinderDate.split("-").reverse().join("-");
let emptyCylinderDate = val.emptyCylinderDate.split("-").reverse().join('-');
tableData += `
<tr>
<td>${fullCylinderDate}</td>
<td>${emptyCylinderDate}</td>
<td>${val.invoiceNo}</td>
<td>${val.cylinderNo}</td>
<td>${val.grossWeight}</td>
<td>${val.tareWeight}</td>
<td>${val.netWeight}</td>
<td>${val.actualWeight}</td>
<td>${val.shortage}</td>
<td style="display:none">${val.id}</td>
<td style="width: 25px; cursor: pointer;">
<i class="fa fa-solid fa-edit btnEditGasShortageCalculator"
style="text-align: center;"
data-toggle="modal"
data-target="#editGasShortageCalculator"
data-id="${val.id}"
title="Edit Gas Shortage List">
</i>
</td>
</tr>`;
});
// Assuming you have a table with ID "gasShortageTable"
$("#gasShortageTable tbody").html(tableData);
} else {
alert("Error: " + response.message);
}
},
error: function (xhr, status, error) {
console.log(xhr.responseText);
alert("Something went wrong! Please try again.");
},
complete:function(){
console.log("ajax call is completed..!!");
$('#loader').hide();
}
});
})
})
</script>
<!-- while closing gasShortageList -->
<script>
$(document).ready(function(){
$('#gasShortageList').on("hide.bs.modal",function(){
$("#gasShortageTable tbody").html(" ");
})
})
</script>
<!-- ajax call for gas Shortage -->
<script>
$("#gasShortageCalculator, #editGasShortageCalculator").submit(function (event) {
event.preventDefault(); // Prevent form reload
let formData;
let method = $(this).closest(".modal").data("form");
// Prepare form data
let addFormData = {
fullCylinderDate: $('#fullCylinderDateId').val(),
emptyCylinderDate: $('#emptyCylinderDateId').val(),
invoiceNo: $('#invoiceNoId').val(),
cylinderNo: $('#cylinderNoId').val(),
grossWeight: $('#grossWeightId').val(),
tareWeight: $('#tareWeightId').val(),
actualWeight: $('#actualWeightId').val(),
netWeight: $('#netWeightId').val(),
shortage: $('#shortageId').val()
};
let editFormData = {
fullCylinderDate: $('#editFullCylinderDateId').val(),
emptyCylinderDate: $('#editEmptyCylinderDateId').val(),
invoiceNo: $('#editInvoiceNoId').val(),
cylinderNo: $('#editCylinderNoId').val(),
grossWeight: $('#editGrossWeightId').val(),
tareWeight: $('#editTareWeightId').val(),
actualWeight: $('#editActualWeightId').val(),
netWeight: $('#editNetWeightId').val(),
shortage: $('#editShortageId').val(),
id : $('#editId').val()
};
if(method == "add"){ formData = addFormData ;}
if(method == "edit"){ formData = editFormData ;}
$('#loader').show();
$.ajax({
type: "POST",
url: "<?php echo base_url()?>/updateGasShortage", // 🔹 Change this to your actual backend endpoint
data: formData,
dataType: "json",
success: function (response) {
if (response.status === "success") {
alert("Gas Shortage Data Saved Successfully!");
$('#gasShortageCalculator').modal('hide'); // Close modal
$('#editGasShortageCalculator').modal('hide');
} else {
alert("Error: " + response.message);
}
},
error: function (xhr, status, error) {
console.log(xhr.responseText);
alert("Something went wrong! Please try again.");
},
complete:function(){
console.log("ajax call is completed..!!");
$('#loader').hide();
}
});
});
</script>
<script>
$(document).on("click", ".btnEditGasShortageCalculator", function () {
console.log("Edit modal opening place");
let id = $(this).data("id");
console.log("Editing ID:", id);
// Smooth transition: First hide, then show after 300ms
$("#gasShortageList").modal("hide");
setTimeout(() => {
$("#editGasShortageCalculator").modal("show");
}, 300);
$('#loader').show();
// AJAX request to fetch data
$.ajax({
type: "POST",
url: "<?php echo base_url()?>/getGasShortageDetail",
data: { id: id },
dataType: "json",
success: function (response) {
if (response.status === "success") {
let data = response.data;
console.log(data);
if(data.length > 0){
data = data[0];
console.log(data);
// Populate the modal fields
$("#editFullCylinderDateId").val(data.fullCylinderDate);
$("#editEmptyCylinderDateId").val(data.emptyCylinderDate);
$("#editInvoiceNoId").val(data.invoiceNo);
$("#editCylinderNoId").val(data.cylinderNo);
$("#editGrossWeightId").val(data.grossWeight);
$("#editTareWeightId").val(data.tareWeight);
$("#editNetWeightId").val(data.netWeight);
$("#editActualWeightId").val(data.actualWeight);
$("#editShortageId").val(data.shortage);
$("#editId").val(data.id); // Hidden field for ID
}
} else {
alert("Error: " + response.message);
}
},
error: function (xhr, status, error) {
console.log(xhr.responseText);
alert("Something went wrong! Please try again.");
},
complete:function(){
console.log("ajax call is completed..!!");
$('#loader').hide();
}
});
});
</script>
<script>
$(document).ready(function(){

View File

@ -5,25 +5,64 @@
*
* @author Kishor Mali
*/
$(document).ready(function(){
var editUserForm = $("#editUser");
var validator = editUserForm.validate({
rules:{
fname :{ required : true },
email : { required : true, email : true, remote : { url : baseURL + "checkEmailExists", type :"post", data : { userId : function(){ return $("#userId").val(); } } } },
cpassword : {equalTo: "#password"},
mobile : { required : true, digits : true },
role : { required : true, selected : true}
},
messages:{
fname :{ required : "This field is required" },
email : { required : "This field is required", email : "Please enter valid email address", remote : "Email already taken" },
cpassword : {equalTo: "Please enter same password" },
mobile : { required : "This field is required", digits : "Please enter numbers only" },
role : { required : "This field is required", selected : "Please select atleast one option" }
}
});
});
$(document).ready(function () {
var editUserForm = $("#editUser");
var baseURL = '<?php echo base_url(); ?>checkEmailExists';
var validator = editUserForm.validate({
rules: {
fname: { required: true },
email: {
required: true,
email: true,
remote: {
param: {
url: baseURL,
type: "post",
data: {
userId: function () {
return $("#userId").val();
}
}
},
depends: function () {
return $("#email").val().length > 0;
}
}
},
cpassword: { equalTo: "#password" },
mobile: { required: true, digits: true },
// role: { required: true, selected: true }
role: { required: true }
},
messages: {
fname: { required: "This field is required" },
email: {
required: "This field is required",
email: "Please enter valid email address",
remote: "Email already taken"
},
cpassword: { equalTo: "Please enter same password" },
mobile: {
required: "This field is required",
digits: "Please enter numbers only"
},
role: {
required: "Please select the option"
}
}
});
$("#reset").on("click", function (e) {
editUserForm[0].reset();
validator.resetForm();
editUserForm.find(".error").removeClass("error");
});
});