Compare commits
1 Commits
master
...
renovate/i
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d1ad0cf53 |
@@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Exports;
|
|
||||||
|
|
||||||
use App\Models\CoilPacking;
|
|
||||||
use Filament\Actions\Exports\ExportColumn;
|
|
||||||
use Filament\Actions\Exports\Exporter;
|
|
||||||
use Filament\Actions\Exports\Models\Export;
|
|
||||||
|
|
||||||
class CoilPackingExporter extends Exporter
|
|
||||||
{
|
|
||||||
protected static ?string $model = CoilPacking::class;
|
|
||||||
|
|
||||||
public static function getColumns(): array
|
|
||||||
{
|
|
||||||
static $rowNumber = 0;
|
|
||||||
return [
|
|
||||||
ExportColumn::make('no')
|
|
||||||
->label('NO')
|
|
||||||
->state(function ($record) use (&$rowNumber) {
|
|
||||||
// Increment and return the row number
|
|
||||||
return ++$rowNumber;
|
|
||||||
}),
|
|
||||||
ExportColumn::make('plant.code')
|
|
||||||
->label('PLANT CODE'),
|
|
||||||
ExportColumn::make('item.code')
|
|
||||||
->label('ITEM CODE'),
|
|
||||||
ExportColumn::make('wire_packing_number')
|
|
||||||
->label('WIRE PACKING NUMBER'),
|
|
||||||
ExportColumn::make('process_order')
|
|
||||||
->label('COIL NUMBER'),
|
|
||||||
ExportColumn::make('coil_packing_status')
|
|
||||||
->label('COIL PACKING STATUS'),
|
|
||||||
ExportColumn::make('created_at')
|
|
||||||
->label('CREATED AT'),
|
|
||||||
ExportColumn::make('updated_at')
|
|
||||||
->label('UPDATED AT'),
|
|
||||||
ExportColumn::make('scanned_at')
|
|
||||||
->label('SCANNED AT'),
|
|
||||||
ExportColumn::make('created_by')
|
|
||||||
->label('CREATED BY'),
|
|
||||||
ExportColumn::make('updated_by')
|
|
||||||
->label('UPDATED BY'),
|
|
||||||
ExportColumn::make('scanned_by')
|
|
||||||
->label('SCANNED BY'),
|
|
||||||
ExportColumn::make('deleted_at')
|
|
||||||
->label('DELETED AT')
|
|
||||||
->enabledByDefault(false),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Export $export): string
|
|
||||||
{
|
|
||||||
$body = 'Your coil packing export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
|
||||||
|
|
||||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -59,8 +59,6 @@ class PanelBoxValidationExporter extends Exporter
|
|||||||
->label('PART VALIDATION 4'),
|
->label('PART VALIDATION 4'),
|
||||||
ExportColumn::make('part_validation5')
|
ExportColumn::make('part_validation5')
|
||||||
->label('PART VALIDATION 5'),
|
->label('PART VALIDATION 5'),
|
||||||
ExportColumn::make('status')
|
|
||||||
->label('STATUS'),
|
|
||||||
ExportColumn::make('created_at')
|
ExportColumn::make('created_at')
|
||||||
->label('CREATED AT'),
|
->label('CREATED AT'),
|
||||||
ExportColumn::make('updated_at')
|
ExportColumn::make('updated_at')
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Imports;
|
|
||||||
|
|
||||||
use App\Models\CoilPacking;
|
|
||||||
use Filament\Actions\Imports\ImportColumn;
|
|
||||||
use Filament\Actions\Imports\Importer;
|
|
||||||
use Filament\Actions\Imports\Models\Import;
|
|
||||||
|
|
||||||
class CoilPackingImporter extends Importer
|
|
||||||
{
|
|
||||||
protected static ?string $model = CoilPacking::class;
|
|
||||||
|
|
||||||
public static function getColumns(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
ImportColumn::make('plant_id')
|
|
||||||
->requiredMapping()
|
|
||||||
->numeric()
|
|
||||||
->rules(['required', 'integer']),
|
|
||||||
ImportColumn::make('item_id')
|
|
||||||
->requiredMapping()
|
|
||||||
->numeric()
|
|
||||||
->rules(['required', 'integer']),
|
|
||||||
ImportColumn::make('coil_packing_number'),
|
|
||||||
ImportColumn::make('process_order'),
|
|
||||||
ImportColumn::make('coil_packing_status'),
|
|
||||||
ImportColumn::make('scanned_at')
|
|
||||||
->requiredMapping()
|
|
||||||
->rules(['required', 'datetime']),
|
|
||||||
ImportColumn::make('created_by'),
|
|
||||||
ImportColumn::make('updated_by'),
|
|
||||||
ImportColumn::make('scanned_by'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function resolveRecord(): ?CoilPacking
|
|
||||||
{
|
|
||||||
// return CoilPacking::firstOrNew([
|
|
||||||
// // Update existing records, matching them by `$this->data['column_name']`
|
|
||||||
// 'email' => $this->data['email'],
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
return new CoilPacking();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Import $import): string
|
|
||||||
{
|
|
||||||
$body = 'Your coil packing import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
|
||||||
|
|
||||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,528 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Pages;
|
|
||||||
|
|
||||||
use App\Models\Line;
|
|
||||||
use App\Models\PanelBoxValidation;
|
|
||||||
use App\Models\Plant;
|
|
||||||
use App\Models\Item;
|
|
||||||
use App\Models\StickerMaster;
|
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Filament\Pages\Page;
|
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
|
||||||
use Filament\Forms\Form;
|
|
||||||
use Filament\Forms\Components\Section;
|
|
||||||
use Filament\Forms\Components\Select;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
class PanelBoxInspectionStock extends Page
|
|
||||||
{
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
|
||||||
|
|
||||||
protected static string $view = 'filament.pages.panel-box-inspection-stock';
|
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Panel Box';
|
|
||||||
|
|
||||||
use InteractsWithActions;
|
|
||||||
use InteractsWithForms;
|
|
||||||
|
|
||||||
public $plantId;
|
|
||||||
|
|
||||||
public $lineId;
|
|
||||||
|
|
||||||
public array $filters = [];
|
|
||||||
|
|
||||||
public $state = [];
|
|
||||||
|
|
||||||
public function mount()
|
|
||||||
{
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $this->plantId,
|
|
||||||
'line_id' => $this->lineId,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function form(Form $form): Form
|
|
||||||
{
|
|
||||||
return $form
|
|
||||||
->statePath('filters')
|
|
||||||
->schema([
|
|
||||||
Section::make('')
|
|
||||||
->schema([
|
|
||||||
Select::make('plant_id')
|
|
||||||
->label('Plant Name')
|
|
||||||
->relationship('plant', 'name')
|
|
||||||
->reactive()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
|
||||||
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
|
||||||
})
|
|
||||||
->afterStateUpdated(function (callable $set, callable $get, $state) {
|
|
||||||
$set('item_id', null);
|
|
||||||
$set('line_id', null);
|
|
||||||
|
|
||||||
$set('plant', $state);
|
|
||||||
|
|
||||||
$pId = $get('plant_id');
|
|
||||||
if (! $pId) {
|
|
||||||
$set('pqPlantError', 'Please select a plant first.');
|
|
||||||
} else {
|
|
||||||
$set('pqPlantError', null);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pId = $get('line_id');
|
|
||||||
if (! $pId) {
|
|
||||||
$set('pqLineError', null);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
->required()
|
|
||||||
->default(fn ($get) => $get('plant') ?? session('last_selected_plant_id'))
|
|
||||||
->extraAttributes(fn ($get) => [
|
|
||||||
'class' => $get('pqPlantError') ? 'border-red-500' : '',
|
|
||||||
])
|
|
||||||
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
|
|
||||||
->hintColor('danger'),
|
|
||||||
Select::make('line_id')
|
|
||||||
->label('Line Name')
|
|
||||||
->relationship('line', titleAttribute: 'name')
|
|
||||||
->reactive()
|
|
||||||
->required()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
if (! $plantId) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Line::where('plant_id', $plantId)
|
|
||||||
->pluck('name', 'id')
|
|
||||||
->toArray();
|
|
||||||
})
|
|
||||||
->afterStateUpdated(function (callable $set, callable $get, $state) {
|
|
||||||
$set('item_id', null);
|
|
||||||
|
|
||||||
$set('line', $state);
|
|
||||||
|
|
||||||
$pId = $get('line_id');
|
|
||||||
if (! $pId) {
|
|
||||||
$set('pqLineError', 'Please select a line.');
|
|
||||||
} else {
|
|
||||||
$set('pqLineError', null);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
->default(fn ($get) => $get('line') ?? session('last_selected_line'))
|
|
||||||
->extraAttributes(fn ($get) => [
|
|
||||||
'class' => $get('pqLineError') ? 'border-red-500' : '',
|
|
||||||
])
|
|
||||||
->hint(fn ($get) => $get('pqLineError') ? $get('pqLineError') : null)
|
|
||||||
->hintColor('danger'),
|
|
||||||
TextInput::make('item_id')
|
|
||||||
->label('Scan QR Code')
|
|
||||||
->reactive()
|
|
||||||
->extraAttributes([
|
|
||||||
'wire:keydown.enter' => 'processScan($event.target.value)',
|
|
||||||
]),
|
|
||||||
])
|
|
||||||
->columns(3),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processScan($value)
|
|
||||||
{
|
|
||||||
$plantId = $this->filters['plant_id'];
|
|
||||||
|
|
||||||
$plantId = trim($plantId) ?? null;
|
|
||||||
|
|
||||||
$lineId = $this->filters['line_id'];
|
|
||||||
|
|
||||||
$lineId = trim($lineId) ?? null;
|
|
||||||
|
|
||||||
$itemId = $this->filters['item_id'];
|
|
||||||
|
|
||||||
$itemId = trim($itemId) ?? null;
|
|
||||||
|
|
||||||
if (! $plantId) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Plant')
|
|
||||||
->body('Please select a plant.')
|
|
||||||
->warning()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (! $lineId) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Line')
|
|
||||||
->body('Please select a line.')
|
|
||||||
->warning()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$plaCode = Plant::find($plantId)?->code;
|
|
||||||
|
|
||||||
// Check if QR format contains '|'
|
|
||||||
|
|
||||||
// if ($itemId && str_contains($itemId, '|'))
|
|
||||||
// {
|
|
||||||
// if (strpos($itemId, '|') == false) {
|
|
||||||
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Unknown Qr Code')
|
|
||||||
// ->body('Scan valid QR code. (Ex: Item_Code|Serial_Number)')
|
|
||||||
// ->warning()
|
|
||||||
// ->send();
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (! preg_match('/^[a-zA-Z0-9]{6,}+\|[1-9][a-zA-Z0-9]{8,}+(\|)?$/', $itemId)) {
|
|
||||||
// $splits = explode('|', $itemId);
|
|
||||||
// $iCode = trim($splits[0]);
|
|
||||||
// $sNumber = isset($splits[1]) ? trim($splits[1]) : null;
|
|
||||||
|
|
||||||
// if (! ctype_alnum($iCode)) {
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Invalid Item Code')
|
|
||||||
// ->body('Item code must contain alpha-numeric values.')
|
|
||||||
// ->warning()
|
|
||||||
// ->send();
|
|
||||||
// return;
|
|
||||||
// } elseif (strlen($iCode) < 6) {
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Invalid Item Code')
|
|
||||||
// ->body('Item code must be at least 6 digits.')
|
|
||||||
// ->warning()
|
|
||||||
// ->send();
|
|
||||||
// return;
|
|
||||||
// } elseif (! ctype_alnum($sNumber)) {
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Invalid Serial Number')
|
|
||||||
// ->body('Serial number must contain alpha-numeric values.')
|
|
||||||
// ->warning()
|
|
||||||
// ->send();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $iId = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
|
|
||||||
|
|
||||||
// if(!$iId){
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Item not found')
|
|
||||||
// ->body("Item code'{$iCode}' not found against plant code '{$plaCode}' in item master.")
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $sticker = StickerMaster::where('plant_id', $plantId)->where('item_id', $iId->id)->first();
|
|
||||||
|
|
||||||
// if(!$sticker){
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Unknown Item Code')
|
|
||||||
// ->body("Item code not found '{$iId->code}' in sticker master.")
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (str_contains($itemId, '|')) {
|
|
||||||
|
|
||||||
// $parts = array_map('trim', explode('|', $itemId));
|
|
||||||
|
|
||||||
// if (count($parts) != 2) {
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Invalid QR Format')
|
|
||||||
// ->body('Expected format: ItemCode|SerialNumber')
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $itemCode = $parts[0];
|
|
||||||
// $serialNumber = $parts[1];
|
|
||||||
|
|
||||||
// if($serialNumber == '' || $serialNumber == null){
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Unknown Serial number')
|
|
||||||
// ->body("Serial number can't be empty!")
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// elseif (! ctype_alnum($serialNumber)) {
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Unknown Serial number')
|
|
||||||
// ->body("Serial Number should contain alpha-numeric values.")
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $iId = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
|
||||||
|
|
||||||
// if(!$iId){
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Item not found')
|
|
||||||
// ->body("Item code'{$itemCode}' not found against plant code '{$plaCode}' in item master.")
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (str_contains($itemId, '/'))
|
|
||||||
{
|
|
||||||
$parts = explode('/', $itemId);
|
|
||||||
|
|
||||||
if (count($parts) < 3) {
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Invalid QR Format')
|
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$supplier = $parts[0];
|
|
||||||
$panelBoxCode = $parts[1];
|
|
||||||
$panelBoxSerialNo = implode('/', array_slice($parts, 2));
|
|
||||||
|
|
||||||
$itemCode = $panelBoxCode;
|
|
||||||
$serialNumber = $panelBoxSerialNo;
|
|
||||||
|
|
||||||
$iId = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
|
||||||
|
|
||||||
if(!$iId){
|
|
||||||
Notification::make()
|
|
||||||
->title('Item not found')
|
|
||||||
->body("Item code'{$itemCode}' not found against plant code '{$plaCode}' in item master.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sticker = StickerMaster::where('plant_id', $plantId)->where('item_id', $iId->id)->first();
|
|
||||||
|
|
||||||
if(!$sticker){
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Item Code')
|
|
||||||
->body("Item code not found '{$iId->code}' in sticker master.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Notification::make()
|
|
||||||
->title('Invalid QR Format')
|
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($itemCode) < 6) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Item Code')
|
|
||||||
->body('Item code must be at least 6 digits.')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
} elseif (! ctype_alnum($itemCode)) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Item Code')
|
|
||||||
->body('Item Code should contain alpha-numeric values.')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $plantId) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Plant')
|
|
||||||
->body('Please select a plant first.')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Check if the item exists for the selected plant
|
|
||||||
$stickerMaster = StickerMaster::where('plant_id', $plantId)->whereHas('item', function ($query) use ($itemCode) {
|
|
||||||
$query->where('code', $itemCode);
|
|
||||||
})->first();
|
|
||||||
|
|
||||||
if (! $stickerMaster) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Item Code')
|
|
||||||
->body('Item code does not exist in master data.')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (! $stickerMaster->item->uom) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Item Code')
|
|
||||||
->body("Item code does not have 'UOM' in master data.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$serialExists = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->first();
|
|
||||||
|
|
||||||
if ($serialExists) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Duplicate Serial Number')
|
|
||||||
->body("Serial number already exists $serialNumber.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$item = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
|
||||||
|
|
||||||
if (! $item) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Item Code')
|
|
||||||
->body("Item code '{$itemCode}' not found against plant code '{$plaCode}' in item master.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find sticker master
|
|
||||||
$sticker = StickerMaster::where('plant_id', $plantId)->where('item_id', $item->id)->first();
|
|
||||||
|
|
||||||
if (! $sticker) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Sticker')
|
|
||||||
->body("Sticker master not found for the selected item.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new PanelBoxValidation record
|
|
||||||
|
|
||||||
$userName = Filament::auth()->user()->name;
|
|
||||||
|
|
||||||
$panelBoxValidation = PanelBoxValidation::create([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'sticker_master_id' => $sticker->id,
|
|
||||||
'serial_number' => $serialNumber,
|
|
||||||
'panel_box_code' => $itemCode ?? null,
|
|
||||||
'panel_box_supplier' => $supplier ?? null,
|
|
||||||
'panel_box_serial_number' => $serialNumber ?? null,
|
|
||||||
'status' => 'Ok',
|
|
||||||
'created_by' => $userName,
|
|
||||||
'updated_by' => $userName,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if($panelBoxValidation){
|
|
||||||
Notification::make()
|
|
||||||
->title('Success')
|
|
||||||
->body("Panel Box with Serial Number '{$serialNumber}' has been successfully inserted.")
|
|
||||||
->success()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
Notification::make()
|
|
||||||
->title('Error')
|
|
||||||
->body("Failed to insert Panel Box with Serial Number '{$serialNumber}'.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'line_id' => $lineId,
|
|
||||||
'item_id' => null,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function canAccess(): bool
|
|
||||||
{
|
|
||||||
return Auth::check() && Auth::user()->can('view panel box inspection stock page');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,468 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources;
|
|
||||||
|
|
||||||
use App\Filament\Resources\CoilPackingResource\Pages;
|
|
||||||
use App\Filament\Resources\CoilPackingResource\RelationManagers;
|
|
||||||
use App\Models\CoilPacking;
|
|
||||||
use App\Models\Item;
|
|
||||||
use App\Models\Plant;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Filament\Forms;
|
|
||||||
use Filament\Forms\Form;
|
|
||||||
use Filament\Resources\Resource;
|
|
||||||
use Filament\Tables;
|
|
||||||
use Filament\Tables\Table;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Filament\Forms\Components\Section;
|
|
||||||
use Filament\Tables\Actions\ExportAction;
|
|
||||||
use Filament\Tables\Actions\ImportAction;
|
|
||||||
use App\Filament\Exports\CoilPackingExporter;
|
|
||||||
use App\Filament\Imports\CoilPackingImporter;
|
|
||||||
use Filament\Tables\Filters\Filter;
|
|
||||||
use Filament\Forms\Components\Select;
|
|
||||||
use Filament\Forms\Components\DateTimePicker;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
|
|
||||||
class CoilPackingResource extends Resource
|
|
||||||
{
|
|
||||||
protected static ?string $model = CoilPacking::class;
|
|
||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Coil Packing';
|
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
|
||||||
{
|
|
||||||
return $form
|
|
||||||
->schema([
|
|
||||||
Section::make('')
|
|
||||||
->schema([
|
|
||||||
Forms\Components\Select::make('plant_id')
|
|
||||||
->label('Plant')
|
|
||||||
->reactive()
|
|
||||||
->relationship('plant', 'name')
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
|
||||||
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
|
||||||
})
|
|
||||||
->required()
|
|
||||||
->afterStateUpdated(function (callable $set) {
|
|
||||||
$set('coil_packing_number', null);
|
|
||||||
$set('process_order', null);
|
|
||||||
}),
|
|
||||||
Forms\Components\TextInput::make('coil_packing_number')
|
|
||||||
->label('Scan Coil Packing No')
|
|
||||||
->reactive()
|
|
||||||
->required()
|
|
||||||
->readonly()
|
|
||||||
->extraAttributes([
|
|
||||||
'x-data' => '{ value: "" }',
|
|
||||||
'x-model' => 'value',
|
|
||||||
'x-on:keydown.enter.prevent' => '$wire.processPalletNo()',
|
|
||||||
])
|
|
||||||
->suffixAction(fn ($get, $set) => Forms\Components\Actions\Action::make('addWirePackNo')
|
|
||||||
->label('')
|
|
||||||
->button()
|
|
||||||
->icon('heroicon-o-plus')
|
|
||||||
->color('primary')
|
|
||||||
->extraAttributes([
|
|
||||||
'class' => 'p-1 w-7 h-7',
|
|
||||||
])
|
|
||||||
->action(function ($get, $set, $livewire) {
|
|
||||||
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
|
|
||||||
$year = now()->format('y');
|
|
||||||
$month = now()->format('m');
|
|
||||||
$prefix = "CP-{$year}{$month}";
|
|
||||||
|
|
||||||
$lastPallet = CoilPacking::where('coil_packing_number', 'like', "{$prefix}%")
|
|
||||||
->orderByDesc('coil_packing_number')
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if ($lastPallet) {
|
|
||||||
$lastNumber = (int) substr(
|
|
||||||
$lastPallet->coil_packing_number,
|
|
||||||
strlen($prefix)
|
|
||||||
);
|
|
||||||
|
|
||||||
$newNumber = $lastNumber + 1;
|
|
||||||
|
|
||||||
$newNumber = $newNumber < 1000
|
|
||||||
? str_pad($newNumber, 3, '0', STR_PAD_LEFT)
|
|
||||||
: (string) $newNumber;
|
|
||||||
} else {
|
|
||||||
$newNumber = '001';
|
|
||||||
}
|
|
||||||
|
|
||||||
$newPalletNumber = "{$prefix}{$newNumber}";
|
|
||||||
|
|
||||||
$set('coil_packing_number', $newPalletNumber);
|
|
||||||
$set('plant_id', $plantId);
|
|
||||||
|
|
||||||
$livewire->redirectToCoilQrPdf($newPalletNumber);
|
|
||||||
})
|
|
||||||
),
|
|
||||||
Forms\Components\TextInput::make('process_order')
|
|
||||||
->label('Coil No')
|
|
||||||
->reactive()
|
|
||||||
->readOnly(fn (callable $get) => ! $get('coil_packing_number') || $get('removeSno_number'))
|
|
||||||
->extraAttributes([
|
|
||||||
'x-on:keydown.enter.prevent' => '$wire.processOrderSNo()',
|
|
||||||
]),
|
|
||||||
Forms\Components\TextInput::make('removeSno_number')
|
|
||||||
->label('Remove Coil No')
|
|
||||||
->reactive()
|
|
||||||
->minLength(9)
|
|
||||||
->readOnly(fn (callable $get) => ! $get('coil_packing_number') || $get('process_order'))
|
|
||||||
->extraAttributes([
|
|
||||||
'x-data' => '{ value: "" }',
|
|
||||||
'x-model' => 'value',
|
|
||||||
'x-on:keydown.enter.prevent' => '$wire.processRemoveSNo()',
|
|
||||||
]),
|
|
||||||
Forms\Components\TextInput::make('Sno_quantity')
|
|
||||||
->label('SNo. Quantity')
|
|
||||||
->readOnly()
|
|
||||||
->default('0'),
|
|
||||||
Forms\Components\Select::make('pending_pallet_list')
|
|
||||||
->label('Pending Pallet List')
|
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set) {
|
|
||||||
$set('coil_packing_number', $state);
|
|
||||||
$set('pallet_number_locked', false);
|
|
||||||
})
|
|
||||||
->options(function ($get) {
|
|
||||||
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
|
|
||||||
if (!$plantId) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return CoilPacking::query()
|
|
||||||
->where('plant_id', $plantId)
|
|
||||||
->where(function ($query) {
|
|
||||||
$query->whereNull('coil_packing_status')
|
|
||||||
->orWhere('coil_packing_status', '');
|
|
||||||
})
|
|
||||||
->whereNotNull('coil_packing_number')
|
|
||||||
->orderBy('coil_packing_number', 'asc')
|
|
||||||
->pluck('coil_packing_number')
|
|
||||||
->unique()
|
|
||||||
->mapWithKeys(fn ($number) => [$number => $number])
|
|
||||||
->toArray();
|
|
||||||
}),
|
|
||||||
Forms\Components\View::make('forms.components.save-coil-processorder-button'),
|
|
||||||
Forms\Components\Hidden::make('created_by')
|
|
||||||
->label('Created By'),
|
|
||||||
Forms\Components\Hidden::make('updated_by')
|
|
||||||
->label('Updated By'),
|
|
||||||
])
|
|
||||||
->columns(5),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
|
||||||
{
|
|
||||||
return $table
|
|
||||||
->columns([
|
|
||||||
Tables\Columns\TextColumn::make('No.')
|
|
||||||
->label('No.')
|
|
||||||
->alignCenter()
|
|
||||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
|
||||||
$paginator = $livewire->getTableRecords();
|
|
||||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
|
||||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
|
||||||
|
|
||||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
|
||||||
}),
|
|
||||||
Tables\Columns\TextColumn::make('plant.name')
|
|
||||||
->label('Plant')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('item.code')
|
|
||||||
->label('Item')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('item.description')
|
|
||||||
->label('Description')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('coil_packing_number')
|
|
||||||
->label('Coil Packing Number')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('process_order')
|
|
||||||
->label('Coil Number')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('coil_packing_status')
|
|
||||||
->label('Coil Packing Status')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
|
||||||
->label('Created At')
|
|
||||||
->alignCenter()
|
|
||||||
->dateTime()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('created_by')
|
|
||||||
->label('Created By')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('updated_at')
|
|
||||||
->label('Updated At')
|
|
||||||
->alignCenter()
|
|
||||||
->dateTime()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
Tables\Columns\TextColumn::make('updated_by')
|
|
||||||
->label('Updated By')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
Tables\Columns\TextColumn::make('scanned_at')
|
|
||||||
->label('Scanned At')
|
|
||||||
->dateTime()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
Tables\Columns\TextColumn::make('scanned_by')
|
|
||||||
->label('Scanned By')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
Tables\Columns\TextColumn::make('deleted_at')
|
|
||||||
->dateTime()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
])
|
|
||||||
->filters([
|
|
||||||
Tables\Filters\TrashedFilter::make(),
|
|
||||||
Filter::make('advanced_filters')
|
|
||||||
->label('Advanced Filters')
|
|
||||||
->form([
|
|
||||||
Select::make('Plant')
|
|
||||||
->label('Search by Plant Name')
|
|
||||||
->nullable()
|
|
||||||
->searchable()
|
|
||||||
->reactive()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
|
||||||
|
|
||||||
if ($userHas && strlen($userHas) > 0) {
|
|
||||||
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
|
||||||
} else {
|
|
||||||
return Plant::whereHas('coilPacking', function ($query) {
|
|
||||||
$query->whereNotNull('id');
|
|
||||||
})->orderBy('code')->pluck('name', 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
|
||||||
})
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
$set('Item', null);
|
|
||||||
}),
|
|
||||||
Select::make('Item')
|
|
||||||
->label('Search by Item Code')
|
|
||||||
->nullable()
|
|
||||||
->searchable()
|
|
||||||
->reactive()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('Plant');
|
|
||||||
|
|
||||||
if (empty($plantId)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Item::whereHas('coilPacking', function ($query) use ($plantId) {
|
|
||||||
if ($plantId) {
|
|
||||||
$query->where('plant_id', $plantId);
|
|
||||||
}
|
|
||||||
})->pluck('code', 'id');
|
|
||||||
})
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
$set('process_order', null);
|
|
||||||
}),
|
|
||||||
TextInput::make('coil_packing_number')
|
|
||||||
->label('Coil Packing Number')
|
|
||||||
->reactive()
|
|
||||||
->placeholder('Enter Coil Packing Number')
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
$set('process_order', null);
|
|
||||||
}),
|
|
||||||
TextInput::make('process_order')
|
|
||||||
->label('Coil No')
|
|
||||||
->reactive()
|
|
||||||
->placeholder('Enter Coil No')
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
$set('Rework', null);
|
|
||||||
}),
|
|
||||||
Select::make('coil_packing_status')
|
|
||||||
->label('Coil Packing Status')
|
|
||||||
->reactive()
|
|
||||||
->options([
|
|
||||||
'Completed' => 'Completed',
|
|
||||||
'Pending' => 'Pending',
|
|
||||||
]),
|
|
||||||
DateTimePicker::make(name: 'created_from')
|
|
||||||
->label('Created From')
|
|
||||||
->placeholder('Select From DateTime')
|
|
||||||
->reactive()
|
|
||||||
->native(false),
|
|
||||||
DateTimePicker::make('created_to')
|
|
||||||
->label('Created To')
|
|
||||||
->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['Item']) && empty($data['process_order']) && empty($data['coil_packing_number']) && empty($data['coil_packing_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
|
||||||
return $query->whereRaw('1 = 0');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['Plant'])) {
|
|
||||||
$query->where('plant_id', $data['Plant']);
|
|
||||||
} else {
|
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
|
||||||
|
|
||||||
if ($userHas && strlen($userHas) > 0) {
|
|
||||||
return $query->whereRaw('1 = 0');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['Item'])) {
|
|
||||||
$query->where('item_id', $data['Item']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['process_order'])) {
|
|
||||||
$query->where('process_order', 'like', '%'.$data['process_order'].'%');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['coil_packing_number'])) {
|
|
||||||
$query->where('coil_packing_number', 'like', '%'.$data['coil_packing_number'].'%');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['coil_packing_status'])) {
|
|
||||||
if ($data['coil_packing_status'] == 'Pending') {
|
|
||||||
$query->where(function ($q) {
|
|
||||||
$q->whereNull('coil_packing_status')
|
|
||||||
->orWhere('coil_packing_status', '');
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$query->where('coil_packing_status', $data['coil_packing_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']);
|
|
||||||
}
|
|
||||||
// $query->orderBy('created_at', 'asc');
|
|
||||||
})
|
|
||||||
->indicateUsing(function (array $data) {
|
|
||||||
$indicators = [];
|
|
||||||
|
|
||||||
if (! empty($data['Plant'])) {
|
|
||||||
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
|
|
||||||
} else {
|
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
|
||||||
|
|
||||||
if ($userHas && strlen($userHas) > 0) {
|
|
||||||
return 'Plant Name: Choose plant to filter records.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['Item'])) {
|
|
||||||
$indicators[] = 'Item Code: '.Item::where('id', $data['Item'])->value('code');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['process_order'])) {
|
|
||||||
$indicators[] = 'Coil No: '.$data['process_order'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['coil_packing_number'])) {
|
|
||||||
$indicators[] = 'Coil Packing Number: '.$data['coil_packing_number'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['coil_packing_status'])) {
|
|
||||||
$indicators[] = 'Coil Packing Status: '.$data['coil_packing_status'];
|
|
||||||
}
|
|
||||||
|
|
||||||
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 Coil Packing')
|
|
||||||
->color('warning')
|
|
||||||
->importer(CoilPackingImporter::class)
|
|
||||||
->visible(function () {
|
|
||||||
return Filament::auth()->user()->can('view import coil packing');
|
|
||||||
}),
|
|
||||||
ExportAction::make()
|
|
||||||
->label('Export Coil Packing')
|
|
||||||
->color('warning')
|
|
||||||
->exporter(CoilPackingExporter::class)
|
|
||||||
->visible(function () {
|
|
||||||
return Filament::auth()->user()->can('view export coil packing');
|
|
||||||
}),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getRelations(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getPages(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'index' => Pages\ListCoilPackings::route('/'),
|
|
||||||
'create' => Pages\CreateCoilPacking::route('/create'),
|
|
||||||
'view' => Pages\ViewCoilPacking::route('/{record}'),
|
|
||||||
'edit' => Pages\EditCoilPacking::route('/{record}/edit'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getEloquentQuery(): Builder
|
|
||||||
{
|
|
||||||
return parent::getEloquentQuery()
|
|
||||||
->withoutGlobalScopes([
|
|
||||||
SoftDeletingScope::class,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,800 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\CoilPackingResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\CoilPackingResource;
|
|
||||||
use App\Models\CoilPacking;
|
|
||||||
use App\Models\Item;
|
|
||||||
use App\Models\Plant;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
|
||||||
|
|
||||||
class CreateCoilPacking extends CreateRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = CoilPackingResource::class;
|
|
||||||
|
|
||||||
protected static string $view = 'filament.resources.coil-packing-resource.create-coil-packing';
|
|
||||||
|
|
||||||
public $processOrder;
|
|
||||||
|
|
||||||
public $plantId;
|
|
||||||
|
|
||||||
public $count = 0;
|
|
||||||
|
|
||||||
public $snoCount = 0;
|
|
||||||
|
|
||||||
public $pendingPallet;
|
|
||||||
|
|
||||||
public $palletNo;
|
|
||||||
|
|
||||||
protected $listeners = [
|
|
||||||
'updateSnoQuantity' => 'handleUpdateSnoQuantity',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function handleUpdateSnoQuantity($newValue)
|
|
||||||
{
|
|
||||||
$this->form->fill([
|
|
||||||
'Sno_quantity' => $newValue,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processOrderSNo(){
|
|
||||||
|
|
||||||
$plantId = $this->form->getState()['plant_id'];
|
|
||||||
|
|
||||||
$plantId = trim($plantId) ?? null;
|
|
||||||
|
|
||||||
$processOrder = trim($this->form->getState()['process_order'])?? null;
|
|
||||||
|
|
||||||
$coilPackNo = trim($this->form->getState()['coil_packing_number'])?? null;
|
|
||||||
|
|
||||||
$coilPackNo = trim($coilPackNo) ?? null;
|
|
||||||
|
|
||||||
$user = Filament::auth()->user();
|
|
||||||
|
|
||||||
$operatorName = $user->name;
|
|
||||||
|
|
||||||
if (empty($processOrder) || $processOrder == '')
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Coil No can't be empty")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $coilPackNo,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pattern = '/^([^|]+)\|([^|]+)$/';
|
|
||||||
|
|
||||||
if (!preg_match($pattern, $processOrder, $matches))
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Scan Valid Qr code ")
|
|
||||||
->body("Expected Format: ItemCode|CoilNo")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $coilPackNo,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$materialCode = $matches[1];
|
|
||||||
$coilNo = $matches[2];
|
|
||||||
|
|
||||||
$icode = Item::where('code', $materialCode)->first();
|
|
||||||
|
|
||||||
if(!$icode)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Unknown Item Code")
|
|
||||||
->body("Item Code not found '$materialCode'")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $coilPackNo,
|
|
||||||
'process_order' => null,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$icodeAgaPlant = Item::where('code', $materialCode)->where('plant_id', $plantId)->first();
|
|
||||||
|
|
||||||
$plantCode = Plant::where('id', $plantId)->first();
|
|
||||||
|
|
||||||
$plantcode = $plantCode->code;
|
|
||||||
|
|
||||||
$itemId = $icodeAgaPlant->id;
|
|
||||||
|
|
||||||
if(!$icodeAgaPlant)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Unknown Item Code")
|
|
||||||
->body("Item Code not found '$materialCode' against Plant Code '$plantcode'")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $coilPackNo,
|
|
||||||
'process_order' => null,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$processOrderAgaPlant = CoilPacking::where('process_order', $coilNo)->where('plant_id', $plantId)->first();
|
|
||||||
|
|
||||||
if($processOrderAgaPlant)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Duplicate Coil No")
|
|
||||||
->body("Duplicate coil number found '$coilNo' against Plant Code '$plantcode'")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $coilPackNo,
|
|
||||||
'process_order' => null,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$existingPallet = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('coil_packing_number', $coilPackNo)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
$count = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('coil_packing_number', $coilPackNo)
|
|
||||||
->count('coil_packing_number');
|
|
||||||
|
|
||||||
$createdAt = $existingPallet ? $existingPallet->created_at : $clickedAt ?? now();
|
|
||||||
|
|
||||||
$createdBy = $existingPallet ? $existingPallet->created_by : $clickedBy ?? $operatorName;
|
|
||||||
|
|
||||||
$record = CoilPacking::create([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'item_id' => $itemId,
|
|
||||||
'coil_packing_number' => $coilPackNo,
|
|
||||||
'process_order' => $coilNo,
|
|
||||||
'created_by' => $createdBy,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
'created_at' => $createdAt,
|
|
||||||
'scanned_at' => now(),
|
|
||||||
'updated_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($record)
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->snoCount = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('coil_packing_number', $coilPackNo)
|
|
||||||
->count();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $coilPackNo, $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'item_id' => $itemId,
|
|
||||||
'coil_packing_number' => $coilPackNo,
|
|
||||||
'process_order' => null,
|
|
||||||
'Sno_quantity' => $this->snoCount,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Failed to insert scanned serial number '$coilNo' into coil packing table!")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $coilPackNo, $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'item_id' => $itemId,
|
|
||||||
'coil_packing_number' => $coilPackNo,
|
|
||||||
'process_order' => null,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title('Error: Serial not inserted.')
|
|
||||||
->body("Something went wrong while inserting process order '{$coilNo}' into pallet table!\nScan the new process order to proceed...")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $coilPackNo, $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $coilPackNo,
|
|
||||||
'process_order' => null,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $coilPackNo, $plantId);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function markAsComplete()
|
|
||||||
{
|
|
||||||
|
|
||||||
$plantId = $this->form->getState()['plant_id'];
|
|
||||||
|
|
||||||
$plantId = trim($plantId) ?? null;
|
|
||||||
|
|
||||||
$pendingPallet = $this->form->getState()['pending_pallet_list'];
|
|
||||||
|
|
||||||
$palletNumber = trim($this->form->getState()['coil_packing_number'])?? null;
|
|
||||||
|
|
||||||
$palletNumber = trim($palletNumber) ?? null;
|
|
||||||
|
|
||||||
$processOrder = trim($this->form->getState()['process_order'])?? null;
|
|
||||||
|
|
||||||
$processOrder = trim($processOrder) ?? null;
|
|
||||||
|
|
||||||
$user = Filament::auth()->user();
|
|
||||||
|
|
||||||
$operatorName = $user->name;
|
|
||||||
|
|
||||||
$isCompleted = $this->data['is_completed'] ?? false;
|
|
||||||
|
|
||||||
// $this->pendingPallet = $this->form->getState()['pending_pallet_list'];
|
|
||||||
|
|
||||||
if (! ($this->data['is_completed'] ?? false)) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Completion required')
|
|
||||||
->body('Please check the "Is Completed" checkbox to finish master packing.')
|
|
||||||
->warning()
|
|
||||||
->duration(3000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$palletExist = CoilPacking::where('coil_packing_number', $palletNumber)
|
|
||||||
->where('plant_id', $plantId)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if (!$palletExist)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Pallet number '$palletNumber' does not have process orders to save!<br>Add the valid process order into pallet number to proceed...")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'pending_pallet_list' => $pendingPallet,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$allCompleted = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('coil_packing_number', $palletNumber)
|
|
||||||
->where('coil_packing_status', '=','Completed')
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if ($allCompleted)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Coil Packing pallet number '$palletNumber' already completed the master packing!<br>Generate the new Coil Packing Pallet number or choose from pending pallet list!")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', '', $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => null,
|
|
||||||
'pending_pallet_list' => null,//$pendingPallet
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$isCompleted)
|
|
||||||
{
|
|
||||||
$updated = CoilPacking::where('coil_packing_number', $palletNumber)
|
|
||||||
->where('plant_id', $plantId)
|
|
||||||
->update([
|
|
||||||
'updated_at' => now(),
|
|
||||||
'updated_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($updated > 0)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Pallet number '$palletNumber' records saved successfully!")
|
|
||||||
->success()
|
|
||||||
->duration(800)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', '', $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => null,//$palletNumber
|
|
||||||
'pending_pallet_list' => null,//$pendingPallet
|
|
||||||
'Sno_quantity' => 0,//$count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$updated = CoilPacking::where('coil_packing_number', $palletNumber)
|
|
||||||
->where('plant_id', $plantId)
|
|
||||||
->update([
|
|
||||||
'coil_packing_status' => 'Completed',
|
|
||||||
'updated_at' => now(),
|
|
||||||
'updated_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($updated > 0)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Pallet number '$palletNumber' completed the coil packing successfully!")
|
|
||||||
->success()
|
|
||||||
->duration(800)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', '', $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => null,//$palletNumber
|
|
||||||
'pending_pallet_list' => null,//$pendingPallet
|
|
||||||
'Sno_quantity' => 0,//$count
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processPalletNo()
|
|
||||||
{
|
|
||||||
$plantId = $this->form->getState()['plant_id'];
|
|
||||||
|
|
||||||
$plantId = trim($plantId) ?? null;
|
|
||||||
|
|
||||||
$pendingPallet = $this->form->getState()['pending_pallet_list'];
|
|
||||||
|
|
||||||
$palletNumber = trim($this->form->getState()['coil_packing_number']) ?? null;
|
|
||||||
|
|
||||||
$palletNumber = trim($palletNumber) ?? null;
|
|
||||||
|
|
||||||
$processOrder = trim($this->form->getState()['process_order']) ?? null;
|
|
||||||
|
|
||||||
$processOrder = trim($processOrder) ?? null;
|
|
||||||
|
|
||||||
$user = Filament::auth()->user();
|
|
||||||
|
|
||||||
$operatorName = $user->name;
|
|
||||||
|
|
||||||
//$this->dispatch('loadData', $palletNumber, $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'pallet_number' => $palletNumber,
|
|
||||||
'pending_pallet_list' => $pendingPallet,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (!$palletNumber)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title('Pallet number is required.')
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', '', $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'pending_pallet_list' => $pendingPallet,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($palletNumber) < 10)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Pallet number '$palletNumber' must be at least 10 digits.")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadLocator' ,'',$plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'serial_number' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'pallet_number' => $palletNumber,
|
|
||||||
'pending_pallet_list' => $pendingPallet,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('coil_packing_number', $palletNumber)
|
|
||||||
->count('coil_packing_number');
|
|
||||||
|
|
||||||
|
|
||||||
$palletNotCompleted = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('coil_packing_number', $palletNumber)
|
|
||||||
->where('coil_packing_status', '=','')
|
|
||||||
->orWhere('coil_packing_status', '=',null)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if (!$palletNotCompleted)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Already completed for pallet number $palletNumber!")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'pending_pallet_list' => $pendingPallet,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'pending_pallet_list' => $pendingPallet,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRemoveSNo()
|
|
||||||
{
|
|
||||||
$plantId = $this->form->getState()['plant_id'];
|
|
||||||
|
|
||||||
$plantId = trim($plantId) ?? null;
|
|
||||||
|
|
||||||
$pendingPallet = $this->form->getState()['pending_pallet_list'];
|
|
||||||
|
|
||||||
$palletNumber = trim($this->form->getState()['coil_packing_number']) ?? null;
|
|
||||||
|
|
||||||
$palletNumber = trim($palletNumber) ?? null;
|
|
||||||
|
|
||||||
$processOrder = trim($this->form->getState()['removeSno_number']) ?? null;
|
|
||||||
|
|
||||||
$processOrder = trim($processOrder) ?? null;
|
|
||||||
|
|
||||||
$user = Filament::auth()->user();
|
|
||||||
|
|
||||||
$operatorName = $user->name;
|
|
||||||
|
|
||||||
if (!$palletNumber)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title('Coil Pallet number is required to remove.')
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pattern = '/^([^|]+)\|([^|]+)$/';
|
|
||||||
|
|
||||||
if (!preg_match($pattern, $processOrder, $matches))
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Scan Valid Qr code ")
|
|
||||||
->body("Expected Format : (MaterialCode|Coil Number)")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'removeSno_number' => null,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$materialCode = $matches[1];
|
|
||||||
$coilNo = $matches[2];
|
|
||||||
|
|
||||||
$count = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('coil_packing_number', $palletNumber)
|
|
||||||
->count('coil_packing_number');
|
|
||||||
|
|
||||||
|
|
||||||
if (!$coilNo)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title('Coil number is required to remove.')
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'removeSno_number' => null,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'pending_pallet_list' => $pendingPallet,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$item = Item::where('plant_id', $plantId)->where('code', $materialCode)->first();
|
|
||||||
|
|
||||||
if(!$item){
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Item Code')
|
|
||||||
->body("Item code {$materialCode} was not found in the Item Master.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'removeSno_number' => null,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemCodeInPallet = CoilPacking::where('plant_id', $plantId)->where('item_id', $item->id)->where('coil_packing_number', $palletNumber)->first();
|
|
||||||
|
|
||||||
if(!$itemCodeInPallet){
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown Item Code')
|
|
||||||
->body("Item code {$materialCode} was not found in the pallet number '$palletNumber'.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'removeSno_number' => null,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemCodeInPalletSerial = CoilPacking::where('plant_id', $plantId)->where('item_id', $item->id)->where('coil_packing_number', $palletNumber)->where('process_order', $coilNo)->first();
|
|
||||||
|
|
||||||
if(!$itemCodeInPalletSerial){
|
|
||||||
Notification::make()
|
|
||||||
->title('Mismatch Item Code')
|
|
||||||
->body("Item code {$materialCode} mismatch with serial number was not found in the pallet number '$palletNumber'.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'removeSno_number' => null,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$processOrderexist = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('process_order', $coilNo)
|
|
||||||
->first();
|
|
||||||
if (!$processOrderexist)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title('Coil Number not exists in pallet table.')
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'removeSno_number' => null,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'pending_pallet_list' => $pendingPallet,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$palletExist = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('process_order', $coilNo)
|
|
||||||
->where('coil_packing_number', '!=', '')
|
|
||||||
->where('coil_packing_number', '!=', null)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if ($palletExist && $palletExist->coil_packing_number != $palletNumber)
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Scanned coil number exist in pallet number '$palletExist->coil_packing_number'.<br>Scan the valid exist coil number to remove!")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'removeSno_number' => null,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'pending_pallet_list' => $pendingPallet,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$deleted = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('coil_packing_number', $palletNumber)
|
|
||||||
->where('process_order', $coilNo)
|
|
||||||
->forceDelete();
|
|
||||||
|
|
||||||
if ($deleted)
|
|
||||||
{
|
|
||||||
// Notification::make()
|
|
||||||
// ->title("Scanned serial number '$serialNumber' successfully removed from pallet table!<br>Scan the next exist serial number to remove...")
|
|
||||||
// ->success()
|
|
||||||
// ->duration(600)
|
|
||||||
// ->send();
|
|
||||||
|
|
||||||
$this->snoCount = CoilPacking::where('plant_id', $plantId)
|
|
||||||
->where('coil_packing_number', $palletNumber)
|
|
||||||
->count();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'removeSno_number' => null,
|
|
||||||
'pending_pallet_list' => $this->pendingPallet,
|
|
||||||
'Sno_quantity' => $this->snoCount,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Notification::make()
|
|
||||||
->title("Failed to remove scanned process order '$processOrder' from master pallet!")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'removeSno_number' => null,
|
|
||||||
'coil_packing_number' => $palletNumber,
|
|
||||||
'pending_pallet_list' => $pendingPallet,
|
|
||||||
'Sno_quantity' => $count,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function redirectToCoilQrPdf($palletNo)
|
|
||||||
{
|
|
||||||
$this->palletNo = $this->form->getState()['coil_packing_number'];
|
|
||||||
|
|
||||||
//return redirect()->route('download-qr-pdf', ['palletNo' => $this->palletNo]);
|
|
||||||
$url = route('download-coil-qr-pdf', ['palletNo' => $this->palletNo]);
|
|
||||||
$this->js(<<<JS
|
|
||||||
window.dispatchEvent(new CustomEvent('open-pdf', {
|
|
||||||
detail: {
|
|
||||||
url: "{$url}"
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
JS);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormActions(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\CoilPackingResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\CoilPackingResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\EditRecord;
|
|
||||||
|
|
||||||
class EditCoilPacking extends EditRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = CoilPackingResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\ViewAction::make(),
|
|
||||||
Actions\DeleteAction::make(),
|
|
||||||
Actions\ForceDeleteAction::make(),
|
|
||||||
Actions\RestoreAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\CoilPackingResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\CoilPackingResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ListRecords;
|
|
||||||
|
|
||||||
class ListCoilPackings extends ListRecords
|
|
||||||
{
|
|
||||||
protected static string $resource = CoilPackingResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\CreateAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\CoilPackingResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\CoilPackingResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ViewRecord;
|
|
||||||
|
|
||||||
class ViewCoilPacking extends ViewRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = CoilPackingResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\EditAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -976,6 +976,7 @@ class PanelBoxValidationResource extends Resource
|
|||||||
->hint(fn ($get) => $get('validationError') ? $get('validationError') : null)
|
->hint(fn ($get) => $get('validationError') ? $get('validationError') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
Forms\Components\Hidden::make('serial_exists')
|
Forms\Components\Hidden::make('serial_exists')
|
||||||
|
// ->default(false)
|
||||||
->live()
|
->live()
|
||||||
->dehydrated()
|
->dehydrated()
|
||||||
->id('serial_exists'),
|
->id('serial_exists'),
|
||||||
@@ -995,7 +996,6 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
$pOrder = $get('production_order');
|
$pOrder = $get('production_order');
|
||||||
$inspecLotNo = $get('inspection_lot_number');
|
$inspecLotNo = $get('inspection_lot_number');
|
||||||
$supplierNo = $get('panel_box_supplier');
|
|
||||||
|
|
||||||
$alreadyExists = PanelBoxValidation::where('serial_number', $serialNumber)
|
$alreadyExists = PanelBoxValidation::where('serial_number', $serialNumber)
|
||||||
->where('plant_id', $plantId)
|
->where('plant_id', $plantId)
|
||||||
@@ -1003,10 +1003,6 @@ class PanelBoxValidationResource extends Resource
|
|||||||
->where('inspection_lot_number', $inspecLotNo)
|
->where('inspection_lot_number', $inspecLotNo)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$alreadyExistsSupplier = PanelBoxValidation::where('serial_number', $serialNumber)
|
|
||||||
->where('plant_id', $plantId)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if ($alreadyExists) {
|
if ($alreadyExists) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Duplicate Found')
|
->title('Duplicate Found')
|
||||||
@@ -1020,29 +1016,18 @@ class PanelBoxValidationResource extends Resource
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if($alreadyExistsSupplier)
|
|
||||||
{
|
|
||||||
if($alreadyExistsSupplier->panel_box_supplier != $supplierNo){
|
|
||||||
Notification::make()
|
|
||||||
->title('Supplier Mismatch')
|
|
||||||
->body(
|
|
||||||
'Supplier number does not match the existing record for this serial number. Please check the supplier number.'
|
|
||||||
)
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$livewire->showChecklist = false;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = $get();
|
$data = $get();
|
||||||
|
|
||||||
$hasCharacteristics = $livewire->checkIfHasCharacteristics($data);
|
$hasCharacteristics = $livewire->checkIfHasCharacteristics($data);
|
||||||
|
|
||||||
|
\Log::info('CHARACTERISTICS RESULT', [
|
||||||
|
'hasCharacteristics' => $hasCharacteristics,
|
||||||
|
]);
|
||||||
|
|
||||||
if ($hasCharacteristics) {
|
if ($hasCharacteristics) {
|
||||||
|
|
||||||
|
\Log::info('SETTING SHOW CHECKLIST TRUE');
|
||||||
|
|
||||||
$livewire->showChecklist = true;
|
$livewire->showChecklist = true;
|
||||||
$livewire->dispatch('close-modal');
|
$livewire->dispatch('close-modal');
|
||||||
return;
|
return;
|
||||||
@@ -1121,8 +1106,7 @@ class PanelBoxValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $extracted = trim(end($parts));
|
$extracted = trim(end($parts));
|
||||||
$extracted = trim(implode('/', array_slice($parts, 2)));
|
|
||||||
|
|
||||||
$expected = $get('serial_number');
|
$expected = $get('serial_number');
|
||||||
|
|
||||||
@@ -1179,22 +1163,18 @@ class PanelBoxValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode('/', $state);
|
if (!preg_match('/^\d+\/\d+\/\d+\/\d+$/', $state)) {
|
||||||
|
|
||||||
if (count($parts) < 3) {
|
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('pack_slip_panel_qr', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$extracted = trim(implode('/', array_slice($parts, 2)));
|
$parts = explode('/', $state);
|
||||||
|
$extracted = trim(end($parts));
|
||||||
$expected = $get('serial_number');
|
|
||||||
|
|
||||||
if ($extracted == '') {
|
if ($extracted == '') {
|
||||||
$set('packSlipPanelError', "SerialNumber can't be empty!");
|
$set('packSlipPanelError', "SerialNumber can't be empty!");
|
||||||
@@ -1202,6 +1182,8 @@ class PanelBoxValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$expected = $get('serial_number');
|
||||||
|
|
||||||
if ($extracted != $expected) {
|
if ($extracted != $expected) {
|
||||||
$set('packSlipPanelError', 'Pack Slip Panel serial does not match.');
|
$set('packSlipPanelError', 'Pack Slip Panel serial does not match.');
|
||||||
$set('pack_slip_panel', null);
|
$set('pack_slip_panel', null);
|
||||||
@@ -1211,13 +1193,13 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('packSlipPanelError', null);
|
$set('packSlipPanelError', null);
|
||||||
$set('pack_slip_panel_qr', $extracted);
|
$set('pack_slip_panel_qr', $extracted);
|
||||||
$set('pack_slip_panel', '1');
|
$set('pack_slip_panel', '1');
|
||||||
$panelParts = explode('/', $state);
|
$panelParts = array_map('trim', explode('/', $state));
|
||||||
|
|
||||||
if (count($panelParts) < 3) {
|
if (count($panelParts) != 4) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
@@ -1226,7 +1208,9 @@ class PanelBoxValidationResource extends Resource
|
|||||||
|
|
||||||
$supplier = $panelParts[0];
|
$supplier = $panelParts[0];
|
||||||
$panelBoxCode = $panelParts[1];
|
$panelBoxCode = $panelParts[1];
|
||||||
$panelBoxSerialNo = implode('/', array_slice($panelParts, 2));
|
$yearMonth = $panelParts[2];
|
||||||
|
$serialNumber = $panelParts[3];
|
||||||
|
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
||||||
|
|
||||||
$set('panel_box_supplier', $supplier);
|
$set('panel_box_supplier', $supplier);
|
||||||
$set('panel_box_serial_number', $panelBoxSerialNo);
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
@@ -1254,22 +1238,18 @@ class PanelBoxValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode('/', $state);
|
if (!preg_match('/^\d+\/\d+\/\d+\/\d+$/', $state)) {
|
||||||
|
|
||||||
if (count($parts) < 3) {
|
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('serial_number_panel_qr', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$extracted = trim(implode('/', array_slice($parts, 2)));
|
$parts = explode('/', $state);
|
||||||
|
$extracted = trim(end($parts));
|
||||||
$expected = $get('serial_number');
|
|
||||||
|
|
||||||
if ($extracted == '') {
|
if ($extracted == '') {
|
||||||
$set('namePlatePanelError', "SerialNumber cant't be empty!");
|
$set('namePlatePanelError', "SerialNumber cant't be empty!");
|
||||||
@@ -1288,13 +1268,13 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('namePlatePanelError', null);
|
$set('namePlatePanelError', null);
|
||||||
$set('name_plate_panel_qr', $extracted);
|
$set('name_plate_panel_qr', $extracted);
|
||||||
$set('name_plate_panel', '1');
|
$set('name_plate_panel', '1');
|
||||||
$panelParts = explode('/', $state);
|
$panelParts = array_map('trim', explode('/', $state));
|
||||||
|
|
||||||
if (count($panelParts) < 3) {
|
if (count($panelParts) != 4) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
@@ -1303,7 +1283,9 @@ class PanelBoxValidationResource extends Resource
|
|||||||
|
|
||||||
$supplier = $panelParts[0];
|
$supplier = $panelParts[0];
|
||||||
$panelBoxCode = $panelParts[1];
|
$panelBoxCode = $panelParts[1];
|
||||||
$panelBoxSerialNo = implode('/', array_slice($panelParts, 2));
|
$yearMonth = $panelParts[2];
|
||||||
|
$serialNumber = $panelParts[3];
|
||||||
|
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
||||||
|
|
||||||
$set('panel_box_supplier', $supplier);
|
$set('panel_box_supplier', $supplier);
|
||||||
$set('panel_box_serial_number', $panelBoxSerialNo);
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
@@ -1331,20 +1313,18 @@ class PanelBoxValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode('/', $state);
|
if (!preg_match('/^\d+\/\d+\/\d+\/\d+$/', $state)) {
|
||||||
|
|
||||||
if (count($parts) < 3) {
|
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('serial_number_panel_qr', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$extracted = trim(implode('/', array_slice($parts, 2)));
|
$parts = explode('/', $state);
|
||||||
|
$extracted = trim(end($parts));
|
||||||
|
|
||||||
if ($extracted == '') {
|
if ($extracted == '') {
|
||||||
$set('tubeStickerPanelError', "SerialNumber can't be empty!");
|
$set('tubeStickerPanelError', "SerialNumber can't be empty!");
|
||||||
@@ -1363,13 +1343,13 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('tubeStickerPanelError', null);
|
$set('tubeStickerPanelError', null);
|
||||||
$set('tube_sticker_panel_qr', $extracted);
|
$set('tube_sticker_panel_qr', $extracted);
|
||||||
$set('tube_sticker_panel', '1');
|
$set('tube_sticker_panel', '1');
|
||||||
$panelParts = explode('/', $state);
|
$panelParts = array_map('trim', explode('/', $state));
|
||||||
|
|
||||||
if (count($panelParts) < 3) {
|
if (count($panelParts) != 4) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
@@ -1378,7 +1358,9 @@ class PanelBoxValidationResource extends Resource
|
|||||||
|
|
||||||
$supplier = $panelParts[0];
|
$supplier = $panelParts[0];
|
||||||
$panelBoxCode = $panelParts[1];
|
$panelBoxCode = $panelParts[1];
|
||||||
$panelBoxSerialNo = implode('/', array_slice($panelParts, 2));
|
$yearMonth = $panelParts[2];
|
||||||
|
$serialNumber = $panelParts[3];
|
||||||
|
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
||||||
|
|
||||||
$set('panel_box_supplier', $supplier);
|
$set('panel_box_supplier', $supplier);
|
||||||
$set('panel_box_serial_number', $panelBoxSerialNo);
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
@@ -1407,20 +1389,18 @@ class PanelBoxValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode('/', $state);
|
if (!preg_match('/^\d+\/\d+\/\d+\/\d+$/', $state)) {
|
||||||
|
|
||||||
if (count($parts) < 3) {
|
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('serial_number_panel_qr', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$extracted = trim(implode('/', array_slice($parts, 2)));
|
$parts = explode('/', $state);
|
||||||
|
$extracted = trim(end($parts));
|
||||||
|
|
||||||
if ($extracted == '') {
|
if ($extracted == '') {
|
||||||
$set('warrantyCardPanelError', "SerialNumber can't be empty!");
|
$set('warrantyCardPanelError', "SerialNumber can't be empty!");
|
||||||
@@ -1439,13 +1419,13 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('warrantyCardPanelError', null);
|
$set('warrantyCardPanelError', null);
|
||||||
$set('warranty_card_qr', $extracted);
|
$set('warranty_card_qr', $extracted);
|
||||||
$set('warranty_card_panel', '1');
|
$set('warranty_card_panel', '1');
|
||||||
$panelParts = explode('/', $state);
|
$panelParts = array_map('trim', explode('/', $state));
|
||||||
|
|
||||||
if (count($panelParts) < 3) {
|
if (count($panelParts) != 4) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
@@ -1454,7 +1434,9 @@ class PanelBoxValidationResource extends Resource
|
|||||||
|
|
||||||
$supplier = $panelParts[0];
|
$supplier = $panelParts[0];
|
||||||
$panelBoxCode = $panelParts[1];
|
$panelBoxCode = $panelParts[1];
|
||||||
$panelBoxSerialNo = implode('/', array_slice($panelParts, 2));
|
$yearMonth = $panelParts[2];
|
||||||
|
$serialNumber = $panelParts[3];
|
||||||
|
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
||||||
|
|
||||||
$set('panel_box_supplier', $supplier);
|
$set('panel_box_supplier', $supplier);
|
||||||
$set('panel_box_serial_number', $panelBoxSerialNo);
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
@@ -1886,16 +1868,6 @@ class PanelBoxValidationResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('status')
|
|
||||||
->label('Status')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable()
|
|
||||||
->color(fn (string $state): string => match ($state) {
|
|
||||||
'Ok' => 'success',
|
|
||||||
'NotOk' => 'danger',
|
|
||||||
default => 'gray',
|
|
||||||
}),
|
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->label('Created At')
|
->label('Created At')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -2014,13 +1986,6 @@ class PanelBoxValidationResource extends Resource
|
|||||||
0 => 'No',
|
0 => 'No',
|
||||||
])
|
])
|
||||||
->reactive(),
|
->reactive(),
|
||||||
Select::make('status')
|
|
||||||
->label('Status')
|
|
||||||
->options([
|
|
||||||
'Ok' => 'Ok',
|
|
||||||
'NotOk' => 'Not Ok',
|
|
||||||
])
|
|
||||||
->reactive(),
|
|
||||||
DateTimePicker::make(name: 'created_from')
|
DateTimePicker::make(name: 'created_from')
|
||||||
->label('Created From')
|
->label('Created From')
|
||||||
->placeholder('Select From DateTime')
|
->placeholder('Select From DateTime')
|
||||||
@@ -2034,7 +1999,7 @@ class PanelBoxValidationResource extends Resource
|
|||||||
])
|
])
|
||||||
->query(function ($query, array $data) {
|
->query(function ($query, array $data) {
|
||||||
// Hide all records initially if no filters are applied
|
// Hide all records initially if no filters are applied
|
||||||
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['production_order']) && empty($data['serial_number']) && empty($data['inspection_lot_number']) && empty($data['panel_box_code']) && empty($data['rework_count']) && empty($data['status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['production_order']) && empty($data['serial_number']) && empty($data['inspection_lot_number']) && empty($data['panel_box_code']) && empty($data['rework_count']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||||
return $query->whereRaw('1 = 0');
|
return $query->whereRaw('1 = 0');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2087,10 +2052,6 @@ class PanelBoxValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['status'])) {
|
|
||||||
$query->where('status', $data['status']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['created_from'])) {
|
if (! empty($data['created_from'])) {
|
||||||
$query->where('created_at', '>=', $data['created_from']);
|
$query->where('created_at', '>=', $data['created_from']);
|
||||||
}
|
}
|
||||||
@@ -2137,10 +2098,6 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$indicators[] = 'Panel Box Code: '.$data['panel_box_code'];
|
$indicators[] = 'Panel Box Code: '.$data['panel_box_code'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['status'])) {
|
|
||||||
$indicators[] = 'Status: '.$data['status'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['created_from'])) {
|
if (! empty($data['created_from'])) {
|
||||||
$indicators[] = 'From: '.$data['created_from'];
|
$indicators[] = 'From: '.$data['created_from'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class ProductionOrderResource extends Resource
|
|||||||
return ($userHas && strlen($userHas) > 0) ? optional(ProductionOrder::where('plant_id', $userHas)->latest()->first())->item_id : optional(ProductionOrder::latest()->first())->item_id;
|
return ($userHas && strlen($userHas) > 0) ? optional(ProductionOrder::where('plant_id', $userHas)->latest()->first())->item_id : optional(ProductionOrder::latest()->first())->item_id;
|
||||||
})
|
})
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function ($state, callable $set, $get) {
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
$set('quantity', null);
|
$set('quantity', null);
|
||||||
$set('show_extra_fields', false);
|
$set('show_extra_fields', false);
|
||||||
$set('start_date', null);
|
$set('start_date', null);
|
||||||
@@ -291,11 +291,6 @@ class ProductionOrderResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('print_status')
|
|
||||||
->label('Status')
|
|
||||||
->searchable()
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->label('Created At')
|
->label('Created At')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
|
|||||||
@@ -437,27 +437,17 @@ class RequestCharacteristicResource extends Resource
|
|||||||
})
|
})
|
||||||
->required()
|
->required()
|
||||||
->disabled(fn (Get $get) => ! empty($get('id'))),
|
->disabled(fn (Get $get) => ! empty($get('id'))),
|
||||||
Forms\Components\Select::make('model_type')
|
Forms\Components\TextInput::make('model_type')
|
||||||
->label('Model Type')
|
->label('Model Type')
|
||||||
->reactive()
|
->reactive()
|
||||||
->nullable()
|
->nullable()
|
||||||
->searchable()
|
|
||||||
->required()
|
|
||||||
->options(function () {
|
|
||||||
return [
|
|
||||||
'MOTOR' => 'MOTOR',
|
|
||||||
'PUMP' => 'PUMP',
|
|
||||||
'NAME_PLATE' => 'NAME_PLATE',
|
|
||||||
'UNKNOWN' => 'UNKNOWN',
|
|
||||||
];
|
|
||||||
})
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('characteristic_name', null);
|
$set('characteristic_name', null);
|
||||||
$set('current_value', null);
|
$set('current_value', null);
|
||||||
$set('update_value', null);
|
$set('update_value', null);
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
})
|
})
|
||||||
->default('MOTOR')
|
->required()
|
||||||
->disabled(fn (Get $get) => ! empty($get('id'))),
|
->disabled(fn (Get $get) => ! empty($get('id'))),
|
||||||
Section::make('Request Characteristic Details')
|
Section::make('Request Characteristic Details')
|
||||||
// ->columnSpan(['default' => 2, 'sm' => 4])
|
// ->columnSpan(['default' => 2, 'sm' => 4])
|
||||||
@@ -1318,23 +1308,9 @@ class RequestCharacteristicResource extends Resource
|
|||||||
TextInput::make('master_characteristic_field')
|
TextInput::make('master_characteristic_field')
|
||||||
->label('Master Characteristic Field')
|
->label('Master Characteristic Field')
|
||||||
->placeholder('Enter Master Characteristic Field'),
|
->placeholder('Enter Master Characteristic Field'),
|
||||||
Select::make('model_type')
|
TextInput::make('model_type')
|
||||||
->label('Search by Model Type')
|
->label('Model Type')
|
||||||
->nullable()
|
->placeholder('Enter Model Type'),
|
||||||
->searchable()
|
|
||||||
->reactive()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
|
||||||
$plantId = $get('Plant');
|
|
||||||
|
|
||||||
if ($userHas && strlen($userHas) > 0) {
|
|
||||||
return RequestCharacteristic::where('plant_id', $userHas)->pluck('model_type', 'model_type')->toArray();
|
|
||||||
} elseif ($plantId) {
|
|
||||||
return RequestCharacteristic::where('plant_id', $plantId)->select('model_type')->distinct()->pluck('model_type', 'model_type');
|
|
||||||
} else {
|
|
||||||
return RequestCharacteristic::select('model_type')->distinct()->pluck('model_type', 'model_type');
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
Select::make('approver_status')
|
Select::make('approver_status')
|
||||||
->label('Approver Status')
|
->label('Approver Status')
|
||||||
->options([
|
->options([
|
||||||
@@ -1421,7 +1397,7 @@ class RequestCharacteristicResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['model_type'])) {
|
if (! empty($data['model_type'])) {
|
||||||
$query->where('model_type', $data['model_type']);
|
$query->where('model_type', 'like', '%'.$data['model_type'].'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['work_flow_id'])) {
|
if (! empty($data['work_flow_id'])) {
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ use App\Filament\Exports\StickerDetailExporter;
|
|||||||
use App\Filament\Imports\StickerDetailImporter;
|
use App\Filament\Imports\StickerDetailImporter;
|
||||||
use App\Filament\Resources\StickerDetailResource\Pages;
|
use App\Filament\Resources\StickerDetailResource\Pages;
|
||||||
use App\Filament\Resources\StickerDetailResource\RelationManagers;
|
use App\Filament\Resources\StickerDetailResource\RelationManagers;
|
||||||
use App\Models\Item;
|
|
||||||
use App\Models\ItemCharacteristic;
|
use App\Models\ItemCharacteristic;
|
||||||
use App\Models\Plant;
|
|
||||||
use App\Models\StickerDetail;
|
use App\Models\StickerDetail;
|
||||||
use App\Models\StickerStructureDetail;
|
use App\Models\StickerStructureDetail;
|
||||||
use Filament\Tables\Actions\ExportAction;
|
use Filament\Tables\Actions\ExportAction;
|
||||||
@@ -24,10 +22,6 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
use Filament\Tables\Filters\Filter;
|
|
||||||
use Filament\Forms\Components\Select;
|
|
||||||
use Filament\Forms\Components\DateTimePicker;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
|
|
||||||
class StickerDetailResource extends Resource
|
class StickerDetailResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -402,49 +396,7 @@ class StickerDetailResource extends Resource
|
|||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
Filter::make('advanced_filters')
|
|
||||||
->label('Advanced Filters')
|
|
||||||
->form([
|
|
||||||
Select::make('sticker_id')
|
|
||||||
->label('Sticker ID')
|
|
||||||
->reactive()
|
|
||||||
->options(
|
|
||||||
StickerStructureDetail::query()
|
|
||||||
->pluck('sticker_id', 'id')
|
|
||||||
->toArray()
|
|
||||||
)
|
|
||||||
->searchable()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
$set('process_order', null);
|
|
||||||
}),
|
|
||||||
])
|
|
||||||
->query(function ($query, array $data) {
|
|
||||||
// Hide all records initially if no filters are applied
|
|
||||||
if (empty($data['sticker_id'])) {
|
|
||||||
return $query->whereRaw('1 = 0');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['sticker_id'])) {
|
|
||||||
|
|
||||||
$stickerDetail = StickerStructureDetail::find($data['sticker_id']);
|
|
||||||
|
|
||||||
if ($stickerDetail) {
|
|
||||||
$query->where('sticker_structure_detail_id',$stickerDetail->id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// $query->orderBy('created_at', 'asc');
|
|
||||||
})
|
|
||||||
->indicateUsing(function (array $data) {
|
|
||||||
$indicators = [];
|
|
||||||
|
|
||||||
if (!empty($data['sticker_id'])) {
|
|
||||||
$indicators[] = 'Sticker ID: ' . StickerStructureDetail::where('id',$data['sticker_id'])->value('sticker_id');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $indicators;
|
|
||||||
}),
|
|
||||||
])
|
])
|
||||||
->filtersFormMaxHeight('280px')
|
|
||||||
->actions([
|
->actions([
|
||||||
Tables\Actions\ViewAction::make(),
|
Tables\Actions\ViewAction::make(),
|
||||||
Tables\Actions\EditAction::make(),
|
Tables\Actions\EditAction::make(),
|
||||||
|
|||||||
@@ -288,52 +288,6 @@ class PalletController extends Controller
|
|||||||
// $mpdf->Output('qr-label.pdf', 'I');
|
// $mpdf->Output('qr-label.pdf', 'I');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function downloadCoilQrPdf($palletNo)
|
|
||||||
{
|
|
||||||
$qrCode = new QrCode($palletNo);
|
|
||||||
$output = new Output\Png;
|
|
||||||
$qrBinary = $output->output($qrCode, 100);
|
|
||||||
$qrBase64 = base64_encode($qrBinary);
|
|
||||||
|
|
||||||
$htmlBlock = '
|
|
||||||
<table class="sticker-table">
|
|
||||||
<tr>
|
|
||||||
<td class="qr-cell">
|
|
||||||
<img class="qr" src="data:image/png;base64,'.$qrBase64.'" alt="QR" />
|
|
||||||
</td>
|
|
||||||
<td class="text-cell">
|
|
||||||
'.htmlspecialchars($palletNo).'
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>';
|
|
||||||
|
|
||||||
return '
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<style>
|
|
||||||
body { margin: 0; padding: 0; width: 50mm; height: auto; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
|
|
||||||
.sticker-table { width: 50mm; height: 60mm; border-collapse: collapse; page-break-after: always; }
|
|
||||||
.qr-cell { width: 50mm; text-align: right; vertical-align: bottom; padding-left: -8mm; padding-top: 0mm; }
|
|
||||||
.text-cell { text-align: left; vertical-align: middle; font-size: 22pt; padding-left: 1mm; padding-top: 18mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
|
|
||||||
img.qr { width: 40mm; height: 40mm; display: block; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
'.$htmlBlock.$htmlBlock.'
|
|
||||||
<script>
|
|
||||||
window.onload = function () {
|
|
||||||
window.print();
|
|
||||||
setTimeout(function () {
|
|
||||||
window.close();
|
|
||||||
}, 1000); // Wait 1 second before closing
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Livewire;
|
|
||||||
|
|
||||||
use App\Models\CoilPacking;
|
|
||||||
use Livewire\Component;
|
|
||||||
|
|
||||||
class CoilPackDataTable extends Component
|
|
||||||
{
|
|
||||||
|
|
||||||
public $plantId;
|
|
||||||
|
|
||||||
public $coilPackNo;
|
|
||||||
|
|
||||||
public $snoCount = 0;
|
|
||||||
|
|
||||||
public $records = [];
|
|
||||||
|
|
||||||
protected $listeners = [
|
|
||||||
'loadData' => 'loadCoilData',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function loadCoilData($coilPackNo, $plantId)
|
|
||||||
{
|
|
||||||
$this->plantId = $plantId;
|
|
||||||
$this->coilPackNo = $coilPackNo;
|
|
||||||
$this->records = [];
|
|
||||||
|
|
||||||
$this->records = CoilPacking::query()
|
|
||||||
->where('plant_id', $this->plantId)
|
|
||||||
->where('coil_packing_number', $this->coilPackNo)
|
|
||||||
->orderBy('scanned_at')
|
|
||||||
->get()
|
|
||||||
->map(function ($record) {
|
|
||||||
return [
|
|
||||||
'created_at' => $record->created_at,
|
|
||||||
'created_by' => $record->created_by ?? '',
|
|
||||||
'coil_packing_number' => $record->coil_packing_number,
|
|
||||||
'item_code' => $record->item?->code ?? '',
|
|
||||||
'item_description' => $record->item?->description ?? '',
|
|
||||||
'process_order' => $record->process_order,
|
|
||||||
'scanned_at' => $record->scanned_at,
|
|
||||||
'scanned_by' => $record->scanned_by ?? '',
|
|
||||||
];
|
|
||||||
})
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
}
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
return view('livewire.coil-pack-data-table');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -218,7 +218,7 @@ public $records = [];
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$qualityValidation = PanelBoxValidation::create([
|
$qualityValidation = PanelBoxValidation::create([
|
||||||
'plant_id' => $this->data['plant_id'] ?? null,
|
'plant_id' => $this->data['plant_id'] ?? null,
|
||||||
'line_id' => $this->data['line_id'] ?? null,
|
'line_id' => $this->data['line_id'] ?? null,
|
||||||
'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
|
'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
|
||||||
@@ -238,12 +238,36 @@ public $records = [];
|
|||||||
'panel_box_serial_number' => $this->data['panel_box_serial_number'] ?? null,
|
'panel_box_serial_number' => $this->data['panel_box_serial_number'] ?? null,
|
||||||
'panel_box_code' => $this->data['panel_box_code'] ?? null,
|
'panel_box_code' => $this->data['panel_box_code'] ?? null,
|
||||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||||
'status' => $this->selectForNotOk ? 'NotOk' : 'Ok',
|
|
||||||
'created_by' => $this->data['created_by'] ?? null,
|
'created_by' => $this->data['created_by'] ?? null,
|
||||||
'updated_by' => $this->data['updated_by'] ?? null,
|
'updated_by' => $this->data['updated_by'] ?? null,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $qualityValidation = PanelBoxValidation::create([
|
||||||
|
// 'plant_id' => $this->data['plant_id'] ?? null,
|
||||||
|
// 'line_id' => $this->data['line_id'] ?? null,
|
||||||
|
// 'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
|
||||||
|
// 'production_order' => $this->data['production_order'] ?? null,
|
||||||
|
// 'serial_number' => $this->data['serial_number'] ?? null,
|
||||||
|
// 'serial_number_panel' => $this->data['serial_number_panel'] ?? null,
|
||||||
|
// 'pack_slip_panel' => $this->data['pack_slip_panel'] ?? null,
|
||||||
|
// 'name_plate_panel' => $this->data['name_plate_panel'] ?? null,
|
||||||
|
// 'tube_sticker_panel' => $this->data['tube_sticker_panel'] ?? null,
|
||||||
|
// 'warranty_card_panel' => $this->data['warranty_card_panel'] ?? null,
|
||||||
|
// 'part_validation1' => $this->data['part_validation1'] ?? null,
|
||||||
|
// 'part_validation2' => $this->data['part_validation2'] ?? null,
|
||||||
|
// 'part_validation3' => $this->data['part_validation3'] ?? null,
|
||||||
|
// 'part_validation4' => $this->data['part_validation4'] ?? null,
|
||||||
|
// 'part_validation5' => $this->data['part_validation5'] ?? null,
|
||||||
|
// 'panel_box_supplier' => $this->data['panel_box_supplier'] ?? null,
|
||||||
|
// 'panel_box_serial_number' => $this->data['panel_box_serial_number'] ?? null,
|
||||||
|
// 'panel_box_code' => $this->data['panel_box_code'] ?? null,
|
||||||
|
// 'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||||
|
// 'created_by' => $this->data['created_by'] ?? null,
|
||||||
|
// 'updated_by' => $this->data['updated_by'] ?? null,
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
|
||||||
if (! $qualityValidation || ! $qualityValidation->exists) {
|
if (! $qualityValidation || ! $qualityValidation->exists) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Failed to save Panel Box Validation')
|
->title('Failed to save Panel Box Validation')
|
||||||
@@ -376,12 +400,15 @@ public $records = [];
|
|||||||
|
|
||||||
if ($mailRule && !empty($mailRule->email)) {
|
if ($mailRule && !empty($mailRule->email)) {
|
||||||
|
|
||||||
|
// $mail = Mail::to($mailRule->email);
|
||||||
|
|
||||||
$toEmails = array_filter(
|
$toEmails = array_filter(
|
||||||
array_map('trim', explode(',', $mailRule->email))
|
array_map('trim', explode(',', $mailRule->email))
|
||||||
);
|
);
|
||||||
|
|
||||||
$mail = Mail::to($toEmails);
|
$mail = Mail::to($toEmails);
|
||||||
|
|
||||||
|
|
||||||
if (!empty($mailRule->cc_emails)) {
|
if (!empty($mailRule->cc_emails)) {
|
||||||
$ccEmails = array_filter(
|
$ccEmails = array_filter(
|
||||||
array_map('trim', explode(',', $mailRule->cc_emails))
|
array_map('trim', explode(',', $mailRule->cc_emails))
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
|
|
||||||
class CoilPacking extends Model
|
|
||||||
{
|
|
||||||
use SoftDeletes;
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'plant_id',
|
|
||||||
'item_id',
|
|
||||||
'coil_packing_number',
|
|
||||||
'process_order',
|
|
||||||
'coil_packing_status',
|
|
||||||
'created_at',
|
|
||||||
'updated_at',
|
|
||||||
'scanned_at',
|
|
||||||
'created_by',
|
|
||||||
'updated_by',
|
|
||||||
'scanned_by',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function plant()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Plant::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function item()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Item::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,6 @@ class Item extends Model
|
|||||||
'description',
|
'description',
|
||||||
'hourly_quantity',
|
'hourly_quantity',
|
||||||
'uom',
|
'uom',
|
||||||
// 'type',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function plant()
|
public function plant()
|
||||||
@@ -119,9 +118,4 @@ class Item extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(PanelGrMaster::class, 'item_id', 'id');
|
return $this->hasMany(PanelGrMaster::class, 'item_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function coilPacking()
|
|
||||||
{
|
|
||||||
return $this->hasMany(CoilPacking::class, 'item_id', 'id');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ class PanelBoxValidation extends Model
|
|||||||
'panel_box_code',
|
'panel_box_code',
|
||||||
'inspection_lot_number',
|
'inspection_lot_number',
|
||||||
'rework_count',
|
'rework_count',
|
||||||
'status',
|
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_by'
|
'updated_by'
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -189,11 +189,6 @@ class Plant extends Model
|
|||||||
return $this->hasMany(TempClassCharacteristic::class, 'plant_id', 'id');
|
return $this->hasMany(TempClassCharacteristic::class, 'plant_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function tempStopCharacteristics()
|
|
||||||
// {
|
|
||||||
// return $this->hasMany(TempStopCharacteristic::class, 'plant_id', 'id');
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function users()
|
public function users()
|
||||||
{
|
{
|
||||||
return $this->hasMany(User::class, 'plant_id', 'id');
|
return $this->hasMany(User::class, 'plant_id', 'id');
|
||||||
@@ -233,9 +228,4 @@ class Plant extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(PanelBoxValidation::class, 'plant_id', 'id');
|
return $this->hasMany(PanelBoxValidation::class, 'plant_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function coilPacking()
|
|
||||||
{
|
|
||||||
return $this->hasMany(CoilPacking::class, 'plant_id', 'id');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ class ProductionOrder extends Model
|
|||||||
'production_order',
|
'production_order',
|
||||||
'from_serial_number',
|
'from_serial_number',
|
||||||
'to_serial_number',
|
'to_serial_number',
|
||||||
'print_status',
|
|
||||||
'print_panel_status',
|
|
||||||
'created_at',
|
'created_at',
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
|
|||||||
@@ -1,106 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Policies;
|
|
||||||
|
|
||||||
use Illuminate\Auth\Access\Response;
|
|
||||||
use App\Models\CoilPacking;
|
|
||||||
use App\Models\User;
|
|
||||||
|
|
||||||
class CoilPackingPolicy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view any models.
|
|
||||||
*/
|
|
||||||
public function viewAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('view-any CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view the model.
|
|
||||||
*/
|
|
||||||
public function view(User $user, CoilPacking $coilpacking): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('view CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can create models.
|
|
||||||
*/
|
|
||||||
public function create(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('create CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can update the model.
|
|
||||||
*/
|
|
||||||
public function update(User $user, CoilPacking $coilpacking): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('update CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete the model.
|
|
||||||
*/
|
|
||||||
public function delete(User $user, CoilPacking $coilpacking): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('delete CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete any models.
|
|
||||||
*/
|
|
||||||
public function deleteAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('delete-any CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore the model.
|
|
||||||
*/
|
|
||||||
public function restore(User $user, CoilPacking $coilpacking): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('restore CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore any models.
|
|
||||||
*/
|
|
||||||
public function restoreAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('restore-any CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can replicate the model.
|
|
||||||
*/
|
|
||||||
public function replicate(User $user, CoilPacking $coilpacking): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('replicate CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can reorder the models.
|
|
||||||
*/
|
|
||||||
public function reorder(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('reorder CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete the model.
|
|
||||||
*/
|
|
||||||
public function forceDelete(User $user, CoilPacking $coilpacking): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('force-delete CoilPacking');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete any models.
|
|
||||||
*/
|
|
||||||
public function forceDeleteAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('force-delete-any CoilPacking');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1042,327 +1042,6 @@ class StickerPdfService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateTemplate(string $stickerId,Collection $dynamicElements,?ItemCharacteristic $itemCharacteristic,$itemCode,$plantId)
|
|
||||||
{
|
|
||||||
$dynamicValueMap = [];
|
|
||||||
|
|
||||||
$itemCode = $itemCharacteristic?->item?->code ?? $itemCode ?? '';
|
|
||||||
|
|
||||||
$plantName = $itemCharacteristic?->plant?->name ?? '';
|
|
||||||
$plantAddress = $itemCharacteristic?->plant?->address ?? '';
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($dynamicElements as $element) {
|
|
||||||
|
|
||||||
$column = $element->characteristics_type;
|
|
||||||
|
|
||||||
$value = '';
|
|
||||||
|
|
||||||
if ($itemCharacteristic && $column && Schema::hasColumn('item_characteristics', $column))
|
|
||||||
{
|
|
||||||
$value = $itemCharacteristic->{$column};
|
|
||||||
}
|
|
||||||
|
|
||||||
$dynamicValueMap[$element->id] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$structure = StickerStructureDetail::where('sticker_id',$stickerId)->firstOrFail();
|
|
||||||
|
|
||||||
$elements = StickerDetail::where('sticker_structure_detail_id',$structure->id)->get();
|
|
||||||
|
|
||||||
$templateElements = [];
|
|
||||||
|
|
||||||
foreach ($elements as $row) {
|
|
||||||
|
|
||||||
if ($row->design_element_type == 'Text') {
|
|
||||||
|
|
||||||
$textValue = $row->string_value ?? '';
|
|
||||||
|
|
||||||
if ($row->element_type == 'Dynamic' && isset($dynamicValueMap[$row->id]) &&
|
|
||||||
!in_array($row->characteristics_type, [
|
|
||||||
'item_code',
|
|
||||||
'serial_number',
|
|
||||||
'plant_name',
|
|
||||||
'plant_address',
|
|
||||||
'current_date',
|
|
||||||
])
|
|
||||||
)
|
|
||||||
{
|
|
||||||
$textValue = $dynamicValueMap[$row->id];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($row->characteristics_type == 'item_code') {
|
|
||||||
$textValue = $itemCode;
|
|
||||||
}
|
|
||||||
if ($row->characteristics_type == 'serial_number') {
|
|
||||||
$textValue = '__SERIAL_NUMBER__';
|
|
||||||
}
|
|
||||||
if ($row->characteristics_type === 'plant_name') {
|
|
||||||
$textValue = $plantName;
|
|
||||||
}
|
|
||||||
if ($row->characteristics_type === 'plant_address') {
|
|
||||||
$textValue = $plantAddress;
|
|
||||||
}
|
|
||||||
if ($row->characteristics_type === 'current_date') {
|
|
||||||
$textValue = date('M-y');
|
|
||||||
}
|
|
||||||
$font = $row->string_font ?? 'helvetica';
|
|
||||||
|
|
||||||
if (str_contains($row->string_value ?? '', '₹')) {
|
|
||||||
$font = 'dejavusans';
|
|
||||||
}
|
|
||||||
|
|
||||||
$templateElements[] =
|
|
||||||
[
|
|
||||||
'type' => 'text',
|
|
||||||
'value' => $textValue,
|
|
||||||
'x' => (float) ($row->string_x_value ?? 0),
|
|
||||||
'y' => (float) ($row->string_y_value ?? 0),
|
|
||||||
'font' => $font,
|
|
||||||
'size' => (int) ($row->string_size ?? 10),
|
|
||||||
'color' => $row->element_colour ?? '#000000',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
elseif ($row->design_element_type == 'QR') {
|
|
||||||
|
|
||||||
if ($row->element_type == 'Dynamic') {
|
|
||||||
$qrValue = '__DYNAMIC_QR__';
|
|
||||||
} else {
|
|
||||||
$qrValue = $row->qr_value ?? '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$templateElements[] = [
|
|
||||||
'type' => 'qr',
|
|
||||||
'value' => $qrValue,
|
|
||||||
'x' => (float) ($row->qr_x_value ?? 0),
|
|
||||||
'y' => (float) ($row->qr_y_value ?? 0),
|
|
||||||
'size' => (float) ($row->qr_size ?? 10),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
elseif ($row->design_element_type == 'Image') {
|
|
||||||
|
|
||||||
$imagePath = null;
|
|
||||||
|
|
||||||
if ($row->element_type == 'Dynamic' && isset($dynamicValueMap[$row->id]) && !empty($dynamicValueMap[$row->id]))
|
|
||||||
{
|
|
||||||
$imageName = strtolower($dynamicValueMap[$row->id]) . '.png';
|
|
||||||
|
|
||||||
$imagePath = public_path('images/' . ltrim($imageName, '/'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$templateElements[] = [
|
|
||||||
'type' => 'image',
|
|
||||||
'path' => $imagePath,
|
|
||||||
'x' => (float) ($row->image_x ?? 0),
|
|
||||||
'y' => (float) ($row->image_y ?? 0),
|
|
||||||
'width' => (float) ($row->image_width ?? 0),
|
|
||||||
'height' => (float) ($row->image_height ?? 0),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
elseif ($row->design_element_type == 'Shape') {
|
|
||||||
|
|
||||||
$templateElements[] = [
|
|
||||||
'type' => 'shape',
|
|
||||||
'name' => $row->shape_name,
|
|
||||||
'pen_size' => (float) ($row->shape_pen_size ?? ''),
|
|
||||||
'color' => $row->element_colour ?? '#000000',
|
|
||||||
'x1' => (float) ($row->shape_x1_value ?? 0),
|
|
||||||
'y1' => (float) ($row->shape_y1_value ?? 0),
|
|
||||||
'x2' => (float) ($row->shape_x2_value ?? 0),
|
|
||||||
'y2' => (float) ($row->shape_y2_value ?? 0),
|
|
||||||
'radius' => (float) ($row->curve_radius ?? ''),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return prepared template. No PDF generation here.
|
|
||||||
return [
|
|
||||||
'width' => (float) $structure->sticker_width,
|
|
||||||
'height' => (float) $structure->sticker_height,
|
|
||||||
'lmargin' => (float) $structure->sticker_lmargin,
|
|
||||||
'tmargin' => (float) $structure->sticker_tmargin,
|
|
||||||
'rmargin' => (float) $structure->sticker_rmargin,
|
|
||||||
'bmargin' => (float) $structure->sticker_bmargin,
|
|
||||||
'itemCode' => $itemCode,
|
|
||||||
'elements' => $templateElements,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function generateBulkFromTemplate(array $template,$fromSerial,$toSerial,string $itemCode)
|
|
||||||
{
|
|
||||||
$stickerWidth = (float) $template['width'];
|
|
||||||
$stickerHeight = (float) $template['height'];
|
|
||||||
|
|
||||||
$gap = 5.0;
|
|
||||||
|
|
||||||
$count = ($toSerial - $fromSerial) + 1;
|
|
||||||
|
|
||||||
$totalHeight =
|
|
||||||
($stickerHeight * $count)
|
|
||||||
+
|
|
||||||
($gap * ($count - 1));
|
|
||||||
|
|
||||||
$pdf = new TCPDF(
|
|
||||||
'P',
|
|
||||||
'mm',
|
|
||||||
[
|
|
||||||
$stickerWidth,
|
|
||||||
$totalHeight
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
'UTF-8',
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
$pdf->setPrintHeader(false);
|
|
||||||
$pdf->setPrintFooter(false);
|
|
||||||
|
|
||||||
$pdf->SetMargins(
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
$pdf->SetAutoPageBreak(false, 0);
|
|
||||||
|
|
||||||
$pdf->AddPage();
|
|
||||||
|
|
||||||
$currentY = 0;
|
|
||||||
|
|
||||||
// Generate every serial
|
|
||||||
|
|
||||||
for ($serial = $fromSerial; $serial <= $toSerial; $serial++)
|
|
||||||
{
|
|
||||||
$qrContent = $itemCode . '|' . $serial;
|
|
||||||
|
|
||||||
foreach ($template['elements'] as $element) {
|
|
||||||
|
|
||||||
if ($element['type'] == 'text') {
|
|
||||||
|
|
||||||
$textValue = $element['value'];
|
|
||||||
|
|
||||||
if ($textValue == '__SERIAL_NUMBER__') {
|
|
||||||
$textValue = (string) $serial;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pdf->SetFont($element['font'],'',$element['size']);
|
|
||||||
|
|
||||||
$rgb = $this->hexToRgb($element['color']);
|
|
||||||
|
|
||||||
$pdf->SetTextColor(
|
|
||||||
$rgb[0],
|
|
||||||
$rgb[1],
|
|
||||||
$rgb[2]
|
|
||||||
);
|
|
||||||
|
|
||||||
$pdf->Text(
|
|
||||||
$element['x'],
|
|
||||||
$element['y'] + $currentY,
|
|
||||||
(string) $textValue
|
|
||||||
);
|
|
||||||
}
|
|
||||||
elseif ($element['type'] == 'qr') {
|
|
||||||
|
|
||||||
$qrValue = $element['value'];
|
|
||||||
|
|
||||||
if ($qrValue == '__DYNAMIC_QR__') {
|
|
||||||
$qrValue = $qrContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pdf->write2DBarcode(
|
|
||||||
$qrValue,
|
|
||||||
'QRCODE,H',
|
|
||||||
$element['x'],
|
|
||||||
$element['y'] + $currentY,
|
|
||||||
$element['size'],
|
|
||||||
$element['size']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
elseif ($element['type'] == 'image') {
|
|
||||||
|
|
||||||
if (!empty($element['path']) && file_exists($element['path']))
|
|
||||||
{
|
|
||||||
|
|
||||||
$pdf->Image(
|
|
||||||
$element['path'],
|
|
||||||
$element['x'],
|
|
||||||
$element['y'] + $currentY,
|
|
||||||
$element['width'],
|
|
||||||
$element['height']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif ($element['type'] == 'shape') {
|
|
||||||
|
|
||||||
$rgb = $this->hexToRgb(
|
|
||||||
$element['color']
|
|
||||||
);
|
|
||||||
|
|
||||||
$pdf->SetDrawColor(
|
|
||||||
$rgb[0],
|
|
||||||
$rgb[1],
|
|
||||||
$rgb[2]
|
|
||||||
);
|
|
||||||
|
|
||||||
$pdf->SetLineWidth(
|
|
||||||
$element['pen_size']
|
|
||||||
);
|
|
||||||
if ($element['name'] == 'Line') {
|
|
||||||
|
|
||||||
$pdf->Line(
|
|
||||||
$element['x1'],
|
|
||||||
$element['y1'] + $currentY,
|
|
||||||
$element['x2'],
|
|
||||||
$element['y2'] + $currentY
|
|
||||||
);
|
|
||||||
}
|
|
||||||
elseif ($element['name'] == 'Rectangle') {
|
|
||||||
|
|
||||||
$x = min($element['x1'],$element['x2']);
|
|
||||||
$y = min($element['y1'],$element['y2']);
|
|
||||||
|
|
||||||
$width = abs($element['x2'] - $element['x1']);
|
|
||||||
|
|
||||||
$height = abs($element['y2'] - $element['y1']);
|
|
||||||
|
|
||||||
$pdf->Rect(
|
|
||||||
$x,
|
|
||||||
$y + $currentY,
|
|
||||||
$width,
|
|
||||||
$height,
|
|
||||||
'D'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
elseif ($element['name'] == 'CurvedRectangle')
|
|
||||||
{
|
|
||||||
$x = min($element['x1'],$element['x2']);
|
|
||||||
$y = min($element['y1'],$element['y2']);
|
|
||||||
|
|
||||||
$width = abs($element['x2'] - $element['x1']);
|
|
||||||
|
|
||||||
$height = abs($element['y2'] - $element['y1']);
|
|
||||||
|
|
||||||
$pdf->RoundedRect(
|
|
||||||
$x,
|
|
||||||
$y + $currentY,
|
|
||||||
$width,
|
|
||||||
$height,
|
|
||||||
$element['radius'],
|
|
||||||
'1111',
|
|
||||||
'D'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$currentY += $stickerHeight + $gap;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $pdf->Output('', 'S');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function generatePdfBySerial($item, $serNo, $plantId, $refNumber)
|
public function generatePdfBySerial($item, $serNo, $plantId, $refNumber)
|
||||||
{
|
{
|
||||||
$recFound = ProductionQuantity::where('plant_id', $plantId)
|
$recFound = ProductionQuantity::where('plant_id', $plantId)
|
||||||
@@ -1467,7 +1146,7 @@ class StickerPdfService
|
|||||||
|
|
||||||
private function hexToRgb($hex)
|
private function hexToRgb($hex)
|
||||||
{
|
{
|
||||||
if (! is_string($hex) || ($hex = trim($hex)) == '') {
|
if (! is_string($hex) || ($hex = trim($hex)) === '') {
|
||||||
return [0, 0, 0];
|
return [0, 0, 0];
|
||||||
}
|
}
|
||||||
$hex = ltrim($hex, '#');
|
$hex = ltrim($hex, '#');
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"diogogpinto/filament-auth-ui-enhancer": "^1.0",
|
"diogogpinto/filament-auth-ui-enhancer": "^1.0",
|
||||||
"erag/laravel-pwa": "^1.9",
|
"erag/laravel-pwa": "^1.9",
|
||||||
"filament/filament": "^3.3",
|
"filament/filament": "^3.3",
|
||||||
"intervention/image": "^3.11",
|
"intervention/image": "^4.0",
|
||||||
"irazasyed/telegram-bot-sdk": "^3.15",
|
"irazasyed/telegram-bot-sdk": "^3.15",
|
||||||
"laravel/framework": "^11.31",
|
"laravel/framework": "^11.31",
|
||||||
"laravel/pulse": "^1.7",
|
"laravel/pulse": "^1.7",
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
$sql1 = <<<'SQL'
|
|
||||||
ALTER TABLE production_orders
|
|
||||||
ADD COLUMN print_status TEXT DEFAULT NULL
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
DB::statement($sql1);
|
|
||||||
|
|
||||||
$sql2 = <<<'SQL'
|
|
||||||
ALTER TABLE production_orders
|
|
||||||
ADD COLUMN print_panel_status TEXT DEFAULT NULL
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
DB::statement($sql2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
// Schema::table('production_orders', function (Blueprint $table) {
|
|
||||||
// //
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
$sql1 = <<<'SQL'
|
|
||||||
ALTER TABLE panel_box_validations
|
|
||||||
ADD COLUMN status TEXT DEFAULT NULL
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
DB::statement($sql1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
// Schema::table('panel_box_validations', function (Blueprint $table) {
|
|
||||||
// //
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
$sql = <<<'SQL'
|
|
||||||
CREATE TABLE coil_packings (
|
|
||||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
|
||||||
|
|
||||||
plant_id BIGINT NOT NULL,
|
|
||||||
item_id BIGINT NOT NULL,
|
|
||||||
coil_packing_number TEXT DEFAULT NULL,
|
|
||||||
process_order TEXT DEFAULT NULL,
|
|
||||||
|
|
||||||
coil_packing_status TEXT DEFAULT NULL,
|
|
||||||
|
|
||||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
||||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
||||||
scanned_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
||||||
created_by TEXT DEFAULT NULL,
|
|
||||||
updated_by TEXT DEFAULT NULL,
|
|
||||||
scanned_by TEXT DEFAULT NULL,
|
|
||||||
deleted_at TIMESTAMP,
|
|
||||||
|
|
||||||
FOREIGN KEY (plant_id) REFERENCES plants(id),
|
|
||||||
FOREIGN KEY (item_id) REFERENCES items(id)
|
|
||||||
);
|
|
||||||
SQL;
|
|
||||||
DB::statement($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('coil_packings');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -240,24 +240,10 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view import locator validation']);
|
Permission::updateOrCreate(['name' => 'view import locator validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view export locator validation']);
|
Permission::updateOrCreate(['name' => 'view export locator validation']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view sticker print page']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import panel gr master']);
|
Permission::updateOrCreate(['name' => 'view import panel gr master']);
|
||||||
Permission::updateOrCreate(['name' => 'view export panel gr master']);
|
Permission::updateOrCreate(['name' => 'view export panel gr master']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import panel box validation']);
|
Permission::updateOrCreate(['name' => 'view sticker print page']);
|
||||||
Permission::updateOrCreate(['name' => 'view export panel box validation']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import sale order master']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export sale order master']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import spare packing']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export spare packing']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import coil packing']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export coil packing']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view panel box inspection stock page']);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
<x-filament-panels::page>
|
|
||||||
|
|
||||||
|
|
||||||
{{ $this->form }}
|
|
||||||
|
|
||||||
<div class="flex flex-row gap-2 mt-4">
|
|
||||||
{{-- <button
|
|
||||||
type="button"
|
|
||||||
wire:click="generateSticker"
|
|
||||||
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
|
||||||
>
|
|
||||||
Generate Sticker
|
|
||||||
</button> --}}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
wire:click="generateStickerId"
|
|
||||||
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
|
||||||
>
|
|
||||||
Generate Sticker ID
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- <script>
|
|
||||||
document.addEventListener('livewire:init', () => {
|
|
||||||
|
|
||||||
Livewire.on('open-sticker-pdf', (event) => {
|
|
||||||
|
|
||||||
console.log('PDF EVENT RECEIVED', event);
|
|
||||||
|
|
||||||
const urls = event.urls;
|
|
||||||
|
|
||||||
console.log('PDF URLs:', urls);
|
|
||||||
|
|
||||||
urls.forEach(url => {
|
|
||||||
window.open(url, '_blank');
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
</script> --}}
|
|
||||||
|
|
||||||
<script>
|
|
||||||
document.addEventListener('livewire:init', () => {
|
|
||||||
|
|
||||||
if (window.stickerPdfListenerRegistered) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.stickerPdfListenerRegistered = true;
|
|
||||||
|
|
||||||
Livewire.on('open-sticker-pdf', (event) => {
|
|
||||||
|
|
||||||
const urls = event.urls || [];
|
|
||||||
|
|
||||||
if (!urls.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
urls.forEach((url, index) => {
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
|
|
||||||
const link = document.createElement('a');
|
|
||||||
|
|
||||||
link.href = url;
|
|
||||||
|
|
||||||
link.download = '';
|
|
||||||
|
|
||||||
document.body.appendChild(link);
|
|
||||||
|
|
||||||
link.click();
|
|
||||||
|
|
||||||
document.body.removeChild(link);
|
|
||||||
|
|
||||||
}, index * 1000);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</x-filament-panels::page>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<x-filament-panels::page>
|
|
||||||
|
|
||||||
<div class="space-y-4">
|
|
||||||
<div class="space-y-4">
|
|
||||||
{{ $this->form }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</x-filament-panels::page>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
|
|
||||||
<x-filament::page>
|
|
||||||
|
|
||||||
<div class="filament-form space-y-6">
|
|
||||||
{{ $this->form }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bg-white shadow rounded-xl p-4">
|
|
||||||
<livewire:coil-pack-data-table />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="filament-actions mt-6">
|
|
||||||
<x-filament::actions>
|
|
||||||
@foreach ($this->getFormActions() as $action)
|
|
||||||
{{ $action }}
|
|
||||||
@endforeach
|
|
||||||
</x-filament::actions>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@push('scripts')
|
|
||||||
<script>
|
|
||||||
window.addEventListener('open-pdf', event => {
|
|
||||||
const url = event.detail.url;
|
|
||||||
const win = window.open(url, '_blank');
|
|
||||||
if (!win || win.closed || typeof win.closed == 'undefined') {
|
|
||||||
alert('Popup blocked. Please allow popups for this site.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@endpush
|
|
||||||
</x-filament::page>
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<div class="flex flex-col items-start space-y-1">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
id="is_completed"
|
|
||||||
wire:model.defer="data.is_completed"
|
|
||||||
class="focus:outline-none focus:ring-0 focus:border-transparent border-gray-300"
|
|
||||||
>
|
|
||||||
<label for="is_completed" style="margin-left:2mm;" class="whitespace-nowrap mb-0">
|
|
||||||
Is Completed!
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
wire:click="markAsComplete"
|
|
||||||
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
|
||||||
>
|
|
||||||
Save Pallet
|
|
||||||
</button>
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<div class="p-4">
|
|
||||||
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
|
||||||
CP DATA TABLE:
|
|
||||||
</h2>
|
|
||||||
<div class="overflow-x-auto rounded-lg shadow">
|
|
||||||
<table class="w-full divide-y divide-gray-200 text-sm text-center">
|
|
||||||
<thead class="bg-gray-100 text-s font-semibold uppercase text-gray-700">
|
|
||||||
<tr>
|
|
||||||
<th class="border px-4 py-2">No</th>
|
|
||||||
<th class="border px-4 py-2">Created Datetime</th>
|
|
||||||
<th class="border px-4 py-2 whitespace-nowrap">Created By</th>
|
|
||||||
<th class="border px-4 py-2 whitespace-nowrap">CPacking No</th>
|
|
||||||
<th class="border px-4 py-2 whitespace-nowrap">Item Code</th>
|
|
||||||
<th class="border px-4 py-2">Description</th>
|
|
||||||
<th class="border px-4 py-2">Coil No</th>
|
|
||||||
<th class="border px-4 py-2">Scanned Datetime</th>
|
|
||||||
<th class="border px-4 py-2 whitespace-nowrap">Scanned By</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="divide-y divide-gray-100">
|
|
||||||
@forelse ($records as $index => $record)
|
|
||||||
<tr class="hover:bg-gray-50">
|
|
||||||
<td class="border px-4 py-2">{{ $index + 1 }}</td>
|
|
||||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['created_at'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['created_by'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['coil_packing_number'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2">{{ $record['item_code'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['item_description'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['process_order'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['scanned_at'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2">{{ $record['scanned_by'] ?? '-' }}</td>
|
|
||||||
</tr>
|
|
||||||
@empty
|
|
||||||
<tr>
|
|
||||||
<td colspan="10" class="px-4 py-4 text-center text-gray-500">
|
|
||||||
No coil packing records found.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforelse
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
@@ -83,14 +83,13 @@
|
|||||||
.po-long {
|
.po-long {
|
||||||
font-size: 8pt;
|
font-size: 8pt;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: right !important;
|
text-align: left !important;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 5pt;
|
right: 5pt;
|
||||||
top: 8pt;
|
top: 8pt;
|
||||||
width: 69pt;
|
width: 69pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 5 */
|
|
||||||
/* .desc {
|
/* .desc {
|
||||||
font-size: 6pt;
|
font-size: 6pt;
|
||||||
margin-left: -5pt;
|
margin-left: -5pt;
|
||||||
@@ -105,7 +104,6 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding-top: 15pt;
|
padding-top: 15pt;
|
||||||
margin-left: -5pt;
|
margin-left: -5pt;
|
||||||
width: 125pt;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
.po-long {
|
.po-long {
|
||||||
font-size: 8pt;
|
font-size: 8pt;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: right !important;
|
text-align: left !important;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 5pt;
|
right: 5pt;
|
||||||
top: 8pt;
|
top: 8pt;
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ Route::get('laser/characteristics/check', [CharacteristicsController::class, 'ch
|
|||||||
|
|
||||||
Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
||||||
|
|
||||||
// ..Marked / Stopped serial (auto or manual)
|
// ..Marked serial (auto or manual)
|
||||||
|
|
||||||
Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
||||||
|
|
||||||
@@ -224,12 +224,10 @@ Route::post('laser/characteristics/status', [CharacteristicsController::class, '
|
|||||||
|
|
||||||
Route::post('laser/winded-serial/status', [CharacteristicsController::class, 'storeLaserWindStatus']);
|
Route::post('laser/winded-serial/status', [CharacteristicsController::class, 'storeLaserWindStatus']);
|
||||||
|
|
||||||
// ..Request Characteristics / Quality - Store
|
// ..Request Characteristics
|
||||||
|
|
||||||
Route::post('laser/characteristics/change', [CharacteristicsController::class, 'storeLaserRequestChar']);
|
Route::post('laser/characteristics/change', [CharacteristicsController::class, 'storeLaserRequestChar']);
|
||||||
|
|
||||||
// ..Request and Stop / Characteristics / Quality - Status
|
|
||||||
|
|
||||||
Route::get('laser/characteristics/request', [CharacteristicsController::class, 'getLaserRequestChar']);
|
Route::get('laser/characteristics/request', [CharacteristicsController::class, 'getLaserRequestChar']);
|
||||||
|
|
||||||
Route::post('laser-doc-pdf', [PdfController::class, 'storeLaserPdf']);
|
Route::post('laser-doc-pdf', [PdfController::class, 'storeLaserPdf']);
|
||||||
@@ -279,7 +277,3 @@ Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);
|
|||||||
Route::get('item-code', [PlantController::class, 'getItemCode']);
|
Route::get('item-code', [PlantController::class, 'getItemCode']);
|
||||||
|
|
||||||
// Route::post('laser-stop-report', [SapFileController::class, 'laserStopReport']);
|
// Route::post('laser-stop-report', [SapFileController::class, 'laserStopReport']);
|
||||||
|
|
||||||
//..Coil Packing
|
|
||||||
|
|
||||||
Route::get('/download-coil-qr-pdf/{palletNo}', [PalletController::class, 'downloadCoilQrPdf'])->name('download-coil-qr-pdf');
|
|
||||||
|
|||||||
Reference in New Issue
Block a user