|
|
@@ -1,12 +1,11 @@
|
|
1
|
1
|
<script setup>
|
|
|
2
|
+import { ref } from 'vue'
|
|
|
3
|
+import { Inertia } from '@inertiajs/inertia'
|
|
2
|
4
|
import { Head, useForm } from '@inertiajs/inertia-vue3'
|
|
3
|
|
-
|
|
4
|
|
-import AppTextInput from '@/components/AppTextInput.vue'
|
|
5
|
|
-import AppButtonCreate from '@/components/AppButtonCreate.vue'
|
|
6
|
|
-import AppButtonDelete from '@/components/AppButtonDelete.vue'
|
|
7
|
|
-import AppButtonAction from '@/components/AppButtonAction.vue'
|
|
8
|
|
-import AppModalAlert from '@/components/AppModalAlert.vue'
|
|
9
|
|
-import DefaultLayout from '@/layouts/DefaultLayout.vue'
|
|
|
5
|
+import AppButton from '@/components/AppButton.vue'
|
|
|
6
|
+import AppInputText from '@/components/AppInputText.vue'
|
|
|
7
|
+import AppDialog from '@/components/AppDialog.vue'
|
|
|
8
|
+import AppLayout from '@/layouts/AppLayout.vue'
|
|
10
|
9
|
|
|
11
|
10
|
const props = defineProps({
|
|
12
|
11
|
laundry: Object,
|
|
|
@@ -21,46 +20,59 @@ const form = useForm({
|
|
21
|
20
|
const submit = () => {
|
|
22
|
21
|
form.put(route('laundries.update', props.laundry.id))
|
|
23
|
22
|
}
|
|
|
23
|
+
|
|
|
24
|
+const visibleDialog = ref(false)
|
|
|
25
|
+
|
|
|
26
|
+const confirmDialog = () => {
|
|
|
27
|
+ visibleDialog.value = true
|
|
|
28
|
+}
|
|
|
29
|
+
|
|
|
30
|
+const onAgree = (id) => Inertia.delete(route('laundries.destroy', id))
|
|
|
31
|
+
|
|
|
32
|
+const onCancel = () => (visibleDialog.value = false)
|
|
24
|
33
|
</script>
|
|
25
|
34
|
|
|
26
|
35
|
<template>
|
|
27
|
36
|
<Head title="Ubah tipe Laundry" />
|
|
28
|
37
|
|
|
29
|
|
- <DefaultLayout v-slot="{ toggleModalAlert }">
|
|
30
|
|
- <CRow>
|
|
31
|
|
- <CCol md="8">
|
|
32
|
|
- <CCard color="light" class="border-light">
|
|
33
|
|
- <CForm @submit.prevent="submit">
|
|
34
|
|
- <CRow class="p-4">
|
|
35
|
|
- <CCol md="6" class="mb-4">
|
|
36
|
|
- <AppTextInput label="Nama" placeholder="nama" :error="form.errors.name" v-model="form.name" />
|
|
37
|
|
- </CCol>
|
|
38
|
|
-
|
|
39
|
|
- <CCol md="6" class="mb-4">
|
|
40
|
|
- <AppTextInput label="Harga" placeholder="harga" :error="form.errors.price" v-model="form.price" />
|
|
41
|
|
- </CCol>
|
|
|
38
|
+ <AppLayout>
|
|
|
39
|
+ <div class="grid">
|
|
|
40
|
+ <div class="col-12 lg:col-8">
|
|
|
41
|
+ <Card>
|
|
|
42
|
+ <template #content>
|
|
|
43
|
+ <div class="grid">
|
|
|
44
|
+ <div class="col-12 md:col-6">
|
|
|
45
|
+ <AppInputText label="Nama" placeholder="nama" :error="form.errors.name" v-model="form.name" />
|
|
|
46
|
+ </div>
|
|
42
|
47
|
|
|
43
|
|
- <CCol md="6" class="mb-4">
|
|
44
|
|
- <AppTextInput label="Satuan" placeholder="unit" :error="form.errors.unit" v-model="form.unit" />
|
|
45
|
|
- </CCol>
|
|
46
|
|
- </CRow>
|
|
|
48
|
+ <div class="col-12 md:col-6">
|
|
|
49
|
+ <AppInputText label="Harga" placeholder="harga" :error="form.errors.price" v-model="form.price" />
|
|
|
50
|
+ </div>
|
|
47
|
51
|
|
|
48
|
|
- <CCardFooter class="d-flex justify-content-between">
|
|
49
|
|
- <AppButtonAction @click="toggleModalAlert">Hapus tipe Laundry</AppButtonAction>
|
|
|
52
|
+ <div class="col-12 md:col-6">
|
|
|
53
|
+ <AppInputText label="Satuan" placeholder="satuan" :error="form.errors.unit" v-model="form.unit" />
|
|
|
54
|
+ </div>
|
|
|
55
|
+ </div>
|
|
|
56
|
+ </template>
|
|
50
|
57
|
|
|
51
|
|
- <AppModalAlert>
|
|
52
|
|
- Anda yakin ingin mengahapus tipe laundry ini?
|
|
|
58
|
+ <template #footer>
|
|
|
59
|
+ <div
|
|
|
60
|
+ class="flex flex-column sm:flex-row align-items-center sm:justify-content-center sm:justify-content-between"
|
|
|
61
|
+ >
|
|
|
62
|
+ <AppDialog
|
|
|
63
|
+ message="Yakin akan menghapus data ini?"
|
|
|
64
|
+ v-model:visible="visibleDialog"
|
|
|
65
|
+ @agree="onAgree(laundry.id)"
|
|
|
66
|
+ @cancel="onCancel"
|
|
|
67
|
+ />
|
|
53
|
68
|
|
|
54
|
|
- <template #footer>
|
|
55
|
|
- <AppButtonDelete :href="route('laundries.destroy', laundry.id)">Hapus tipe Laundry</AppButtonDelete>
|
|
56
|
|
- </template>
|
|
57
|
|
- </AppModalAlert>
|
|
|
69
|
+ <Button label="Hapus" icon="pi pi-trash" class="p-button-text p-button-danger" @click="confirmDialog" />
|
|
58
|
70
|
|
|
59
|
|
- <AppButtonCreate :disabled="form.processing">Ubah tipe Laundry</AppButtonCreate>
|
|
60
|
|
- </CCardFooter>
|
|
61
|
|
- </CForm>
|
|
62
|
|
- </CCard>
|
|
63
|
|
- </CCol>
|
|
64
|
|
- </CRow>
|
|
65
|
|
- </DefaultLayout>
|
|
|
71
|
+ <AppButton @click="submit" label="Simpan" icon="pi pi-check" />
|
|
|
72
|
+ </div>
|
|
|
73
|
+ </template>
|
|
|
74
|
+ </Card>
|
|
|
75
|
+ </div>
|
|
|
76
|
+ </div>
|
|
|
77
|
+ </AppLayout>
|
|
66
|
78
|
</template>
|