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