- Removed legacy stock management components including PurchaseForm, RestockForm, StockOpnameForm, and StockTransferForm. - Updated routes to reflect new structure under 'studio.stock' namespace for better organization. - Adjusted view files for stock management to align with the new routing and component structure. - Modified action routes in the ViewServiceProvider to ensure proper access control and navigation. - Cleaned up related test files to remove references to deleted components.
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Studio\Stock\Restock;
|
|
|
|
use App\Models\Restock;
|
|
use App\Traits\Authorization\WithAuthorization;
|
|
use App\Traits\Components\WithCloseModal;
|
|
use App\Traits\Components\WithConfirmation;
|
|
use App\Traits\Components\WithToast;
|
|
use App\Traits\Notification\WithSubscribeNotification;
|
|
use App\Traits\Restock\WithRestockStock;
|
|
use App\Traits\Utilities\WithRequestNotification;
|
|
use Flux\Flux;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Livewire\Attributes\Title;
|
|
use Livewire\Component;
|
|
|
|
#[Title('Restock Toko')]
|
|
class Index extends Component
|
|
{
|
|
use WithAuthorization, WithCloseModal, WithConfirmation, WithRequestNotification, WithRestockStock, WithSubscribeNotification, WithToast;
|
|
|
|
public function delete(Restock $restock): void
|
|
{
|
|
$this->canOrAbort('delete restock');
|
|
|
|
DB::transaction(function () use ($restock) {
|
|
foreach ($restock->items as $item) {
|
|
$this->reverseStockTransfer($restock->warehouse, $restock->outlet, $item);
|
|
}
|
|
|
|
$restock->delete();
|
|
});
|
|
|
|
$this->dispatch('refreshDatatable');
|
|
|
|
$this->toast('Restock berhasil dihapus.');
|
|
|
|
Flux::modals()->close();
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.studio.stock.restock.index', [
|
|
'pageTitle' => 'Restock Toko',
|
|
]);
|
|
}
|
|
}
|