1. Added import and export actions with labels and warning colors for the following resources:

- LineResource
  - LineStopResource
  - LocatorResource
  - MachineResource
  - MfmMeterResource
  - MfmParameterResource
  - MotorTestingMasterResource
  - PlantResource
  - ProductionLineStopResource
  - ProductionPlanResource
  - ProductionQuantityResource
  - QualityValidationResource
  - SerialValidationResource
  - ShiftResource
  - StickerMasterResource
  - UserResource
  - WorkGroupMasterResource
2. Updated camera capture functionality to ensure overlay canvas size syncs with video size.
This commit is contained in:
dhanabalan
2025-11-13 16:27:48 +05:30
parent d9e1190d92
commit 68cd0b81a2
31 changed files with 641 additions and 108 deletions

View File

@@ -2419,125 +2419,129 @@ class QualityValidationResource extends Resource
->placeholder(placeholder: 'Select To DateTime')
->reactive()
->native(false),
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['production_order']) && empty($data['serial_number']) && empty($data['sap_msg_status']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['operator_id']) && empty($data['sticker_master_id'])) {
return $query->whereRaw('1 = 0');
}
if (!empty($data['Plant'])) {
$query->where('plant_id', $data['Plant']);
}
if (!empty($data['Line'])) {
$query->where('line_id', $data['Line']);
}
if (!empty($data['production_order'])) {
$query->where('production_order', $data['production_order']);
}
if (!empty($data['serial_number'])) {
$query->where('serial_number', $data['serial_number']);
}
if (!empty($data['sap_msg_status'])) {
$query->where('sap_msg_status', $data['sap_msg_status']);
}
if (!empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
if (!empty($data['created_to'])) {
$query->where('created_at', '<=', $data['created_to']);
}
if (!empty($data['operator_id'])) {
$query->where('operator_id', $data['operator_id']);
}
if (!empty($data['sticker_master_id'])) {
$stickerMasterIds = StickerMaster::where('item_id', $data['sticker_master_id'])
->pluck('id')
->toArray();
if (!empty($stickerMasterIds)) {
$query->whereIn('sticker_master_id', $stickerMasterIds);
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['production_order']) && empty($data['serial_number']) && empty($data['sap_msg_status']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['operator_id']) && empty($data['sticker_master_id'])) {
return $query->whereRaw('1 = 0');
}
}
//$query->orderBy('created_at', 'asc');
})
->indicateUsing(function (array $data) {
$indicators = [];
if (!empty($data['Plant'])) {
$query->where('plant_id', $data['Plant']);
}
if (!empty($data['Plant'])) {
$indicators[] = 'Plant: ' . Plant::where('id', $data['Plant'])->value('name');
}
if (!empty($data['Line'])) {
$query->where('line_id', $data['Line']);
}
if (!empty($data['Line'])) {
$indicators[] = 'Line: ' . Line::where('id', $data['Line'])->value('name');
}
if (!empty($data['production_order'])) {
$query->where('production_order', $data['production_order']);
}
if (!empty($data['production_order'])) {
$indicators[] = 'Production Order: ' . $data['production_order'];
}
if (!empty($data['serial_number'])) {
$query->where('serial_number', $data['serial_number']);
}
if (!empty($data['serial_number'])) {
$indicators[] = 'Serial Number: ' . $data['serial_number'];
}
if (!empty($data['sap_msg_status'])) {
$query->where('sap_msg_status', $data['sap_msg_status']);
}
if (!empty($data['sticker_master_id'])) {
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
$indicators[] = 'Item Codes: ' . $itemCode;
}
if (!empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
if (!empty($data['sap_msg_status'])) {
$indicators[] = 'SAP Message Status: ' . $data['sap_msg_status'];
}
if (!empty($data['created_to'])) {
$query->where('created_at', '<=', $data['created_to']);
}
if (!empty($data['operator_id'])) {
$indicators[] = 'Created By: ' . $data['operator_id'];
}
if (!empty($data['operator_id'])) {
$query->where('operator_id', $data['operator_id']);
}
if (!empty($data['created_from'])) {
$indicators[] = 'From: ' . $data['created_from'];
}
if (!empty($data['sticker_master_id'])) {
$stickerMasterIds = StickerMaster::where('item_id', $data['sticker_master_id'])
->pluck('id')
->toArray();
if (!empty($data['created_to'])) {
$indicators[] = 'To: ' . $data['created_to'];
}
if (!empty($stickerMasterIds)) {
$query->whereIn('sticker_master_id', $stickerMasterIds);
}
}
return $indicators;
})
])
->filtersFormMaxHeight('280px')
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
//$query->orderBy('created_at', 'asc');
})
->indicateUsing(function (array $data) {
$indicators = [];
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
])
->headerActions([
ImportAction::make()
->importer(QualityValidationImporter::class)
->visible(function() {
return Filament::auth()->user()->can('view import quality validation');
}),
ExportAction::make()
->exporter(QualityValidationExporter::class)
->visible(function() {
return Filament::auth()->user()->can('view export quality validation');
}),
]);
if (!empty($data['Plant'])) {
$indicators[] = 'Plant: ' . Plant::where('id', $data['Plant'])->value('name');
}
if (!empty($data['Line'])) {
$indicators[] = 'Line: ' . Line::where('id', $data['Line'])->value('name');
}
if (!empty($data['production_order'])) {
$indicators[] = 'Production Order: ' . $data['production_order'];
}
if (!empty($data['serial_number'])) {
$indicators[] = 'Serial Number: ' . $data['serial_number'];
}
if (!empty($data['sticker_master_id'])) {
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
$indicators[] = 'Item Codes: ' . $itemCode;
}
if (!empty($data['sap_msg_status'])) {
$indicators[] = 'SAP Message Status: ' . $data['sap_msg_status'];
}
if (!empty($data['operator_id'])) {
$indicators[] = 'Created By: ' . $data['operator_id'];
}
if (!empty($data['created_from'])) {
$indicators[] = 'From: ' . $data['created_from'];
}
if (!empty($data['created_to'])) {
$indicators[] = 'To: ' . $data['created_to'];
}
return $indicators;
})
])
->filtersFormMaxHeight('280px')
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
])
->headerActions([
ImportAction::make()
->label('Import Quality Validations')
->color('warning')
->importer(QualityValidationImporter::class)
->visible(function() {
return Filament::auth()->user()->can('view import quality validation');
}),
ExportAction::make()
->label('Export Quality Validations')
->color('warning')
->exporter(QualityValidationExporter::class)
->visible(function() {
return Filament::auth()->user()->can('view export quality validation');
}),
]);
}