Seeking a proficient approach to the issue at hand:
https://i.sstatic.net/JP8aE.png
In essence, the goal is to prioritize items with a pending status at the top and arrange all other statuses below, then sort each section alphabetically by name.
Here is my current solution implementation:
arrangeData(data){
const pending = [];
const nonPending = [];
data.forEach((item) => {
if(item.status === 'Pending') { //case insensitive logic can be incorporated
pending.push(item)
} else {
nonPending.push(item);
}
});
pending.sort((a, b) => {
return a.name.localeCompare(b.name);
});
nonPending.sort((a, b) => {
return a.name.localeCompare(b.name);
});
return pending.concat(nonPending);
}