From 6093f0f22d28a910d4d729d112c68b631545a3b3 Mon Sep 17 00:00:00 2001 From: "Siwat T." Date: Sun, 1 Sep 2024 23:17:48 +0700 Subject: [PATCH] feat: add toggle all button to closure approval form --- resources/js/Pages/ProjectApproval.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/js/Pages/ProjectApproval.vue b/resources/js/Pages/ProjectApproval.vue index d92489d..cda6a79 100644 --- a/resources/js/Pages/ProjectApproval.vue +++ b/resources/js/Pages/ProjectApproval.vue @@ -148,7 +148,7 @@ รับรอง/ไม่รับรองรายชื่อ - อนุมัติ @@ -360,6 +360,13 @@ const selectParticipant = (id) => { selectedParticipants.value.push(id); } }; +const toggleAll = () => { + if (selectedParticipants.value.length > 0) { + selectedParticipants.value = []; + } else { + selectedParticipants.value = props.item.participants.map(e => e.id); + } +}; const submit = () => { form.approve_participants = selectedParticipants.value; form.post(route('projects.approvalSubmit', {project: props.item.id}));