แก้ไขสถานะ กับ ลบ
This commit is contained in:
parent
efe4fd5950
commit
e969ff7ba4
2 changed files with 38 additions and 11 deletions
|
|
@ -42,6 +42,8 @@ const {
|
|||
createSchedule,
|
||||
editSchedule,
|
||||
deleteSchedule,
|
||||
|
||||
toggleSchedule,
|
||||
} = useDataStore();
|
||||
const storeData = useDataStore();
|
||||
const { dataBackUp, restoreRunTotal, dataSchedule } = storeToRefs(storeData);
|
||||
|
|
@ -180,7 +182,8 @@ async function onSubmit() {
|
|||
function onDelete(id: string) {
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
deleteBackUp(id);
|
||||
await deleteSchedule(id);
|
||||
await getSchedule();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -210,13 +213,13 @@ const tabItems = ref<ItemsTeb[]>([
|
|||
]);
|
||||
|
||||
const dayColors: { [key: string]: string } = {
|
||||
monday: "#FFFF00", // Yellow
|
||||
tuesday: "#FF69B4", // Pink
|
||||
wednesday: "#008000", // Green
|
||||
thursday: "#FFA500", // Orange
|
||||
friday: "#0000FF", // Blue
|
||||
saturday: "#800080", // Purple
|
||||
sunday: "#FF0000", // Red
|
||||
mon: "#FFC700", // Yellow
|
||||
tue: "#FF69B4", // Pink
|
||||
wed: "#008000", // Green
|
||||
thu: "#FFA500", // Orange
|
||||
fri: "#0000FF", // Blue
|
||||
sat: "#800080", // Purple
|
||||
sun: "#FF0000", // Red
|
||||
};
|
||||
|
||||
const dayNames: { [key: string]: string } = {
|
||||
|
|
@ -359,7 +362,17 @@ onMounted(async () => {
|
|||
<q-td>
|
||||
{{ date2Thai(props.row.startAt, true, false) }}
|
||||
</q-td>
|
||||
<q-td> <q-toggle size="lg" v-model="props.row.enabled" /> </q-td>
|
||||
<q-td>
|
||||
<q-toggle
|
||||
size="lg"
|
||||
v-model="props.row.enabled"
|
||||
@click.stop="
|
||||
() => {
|
||||
toggleSchedule(props.row.id);
|
||||
}
|
||||
"
|
||||
/>
|
||||
</q-td>
|
||||
<q-td>
|
||||
<q-btn
|
||||
dense
|
||||
|
|
@ -368,7 +381,7 @@ onMounted(async () => {
|
|||
icon="edit"
|
||||
color="primary"
|
||||
size="12px"
|
||||
@click.petvent="onDelete(props.row.name)"
|
||||
@click.petvent="onDelete(props.row.id)"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูลสำรอง </q-tooltip>
|
||||
</q-btn>
|
||||
|
|
@ -381,7 +394,7 @@ onMounted(async () => {
|
|||
icon="delete"
|
||||
color="red"
|
||||
size="12px"
|
||||
@click.petvent="onRestore(props.row.name)"
|
||||
@click.petvent="onDelete(props.row.id)"
|
||||
>
|
||||
<q-tooltip>คืนค่า </q-tooltip>
|
||||
</q-btn>
|
||||
|
|
|
|||
|
|
@ -294,6 +294,18 @@ export const useDataStore = defineStore("systemStore", () => {
|
|||
});
|
||||
}
|
||||
|
||||
async function toggleSchedule(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.backup + "/schedule/" + id + "/toggle")
|
||||
.then(async (res) => {
|
||||
return res.data;
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
async function deleteSchedule(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -327,5 +339,7 @@ export const useDataStore = defineStore("systemStore", () => {
|
|||
createSchedule,
|
||||
editSchedule,
|
||||
deleteSchedule,
|
||||
|
||||
toggleSchedule,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue