|
|
@@ -1,17 +1,19 @@
|
|
1
|
1
|
<script setup>
|
|
|
2
|
+import { computed } from 'vue'
|
|
2
|
3
|
import { optionStatus } from './config'
|
|
3
|
4
|
import { cartTable } from './config'
|
|
4
|
5
|
import Details from './Components/Details.vue'
|
|
5
|
6
|
import Cart from './Components/Cart.vue'
|
|
6
|
|
-import HistoryProduct from './Components/HistoryProduct.vue'
|
|
7
|
7
|
import { useProductCart } from './Composables/useProductCart'
|
|
8
|
|
-import { onShowDialog } from './Composables/onShowDialog'
|
|
|
8
|
+import { useDialog } from './Composables/useDialog'
|
|
9
|
9
|
import { useForm } from '@/composables/useForm'
|
|
|
10
|
+import HistoryProduct from './Components/HistoryProduct.vue'
|
|
10
|
11
|
import AppInputText from '@/components/AppInputText.vue'
|
|
11
|
12
|
import AppInputNumber from '@/components/AppInputNumber.vue'
|
|
12
|
13
|
import AppDropdown from '@/components/AppDropdown.vue'
|
|
13
|
14
|
import AppAutoComplete from '@/components/AppAutoComplete.vue'
|
|
14
|
15
|
import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
|
|
|
16
|
+import { provide } from 'vue'
|
|
15
|
17
|
|
|
16
|
18
|
const props = defineProps({
|
|
17
|
19
|
id: Number,
|
|
|
@@ -25,7 +27,7 @@ const props = defineProps({
|
|
25
|
27
|
default: [],
|
|
26
|
28
|
},
|
|
27
|
29
|
purchaseDetail: Array,
|
|
28
|
|
- historyProductPurchase: Object,
|
|
|
30
|
+ productPurchase: Object,
|
|
29
|
31
|
})
|
|
30
|
32
|
|
|
31
|
33
|
const form = useForm({
|
|
|
@@ -50,6 +52,10 @@ const onSubmit = () => {
|
|
50
|
52
|
})
|
|
51
|
53
|
}
|
|
52
|
54
|
|
|
|
55
|
+provide('form', form)
|
|
|
56
|
+
|
|
|
57
|
+const productUnit = computed(() => form.product?.unit)
|
|
|
58
|
+
|
|
53
|
59
|
const {
|
|
54
|
60
|
productCart,
|
|
55
|
61
|
productCartDeleted,
|
|
|
@@ -60,7 +66,7 @@ const {
|
|
60
|
66
|
totalProductPrice,
|
|
61
|
67
|
} = useProductCart(form, props.purchaseDetail)
|
|
62
|
68
|
|
|
63
|
|
-const { onShowCreateProduct } = onShowDialog()
|
|
|
69
|
+const { onShowCreateProduct } = useDialog()
|
|
64
|
70
|
</script>
|
|
65
|
71
|
|
|
66
|
72
|
<template>
|
|
|
@@ -112,7 +118,7 @@ const { onShowCreateProduct } = onShowDialog()
|
|
112
|
118
|
field="name"
|
|
113
|
119
|
refresh-data="products"
|
|
114
|
120
|
v-model="form.product"
|
|
115
|
|
- :error="form.errors.products"
|
|
|
121
|
+ :error="form.errors.product"
|
|
116
|
122
|
:suggestions="products"
|
|
117
|
123
|
>
|
|
118
|
124
|
<template #item="slotProps">
|
|
|
@@ -141,20 +147,19 @@ const { onShowCreateProduct } = onShowDialog()
|
|
141
|
147
|
disabled
|
|
142
|
148
|
label="Satuan"
|
|
143
|
149
|
placeholder="satuan"
|
|
144
|
|
- v-model="form.product.unit"
|
|
|
150
|
+ v-model="productUnit"
|
|
145
|
151
|
/>
|
|
146
|
152
|
</div>
|
|
147
|
153
|
|
|
148
|
|
- <HistoryProduct
|
|
149
|
|
- :product="form.product"
|
|
150
|
|
- :supplier="form.supplier"
|
|
151
|
|
- />
|
|
|
154
|
+ <Divider type="dashed" />
|
|
|
155
|
+
|
|
|
156
|
+ <HistoryProduct :product-purchase="productPurchase" />
|
|
152
|
157
|
|
|
153
|
158
|
<Divider type="dashed" />
|
|
154
|
159
|
|
|
155
|
160
|
<div class="col-12 md:col-6">
|
|
156
|
161
|
<AppInputNumber
|
|
157
|
|
- :disabled="!form.supplier?.id"
|
|
|
162
|
+ :disabled="!form.product?.id"
|
|
158
|
163
|
label="Harga"
|
|
159
|
164
|
placeholder="harga"
|
|
160
|
165
|
v-model="form.price"
|
|
|
@@ -163,7 +168,7 @@ const { onShowCreateProduct } = onShowDialog()
|
|
163
|
168
|
|
|
164
|
169
|
<div class="col-12 md:col-6">
|
|
165
|
170
|
<AppInputText
|
|
166
|
|
- :disabled="!form.supplier?.id"
|
|
|
171
|
+ :disabled="!form.product?.id"
|
|
167
|
172
|
label="Kuantitas"
|
|
168
|
173
|
placeholder="kuantitas"
|
|
169
|
174
|
type="number"
|