It is Dynamic Buttons (It is cool using script) Maybe we should have script instead of rule or Script box in the Rule instead
function mainMenuButtons(TicketType,TicketStatus,DeliveryCharged,AutoFee,PayOut) {
DeliveryCharged = Number(DeliveryCharged);
PayOut = Number(PayOut.replace(/ Re-Settle/g,""));
var buttonList = '';
if (TicketType == 'Online') {
buttonList = "Pay Cash,Pay Customer Account,Delivery Payout,Cancel";
} else {
switch(TicketStatus) {
case 'New Orders':
buttonList = "Auto Delivery Fee $"+AutoFee+"="+AutoFee+",Manual Delivery Fee,Credit Card Info,Pickup Time,Close Ticket,Cancel";
break;
case 'Unpaid':
if (DeliveryCharged < 1){
buttonList = "Auto Delivery Fee $"+AutoFee+"="+AutoFee+",Manual Delivery Fee,Credit Card Info,Close Ticket,Cancel";
}
if (DeliveryCharged > 0 && PayOut < 1){
buttonList = "Print Bill,Credit Card Info,Manual Delivery Fee,Save Delivery Fee,Delivery Payout,Close Ticket,Cancel";
}
if (DeliveryCharged > 0 && PayOut > 0){
buttonList = "Pay Cash,Pay Debit/Credit,Delivery Payout,Cancel";
}
break;
default:
buttonList = "Print Bill,Credit Card Info,Manual Delivery Fee,Delivery Payout,Pay Cash,Pay Debit/Credit,Pay Customer Account,Cancel";
}
}
return buttonList;
}