mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-23 11:05:57 +02:00
UI fixes for transfers
This commit is contained in:
parent
d03e85b3cb
commit
6f41d3d883
1 changed files with 24 additions and 17 deletions
|
@ -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 += `<a class="btn btn-success btn-icon" href="transfer/approve/${cell.getRow().getData().name}" title="Approve Transfer"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 11l3 3l8 -8" /><path d="M20 12v6a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h9" /></svg></a> `;
|
||||
} else {
|
||||
actionButtons += `<a class="btn btn-secondary btn-icon" href="transfer/cancel/${cell.getRow().getData().name}" title="Cancel Transfer"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"></path><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"></path></svg></a> `;
|
||||
actionButtons += `<a class="btn btn-danger btn-icon" href="transfer/reject/${cell.getRow().getData().name}" title="Reject Transfer"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7h16"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path><path d="M10 12l4 4m0 -4l-4 4"></path></svg></a>`;
|
||||
}
|
||||
|
||||
if (clidValue === '0') {
|
||||
actionButtons += `<a class="btn btn-dark btn-icon" href="transfer/cancel/${cell.getRow().getData().name}" title="Cancel Transfer"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M10 10l4 4m0 -4l-4 4" /></svg></a> `;
|
||||
actionButtons += `<a class="btn btn-danger btn-icon" href="transfer/reject/${cell.getRow().getData().name}" title="Reject Transfer"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M5.7 5.7l12.6 12.6" /></svg></a>`;
|
||||
} 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 += `<a class="btn btn-dark btn-icon" href="transfer/cancel/${cell.getRow().getData().name}" title="Cancel Transfer"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M10 10l4 4m0 -4l-4 4" /></svg></a> `;
|
||||
} else if (clidValue === rowData.acid) {
|
||||
actionButtons += `<a class="btn btn-success btn-icon" href="transfer/approve/${cell.getRow().getData().name}" title="Approve Transfer"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 11l3 3l8 -8" /><path d="M20 12v6a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h9" /></svg></a> `;
|
||||
actionButtons += `<a class="btn btn-danger btn-icon" href="transfer/reject/${cell.getRow().getData().name}" title="Reject Transfer"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M5.7 5.7l12.6 12.6" /></svg></a>`;
|
||||
} else {
|
||||
// Code to execute if clidValue is empty or null
|
||||
console.log('clidValue is empty or null');
|
||||
actionButtons += `<strong class="text-success"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M9 12l2 2l4 -4" /></svg> Completed</strong>`;
|
||||
}
|
||||
|
||||
|
||||
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 `<span class="badge bg-${badgeClass}-lt">${text}</span>`;
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue