added bundle quantity and material type columns and import and export functionality
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\StickerMasterExporter;
|
||||
use App\Filament\Imports\ShiftImporter;
|
||||
use App\Filament\Imports\StickerMasterImporter;
|
||||
use App\Filament\Resources\StickerMasterResource\Pages;
|
||||
@@ -15,6 +16,7 @@ use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
|
||||
class StickerMasterResource extends Resource
|
||||
@@ -35,6 +37,9 @@ class StickerMasterResource extends Resource
|
||||
->relationship('plant', 'name')
|
||||
->reactive()
|
||||
->nullable()
|
||||
->default(function () {
|
||||
return optional(StickerMaster::latest()->first())->plant_id;
|
||||
})
|
||||
->disabled(fn (Get $get) => !empty($get('id'))) //disable in edit if user try to change
|
||||
->afterStateUpdated(fn (callable $set) =>
|
||||
$set('item_id', null) & //when plant changed remove all the data which is in text input box
|
||||
@@ -160,6 +165,20 @@ class StickerMasterResource extends Resource
|
||||
Forms\Components\TextInput::make('load_rate')
|
||||
->label('Load Rate')
|
||||
->default(0)
|
||||
->integer()
|
||||
->nullable(),
|
||||
|
||||
|
||||
Forms\Components\Select::make('material_type')
|
||||
->label('Material Type')
|
||||
->options([
|
||||
'individual' => '1',
|
||||
'bundle' => '2',
|
||||
]),
|
||||
|
||||
Forms\Components\TextInput::make('bundle_quantity')
|
||||
->label('Bundle Quantity')
|
||||
->integer()
|
||||
->nullable(),
|
||||
|
||||
|
||||
@@ -284,6 +303,15 @@ class StickerMasterResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('part_validation5')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('panel_box_code')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('load_rate')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('bundle_quantity')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('material_type')
|
||||
->label('Material Type')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
@@ -314,6 +342,8 @@ class StickerMasterResource extends Resource
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(StickerMasterImporter::class),
|
||||
ExportAction::make()
|
||||
->exporter(StickerMasterExporter::class),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user