Merge pull request 'ranjith-dev' (#969) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #969
This commit was merged in pull request #969.
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Filament\Resources\PanelGrMasterResource\RelationManagers;
|
|||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use App\Models\PalletValidation;
|
use App\Models\PalletValidation;
|
||||||
use App\Models\PanelGrMaster;
|
use App\Models\PanelGrMaster;
|
||||||
|
use App\Models\PanelBoxValidation;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
@@ -26,6 +27,8 @@ use Filament\Forms\Components\Section;
|
|||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Closure;
|
use Closure;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class PanelGrMasterResource extends Resource
|
class PanelGrMasterResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -99,6 +102,9 @@ class PanelGrMasterResource extends Resource
|
|||||||
if ((float) $state == 0) {
|
if ((float) $state == 0) {
|
||||||
$set('quantity', null);
|
$set('quantity', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
$set('updated_at', now());
|
||||||
}),
|
}),
|
||||||
Forms\Components\Hidden::make('created_by')
|
Forms\Components\Hidden::make('created_by')
|
||||||
->label('Created By')
|
->label('Created By')
|
||||||
@@ -161,7 +167,16 @@ class PanelGrMasterResource extends Resource
|
|||||||
->label('Scanned Quantity')
|
->label('Scanned Quantity')
|
||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->getStateUsing(function ($record) {
|
||||||
|
return PanelBoxValidation::where('plant_id', $record->plant_id)
|
||||||
|
->where('production_order', $record->document_number)
|
||||||
|
->where('inspection_lot_number', $record->inspection_lot_number)
|
||||||
|
->whereHas('stickerMaster', function ($query) use ($record) {
|
||||||
|
$query->where('item_id', $record->item_id);
|
||||||
|
})
|
||||||
|
->count();
|
||||||
|
}),
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -371,10 +386,6 @@ class PanelGrMasterResource extends Resource
|
|||||||
return parent::getEloquentQuery()
|
return parent::getEloquentQuery()
|
||||||
->withoutGlobalScopes([
|
->withoutGlobalScopes([
|
||||||
SoftDeletingScope::class,
|
SoftDeletingScope::class,
|
||||||
])
|
|
||||||
->withCount([
|
|
||||||
'panelBoxValidations as scanned_quantity'
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,8 @@ class PanelGrMaster extends Model
|
|||||||
return $this->belongsTo(Item::class);
|
return $this->belongsTo(Item::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function panelBoxValidations()
|
public function stickerMaster()
|
||||||
{
|
{
|
||||||
return $this->hasMany(PanelBoxValidation::class, 'plant_id', 'plant_id')
|
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
|
||||||
->whereColumn('production_order', 'panel_gr_masters.document_number')
|
|
||||||
->whereColumn('inspection_lot_number', 'panel_gr_masters.inspection_lot_number');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user