parfum/app/Livewire/Studio/Stock/StockTransfer/Index.php
Yoga Pangestu 293dd7d1fd refactor: restructure stock management components and update routes
- 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.
2026-01-09 21:57:06 +07:00

50 lines
1.5 KiB
PHP

<?php
namespace App\Livewire\Studio\Stock\StockTransfer;
use App\Models\StockTransfer;
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\StockTransfer\WithStockTransferStock;
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('Transfer Stok')]
class Index extends Component
{
use WithAuthorization, WithCloseModal, WithConfirmation, WithRequestNotification, WithStockTransferStock, WithSubscribeNotification, WithToast;
public function delete(StockTransfer $stockTransfer): void
{
$this->canOrAbort('delete stock transfer');
DB::transaction(function () use ($stockTransfer) {
foreach ($stockTransfer->items as $item) {
$this->reverseStockTransferBetweenOutlets($stockTransfer->sourceOutlet, $stockTransfer->destinationOutlet, $item);
}
$stockTransfer->delete();
});
$this->dispatch('refreshDatatable');
$this->toast('Transfer stok berhasil dihapus.');
Flux::modals()->close();
}
public function render(): View
{
return view('livewire.studio.stock.stock-transfer.index', [
'pageTitle' => 'Transfer Stok Antar Outlet',
]);
}
}