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:
@@ -164,11 +164,15 @@ class BlockResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Blocks')
|
||||||
|
->color('warning')
|
||||||
->importer(BlockImporter::class)
|
->importer(BlockImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import block');
|
return Filament::auth()->user()->can('view import block');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Blocks')
|
||||||
|
->color('warning')
|
||||||
->exporter(BlockExporter::class)
|
->exporter(BlockExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export block');
|
return Filament::auth()->user()->can('view export block');
|
||||||
|
|||||||
@@ -153,11 +153,15 @@ class CheckPointNameResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Check Point Names')
|
||||||
|
->color('warning')
|
||||||
->importer(CheckPointNameImporter::class)
|
->importer(CheckPointNameImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import check point name');
|
return Filament::auth()->user()->can('view import check point name');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Check Point Names')
|
||||||
|
->color('warning')
|
||||||
->exporter(CheckPointNameExporter::class)
|
->exporter(CheckPointNameExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export check point name');
|
return Filament::auth()->user()->can('view export check point name');
|
||||||
|
|||||||
@@ -384,11 +384,15 @@ class CheckPointTimeResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Check Point Times')
|
||||||
|
->color('warning')
|
||||||
->importer(CheckPointTimeImporter::class)
|
->importer(CheckPointTimeImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import check point time');
|
return Filament::auth()->user()->can('view import check point time');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Check Point Times')
|
||||||
|
->color('warning')
|
||||||
->exporter(CheckPointTimeExporter::class)
|
->exporter(CheckPointTimeExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export check point time');
|
return Filament::auth()->user()->can('view export check point time');
|
||||||
|
|||||||
@@ -121,11 +121,15 @@ class CompanyResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Companies')
|
||||||
|
->color('warning')
|
||||||
->importer(CompanyImporter::class)
|
->importer(CompanyImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import company');
|
return Filament::auth()->user()->can('view import company');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Companies')
|
||||||
|
->color('warning')
|
||||||
->exporter(CompanyExporter::class)
|
->exporter(CompanyExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export company');
|
return Filament::auth()->user()->can('view export company');
|
||||||
|
|||||||
@@ -183,11 +183,15 @@ class ConfigurationResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Configurations')
|
||||||
|
->color('warning')
|
||||||
->importer(ConfigurationImporter::class)
|
->importer(ConfigurationImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import configuration');
|
return Filament::auth()->user()->can('view import configuration');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Configurations')
|
||||||
|
->color('warning')
|
||||||
->exporter(ConfigurationExporter::class)
|
->exporter(ConfigurationExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export configuration');
|
return Filament::auth()->user()->can('view export configuration');
|
||||||
|
|||||||
@@ -117,11 +117,15 @@ class DeviceMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Device Masters')
|
||||||
|
->color('warning')
|
||||||
->importer(DeviceMasterImporter::class)
|
->importer(DeviceMasterImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import device master');
|
return Filament::auth()->user()->can('view import device master');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Device Masters')
|
||||||
|
->color('warning')
|
||||||
->exporter(DeviceMasterExporter::class)
|
->exporter(DeviceMasterExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export device master');
|
return Filament::auth()->user()->can('view export device master');
|
||||||
|
|||||||
@@ -412,11 +412,15 @@ class EbReadingResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import EB Readings')
|
||||||
|
->color('warning')
|
||||||
->importer(EbReadingImporter::class)
|
->importer(EbReadingImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import eb reading');
|
return Filament::auth()->user()->can('view import eb reading');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export EB Readings')
|
||||||
|
->color('warning')
|
||||||
->exporter(EbReadingExporter::class)
|
->exporter(EbReadingExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export eb reading');
|
return Filament::auth()->user()->can('view export eb reading');
|
||||||
|
|||||||
@@ -446,11 +446,15 @@ class EquipmentMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Equipment Masters')
|
||||||
|
->color('warning')
|
||||||
->importer(EquipmentMasterImporter::class)
|
->importer(EquipmentMasterImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import equipment master');
|
return Filament::auth()->user()->can('view import equipment master');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Equipment Masters')
|
||||||
|
->color('warning')
|
||||||
->exporter(EquipmentMasterExporter::class)
|
->exporter(EquipmentMasterExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export equipment master');
|
return Filament::auth()->user()->can('view export equipment master');
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
|||||||
use Filament\Tables\Actions\ImportAction;
|
use Filament\Tables\Actions\ImportAction;
|
||||||
use Filament\Tables\Actions\ExportAction;
|
use Filament\Tables\Actions\ExportAction;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
use thiagoalessio\TesseractOCR\TesseractOCR;
|
||||||
|
use setasign\Fpdi\Fpdi;
|
||||||
|
use setasign\Fpdi\PdfReader;
|
||||||
|
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GrMasterResource extends Resource
|
class GrMasterResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -210,6 +217,176 @@ class GrMasterResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
// Action::make('uploadNow1')
|
||||||
|
// ->label('Upload OCR')
|
||||||
|
// ->action(function ($get, callable $set) {
|
||||||
|
// $uploadedFiles = $get('photo');
|
||||||
|
|
||||||
|
// if (is_array($uploadedFiles) && count($uploadedFiles) > 0)
|
||||||
|
// {
|
||||||
|
// $uploaded = reset($uploadedFiles);
|
||||||
|
|
||||||
|
// if ($uploaded instanceof TemporaryUploadedFile) {
|
||||||
|
// $grNumber = $get('gr_number');
|
||||||
|
// $safeName = preg_replace('/[^A-Za-z0-9_\-]/', '_', $grNumber);
|
||||||
|
// // $originalName = $uploaded->getClientOriginalName();
|
||||||
|
// // $path = 'uploads/GRNumber/' . $originalName;
|
||||||
|
// $finalFileName = $safeName . '.jpg';
|
||||||
|
// $finalPath = 'uploads/OCR/' . $finalFileName;
|
||||||
|
|
||||||
|
// // if (Storage::disk('local')->exists($finalPath)) {
|
||||||
|
// // Notification::make()
|
||||||
|
// // ->title('Duplicate File')
|
||||||
|
// // ->body("The file '{$finalFileName}' already exists in uploads/GRNumber.")
|
||||||
|
// // ->warning()
|
||||||
|
// // ->send();
|
||||||
|
// // return; // Stop here
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// $storedPath = $uploaded->storeAs(
|
||||||
|
// 'uploads/OCR',
|
||||||
|
// $finalFileName,
|
||||||
|
// 'local'
|
||||||
|
// );
|
||||||
|
|
||||||
|
// // $storedPath = $uploaded->storeAs('uploads/OCR', $finalFileName, 'local');
|
||||||
|
// // $fullPath = storage_path('app/' . $storedPath);
|
||||||
|
// $storedPath = $uploaded->storeAs('uploads/OCR', $finalFileName, 'local');
|
||||||
|
|
||||||
|
// $fullPath = storage_path('app/private/' . $storedPath);
|
||||||
|
|
||||||
|
// $text = (new TesseractOCR($fullPath))->lang('eng')->run();
|
||||||
|
|
||||||
|
// $rawText = $text;
|
||||||
|
|
||||||
|
// preg_match_all('/\d+/', $rawText, $matches);
|
||||||
|
|
||||||
|
// $serialNumbers = $matches[0];
|
||||||
|
|
||||||
|
// $serialNumbers = array_slice($serialNumbers, 0, 4);
|
||||||
|
|
||||||
|
// //dd($serialNumbers);
|
||||||
|
|
||||||
|
// $processOrder = $get('gr_number');
|
||||||
|
|
||||||
|
// $itemId = $get('item_id');
|
||||||
|
|
||||||
|
// $plant = $get('plant_id');
|
||||||
|
|
||||||
|
// $item = Item::find($itemId);
|
||||||
|
|
||||||
|
// $plant = Plant::find($plant);
|
||||||
|
|
||||||
|
// $templatePath = storage_path('app/private/uploads/StickerTemplateOcr/multi.pdf');
|
||||||
|
|
||||||
|
// $outputPath = storage_path('app/private/uploads/StickerTemplateOcr/multi_filled.pdf');
|
||||||
|
|
||||||
|
// $storedPath = $uploaded->storeAs(
|
||||||
|
// 'uploads/GRNumber',
|
||||||
|
// $finalFileName,
|
||||||
|
// 'local'
|
||||||
|
// );
|
||||||
|
|
||||||
|
// $pdf = new Fpdi('P', 'mm', [90, 90]);
|
||||||
|
|
||||||
|
// $templateId = $pdf->setSourceFile($templatePath);
|
||||||
|
// $templatePage = $pdf->importPage(1);
|
||||||
|
|
||||||
|
// $pdf->AddPage();
|
||||||
|
// $pdf->useTemplate($templatePage, 0, 0, 90, 90);
|
||||||
|
|
||||||
|
// $pdf->SetFont('Helvetica', '', 10);
|
||||||
|
// $pdf->SetTextColor(0, 0, 0);
|
||||||
|
|
||||||
|
// $slots = [
|
||||||
|
// ['x' => 5.7, 'y' => 41.9, 'w' => 46.5, 'h' => 3.5], // 1st serial
|
||||||
|
// ['x' => 50, 'y' => 41.5, 'w' => 46.6, 'h' => 3.9], // 2nd serial
|
||||||
|
// ['x' => 5.7, 'y' => 60, 'w' => 46.5, 'h' => 3.5], // 3rd serial
|
||||||
|
// ['x' => 50, 'y' => 60, 'w' => 46.6, 'h' => 3.5], // 4rd serial
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $qrSlots = [
|
||||||
|
// ['x' => 17.3, 'y' => 29.2, 'size' => 11.4],
|
||||||
|
// ['x' => 61.5, 'y' => 29, 'size' => 11.5],
|
||||||
|
// ['x' => 17.7, 'y' => 46.7, 'size' => 11.4],
|
||||||
|
// ['x' => 61.7, 'y' => 46.7, 'size' => 11.4],
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// // foreach ($serialNumbers as $i => $serial) {
|
||||||
|
// // if (isset($slots[$i])) {
|
||||||
|
// // $pdf->SetFillColor(255, 255, 255); // erase old serial
|
||||||
|
// // $pdf->Rect($slots[$i]['x'], $slots[$i]['y'], $slots[$i]['w'], $slots[$i]['h'], 'F');
|
||||||
|
// // $pdf->SetXY($slots[$i]['x'], $slots[$i]['y']);
|
||||||
|
// // // $pdf->Write(0, $serial);
|
||||||
|
// // $pdf->Cell($slots[$i]['w'], $slots[$i]['h'], $serial, 0, 0, 'L');
|
||||||
|
// // }
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// // $pdf->Output('F', $outputPath);
|
||||||
|
// // return response()->download($outputPath);
|
||||||
|
|
||||||
|
// //
|
||||||
|
|
||||||
|
// // foreach ($serialNumbers as $i => $serial) {
|
||||||
|
// // if (!isset($slots[$i]) || !isset($qrSlots[$i])) continue;
|
||||||
|
|
||||||
|
// // //Generate QR code PNG temporarily
|
||||||
|
// // $qrPath = storage_path("app/private/uploads/QR/qr_$serial.png");
|
||||||
|
// // QrCode::format('png')->size(100)->generate($serial, $qrPath);
|
||||||
|
|
||||||
|
// // //Place QR code above serial
|
||||||
|
// // $pdf->Image($qrPath, $qrSlots[$i]['x'], $qrSlots[$i]['y'], $qrSlots[$i]['size'], $qrSlots[$i]['size']);
|
||||||
|
|
||||||
|
// // //Erase old serial
|
||||||
|
// // $pdf->SetFillColor(255, 255, 255);
|
||||||
|
// // $pdf->Rect($slots[$i]['x'], $slots[$i]['y'], $slots[$i]['w'], $slots[$i]['h'], 'F');
|
||||||
|
|
||||||
|
// // //Write new serial number
|
||||||
|
// // $pdf->SetXY($slots[$i]['x'], $slots[$i]['y']);
|
||||||
|
// // $pdf->Cell($slots[$i]['w'], $slots[$i]['h'], $serial, 0, 0, 'L');
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// foreach ($serialNumbers as $i => $serial) {
|
||||||
|
// if (!isset($slots[$i]) || !isset($qrSlots[$i])) continue;
|
||||||
|
|
||||||
|
// // Erase old QR completely (slightly larger)
|
||||||
|
// $pdf->SetFillColor(255, 255, 255);
|
||||||
|
// $pdf->Rect($qrSlots[$i]['x']-1, $qrSlots[$i]['y']-1, $qrSlots[$i]['size']+2, $qrSlots[$i]['size']+2, 'F');
|
||||||
|
|
||||||
|
// // Generate new QR code
|
||||||
|
// $qrPath = storage_path("app/private/uploads/QR/qr_$serial.png");
|
||||||
|
// $qrDir = storage_path('app/private/uploads/QR');
|
||||||
|
// if (!file_exists($qrDir)) mkdir($qrDir, 0777, true);
|
||||||
|
// QrCode::format('png')->size(100)->generate($serial, $qrPath);
|
||||||
|
|
||||||
|
// // Place QR code
|
||||||
|
// $pdf->Image($qrPath, $qrSlots[$i]['x'], $qrSlots[$i]['y'], $qrSlots[$i]['size'], $qrSlots[$i]['size']);
|
||||||
|
|
||||||
|
// // Erase old serial
|
||||||
|
// $pdf->SetFillColor(255, 255, 255);
|
||||||
|
// $pdf->Rect($slots[$i]['x'], $slots[$i]['y'], $slots[$i]['w'], $slots[$i]['h'], 'F');
|
||||||
|
|
||||||
|
// // Write new serial
|
||||||
|
// $pdf->SetXY($slots[$i]['x'], $slots[$i]['y']);
|
||||||
|
// $pdf->Cell($slots[$i]['w'], $slots[$i]['h'], $serial, 0, 0, 'L');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Save the final PDF
|
||||||
|
// $pdf->Output('F', $outputPath);
|
||||||
|
|
||||||
|
// // Download
|
||||||
|
// return response()->download($outputPath);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('No file selected to upload')
|
||||||
|
// ->warning()
|
||||||
|
// ->send();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }),
|
||||||
|
|
||||||
Action::make('downloadAttachment')
|
Action::make('downloadAttachment')
|
||||||
->label('Download PDF')
|
->label('Download PDF')
|
||||||
@@ -326,11 +503,15 @@ class GrMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import GR Masters')
|
||||||
|
->color('warning')
|
||||||
->importer(GrMasterImporter::class)
|
->importer(GrMasterImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import gr master');
|
return Filament::auth()->user()->can('view import gr master');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export GR Masters')
|
||||||
|
->color('warning')
|
||||||
->exporter(GrMasterExporter::class)
|
->exporter(GrMasterExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export gr master');
|
return Filament::auth()->user()->can('view export gr master');
|
||||||
|
|||||||
@@ -166,11 +166,15 @@ class GuardNameResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Guard Names')
|
||||||
|
->color('warning')
|
||||||
->importer(GuardNameImporter::class)
|
->importer(GuardNameImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import guard name');
|
return Filament::auth()->user()->can('view import guard name');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Guard Names')
|
||||||
|
->color('warning')
|
||||||
->exporter(GuardNameExporter::class)
|
->exporter(GuardNameExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export guard name');
|
return Filament::auth()->user()->can('view export guard name');
|
||||||
|
|||||||
@@ -568,6 +568,8 @@ class InvoiceDataValidationResource extends Resource
|
|||||||
return Filament::auth()->user()->can('view import invoice data validation');
|
return Filament::auth()->user()->can('view import invoice data validation');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Invoice Data')
|
||||||
|
->color('warning')
|
||||||
->exporter(InvoiceDataValidationExporter::class)
|
->exporter(InvoiceDataValidationExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export invoice data validation');
|
return Filament::auth()->user()->can('view export invoice data validation');
|
||||||
|
|||||||
@@ -501,6 +501,8 @@ class InvoiceOutValidationResource extends Resource
|
|||||||
return Filament::auth()->user()->can('view import invoice out validation');
|
return Filament::auth()->user()->can('view import invoice out validation');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Invoice Out Data')
|
||||||
|
->color('warning')
|
||||||
->exporter(InvoiceOutValidationExporter::class)
|
->exporter(InvoiceOutValidationExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export invoice out validation');
|
return Filament::auth()->user()->can('view export invoice out validation');
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ namespace App\Filament\Resources;
|
|||||||
use App\Filament\Exports\ItemExporter;
|
use App\Filament\Exports\ItemExporter;
|
||||||
use App\Filament\Imports\ItemImporter;
|
use App\Filament\Imports\ItemImporter;
|
||||||
use App\Filament\Resources\ItemResource\Pages;
|
use App\Filament\Resources\ItemResource\Pages;
|
||||||
|
use App\Models\InvoiceValidation;
|
||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
|
use App\Models\StickerMaster;
|
||||||
use Filament\Actions\Exports\Enums\ExportFormat;
|
use Filament\Actions\Exports\Enums\ExportFormat;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Components\FileUpload;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Forms\Get;
|
use Filament\Forms\Get;
|
||||||
@@ -21,7 +24,12 @@ 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 Filament\Forms\Components\Section;
|
use Filament\Forms\Components\Section;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Storage;
|
||||||
|
use Str;
|
||||||
|
|
||||||
class ItemResource extends Resource
|
class ItemResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -243,7 +251,237 @@ class ItemResource extends Resource
|
|||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
|
|
||||||
|
// Tables\Actions\Action::make('Import Items')
|
||||||
|
// ->label('Import Items')
|
||||||
|
// ->form([
|
||||||
|
// Select::make('plant_id')
|
||||||
|
// // ->options(Plant::pluck('name', 'id')->toArray()) // Fetch plant names and IDs
|
||||||
|
// ->options(function (callable $get) {
|
||||||
|
// $userHas = Filament::auth()->user()->plant_id;
|
||||||
|
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
|
// })
|
||||||
|
// ->label('Select Plant')
|
||||||
|
// ->required()
|
||||||
|
// // ->default(function () {
|
||||||
|
// // return optional(InvoiceValidation::latest()->first())->plant_id;
|
||||||
|
// // })
|
||||||
|
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
// $set('item_code_file', null);
|
||||||
|
// })
|
||||||
|
// ->reactive(),
|
||||||
|
|
||||||
|
// FileUpload::make('item_code_file')
|
||||||
|
// ->label('Master Item Code')
|
||||||
|
// // ->required()
|
||||||
|
// ->preserveFilenames() // <- this keeps the original filename
|
||||||
|
// ->storeFiles(false) // prevent auto-storing, we will store manually
|
||||||
|
// ->reactive()
|
||||||
|
// ->required()
|
||||||
|
// ->disk('local') //'local' refers to the local storage disk defined in config/filesystems.php, typically pointing to storage/app.
|
||||||
|
// ->visible(fn (Get $get) => !empty($get('plant_id')))
|
||||||
|
// ->directory('uploads/temp'),
|
||||||
|
// ])
|
||||||
|
// ->action(function (array $data) {
|
||||||
|
// $uploadedFile = $data['item_code_file'];
|
||||||
|
|
||||||
|
// $disk = Storage::disk('local');
|
||||||
|
|
||||||
|
// $plantId = $data['plant_id'];
|
||||||
|
|
||||||
|
// // Get original filename
|
||||||
|
// $originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx
|
||||||
|
|
||||||
|
// $originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
|
||||||
|
|
||||||
|
// // Store manually using storeAs to keep original name
|
||||||
|
// $path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path
|
||||||
|
|
||||||
|
// $fullPath = Storage::disk('local')->path($path);
|
||||||
|
|
||||||
|
// if ($fullPath && file_exists($fullPath))
|
||||||
|
// {
|
||||||
|
// $rows = Excel::toArray(null, $fullPath)[0];
|
||||||
|
|
||||||
|
// if ((count($rows) - 1) <= 0)
|
||||||
|
// {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Records Not Found')
|
||||||
|
// ->body("Import the valid 'Serial Invoice' file to proceed..!")
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
|
||||||
|
// if ($disk->exists($path)) {
|
||||||
|
// $disk->delete($path);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $invalidCategory = [];
|
||||||
|
// $materialCodes = [];
|
||||||
|
// $description = [];
|
||||||
|
// $invalidHourlyQuantity = [];
|
||||||
|
// $invalidUOM = [];
|
||||||
|
// $invalidPlantName = [];
|
||||||
|
// $seenItems = [];
|
||||||
|
// $uniqueInvalidCodes = [];
|
||||||
|
// $uniqueDesc = [];
|
||||||
|
|
||||||
|
// foreach ($rows as $index => $row)
|
||||||
|
// {
|
||||||
|
// if ($index == 0) continue; // Skip header
|
||||||
|
|
||||||
|
// $category = trim($row[0]);
|
||||||
|
// $materialCode = trim($row[1]);
|
||||||
|
// $desc = trim($row[2]);
|
||||||
|
// $hourlyQuantity = trim($row[3]);
|
||||||
|
// $uom = trim($row[4]);
|
||||||
|
// $plantName = trim($row[5]);
|
||||||
|
|
||||||
|
// if (strlen($materialCode) < 6) {
|
||||||
|
// $uniqueInvalidCodes[] = $materialCode;
|
||||||
|
// }
|
||||||
|
// else if (strlen($desc) < 7) {
|
||||||
|
// $uniqueDesc[] = $desc;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $key = $plantName . '|' . $materialCode;
|
||||||
|
|
||||||
|
// if (isset($seenItems[$key]))
|
||||||
|
// {
|
||||||
|
// $materialCodes[] = $materialCode;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $seenItems[$key] = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!empty($uniqueInvalidCodes)) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Invalid Item Codes')
|
||||||
|
// ->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>' . implode(', ', $uniqueInvalidCodes))
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// if ($disk->exists($path)) {
|
||||||
|
// $disk->delete($path);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// else if (!empty($uniqueMissingSerials)) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Missing Serial Numbers')
|
||||||
|
// ->body("The following item codes doesn't have valid serial number:<br>" . implode(', ', $uniqueMissingSerials))
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// if ($disk->exists($path)) {
|
||||||
|
// $disk->delete($path);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// else if (!empty($uniqueSerialCodes)) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Invalid Serial Number')
|
||||||
|
// ->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// if ($disk->exists($path)) {
|
||||||
|
// $disk->delete($path);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// else if (!empty($duplicateSerialCodes)) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Duplicate Serial Numbers')
|
||||||
|
// ->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes))
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// if ($disk->exists($path)) {
|
||||||
|
// $disk->delete($path);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// $uniqueCodes = array_unique($materialCodes);
|
||||||
|
|
||||||
|
// $matchedItems = StickerMaster::with('item')
|
||||||
|
// ->whereHas('item', function ($query) use ($uniqueCodes) {
|
||||||
|
// $query->whereIn('code', $uniqueCodes);
|
||||||
|
// })
|
||||||
|
// ->get();
|
||||||
|
|
||||||
|
// $matchedCodes = $matchedItems->pluck('item.code')->toArray();
|
||||||
|
|
||||||
|
// $missingCodes = array_diff($uniqueCodes, $matchedCodes);
|
||||||
|
|
||||||
|
// if (!empty($missingCodes))
|
||||||
|
// {
|
||||||
|
// $missingCount = count($missingCodes);
|
||||||
|
|
||||||
|
// $message = $missingCount > 10 ? "'$missingCount' item codes are not found in database." : 'The following item codes are not found in database:<br>' . implode(', ', $missingCodes);
|
||||||
|
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Unknown Item Codes')
|
||||||
|
// ->body($message)
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
|
||||||
|
// if ($disk->exists($path)) {
|
||||||
|
// $disk->delete($path);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Check which codes have a material_type set (not null)
|
||||||
|
// $invalidCodes = $matchedItems
|
||||||
|
// ->filter(fn ($sticker) => !empty($sticker->material_type)) //filter invalid
|
||||||
|
// ->pluck('item.code')
|
||||||
|
// ->toArray();
|
||||||
|
|
||||||
|
// if (count($invalidCodes) > 10)
|
||||||
|
// {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Invalid item codes found')
|
||||||
|
// ->body('' . count($invalidCodes) . 'item codes found have material type.')
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
|
||||||
|
// if ($disk->exists($path)) {
|
||||||
|
// $disk->delete($path);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// else if (count($invalidCodes) > 0)
|
||||||
|
// {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Invalid item codes found')
|
||||||
|
// ->body('Material invoice Item Codes found : ' . implode(', ', $invalidCodes))
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
|
||||||
|
// if ($disk->exists($path)) {
|
||||||
|
// $disk->delete($path);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// // Save full file path to session
|
||||||
|
// session(['uploaded_invoice_path' => $fullPath]);
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Serial invoice imported successfully.')
|
||||||
|
// ->success()
|
||||||
|
// ->send();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// ->visible(function() {
|
||||||
|
// return Filament::auth()->user()->can('view import serial invoice');
|
||||||
|
// }),
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Items')
|
||||||
|
->color('warning')
|
||||||
->importer(ItemImporter::class)
|
->importer(ItemImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import item');
|
return Filament::auth()->user()->can('view import item');
|
||||||
@@ -251,7 +489,8 @@ class ItemResource extends Resource
|
|||||||
// ->maxRows(100000),
|
// ->maxRows(100000),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
// ->columnMapping(true)
|
// ->columnMapping(true)
|
||||||
// ->label('Export')
|
->label('Import Items')
|
||||||
|
->color('warning')
|
||||||
// ->fileName("Items Report " . date('Y-m-d H:i:s'))
|
// ->fileName("Items Report " . date('Y-m-d H:i:s'))
|
||||||
->exporter(ItemExporter::class)
|
->exporter(ItemExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
|
|||||||
@@ -1119,11 +1119,15 @@ class LineResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Lines')
|
||||||
|
->color('warning')
|
||||||
->importer(LineImporter::class)
|
->importer(LineImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import line');
|
return Filament::auth()->user()->can('view import line');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Lines')
|
||||||
|
->color('warning')
|
||||||
->exporter(LineExporter::class)
|
->exporter(LineExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export line');
|
return Filament::auth()->user()->can('view export line');
|
||||||
|
|||||||
@@ -157,11 +157,15 @@ class LineStopResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Line Stops')
|
||||||
|
->color('warning')
|
||||||
->importer(LineStopImporter::class)
|
->importer(LineStopImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import line stop');
|
return Filament::auth()->user()->can('view import line stop');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Line Stops')
|
||||||
|
->color('warning')
|
||||||
->exporter(LineStopExporter::class)
|
->exporter(LineStopExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export line stop');
|
return Filament::auth()->user()->can('view export line stop');
|
||||||
|
|||||||
@@ -342,11 +342,15 @@ class LocatorResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Locators')
|
||||||
|
->color('warning')
|
||||||
->importer(LocatorImporter::class)
|
->importer(LocatorImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import locator');
|
return Filament::auth()->user()->can('view import locator');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Locators')
|
||||||
|
->color('warning')
|
||||||
->exporter(LocatorExporter::class)
|
->exporter(LocatorExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export locator');
|
return Filament::auth()->user()->can('view export locator');
|
||||||
|
|||||||
@@ -249,11 +249,15 @@ class MachineResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Machines')
|
||||||
|
->color('warning')
|
||||||
->importer(MachineImporter::class)
|
->importer(MachineImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import machine');
|
return Filament::auth()->user()->can('view import machine');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Machines')
|
||||||
|
->color('warning')
|
||||||
->exporter(MachineExporter::class)
|
->exporter(MachineExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export machine');
|
return Filament::auth()->user()->can('view export machine');
|
||||||
|
|||||||
@@ -123,11 +123,15 @@ class MfmMeterResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import MFM Meters')
|
||||||
|
->color('warning')
|
||||||
->importer(MfmMeterImporter::class)
|
->importer(MfmMeterImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import mfm meter');
|
return Filament::auth()->user()->can('view import mfm meter');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export MFM Meters')
|
||||||
|
->color('warning')
|
||||||
->exporter(MfmMeterExporter::class)
|
->exporter(MfmMeterExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export mfm meter');
|
return Filament::auth()->user()->can('view export mfm meter');
|
||||||
|
|||||||
@@ -154,11 +154,15 @@ class MfmParameterResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import MFM Parameters')
|
||||||
|
->color('warning')
|
||||||
->importer(MfmParameterImporter::class)
|
->importer(MfmParameterImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import mfm parameter');
|
return Filament::auth()->user()->can('view import mfm parameter');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export MFM Parameters')
|
||||||
|
->color('warning')
|
||||||
->exporter(MfmParameterExporter::class)
|
->exporter(MfmParameterExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export mfm parameter');
|
return Filament::auth()->user()->can('view export mfm parameter');
|
||||||
|
|||||||
@@ -761,11 +761,15 @@ class MotorTestingMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Motor Testing Masters')
|
||||||
|
->color('warning')
|
||||||
->importer(MotorTestingMasterImporter::class)
|
->importer(MotorTestingMasterImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import motor testing master');
|
return Filament::auth()->user()->can('view import motor testing master');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Motor Testing Masters')
|
||||||
|
->color('warning')
|
||||||
->exporter(MotorTestingMasterExporter::class)
|
->exporter(MotorTestingMasterExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export motor testing master');
|
return Filament::auth()->user()->can('view export motor testing master');
|
||||||
|
|||||||
@@ -222,11 +222,15 @@ class PlantResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Plants')
|
||||||
|
->color('warning')
|
||||||
->importer(PlantImporter::class)
|
->importer(PlantImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import plant');
|
return Filament::auth()->user()->can('view import plant');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Plants')
|
||||||
|
->color('warning')
|
||||||
->exporter(PlantExporter::class)
|
->exporter(PlantExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export plant');
|
return Filament::auth()->user()->can('view export plant');
|
||||||
|
|||||||
@@ -616,11 +616,15 @@ class ProductionLineStopResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Production Line Stops')
|
||||||
|
->color('warning')
|
||||||
->importer(ProductionLineStopImporter::class)
|
->importer(ProductionLineStopImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import production line stop');
|
return Filament::auth()->user()->can('view import production line stop');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Production Line Stops')
|
||||||
|
->color('warning')
|
||||||
->exporter(ProductionLineStopExporter::class)
|
->exporter(ProductionLineStopExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export production line stop');
|
return Filament::auth()->user()->can('view export production line stop');
|
||||||
|
|||||||
@@ -731,11 +731,15 @@ class ProductionPlanResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Production Plans')
|
||||||
|
->color('warning')
|
||||||
->importer(ProductionPlanImporter::class)
|
->importer(ProductionPlanImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import production plan');
|
return Filament::auth()->user()->can('view import production plan');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Production Plans')
|
||||||
|
->color('warning')
|
||||||
->exporter(ProductionPlanExporter::class)
|
->exporter(ProductionPlanExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export production plan');
|
return Filament::auth()->user()->can('view export production plan');
|
||||||
|
|||||||
@@ -1316,6 +1316,8 @@ class ProductionQuantityResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Production Quantities')
|
||||||
|
->color('warning')
|
||||||
->importer(ProductionQuantityImporter::class)
|
->importer(ProductionQuantityImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import production quantities');
|
return Filament::auth()->user()->can('view import production quantities');
|
||||||
@@ -1323,6 +1325,8 @@ class ProductionQuantityResource extends Resource
|
|||||||
// ->chunkSize(250),
|
// ->chunkSize(250),
|
||||||
// ->maxRows(100000),
|
// ->maxRows(100000),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Production Quantities')
|
||||||
|
->color('warning')
|
||||||
->exporter(ProductionQuantityExporter::class)
|
->exporter(ProductionQuantityExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export production quantities');
|
return Filament::auth()->user()->can('view export production quantities');
|
||||||
|
|||||||
@@ -2528,11 +2528,15 @@ class QualityValidationResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Quality Validations')
|
||||||
|
->color('warning')
|
||||||
->importer(QualityValidationImporter::class)
|
->importer(QualityValidationImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import quality validation');
|
return Filament::auth()->user()->can('view import quality validation');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Quality Validations')
|
||||||
|
->color('warning')
|
||||||
->exporter(QualityValidationExporter::class)
|
->exporter(QualityValidationExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export quality validation');
|
return Filament::auth()->user()->can('view export quality validation');
|
||||||
|
|||||||
@@ -982,7 +982,7 @@ class SerialValidationResource extends Resource
|
|||||||
// return Filament::auth()->user()->can('view import material invoice');
|
// return Filament::auth()->user()->can('view import material invoice');
|
||||||
// }),
|
// }),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
->label('Export Invoices')
|
->label('Export Serial Invoices')
|
||||||
->color('warning')
|
->color('warning')
|
||||||
->exporter(SerialValidationExporter::class)
|
->exporter(SerialValidationExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
|
|||||||
@@ -344,11 +344,15 @@ class ShiftResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Shifts')
|
||||||
|
->color('warning')
|
||||||
->importer(ShiftImporter::class)
|
->importer(ShiftImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import shift');
|
return Filament::auth()->user()->can('view import shift');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Shifts')
|
||||||
|
->color('warning')
|
||||||
->exporter(ShiftExporter::class)
|
->exporter(ShiftExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export shift');
|
return Filament::auth()->user()->can('view export shift');
|
||||||
|
|||||||
@@ -609,11 +609,15 @@ class StickerMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Sticker Masters')
|
||||||
|
->color('warning')
|
||||||
->importer(StickerMasterImporter::class)
|
->importer(StickerMasterImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import sticker master');
|
return Filament::auth()->user()->can('view import sticker master');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Sticker Masters')
|
||||||
|
->color('warning')
|
||||||
->exporter(StickerMasterExporter::class)
|
->exporter(StickerMasterExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export sticker master');
|
return Filament::auth()->user()->can('view export sticker master');
|
||||||
|
|||||||
@@ -161,11 +161,15 @@ class UserResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Users')
|
||||||
|
->color('warning')
|
||||||
->importer(UserImporter::class)
|
->importer(UserImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import user');
|
return Filament::auth()->user()->can('view import user');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Users')
|
||||||
|
->color('warning')
|
||||||
->exporter(UserExporter::class)
|
->exporter(UserExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export user');
|
return Filament::auth()->user()->can('view export user');
|
||||||
|
|||||||
@@ -172,11 +172,15 @@ class WorkGroupMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
|
->label('Import Work Group Masters')
|
||||||
|
->color('warning')
|
||||||
->importer(WorkGroupMasterImporter::class)
|
->importer(WorkGroupMasterImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view import work group master');
|
return Filament::auth()->user()->can('view import work group master');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
|
->label('Export Work Group Masters')
|
||||||
|
->color('warning')
|
||||||
->exporter(WorkGroupMasterExporter::class)
|
->exporter(WorkGroupMasterExporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
return Filament::auth()->user()->can('view export work group master');
|
return Filament::auth()->user()->can('view export work group master');
|
||||||
|
|||||||
@@ -993,6 +993,15 @@ function cameraCapture() {
|
|||||||
this.$refs.snapshot.classList.add('hidden');
|
this.$refs.snapshot.classList.add('hidden');
|
||||||
this.$refs.video.classList.remove('hidden');
|
this.$refs.video.classList.remove('hidden');
|
||||||
await this.initCamera();
|
await this.initCamera();
|
||||||
|
await new Promise(resolve => {
|
||||||
|
this.$refs.video.onloadedmetadata = resolve;
|
||||||
|
});
|
||||||
|
|
||||||
|
// ✅ Sync overlay canvas size with video size
|
||||||
|
const video = this.$refs.video;
|
||||||
|
const overlay = this.$refs.overlay;
|
||||||
|
overlay.width = video.videoWidth;
|
||||||
|
overlay.height = video.videoHeight;
|
||||||
this.startDetection();
|
this.startDetection();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user