FIX_Minor issues
This commit is contained in:
parent
03608dbda4
commit
1fb60aece4
@ -110,13 +110,14 @@ input:checked + .slider:before {
|
|||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="client_name">Client Name<span
|
<label for="client_name">Client Name<span
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="client_name"
|
<input type="text" class="form-control" id="client_name" data-old-name="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
|
||||||
placeholder="Enter Client Name" value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>" name="client_name" required>
|
placeholder="Enter Client Name" value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>" name="client_name" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="short_name">Client Short Name<span
|
<label for="short_name">Client Short Name<span
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="short_name"
|
<input type="text" class="form-control" id="short_name"
|
||||||
|
data-old-short="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||||
placeholder="Enter Short Name" value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>" name="short_name" onkeyup="validateInput(this, 'clients', 'short_name', 'clientBtnSubmit')" required>
|
placeholder="Enter Short Name" value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>" name="short_name" onkeyup="validateInput(this, 'clients', 'short_name', 'clientBtnSubmit')" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -862,6 +862,83 @@ function checkMobileNumber(input) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function generateShortName() {
|
||||||
|
// let clientName = $("#client_name").val().trim();
|
||||||
|
// if (clientName.length > 0) {
|
||||||
|
// let shortName = clientName.substring(0, 10).replace(/\s+/g, '').toUpperCase(); // Take first 10 chars , space removed, converted caps
|
||||||
|
// $("#short_name").val(shortName);
|
||||||
|
// makeUniqueShortName(shortName);
|
||||||
|
// }else{
|
||||||
|
// $("#short_name").val('');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
let shortNameTimer;
|
||||||
|
|
||||||
|
$("#client_name").on("input change keyup", function() {
|
||||||
|
clearTimeout(shortNameTimer); // cancel previous call
|
||||||
|
shortNameTimer = setTimeout(() => {
|
||||||
|
generateShortName(); // only runs after 200ms pause
|
||||||
|
}, 200); // adjust debounce delay as needed
|
||||||
|
});
|
||||||
|
|
||||||
|
function generateShortName() {
|
||||||
|
let clientInput = $("#client_name");
|
||||||
|
let shortInput = $("#short_name");
|
||||||
|
|
||||||
|
let oldClientName = clientInput.data("old-name"); // from DB
|
||||||
|
let oldShortName = shortInput.data("old-short"); // from DB
|
||||||
|
let newClientName = clientInput.val().trim();
|
||||||
|
console.log(`LN 882 : NEW - ${newClientName} | OLD - ${oldClientName} | OLD SN - ${oldShortName}`);
|
||||||
|
|
||||||
|
if (newClientName.toUpperCase() === (oldClientName || '').toUpperCase()) {
|
||||||
|
shortInput.val(oldShortName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newClientName.length == 0) {
|
||||||
|
shortInput.val('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newClientName.length > 0) {
|
||||||
|
let shortName = newClientName.substring(0, 10).replace(/\s+/g, '').toUpperCase();
|
||||||
|
shortInput.val(shortName);
|
||||||
|
makeUniqueShortName(shortName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function makeUniqueShortName(baseName) {
|
||||||
|
let input = $("#short_name")[0]; // input element
|
||||||
|
checkDuplicateTableFieldValue("clients", "short_name", baseName, function(isDuplicate) {
|
||||||
|
if (isDuplicate) {
|
||||||
|
// Append sequence until unique
|
||||||
|
let counter = 1;
|
||||||
|
function tryNext() {
|
||||||
|
let padded = String(counter).padStart(3, '0'); // 001, 002, 003
|
||||||
|
let newName = baseName + padded;
|
||||||
|
|
||||||
|
checkDuplicateTableFieldValue("clients", "short_name", newName, function(exists) {
|
||||||
|
if (exists) {
|
||||||
|
counter++;
|
||||||
|
tryNext(); // keep checking
|
||||||
|
} else {
|
||||||
|
$("#short_name").val(newName);
|
||||||
|
validateInput(input, "clients", "short_name", "clientBtnSubmit");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
tryNext();
|
||||||
|
} else {
|
||||||
|
$("#short_name").val(baseName);
|
||||||
|
validateInput(input, "clients", "short_name", "clientBtnSubmit");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function validateInput(input, table, field, submitButId){
|
function validateInput(input, table, field, submitButId){
|
||||||
|
|
||||||
let value = $(input).val();
|
let value = $(input).val();
|
||||||
|
|||||||
@ -326,6 +326,11 @@ $(document).ready(function()
|
|||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||||
title: 'Client-List',
|
title: 'Client-List',
|
||||||
|
// title: function() {
|
||||||
|
// return $('#toggleButtons').is(':checked')
|
||||||
|
// ? 'GC-Client-List'
|
||||||
|
// : 'RC-Client-List';
|
||||||
|
// },
|
||||||
className: 'app-btn-primary ',
|
className: 'app-btn-primary ',
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
columns: ':not(:last-child)'
|
columns: ':not(:last-child)'
|
||||||
@ -357,26 +362,20 @@ $(document).ready(function()
|
|||||||
$(".datatable-buttons").prepend(`
|
$(".datatable-buttons").prepend(`
|
||||||
<span id="statusSwitchWrapper" class="dt-switch-wrapper">
|
<span id="statusSwitchWrapper" class="dt-switch-wrapper">
|
||||||
<span class="custom-switch" style="text-align: left;">
|
<span class="custom-switch" style="text-align: left;">
|
||||||
<input type="checkbox" class="custom-control-input" id="toggleButtons">
|
<input type="checkbox" class="custom-control-input" id="toggleButtons" checked>
|
||||||
<label class="custom-control-label" for="toggleButtons" style="vertical-align: middle !important;">Group Client</label>
|
<label class="custom-control-label" for="toggleButtons" style="vertical-align: middle !important;">Group Client</label>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
`);
|
`);
|
||||||
$("#toggleButtons").prop("checked", true); // default checked.
|
|
||||||
$('#toggleButtons').on('change', function() {
|
$('#toggleButtons').on('change', function() {
|
||||||
if ($(this).is(':checked')) {
|
let type = $(this).is(':checked') ? 1 : 2;
|
||||||
console.log("Checked na gro");
|
// $('div.col-6 h4').text(
|
||||||
loadTableData(1);
|
// $(this).is(':checked')
|
||||||
} else {
|
// ? "GC Client List"
|
||||||
console.log("UnChecked na indi");
|
// : "RC Client List"
|
||||||
loadTableData(2);
|
// );
|
||||||
}
|
let url = '<?= base_url('client/typeList/') ?>' + type;
|
||||||
});
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
function loadTableData(type) {
|
|
||||||
let url = '<?= base_url('client/typeList/') ?>' + type
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -392,7 +391,9 @@ $(document).ready(function()
|
|||||||
renderRows([]);
|
renderRows([]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
function renderRows(data) {
|
function renderRows(data) {
|
||||||
table.clear();
|
table.clear();
|
||||||
|
|||||||
@ -332,7 +332,8 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#hr-access-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="hr_access_tab" onclick="appendHrAccessControllHtml(this)">
|
<a href="#hr-access-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="hr_access_tab" onclick="appendHrAccessControllHtml(this)">
|
||||||
<span class="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span>
|
<span class="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span>
|
||||||
<span class="d-none d-sm-inline-block">HR Access Control</span>
|
<span class="d-none d-sm-inline-block">Client Access Control</span>
|
||||||
|
<!-- Name Changed "HR Access Controll" into "Client Access Control" -->
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@ -563,7 +564,7 @@
|
|||||||
client_notification();
|
client_notification();
|
||||||
});
|
});
|
||||||
|
|
||||||
//HR Access Controll
|
//HR Access Controll also know as "Client Access Control"
|
||||||
function appendHrAccessControllHtml(input) {
|
function appendHrAccessControllHtml(input) {
|
||||||
console.log(input.id);
|
console.log(input.id);
|
||||||
let client_id = $('#general_PrimaryKey').val();
|
let client_id = $('#general_PrimaryKey').val();
|
||||||
|
|||||||
@ -200,7 +200,8 @@
|
|||||||
<span class="slider round" style="height: 27px;"></span>
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label>
|
<!-- <label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label> -->
|
||||||
|
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Employee App</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4 EB">
|
<div class="form-group col-md-4 EB">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user