diff --git a/app/Livewire/Forms/Studio/Stock/StockOpnameForm.php b/app/Livewire/Forms/Studio/Stock/StockOpnameForm.php index 7ef3c12..1d63a31 100644 --- a/app/Livewire/Forms/Studio/Stock/StockOpnameForm.php +++ b/app/Livewire/Forms/Studio/Stock/StockOpnameForm.php @@ -54,7 +54,11 @@ public function update(): void continue; } - $item->qty_physical = (int) str_replace('.', '', (string) ($qtyPhysical ?? 0)); + // Bersihkan nilai: hapus separator ribuan (titik), trim whitespace + $normalizedQty = trim(str_replace('.', '', (string) ($qtyPhysical ?? ''))); + + // Simpan null jika input kosong/tidak diisi, integer jika ada nilai + $item->qty_physical = $normalizedQty !== '' ? (int) $normalizedQty : null; $item->save(); } diff --git a/app/Livewire/Studio/Stock/StockOpname/Index.php b/app/Livewire/Studio/Stock/StockOpname/Index.php index 04c2c68..40e84b5 100644 --- a/app/Livewire/Studio/Stock/StockOpname/Index.php +++ b/app/Livewire/Studio/Stock/StockOpname/Index.php @@ -110,7 +110,7 @@ public function render(): View ->whereNotNull('qty_physical') ->count(); - $percent = $total > 0 ? round(($filled / $total) * 100) : 0; + $percent = $total > 0 ? floor(($filled / $total) * 100) : 0; $stockOpname->total_item = $total; $stockOpname->progress_filled = $filled; diff --git a/app/Livewire/Studio/Stock/StockOpname/Manage.php b/app/Livewire/Studio/Stock/StockOpname/Manage.php index ce059be..2a9c407 100644 --- a/app/Livewire/Studio/Stock/StockOpname/Manage.php +++ b/app/Livewire/Studio/Stock/StockOpname/Manage.php @@ -53,6 +53,14 @@ public function save(): void ], navigate: true); } + public function fillAllWithZero(): void + { + $this->form->outlet_stock = array_map( + fn ($qty) => $qty === null || $qty === '' ? 0 : $qty, + $this->form->outlet_stock + ); + } + public function render(): View { $items = StockOpnameItem::with('itemable') diff --git a/resources/views/livewire/studio/stock/stock-opname/index.blade.php b/resources/views/livewire/studio/stock/stock-opname/index.blade.php index 551bf46..65e6693 100644 --- a/resources/views/livewire/studio/stock/stock-opname/index.blade.php +++ b/resources/views/livewire/studio/stock/stock-opname/index.blade.php @@ -69,16 +69,13 @@ @if ($item->progress_percent == 100) - + @@ -87,15 +84,12 @@ @endif @if ($item->status === \App\Enums\StockOpnameStatus::PENDING_APPROVAL && auth()->user()->can('approve stock opname')) - + @@ -110,11 +104,21 @@ @include('components.modals.confirmation', [ - 'modalName' => 'delete-confirmation', + 'modalName' => 'request-confirmation', 'modalTitle' => 'Apakah Anda yakin?', - 'modalMessage' => 'Data yang berelasi dengan data ini juga akan ikut terhapus.', + 'modalMessage' => 'Pastikan proses stock opname sudah tepat dan sesuai.', 'buttonVariant' => 'primary', 'buttonColor' => 'danger', - 'buttonText' => 'Ya, Hapus', + 'buttonText' => 'Ya, Ajukan', + ]) + + @include('components.modals.confirmation', [ + 'modalName' => 'approve-confirmation', + 'modalTitle' => 'Apakah Anda yakin?', + 'modalMessage' => + 'Proses ini akan menyesuaikan kembali stok barang dengan hasil inputan dan proes tidak dapat dibatalkan, silakan periksa kembali dengan benar.', + 'buttonVariant' => 'primary', + 'buttonColor' => 'danger', + 'buttonText' => 'Ya, Setujui', ]) diff --git a/resources/views/livewire/studio/stock/stock-opname/manage.blade.php b/resources/views/livewire/studio/stock/stock-opname/manage.blade.php index f12dad0..0b99a7c 100644 --- a/resources/views/livewire/studio/stock/stock-opname/manage.blade.php +++ b/resources/views/livewire/studio/stock/stock-opname/manage.blade.php @@ -33,8 +33,8 @@ {{ $item->qty_system }} - + {{ $item->difference }} @@ -50,7 +50,10 @@ autocomplete="off" rows="2" /> -
+
+ + Isi Kosong dengan 0 + Simpan