1 Commits

Author SHA1 Message Date
c7620c11b4 Update dependency livewire/livewire to v4
Some checks failed
renovate/artifacts Artifact file update failure
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 9s
Laravel Larastan / larastan (pull_request) Failing after 1m54s
Laravel Pint / pint (pull_request) Failing after 1m57s
2026-01-18 00:01:02 +00:00
3 changed files with 20 additions and 44 deletions

View File

@@ -197,7 +197,6 @@ class ItemResource extends Resource
->searchable(), ->searchable(),
Tables\Columns\TextColumn::make('category') Tables\Columns\TextColumn::make('category')
->label('Category') ->label('Category')
->default('-')
->alignCenter() ->alignCenter()
->sortable() ->sortable()
->searchable(), ->searchable(),
@@ -218,7 +217,6 @@ class ItemResource extends Resource
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('uom') Tables\Columns\TextColumn::make('uom')
->label('Unit of Measure') ->label('Unit of Measure')
->default('-')
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('created_at') Tables\Columns\TextColumn::make('created_at')
@@ -239,7 +237,6 @@ class ItemResource extends Resource
->sortable() ->sortable()
->toggleable(isToggledHiddenByDefault: true), ->toggleable(isToggledHiddenByDefault: true),
]) ])
->searchPlaceholder('Search Item Code')
->filters([ ->filters([
Tables\Filters\TrashedFilter::make(), Tables\Filters\TrashedFilter::make(),
Filter::make('advanced_filters') Filter::make('advanced_filters')
@@ -259,7 +256,7 @@ class ItemResource extends Resource
$set('operator_id', null); $set('operator_id', null);
}), }),
Select::make('code') Select::make('code')
->label('Search by Code') ->label('Search by Item Code')
->nullable() ->nullable()
// ->options(function (callable $get) { // ->options(function (callable $get) {
// $plantId = $get('Plant'); // $plantId = $get('Plant');

View File

