From fded06995776c2bf48ea152f4a617b72e2f7c58e Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 20 Nov 2025 12:01:18 +0530 Subject: [PATCH] CHANGE_CHECK_USED_RULE_IS --- app/Controllers/RuleImportController.php | 1 + app/Views/commission_rules_list.php | 157 +++++++++-------------- 2 files changed, 59 insertions(+), 99 deletions(-) diff --git a/app/Controllers/RuleImportController.php b/app/Controllers/RuleImportController.php index fbe785a1..91fc2ddc 100644 --- a/app/Controllers/RuleImportController.php +++ b/app/Controllers/RuleImportController.php @@ -822,6 +822,7 @@ class RuleImportController extends AdminController $count = $this->partnerPolicyModel->where('commission_applied_rule', $rule_id) ->countAllResults(); + // $count = 1; return $this->respond(['status' => true, 'code' => 200, 'count' => $count, 'message' => ""], 200); } diff --git a/app/Views/commission_rules_list.php b/app/Views/commission_rules_list.php index d3b34eab..63918706 100644 --- a/app/Views/commission_rules_list.php +++ b/app/Views/commission_rules_list.php @@ -328,8 +328,9 @@
- - + + +
@@ -611,28 +612,7 @@ }); }); - - function deleteRule(ruleId, department) { - if (confirm('Are you sure you want to delete this rule?')) { - fetch('', { - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - body: 'action=delete_rule&rule_id=' + ruleId + '&department=' + department - }) - .then(response => response.json()) - .then(data => { - if (data.success) { - showAlert('Rule deleted successfully!', 'success'); - // loadAllRules(); - } else { - showAlert('Error deleting rule: ' + data.message, 'error'); - } - }); - } - } - + function resetForm() { document.getElementById('ruleForm').reset(); document.getElementById('ruleId').value = ''; @@ -643,48 +623,6 @@ addCondition(); toggleCalculationFields(); } - - function filterRules() { - const department = document.getElementById('filterDepartment').value; - - if (!department) { - // loadAllRules(); - return; - } - - fetch('', { - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - body: 'action=get_rules&department=' + department - }) - .then(response => response.json()) - .then(rules => { - const rulesWithDept = rules.map(rule => ({...rule, department: department})); - displayRules(rulesWithDept); - }); - } - - function showAlert(message, type) { - const alertContainer = document.getElementById('alert-container'); - const alertClass = type === 'success' ? 'alert-success' : 'alert-error'; - - alertContainer.innerHTML = ` -
- ${message} -
- `; - - // Remove alert after 5 seconds - setTimeout(() => { - alertContainer.innerHTML = ''; - }, 5000); - } - - - -