From 6f41d3d883b3c6fa30ee4e57b11a605d8e4a6372 Mon Sep 17 00:00:00 2001
From: Pinga <121483313+getpinga@users.noreply.github.com>
Date: Thu, 7 Dec 2023 16:26:36 +0200
Subject: [PATCH] UI fixes for transfers
---
cp/resources/views/partials/js-transfers.twig | 41 +++++++++++--------
1 file changed, 24 insertions(+), 17 deletions(-)
diff --git a/cp/resources/views/partials/js-transfers.twig b/cp/resources/views/partials/js-transfers.twig
index 88c5369..840bf32 100644
--- a/cp/resources/views/partials/js-transfers.twig
+++ b/cp/resources/views/partials/js-transfers.twig
@@ -19,40 +19,47 @@
var hasPendingStatus = rowData.trstatus && rowData.trstatus.includes('pending');
var clidValue = document.getElementById('clid').value;
- if (hasPendingStatus) {
+ if (hasPendingStatus && clidValue === '0') {
actionButtons += ` `;
- } else {
- actionButtons += ` `;
- actionButtons += ``;
- }
-
- if (clidValue === '0') {
actionButtons += ` `;
actionButtons += ``;
- } else if (clidValue !== '' && clidValue !== null) {
- // Code to execute if clidValue is not empty and not null
- console.log('clidValue is not empty and not null');
+ } else if (clidValue === rowData.reid) {
+ actionButtons += ` `;
+ } else if (clidValue === rowData.acid) {
+ actionButtons += ` `;
+ actionButtons += ``;
} else {
- // Code to execute if clidValue is empty or null
- console.log('clidValue is empty or null');
+ actionButtons += ` Completed`;
}
-
+
return actionButtons;
}
function statusFormatter(cell) {
var status = cell.getValue(); // Get the status value as a string
- var rowData = cell.getRow().getData(); // Get the entire row data
- // Function to create a badge
+ // Function to create a badge with a given text and Bootstrap color class
function createBadge(text, badgeClass) {
return `${text}`;
}
- // Check if status is not null or undefined
+ // Check if status is not null or undefined and assign colors
if (status) {
- return createBadge(status, 'azure');
+ let badgeClass = 'secondary'; // Default color class
+
+ if (status.includes('pending')) {
+ badgeClass = 'warning'; // Bootstrap warning color for pending
+ } else if (status.includes('Approved')) {
+ badgeClass = 'success'; // Bootstrap success color for Approved
+ } else if (status.includes('Rejected')) {
+ badgeClass = 'danger'; // Bootstrap danger color for Rejected
+ } else if (status.includes('Cancelled')) {
+ badgeClass = 'info'; // Bootstrap info color for Cancelled
+ }
+
+ return createBadge(status, badgeClass);
}
+
return ''; // Return an empty string if status is null or undefined
}