@@ -30,7 +30,6 @@ use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Validation\Rule;
// use Illuminate\Validation\Rule; // use Illuminate\Validation\Rule;
@@ -94,33 +93,21 @@ class StickerMasterResource extends Resource
Forms\Components\Select::make('item_id') Forms\Components\Select::make('item_id')
->label('Item Code') ->label('Item Code')
->options(function (callable $get) { ->options(function (callable $get) {
$plantId = $get('plant_id');
if (! $get('plant_id')) { if (! $get('plant_id')) {
return []; return [];
} }
if (! $get('id')) { return \App\Models\Item::where('plant_id', $get('plant_id'))
// whereHas ->pluck('code', 'id')
return Item::where('plant_id', $plantId)->whereDoesntHave('stickerMasters')->pluck('code', 'id'); ->toArray();
} else {
$itemId = StickerMaster::where('id', $get('id'))->first()?->item_id;
return Item::where('plant_id', $plantId)
->where(function ($query) use ($itemId) {
$query->whereDoesntHave('stickerMasters')
->orWhere('id', $itemId);
})
->pluck('code', 'id');
}
// return Item::where('plant_id', $plantId)->pluck('code', 'id')->toArray();
})
->rule(function (callable $get) {
return Rule::unique('sticker_masters', 'item_id')
->where('plant_id', $get('plant_id'))
->ignore($get('id')); // Ignore current record during updates
}) })
// ->rule(function (callable $get) {
// return Rule::unique('items', 'code')
// ->where('plant_id', $get('plant_id'))
// ->ignore($get('id')); // Ignore current record during updates
// })
->required() ->required()
// ->nullable() ->nullable()
->searchable() ->searchable()
->reactive() ->reactive()
// ->disabled(fn (Get $get) => !empty($get('id'))) // ->disabled(fn (Get $get) => !empty($get('id')))
@@ -145,7 +132,7 @@ class StickerMasterResource extends Resource
return; return;
} }
$availableItems = Item::where('plant_id', $plantId)->exists(); $availableItems = \App\Models\Item::where('plant_id', $plantId)->exists();
if (! $availableItems) { if (! $availableItems) {
$set('item_error', null); $set('item_error', null);
@@ -160,7 +147,7 @@ class StickerMasterResource extends Resource
} }
// Check if item exists for the selected plant // Check if item exists for the selected plant
$item = Item::where('plant_id', $plantId) $item = \App\Models\Item::where('plant_id', $plantId)
->where('id', $itemId) ->where('id', $itemId)
->first(); ->first();
@@ -174,8 +161,7 @@ class StickerMasterResource extends Resource
->where('item_id', $itemId) ->where('item_id', $itemId)
->exists(); ->exists();
if (! $get('id')) { if (! $get('id')) {
// $set('item_error', $duplicateSticker ? 'Item Code already exists for the selected plant.' : null); $set('item_error', $duplicateSticker ? 'Item Code already exists for the selected plant.' : null);
$set('item_error', null);
} }
}) })
->extraAttributes(fn ($get) => [ ->extraAttributes(fn ($get) => [
@@ -191,7 +177,7 @@ class StickerMasterResource extends Resource
if ($get('id')) { if ($get('id')) {
$itemId = StickerMaster::where('id', $get('id'))->first()?->item_id; $itemId = StickerMaster::where('id', $get('id'))->first()?->item_id;
if ($itemId) { if ($itemId) {
$item = Item::where('id', $itemId)->first()?->description; $item = \App\Models\Item::where('id', $itemId)->first()?->description;
if ($item) { if ($item) {
$set('item_description', $item); $set('item_description', $item);
} else { } else {
@@ -539,35 +525,27 @@ class StickerMasterResource extends Resource
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('part_validation1') Tables\Columns\TextColumn::make('part_validation1')
->label('Part Validation 1') ->label('Part Validation 1')
->default('-')
->alignCenter(), ->alignCenter(),
Tables\Columns\TextColumn::make('part_validation2') Tables\Columns\TextColumn::make('part_validation2')
->label('Part Validation 2') ->label('Part Validation 2')
->default('-')
->alignCenter(), ->alignCenter(),
Tables\Columns\TextColumn::make('part_validation3') Tables\Columns\TextColumn::make('part_validation3')
->label('Part Validation 3') ->label('Part Validation 3')
->default('-')
->alignCenter(), ->alignCenter(),
Tables\Columns\TextColumn::make('part_validation4') Tables\Columns\TextColumn::make('part_validation4')
->label('Part Validation 4') ->label('Part Validation 4')
->default('-')
->alignCenter(), ->alignCenter(),
Tables\Columns\TextColumn::make('part_validation5') Tables\Columns\TextColumn::make('part_validation5')
->label('Part Validation 5') ->label('Part Validation 5')
->default('-')
->alignCenter(), ->alignCenter(),
Tables\Columns\TextColumn::make('laser_part_validation1') Tables\Columns\TextColumn::make('laser_part_validation1')
->label('Laser Part Validation 1') ->label('Laser Part Validation 1')
->default('-')
->alignCenter(), ->alignCenter(),
Tables\Columns\TextColumn::make('laser_part_validation2') Tables\Columns\TextColumn::make('laser_part_validation2')
->label('Laser Part Validation 2') ->label('Laser Part Validation 2')
->default('-')
->alignCenter(), ->alignCenter(),
Tables\Columns\TextColumn::make('panel_box_code') Tables\Columns\TextColumn::make('panel_box_code')
->label('Panel Box Code') ->label('Panel Box Code')
->default('-')
->alignCenter(), ->alignCenter(),
Tables\Columns\TextColumn::make('load_rate') Tables\Columns\TextColumn::make('load_rate')
->label('Load Rate') ->label('Load Rate')
@@ -575,7 +553,6 @@ class StickerMasterResource extends Resource
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('bundle_quantity') Tables\Columns\TextColumn::make('bundle_quantity')
->label('Bundle Quantity') ->label('Bundle Quantity')
->default('-')
->alignCenter(), ->alignCenter(),
Tables\Columns\TextColumn::make('material_type') Tables\Columns\TextColumn::make('material_type')
->label('Material Type') ->label('Material Type')
@@ -610,7 +587,9 @@ class StickerMasterResource extends Resource
->sortable() ->sortable()
->toggleable(isToggledHiddenByDefault: true), ->toggleable(isToggledHiddenByDefault: true),
]) ])
->searchPlaceholder('Search Item Code') // ->filters([
// Tables\Filters\TrashedFilter::make(),
// ])
->filters([ ->filters([
Tables\Filters\TrashedFilter::make(), Tables\Filters\TrashedFilter::make(),
Filter::make('advanced_filters') Filter::make('advanced_filters')
@@ -656,7 +635,7 @@ class StickerMasterResource extends Resource
->searchable() ->searchable()
->reactive(), ->reactive(),
Select::make('material_type') Select::make('material_type')
->label('Select Material Type') ->label('Material Type')
->options([ ->options([
1 => 'Individual', 1 => 'Individual',
2 => 'Bundle', 2 => 'Bundle',
@@ -665,7 +644,7 @@ class StickerMasterResource extends Resource
->reactive(), ->reactive(),
TextInput::make('panel_box_code') TextInput::make('panel_box_code')
->label('Search by Panel Box Code') ->label('Panel Box Code')
->placeholder(placeholder: 'Enter Panel Box Code'), ->placeholder(placeholder: 'Enter Panel Box Code'),
DateTimePicker::make(name: 'created_from') DateTimePicker::make(name: 'created_from')
->label('Created From') ->label('Created From')

View File

@@ -17,7 +17,7 @@
"laravel/sanctum": "^4.0", "laravel/sanctum": "^4.0",
"laravel/tinker": "^2.9", "laravel/tinker": "^2.9",
"league/flysystem-sftp-v3": "^3.30", "league/flysystem-sftp-v3": "^3.30",
"livewire/livewire": "^3.6", "livewire/livewire": "^4.0",
"maatwebsite/excel": "^3.1", "maatwebsite/excel": "^3.1",
"mike42/escpos-php": "^4.0", "mike42/escpos-php": "^4.0",
"mpdf/mpdf": "^8.2", "mpdf/mpdf": "^8.2",