Skip to content

Commit

Permalink
feat: add toggle all button to closure approval form
Browse files Browse the repository at this point in the history
  • Loading branch information
keenthekeen committed Sep 1, 2024
1 parent cd91a07 commit 6093f0f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion resources/js/Pages/ProjectApproval.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
<th scope="col" class="px-2 pb-1 text-left text-xs font-medium text-gray-500 tracking-wider">
รับรอง/ไม่รับรองรายชื่อ
</th>
<th v-if="showCheckbox"
<th v-if="showCheckbox" @click="toggleAll" :class="{ 'cursor-pointer': item.closure_status < 10 }"
scope="col" class="px-2 pb-1 text-left text-xs font-medium text-gray-500 tracking-wider">
อนุมัติ
</th>
Expand Down Expand Up @@ -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}));
Expand Down

0 comments on commit 6093f0f

Please sign in to comment.