|
|
@@ -1,9 +1,12 @@
|
|
1
|
1
|
<script setup>
|
|
2
|
2
|
import { useDialog } from 'primevue/usedialog'
|
|
3
|
3
|
import { optionStatus, dialogStyle } from './config'
|
|
4
|
|
-import SupplierCreate from './Components/Dialog/SupplierCreate.vue'
|
|
5
|
|
-import ProductCreate from './Components/Dialog/ProductCreate.vue'
|
|
|
4
|
+import { cartTable } from './config'
|
|
|
5
|
+import SupplierCreate from './Components/SupplierCreate.vue'
|
|
|
6
|
+import ProductCreate from './Components/ProductCreate.vue'
|
|
6
|
7
|
import Details from './Components/Details.vue'
|
|
|
8
|
+import Cart from './Components/Cart.vue'
|
|
|
9
|
+import { useProductCart } from './Composables/useProductCart'
|
|
7
|
10
|
import { useForm } from '@/composables/useForm'
|
|
8
|
11
|
import AppInputText from '@/components/AppInputText.vue'
|
|
9
|
12
|
import AppInputNumber from '@/components/AppInputNumber.vue'
|
|
|
@@ -13,7 +16,7 @@ import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
|
|
13
|
16
|
|
|
14
|
17
|
const props = defineProps({
|
|
15
|
18
|
number: String,
|
|
16
|
|
- ppn: String,
|
|
|
19
|
+ ppn: Number,
|
|
17
|
20
|
suppliers: {
|
|
18
|
21
|
type: Array,
|
|
19
|
22
|
default: [],
|
|
|
@@ -48,9 +51,12 @@ const onSubmit = () => {
|
|
48
|
51
|
})
|
|
49
|
52
|
}
|
|
50
|
53
|
|
|
|
54
|
+const { cartProduct, onAddProduct, onDeleteProduct, onClearProduct } =
|
|
|
55
|
+ useProductCart(form)
|
|
|
56
|
+
|
|
51
|
57
|
const dialog = useDialog()
|
|
52
|
58
|
|
|
53
|
|
-const showCreateSupplier = () => {
|
|
|
59
|
+const onShowCreateSupplier = () => {
|
|
54
|
60
|
dialog.open(SupplierCreate, {
|
|
55
|
61
|
props: {
|
|
56
|
62
|
header: 'Tambah Supplier',
|
|
|
@@ -59,7 +65,7 @@ const showCreateSupplier = () => {
|
|
59
|
65
|
})
|
|
60
|
66
|
}
|
|
61
|
67
|
|
|
62
|
|
-const showCreateProduct = () => {
|
|
|
68
|
+const onShowCreateProduct = () => {
|
|
63
|
69
|
dialog.open(ProductCreate, {
|
|
64
|
70
|
props: {
|
|
65
|
71
|
header: 'Tambah Produk',
|
|
|
@@ -67,14 +73,6 @@ const showCreateProduct = () => {
|
|
67
|
73
|
},
|
|
68
|
74
|
})
|
|
69
|
75
|
}
|
|
70
|
|
-
|
|
71
|
|
-const checkBtnSubmit = () => {
|
|
72
|
|
- if (form.price && form.qty && form.supplier && form.product) {
|
|
73
|
|
- return false
|
|
74
|
|
- } else {
|
|
75
|
|
- return true
|
|
76
|
|
- }
|
|
77
|
|
-}
|
|
78
|
76
|
</script>
|
|
79
|
77
|
|
|
80
|
78
|
<template>
|
|
|
@@ -82,9 +80,9 @@ const checkBtnSubmit = () => {
|
|
82
|
80
|
<DynamicDialog />
|
|
83
|
81
|
|
|
84
|
82
|
<div class="grid">
|
|
85
|
|
- <div class="col-12 lg:col-8">
|
|
|
83
|
+ <div class="col-12 md:col-8 flex-order-1 md:flex-order-0">
|
|
86
|
84
|
<Card>
|
|
87
|
|
- <template #title> Tambah Pembelian </template>
|
|
|
85
|
+ <template #title> Pembeli </template>
|
|
88
|
86
|
<template #content>
|
|
89
|
87
|
<div class="grid">
|
|
90
|
88
|
<div class="col-12 md:col-6">
|
|
|
@@ -130,14 +128,36 @@ const checkBtnSubmit = () => {
|
|
130
|
128
|
<span
|
|
131
|
129
|
class="cursor-pointer"
|
|
132
|
130
|
style="color: var(--primary-color)"
|
|
133
|
|
- @click="showCreateSupplier"
|
|
|
131
|
+ @click="onShowCreateSupplier"
|
|
134
|
132
|
>
|
|
135
|
133
|
Tambah Supplier
|
|
136
|
134
|
</span>
|
|
137
|
135
|
</template>
|
|
138
|
136
|
</AppAutoComplete>
|
|
139
|
137
|
</div>
|
|
|
138
|
+ </div>
|
|
|
139
|
+ </template>
|
|
|
140
|
+ </Card>
|
|
|
141
|
+ </div>
|
|
|
142
|
+
|
|
|
143
|
+ <div class="col-12 md:col-4 flex-order-4 md:flex-order-0">
|
|
|
144
|
+ <Details
|
|
|
145
|
+ title="Detail Pembelian"
|
|
|
146
|
+ :number="number"
|
|
|
147
|
+ :ppn="ppn"
|
|
|
148
|
+ :status="form.status"
|
|
|
149
|
+ :person="form.supplier"
|
|
|
150
|
+ :product="form.product"
|
|
|
151
|
+ :disabled="form.processing"
|
|
|
152
|
+ @click="onSubmit"
|
|
|
153
|
+ />
|
|
|
154
|
+ </div>
|
|
140
|
155
|
|
|
|
156
|
+ <div class="col-12 md:col-8 flex-order-2 md:flex-order-0">
|
|
|
157
|
+ <Card>
|
|
|
158
|
+ <template #title>Produk</template>
|
|
|
159
|
+ <template #content>
|
|
|
160
|
+ <div class="grid">
|
|
141
|
161
|
<div class="col-12 md:col-6">
|
|
142
|
162
|
<AppAutoComplete
|
|
143
|
163
|
label="Produk"
|
|
|
@@ -161,7 +181,7 @@ const checkBtnSubmit = () => {
|
|
161
|
181
|
<span
|
|
162
|
182
|
class="cursor-pointer"
|
|
163
|
183
|
style="color: var(--primary-color)"
|
|
164
|
|
- @click="showCreateProduct"
|
|
|
184
|
+ @click="onShowCreateProduct"
|
|
165
|
185
|
>
|
|
166
|
186
|
Tambah Produk
|
|
167
|
187
|
</span>
|
|
|
@@ -189,31 +209,27 @@ const checkBtnSubmit = () => {
|
|
189
|
209
|
</div>
|
|
190
|
210
|
</div>
|
|
191
|
211
|
</template>
|
|
192
|
|
-
|
|
193
|
212
|
<template #footer>
|
|
194
|
213
|
<div class="flex flex-column md:flex-row justify-content-end">
|
|
195
|
214
|
<Button
|
|
196
|
|
- label="Simpan"
|
|
|
215
|
+ label="Tambah Produk"
|
|
197
|
216
|
icon="pi pi-check"
|
|
198
|
217
|
class="p-button-outlined"
|
|
199
|
|
- :disabled="form.processing || checkBtnSubmit()"
|
|
200
|
|
- @click="onSubmit"
|
|
|
218
|
+ :disabled="form.processing"
|
|
|
219
|
+ @click="onAddProduct"
|
|
201
|
220
|
/>
|
|
202
|
221
|
</div>
|
|
203
|
222
|
</template>
|
|
204
|
223
|
</Card>
|
|
205
|
224
|
</div>
|
|
206
|
225
|
|
|
207
|
|
- <div class="col-12 lg:col-4">
|
|
208
|
|
- <Details
|
|
209
|
|
- title="Detail Pembelian"
|
|
210
|
|
- :number="number"
|
|
211
|
|
- :price="form.price"
|
|
212
|
|
- :qty="form.qty"
|
|
213
|
|
- :ppn="ppn"
|
|
214
|
|
- :status="form.status"
|
|
215
|
|
- :person="form.supplier"
|
|
216
|
|
- :product="form.product"
|
|
|
226
|
+ <div class="col-12 md:col-8 flex-order-3 md:flex-order-0">
|
|
|
227
|
+ <Cart
|
|
|
228
|
+ title="Keranjang Produk"
|
|
|
229
|
+ :header-table="cartTable"
|
|
|
230
|
+ :form="form"
|
|
|
231
|
+ :value="cartProduct"
|
|
|
232
|
+ @delete="onDeleteProduct"
|
|
217
|
233
|
/>
|
|
218
|
234
|
</div>
|
|
219
|
235
|
</div>
|