Gennovadc - Dialysis Plan vs Exec Tracker form changes 4
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m51s Details

This commit is contained in:
Farhan Pathan 2026-06-10 12:11:36 +05:30
parent 65957f9289
commit f45ff9e8e7
1 changed files with 140 additions and 18 deletions

View File

@ -1179,9 +1179,9 @@ $brandData2 = [
$('label[for="execution-execution_week"]').html('<p class="form-label">Select Execution Week <span class="text-danger">*</span></p><p class="text-danger">*below total exe units & achv % will be calculated basis the week selected here</p>');
$('label[for="execution-execution_product"]').html('<p class="form-label">Execution Product <span class="text-danger">*</span></p><p class="text-danger">*Pl enter exec/achv units for the week selected above;<br/> eg if week 3 is selected, enter achv/exec units for week 3 only; accordingly total units and percentage will get calculated</p>');
/*
function calculateExecution() {
console.log("func 1...");
let numOfWeek = $('#execution-execution_week').val();
if (!numOfWeek) return;
@ -1276,7 +1276,10 @@ $brandData2 = [
dynPlan ? ((dynSelected / dynPlan) * 100).toFixed(2) : 0
);
}
/*function calculateExecution() {
*/
/*function calculateExecution() {
console.log("func 2...");
let numOfWeek = $('#execution-execution_week').val();
@ -1339,25 +1342,146 @@ $brandData2 = [
}*/
// Auto calculate while typing
$('[id*="_exe"]').on('keyup change', function () {
calculateExecution();
});
function calculateExecution() {
let numOfWeek = $('#execution-execution_week').val();
if (!numOfWeek) {
return;
}
// =========================
// Vintor 4K
// =========================
let v4kTotal =
parseInt($('#execution-vintor_4k_week' + numOfWeek + '_exe').val()) || 0;
let v4kPlan =
parseInt($('#execution-vintor_4k_units').val()) || 0;
$('#execution-vintor_4k_units_execution').val(v4kTotal);
$('#execution-vintor_4k_percent').val(
v4kPlan ? ((v4kTotal / v4kPlan) * 100).toFixed(2) : 0
);
// Week change readonly logic
$('#execution-execution_week').on('change', function () {
// =========================
// Vintor 10K
// =========================
let v10kTotal =
parseInt($('#execution-vintor_10k_week' + numOfWeek + '_exe').val()) || 0;
let selectedWeek = $(this).val();
let v10kPlan =
parseInt($('#execution-vintor_10k_units').val()) || 0;
$('[id*="_week"][id*="_exe"]').prop('readonly', true);
$('#execution-vintor_10k_units_execution').val(v10kTotal);
$('#execution-vintor_10k_percent').val(
v10kPlan ? ((v10kTotal / v10kPlan) * 100).toFixed(2) : 0
);
if (selectedWeek) {
$(`[id*="_week${selectedWeek}_exe"]`).prop('readonly', false);
}
calculateExecution();
});
// =========================
// Vintor 6K
// =========================
let v6kTotal =
parseInt($('#execution-vintor_6k_week' + numOfWeek + '_exe').val()) || 0;
let v6kPlan =
parseInt($('#execution-vintor_6k_units').val()) || 0;
$('#execution-vintor_6k_units_execution').val(v6kTotal);
$('#execution-vintor_6k_percent').val(
v6kPlan ? ((v6kTotal / v6kPlan) * 100).toFixed(2) : 0
);
// =========================
// Encicarb 500
// =========================
let e500Total =
parseInt($('#execution-encicarb_500_week' + numOfWeek + '_exe').val()) || 0;
let e500Plan =
parseInt($('#execution-encicarb_500_units').val()) || 0;
$('#execution-encicarb_500_units_execution').val(e500Total);
$('#execution-encicarb_500_percent').val(
e500Plan ? ((e500Total / e500Plan) * 100).toFixed(2) : 0
);
// =========================
// Encicarb 100
// =========================
let e100Total =
parseInt($('#execution-encicarb_100_week' + numOfWeek + '_exe').val()) || 0;
let e100Plan =
parseInt($('#execution-encicarb_100_units').val()) || 0;
$('#execution-encicarb_100_units_execution').val(e100Total);
$('#execution-encicarb_100_percent').val(
e100Plan ? ((e100Total / e100Plan) * 100).toFixed(2) : 0
);
// =========================
// Dynulta
// =========================
let dynTotal =
parseInt($('#execution-dynulta_week' + numOfWeek + '_exe').val()) || 0;
let dynPlan =
parseInt($('#execution-dynulta_units').val()) || 0;
$('#execution-dynulta_units_execution').val(dynTotal);
$('#execution-dynulta_percent').val(
dynPlan ? ((dynTotal / dynPlan) * 100).toFixed(2) : 0
);
}
// Auto calculate while typing
$('[id*="_week"][id*="_exe"]').on('keyup change', function () {
let currentField = $(this);
let value = parseInt(currentField.val()) || 0;
// Example:
// execution-vintor_4k_week2_exe
let fieldId = currentField.attr('id');
let product = fieldId.replace(/^execution-/, '');
product = product.replace(/_week[1-4]_exe$/, '');
let planValue =
parseInt($('#execution-' + product + '_units').val()) || 0;
$('#execution-' + product + '_units_execution').val(value);
$('#execution-' + product + '_percent').val(
planValue ? ((value / planValue) * 100).toFixed(2) : 0
);
});
// Week change readonly logic
$('#execution-execution_week').on('change', function () {
let selectedWeek = $(this).val();
// Lock all week fields
$('[id*="_week"][id*="_exe"]').prop('readonly', true);
// Enable only selected week
if (selectedWeek) {
$(`[id*="_week${selectedWeek}_exe"]`).prop('readonly', false);
}
});
// $('#execution-execution_week').on('change',function(){
// let numOfWeek=$('#execution-execution_week').val();
// console.log("Number of Week : ",numOfWeek);
@ -1763,8 +1887,6 @@ $brandData2 = [
})