HistoryProduct.vue 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <script setup>
  2. import { watch } from 'vue'
  3. import { Inertia } from '@inertiajs/inertia'
  4. import { usePage } from '@inertiajs/inertia-vue3'
  5. import AppInputNumber from '@/components/AppInputNumber.vue'
  6. import AppInputText from '@/components/AppInputText.vue'
  7. const props = defineProps(['product', 'supplier'])
  8. watch(
  9. () => props.product,
  10. () => {
  11. if (props.product?.number && props.supplier?.id) {
  12. Inertia.reload({
  13. data: {
  14. productNumber: props.product.number,
  15. supplierId: props.supplier.id,
  16. },
  17. only: ['historyProductPurchase'],
  18. })
  19. }
  20. usePage().props.value.historyProductPurchase = {}
  21. }
  22. )
  23. </script>
  24. <template>
  25. <template v-if="$page.props.historyProductPurchase?.id">
  26. <div class="col-12">
  27. <h3 class="text-lg">Riwayat Produk Sebelumnya</h3>
  28. </div>
  29. <div class="col-12 md:col-6">
  30. <AppInputNumber
  31. disabled
  32. class="mb-0"
  33. label="Harga "
  34. placeholder="harga"
  35. v-model="$page.props.historyProductPurchase.price"
  36. />
  37. <span v-if="$page.props.historyProductPurchase.ppn" class="text-xs">
  38. Harga sudah termasuk PPN {{ $page.props.ppn }} %
  39. </span>
  40. </div>
  41. <div class="col-12 md:col-6">
  42. <AppInputText
  43. disabled
  44. label="Kuantitas"
  45. placeholder="kuantitas"
  46. type="number"
  47. v-model="$page.props.historyProductPurchase.qty"
  48. />
  49. </div>
  50. </template>
  51. </template>