Skip to content

Instantly share code, notes, and snippets.

@lyquangthai1993
Last active November 29, 2023 01:58
Show Gist options
  • Save lyquangthai1993/6991051947d2d5a8275ba939961e6122 to your computer and use it in GitHub Desktop.
Save lyquangthai1993/6991051947d2d5a8275ba939961e6122 to your computer and use it in GitHub Desktop.
logic 3 button action column
function (data, type, row, meta) {
let isDisableAll = false;
let disabledDone = false;
let showDone = true;
let isHideRelease = false;
let classEditButton = 'edit-transaction-action';
if (row['status'] === 'canceled') {
isDisableAll = true;
}
if (row['status'] === 'signed') {
disabledDone = true;
isHideRelease = true;
}
if (row['status'] === 'waiting_customer_confirmation_sign') {
disabledDone = true;
}
if (row['status'] !== 'deposit_approved') {
showDone = false;
}
if (row['lead'] && row['lead']['partner_type'] === '3') {
classEditButton = 'edit-company-transaction-action';
}
if (group_code === 'VINHOMES_NORTH') {
disabledDone = true;
// !!! vin north book
if (account_type === '13' && row['status'] === 'new') {
disabledDone = false;
}
// !!! vin north approve
if (account_type === '11' && (row['status'] === 'new' || row['status'] === 'waiting_customer_confirmation_sign')) {
disabledDone = false;
}
// if (row['status'] === 'new') {
// disabledDone = false;
// } else {
// disabledDone = true;
// }
}
return `
<a type="button" href="javascript:void(0);" title="Edit" class="${ (isDisableAll || disabledDone || !is_vinhome_management_edit_lead ? 'prevent-control disabled' : '') } ${ classEditButton }" data-index="${ meta.row }"><i class="ph-pencil color-BE853B" style="font-size: 22px;"></i></a>
<a type="button" href="javascript:void(0);" title="View transfer guide" class="${ isDisableAll || !is_vinhome_management_transfer_guide_view ? 'prevent-control disabled' : '' } view-transfer-guide-action cursor-pointer"><i style="font-size: 22px;" class=" ph-file-text color-FFC444" data-index="${ meta.row }"></i></a>
<a type="button" href="javascript:void(0);" title="Print document" class="${ isDisableAll || (!is_vinhome_management_print_xndkch && !is_vinhome_management_print_xngd && !is_vinhome_management_print_xntt) ? 'prevent-control disabled' : '' } print-document-action cursor-pointer"><i style="font-size: 22px;" class=" ph-printer color-0388C1" data-index="${ meta.row }"></i></a>
`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment