Compare commits
1 Commits
64c5b87dee
...
renovate/e
| Author | SHA1 | Date | |
|---|---|---|---|
| c841ff830d |
@@ -337,7 +337,7 @@ class Scheduler extends Command
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Daily':
|
case 'Daily':
|
||||||
if (now()->format('H:i') == '08:00') {
|
if (now()->format('H:i') == '11:30') {
|
||||||
try {
|
try {
|
||||||
\Artisan::call('send-import-transit', [
|
\Artisan::call('send-import-transit', [
|
||||||
'schedule_type' => $rule->schedule_type,
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
|||||||
@@ -53,12 +53,50 @@ class SendImportTransit extends Command
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $todayRecordExists = ImportTransit::whereDate('created_at', now()->toDateString())->first();
|
||||||
|
|
||||||
|
// if (!$todayRecordExists) {
|
||||||
|
// $this->info('No records created today. Mail not sent.');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $tableData = ImportTransit::select([
|
||||||
|
// 'cri_rfq_number',
|
||||||
|
// 'mail_received_date',
|
||||||
|
// 'pricol_ref_number',
|
||||||
|
// 'requester',
|
||||||
|
// 'shipper',
|
||||||
|
// 'shipper_location',
|
||||||
|
// 'shipper_invoice',
|
||||||
|
// 'shipper_invoice_date',
|
||||||
|
// 'customs_agent_name',
|
||||||
|
// 'eta_date',
|
||||||
|
// 'status',
|
||||||
|
// 'delivery_location',
|
||||||
|
// 'etd_date',
|
||||||
|
// 'mode',
|
||||||
|
// 'inco_terms',
|
||||||
|
// 'port_of_loading',
|
||||||
|
// 'port_of_discharge',
|
||||||
|
// 'delivery_city',
|
||||||
|
// 'packages',
|
||||||
|
// 'type_of_package',
|
||||||
|
// 'gross_weight',
|
||||||
|
// 'volume',
|
||||||
|
// 'bill_number',
|
||||||
|
// 'bill_received_date',
|
||||||
|
// 'vessel_number',
|
||||||
|
// 'remark',
|
||||||
|
// 'is_transit_identified',
|
||||||
|
// ])
|
||||||
|
// ->where('status', '!=', 'Delivered')
|
||||||
|
// ->get();
|
||||||
|
|
||||||
$tableData = ImportTransit::where('status', '!=', 'Delivered')->orderByRaw("
|
$tableData = ImportTransit::where('status', '!=', 'Delivered')->orderByRaw("
|
||||||
CASE
|
CAST(
|
||||||
WHEN cri_rfq_number ~ '[0-9]+'
|
regexp_replace(cri_rfq_number, '.*-([0-9]+).*', '\\1')
|
||||||
THEN CAST(regexp_replace(cri_rfq_number, '[^0-9]', '', 'g') AS INTEGER)
|
AS INTEGER
|
||||||
ELSE NULL
|
)
|
||||||
END NULLS LAST
|
|
||||||
")->get();
|
")->get();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -77,48 +77,42 @@ class GuardPatrolEntryResource extends Resource
|
|||||||
])
|
])
|
||||||
->hint(fn ($get) => $get('gPePlantError') ? $get('gPePlantError') : null)
|
->hint(fn ($get) => $get('gPePlantError') ? $get('gPePlantError') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
// Forms\Components\Select::make('guard_name_id')
|
Forms\Components\Select::make('guard_name_id')
|
||||||
// ->label('Guard Name')
|
|
||||||
// // ->relationship('guardNames', 'name')
|
|
||||||
// ->options(function (callable $get) {
|
|
||||||
// $plantId = $get('plant_id');
|
|
||||||
// if (! $plantId) {
|
|
||||||
// return [];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return GuardName::where('plant_id', $plantId)
|
|
||||||
// ->pluck('name', 'id')
|
|
||||||
// ->toArray();
|
|
||||||
// })
|
|
||||||
// ->required()
|
|
||||||
// ->reactive()
|
|
||||||
// ->default(function () {
|
|
||||||
// return optional(GuardPatrolEntry::where('created_by', Filament::auth()->user()?->name)->latest()->first())->guard_name_id;
|
|
||||||
// })
|
|
||||||
// ->disabled(fn (Get $get) => ! empty($get('id')))
|
|
||||||
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
// $guardName = $get('guard_name_id');
|
|
||||||
// if (! $guardName) {
|
|
||||||
// $set('gPeGuardNameError', 'Please select a guard name first.');
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// } else {
|
|
||||||
// $set('patrol_time', now()->format('Y-m-d H:i:s'));
|
|
||||||
// $set('updated_by', Filament::auth()->user()?->name);
|
|
||||||
// $set('gPeGuardNameError', null);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// ->extraAttributes(fn ($get) => [
|
|
||||||
// 'class' => $get('gPeGuardNameError') ? 'border-red-500' : '',
|
|
||||||
// ])
|
|
||||||
// ->hint(fn ($get) => $get('gPeGuardNameError') ? $get('gPeGuardNameError') : null)
|
|
||||||
// ->hintColor('danger'),
|
|
||||||
Forms\Components\TextInput::make('guard_name')
|
|
||||||
->label('Guard Name')
|
->label('Guard Name')
|
||||||
->default(fn () => Filament::auth()->user()?->name)
|
// ->relationship('guardNames', 'name')
|
||||||
->readOnly()
|
->options(function (callable $get) {
|
||||||
->dehydrated(),
|
$plantId = $get('plant_id');
|
||||||
|
if (! $plantId) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return GuardName::where('plant_id', $plantId)
|
||||||
|
->pluck('name', 'id')
|
||||||
|
->toArray();
|
||||||
|
})
|
||||||
|
->required()
|
||||||
|
->reactive()
|
||||||
|
->default(function () {
|
||||||
|
return optional(GuardPatrolEntry::where('created_by', Filament::auth()->user()?->name)->latest()->first())->guard_name_id;
|
||||||
|
})
|
||||||
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$guardName = $get('guard_name_id');
|
||||||
|
if (! $guardName) {
|
||||||
|
$set('gPeGuardNameError', 'Please select a guard name first.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
$set('patrol_time', now()->format('Y-m-d H:i:s'));
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
$set('gPeGuardNameError', null);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->extraAttributes(fn ($get) => [
|
||||||
|
'class' => $get('gPeGuardNameError') ? 'border-red-500' : '',
|
||||||
|
])
|
||||||
|
->hint(fn ($get) => $get('gPeGuardNameError') ? $get('gPeGuardNameError') : null)
|
||||||
|
->hintColor('danger'),
|
||||||
Forms\Components\Hidden::make('check_point_name')// TextInput
|
Forms\Components\Hidden::make('check_point_name')// TextInput
|
||||||
->label('Check Point Name')
|
->label('Check Point Name')
|
||||||
->reactive()
|
->reactive()
|
||||||
@@ -129,88 +123,50 @@ class GuardPatrolEntryResource extends Resource
|
|||||||
->extraAttributes([
|
->extraAttributes([
|
||||||
'x-on:keydown.enter.prevent' => '$wire.processCheckPointName()',
|
'x-on:keydown.enter.prevent' => '$wire.processCheckPointName()',
|
||||||
]),
|
]),
|
||||||
// Forms\Components\Select::make('check_point_name_id')
|
Forms\Components\Select::make('check_point_name_id')
|
||||||
// ->label('Check Point Name')
|
|
||||||
// // ->relationship('checkPointNames', 'name')
|
|
||||||
// ->options(function (callable $get) {
|
|
||||||
// $plantId = $get('plant_id');
|
|
||||||
// if (! $plantId) {
|
|
||||||
// return [];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return CheckPointName::where('plant_id', $plantId)
|
|
||||||
// ->pluck('name', 'id')
|
|
||||||
// ->toArray();
|
|
||||||
// })
|
|
||||||
// ->required()
|
|
||||||
// ->reactive()
|
|
||||||
// // ->default(function () {
|
|
||||||
// // return optional(GuardPatrolEntry::where('created_by', Filament::auth()->user()?->name)->latest()->first())->check_point_name_id;
|
|
||||||
// // })
|
|
||||||
// ->disabled(fn (Get $get) => ! empty($get('id')))
|
|
||||||
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
// $checkPointName = $get('check_point_name_id');
|
|
||||||
// if (! $checkPointName) {
|
|
||||||
// $set('check_point_name_id', null);
|
|
||||||
// $set('gPeCheckPointNameError', 'Please select a check point name first.');
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// } else {
|
|
||||||
// $set('patrol_time', now()->format('Y-m-d H:i:s'));
|
|
||||||
// $set('updated_by', Filament::auth()->user()?->name);
|
|
||||||
// $set('gPeCheckPointNameError', null);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// ->extraAttributes(fn ($get) => [
|
|
||||||
// 'class' => $get('gPeCheckPointNameError') ? 'border-red-500' : '',
|
|
||||||
// ])
|
|
||||||
// ->hint(fn ($get) => $get('gPeCheckPointNameError') ? $get('gPeCheckPointNameError') : null)
|
|
||||||
// ->hintColor('danger')
|
|
||||||
// ->rule(function (callable $get) {
|
|
||||||
// return Rule::unique('guard_patrol_entries', 'check_point_name_id')
|
|
||||||
// ->where('guard_name_id', $get('guard_name_id'))
|
|
||||||
// ->where('patrol_time', now())
|
|
||||||
// ->where('plant_id', $get('plant_id'))
|
|
||||||
// ->ignore($get('id'));
|
|
||||||
// }),
|
|
||||||
|
|
||||||
Forms\Components\Hidden::make('check_point_name_id')
|
|
||||||
->dehydrated(true),
|
|
||||||
Forms\Components\TextInput::make('check_point_name')
|
|
||||||
->label('Check Point Name')
|
->label('Check Point Name')
|
||||||
|
// ->relationship('checkPointNames', 'name')
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$plantId = $get('plant_id');
|
||||||
|
if (! $plantId) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return CheckPointName::where('plant_id', $plantId)
|
||||||
|
->pluck('name', 'id')
|
||||||
|
->toArray();
|
||||||
|
})
|
||||||
->required()
|
->required()
|
||||||
->reactive()
|
->reactive()
|
||||||
|
// ->default(function () {
|
||||||
|
// return optional(GuardPatrolEntry::where('created_by', Filament::auth()->user()?->name)->latest()->first())->check_point_name_id;
|
||||||
|
// })
|
||||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$checkPointName = $get('check_point_name_id');
|
||||||
if (blank($state)) {
|
if (! $checkPointName) {
|
||||||
$set('check_point_name_id', null);
|
$set('check_point_name_id', null);
|
||||||
$set('gPeCheckPointNameError', 'Please enter a check point name.');
|
$set('gPeCheckPointNameError', 'Please select a check point name first.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
$set('patrol_time', now()->format('Y-m-d H:i:s'));
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
$set('gPeCheckPointNameError', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
$checkPoint = CheckPointName::where('plant_id', $get('plant_id'))
|
|
||||||
->whereRaw('LOWER(name) = ?', [strtolower(trim($state))])
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if (! $checkPoint) {
|
|
||||||
$set('check_point_name_id', null);
|
|
||||||
$set('gPeCheckPointNameError', 'Invalid check point name.');
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$set('check_point_name_id', $checkPoint->id);
|
|
||||||
$set('patrol_time', now()->format('Y-m-d H:i:s'));
|
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
|
||||||
$set('gPeCheckPointNameError', null);
|
|
||||||
})
|
})
|
||||||
->extraAttributes(fn ($get) => [
|
->extraAttributes(fn ($get) => [
|
||||||
'class' => $get('gPeCheckPointNameError') ? 'border-red-500' : '',
|
'class' => $get('gPeCheckPointNameError') ? 'border-red-500' : '',
|
||||||
])
|
])
|
||||||
->hint(fn ($get) => $get('gPeCheckPointNameError'))
|
->hint(fn ($get) => $get('gPeCheckPointNameError') ? $get('gPeCheckPointNameError') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger')
|
||||||
|
->rule(function (callable $get) {
|
||||||
|
return Rule::unique('guard_patrol_entries', 'check_point_name_id')
|
||||||
|
->where('guard_name_id', $get('guard_name_id'))
|
||||||
|
->where('patrol_time', now())
|
||||||
|
->where('plant_id', $get('plant_id'))
|
||||||
|
->ignore($get('id'));
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('reader_code')
|
Forms\Components\TextInput::make('reader_code')
|
||||||
->label('Reader Code')
|
->label('Reader Code')
|
||||||
->hidden(fn (Get $get) => ! $get('id'))
|
->hidden(fn (Get $get) => ! $get('id'))
|
||||||
|
|||||||
@@ -3,10 +3,6 @@
|
|||||||
namespace App\Filament\Resources\GuardPatrolEntryResource\Pages;
|
namespace App\Filament\Resources\GuardPatrolEntryResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\GuardPatrolEntryResource;
|
use App\Filament\Resources\GuardPatrolEntryResource;
|
||||||
use App\Models\CheckPointName;
|
|
||||||
use App\Models\CheckPointTime;
|
|
||||||
use App\Models\GuardName;
|
|
||||||
use App\Models\GuardPatrolEntry;
|
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
@@ -33,100 +29,6 @@ class CreateGuardPatrolEntry extends CreateRecord
|
|||||||
|
|
||||||
// public ?array $data = null;
|
// public ?array $data = null;
|
||||||
|
|
||||||
protected function mutateFormDataBeforeCreate(array $data): array
|
|
||||||
{
|
|
||||||
$guardId = GuardName::where(
|
|
||||||
'name',
|
|
||||||
Filament::auth()->user()?->name
|
|
||||||
)->value('id');
|
|
||||||
|
|
||||||
if (! $guardId) {
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Guard Name Not Matched')
|
|
||||||
->body('Logged-in user name was not found in Guard Name Master.')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->halt();
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['guard_name_id'] = $guardId;
|
|
||||||
|
|
||||||
$checkPoint = CheckPointName::where('plant_id', $data['plant_id'])
|
|
||||||
->where('name', trim($data['check_point_name']))
|
|
||||||
->value('id');
|
|
||||||
|
|
||||||
if (! $checkPoint) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Invalid Check Point')
|
|
||||||
->body('The entered check point name does not exist.')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->halt();
|
|
||||||
}
|
|
||||||
|
|
||||||
// $lastScan = GuardPatrolEntry::where('plant_id', $data['plant_id'])
|
|
||||||
// ->where('guard_name_id', $guardId)
|
|
||||||
// ->latest('id')
|
|
||||||
// ->first();
|
|
||||||
|
|
||||||
// if ($lastScan) {
|
|
||||||
|
|
||||||
// $previousPoint = $lastScan->check_point_name_id;
|
|
||||||
|
|
||||||
// $route = CheckPointTime::where('plant_id', $data['plant_id'])
|
|
||||||
// ->where('check_point1_id', $previousPoint)
|
|
||||||
// ->where('check_point2_id', $checkPoint->id)
|
|
||||||
// ->first();
|
|
||||||
|
|
||||||
|
|
||||||
// if (! $route) {
|
|
||||||
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Wrong Check Point Order')
|
|
||||||
// ->body('This checkpoint is not the next allowed point.')
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
|
|
||||||
// $this->halt();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
|
|
||||||
|
|
||||||
// // First scan must start from sequence 1
|
|
||||||
|
|
||||||
// $firstRoute = CheckPointTime::where('plant_id', $data['plant_id'])
|
|
||||||
// ->where('check_point2_id', $checkPoint->id)
|
|
||||||
// ->where('sequence_number', 1)
|
|
||||||
// ->first();
|
|
||||||
|
|
||||||
|
|
||||||
// if (! $firstRoute) {
|
|
||||||
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Invalid Starting Point')
|
|
||||||
// ->body('Patrol must start from the first checkpoint.')
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
|
|
||||||
// $this->halt();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$data['check_point_name_id'] = $checkPoint;
|
|
||||||
|
|
||||||
|
|
||||||
unset($data['check_point_name']);
|
|
||||||
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function processCheckPointName()
|
public function processCheckPointName()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,10 +24,6 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
use Filament\Tables\Actions\ImportAction;
|
use Filament\Tables\Actions\ImportAction;
|
||||||
use Filament\Forms\Components\DateTimePicker;
|
|
||||||
use Filament\Forms\Components\Select;
|
|
||||||
use Filament\Tables\Filters\Filter;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
// use PhpOffice\PhpSpreadsheet\IOFactory;
|
// use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
|
|
||||||
class ImportTransitResource extends Resource
|
class ImportTransitResource extends Resource
|
||||||
@@ -406,100 +402,7 @@ class ImportTransitResource extends Resource
|
|||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
Filter::make('advanced_filters')
|
|
||||||
->label('Advanced Filters')
|
|
||||||
->form([
|
|
||||||
TextInput::make('cri_rfq_number')
|
|
||||||
->label('CRI RFQ Number')
|
|
||||||
->reactive()
|
|
||||||
->placeholder('Enter Rfq Number')
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
|
||||||
$set('created_from', null);
|
|
||||||
$set('created_to', null);
|
|
||||||
}),
|
|
||||||
TextInput::make('status')
|
|
||||||
->label('Status')
|
|
||||||
->reactive()
|
|
||||||
->placeholder('Enter Status')
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
|
||||||
$set('created_from', null);
|
|
||||||
$set('created_to', null);
|
|
||||||
}),
|
|
||||||
Select::make('is_transit_identified')
|
|
||||||
->label('Is Transit Identified')
|
|
||||||
->reactive()
|
|
||||||
->options([
|
|
||||||
0 => 0,
|
|
||||||
1 => 1,
|
|
||||||
])
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
|
||||||
$set('created_from', null);
|
|
||||||
$set('created_to', null);
|
|
||||||
}),
|
|
||||||
DateTimePicker::make(name: 'created_from')
|
|
||||||
->label('Created From')
|
|
||||||
->placeholder(placeholder: 'Select From DateTime')
|
|
||||||
->reactive()
|
|
||||||
->native(false),
|
|
||||||
DateTimePicker::make('created_to')
|
|
||||||
->label('Created To')
|
|
||||||
->placeholder(placeholder: 'Select To DateTime')
|
|
||||||
->reactive()
|
|
||||||
->native(false),
|
|
||||||
])
|
|
||||||
->query(function ($query, array $data) {
|
|
||||||
// Hide all records initially if no filters are applied
|
|
||||||
if (empty($data['cri_rfq_number']) && empty($data['status']) && ! isset($data['is_transit_identified']) && empty($data['created_from']) && empty($data['created_to'])) {
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['cri_rfq_number'])) {
|
|
||||||
$query->where('cri_rfq_number', 'like', '%'.$data['cri_rfq_number'].'%');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['status'])) {
|
|
||||||
$query->where('status', 'like', '%'.$data['status'].'%');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($data['is_transit_identified'])) {
|
|
||||||
$query->where('is_transit_identified', $data['is_transit_identified']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['created_from'])) {
|
|
||||||
$query->where('created_at', '>=', $data['created_from']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['created_to'])) {
|
|
||||||
$query->where('created_at', '<=', $data['created_to']);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
->indicateUsing(function (array $data) {
|
|
||||||
$indicators = [];
|
|
||||||
|
|
||||||
if (! empty($data['cri_rfq_number'])) {
|
|
||||||
$indicators[] = 'CRI Rfq Number: '.$data['cri_rfq_number'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['status'])) {
|
|
||||||
$indicators[] = 'Status: '.$data['status'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($data['is_transit_identified'])) {
|
|
||||||
$indicators[] = 'Is Transit Identified: '.$data['is_transit_identified'];
|
|
||||||
}
|
|
||||||
|
|
||||||
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([
|
->actions([
|
||||||
Tables\Actions\ViewAction::make(),
|
Tables\Actions\ViewAction::make(),
|
||||||
Tables\Actions\EditAction::make(),
|
Tables\Actions\EditAction::make(),
|
||||||
|
|||||||
@@ -611,7 +611,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
'sticker_master_id' => $sticker->id,
|
'sticker_master_id' => $sticker->id,
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
'invoice_quantity' => 1,
|
|
||||||
'quantity' => 1,
|
'quantity' => 1,
|
||||||
'operator_id' => $operatorName,
|
'operator_id' => $operatorName,
|
||||||
'created_by' => $operatorName,
|
'created_by' => $operatorName,
|
||||||
@@ -654,7 +653,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
'sticker_master_id' => $sticker->id,
|
'sticker_master_id' => $sticker->id,
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
'invoice_quantity' => $bundleQty,
|
|
||||||
'quantity' => $bundleQty,
|
'quantity' => $bundleQty,
|
||||||
'operator_id' => $operatorName,
|
'operator_id' => $operatorName,
|
||||||
'created_by' => $operatorName,
|
'created_by' => $operatorName,
|
||||||
@@ -699,13 +697,11 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
// 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0
|
// 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0
|
||||||
// 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0
|
// 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0
|
||||||
// 0 = 0 + 0
|
// 0 = 0 + 0
|
||||||
// 4 = 1.5 + 2.5
|
|
||||||
$existQty = $existEmpQty + $existComQty;
|
$existQty = $existEmpQty + $existComQty;
|
||||||
|
|
||||||
// 8 <= 11 // 8 <= 8 // 8 <= 11 // 8 <= 9
|
// 8 <= 11 // 8 <= 8 // 8 <= 11 // 8 <= 9
|
||||||
// 8 <= 7 // 8 <= 7 // 8 <= 7 // 8 <= 7
|
// 8 <= 7 // 8 <= 7 // 8 <= 7 // 8 <= 7
|
||||||
// 0 <= 5
|
// 0 <= 5
|
||||||
// 4 <= 2
|
|
||||||
|
|
||||||
if ($existQty <= $totalExcelQty) {
|
if ($existQty <= $totalExcelQty) {
|
||||||
// 6 = 11 - 5 // 5 = 8 - 3 // 3 = 11 - 8 // 9 = 9 - 0
|
// 6 = 11 - 5 // 5 = 8 - 3 // 3 = 11 - 8 // 9 = 9 - 0
|
||||||
@@ -727,46 +723,29 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
'updated_by' => $operatorName,
|
'updated_by' => $operatorName,
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
|
|
||||||
->update([
|
|
||||||
'invoice_quantity' => $totalExcelQty,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$newQuan--;
|
$newQuan--;
|
||||||
$inserted++;
|
$inserted++;
|
||||||
} elseif ($newInsQty > 0) { // if ($sticker) // create
|
} elseif ($newInsQty > 0) { // if ($sticker) // create
|
||||||
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
|
|
||||||
->update([
|
|
||||||
'invoice_quantity' => $totalExcelQty,
|
|
||||||
]);
|
|
||||||
|
|
||||||
InvoiceValidation::create([
|
InvoiceValidation::create([
|
||||||
'sticker_master_id' => $sticker->id,
|
'sticker_master_id' => $sticker->id,
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
'invoice_quantity' => $totalExcelQty,
|
|
||||||
'quantity' => $newInsQty,
|
'quantity' => $newInsQty,
|
||||||
'operator_id' => $operatorName,
|
'operator_id' => $operatorName,
|
||||||
'created_by' => $operatorName,
|
'created_by' => $operatorName,
|
||||||
'updated_by' => $operatorName,
|
'updated_by' => $operatorName,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$inserted++;
|
$inserted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 8 > 7 // 8 > 7 // 8 > 7 // 8 > 7
|
// 8 > 7 // 8 > 7 // 8 > 7 // 8 > 7
|
||||||
// 4 > 2
|
|
||||||
else {
|
else {
|
||||||
// 2 = 7 - 5 // 4 = 7 - 3 // -1 = 7 - 8 // 7 = 7 - 0
|
// 2 = 7 - 5 // 4 = 7 - 3 // -1 = 7 - 8 // 7 = 7 - 0
|
||||||
// -0.5 = 2 - 2.5 //
|
|
||||||
$newInsQty = $totalExcelQty - $existComQty;
|
$newInsQty = $totalExcelQty - $existComQty;
|
||||||
|
|
||||||
// 3 > 0 // 5 > 0 // 0 > 0 // 8 > 0
|
// 3 > 0 // 5 > 0 // 0 > 0 // 8 > 0
|
||||||
// 1.5 > 0 //
|
if ($existEmpQty > 0) { // update
|
||||||
if ($newInsQty > 0 && $existEmpQty > 0) { // update
|
|
||||||
// 3 = 2 // 5 = 4 // 0 = -1 // 8 = 7
|
// 3 = 2 // 5 = 4 // 0 = -1 // 8 = 7
|
||||||
// 1.5 == -0.5 //
|
|
||||||
if ($existEmpQty == $newInsQty) {
|
if ($existEmpQty == $newInsQty) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -777,12 +756,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
'updated_by' => $operatorName,
|
'updated_by' => $operatorName,
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
|
|
||||||
->update([
|
|
||||||
'invoice_quantity' => $totalExcelQty,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$newQuan--;
|
$newQuan--;
|
||||||
$inserted++;
|
$inserted++;
|
||||||
} elseif ($newInsQty > 0) { // create
|
} elseif ($newInsQty > 0) { // create
|
||||||
@@ -790,18 +763,11 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
'sticker_master_id' => $sticker->id,
|
'sticker_master_id' => $sticker->id,
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
'invoice_quantity' => $totalExcelQty,
|
|
||||||
'quantity' => $newInsQty,
|
'quantity' => $newInsQty,
|
||||||
'operator_id' => $operatorName,
|
'operator_id' => $operatorName,
|
||||||
'created_by' => $operatorName,
|
'created_by' => $operatorName,
|
||||||
'updated_by' => $operatorName,
|
'updated_by' => $operatorName,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
|
|
||||||
->update([
|
|
||||||
'invoice_quantity' => $totalExcelQty,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$inserted++;
|
$inserted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1825,7 +1791,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
'sticker_master_id' => $sticker->id,
|
'sticker_master_id' => $sticker->id,
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
'invoice_quantity' => 1,
|
|
||||||
'quantity' => 1,
|
'quantity' => 1,
|
||||||
'operator_id' => $operatorName,
|
'operator_id' => $operatorName,
|
||||||
'created_by' => $operatorName,
|
'created_by' => $operatorName,
|
||||||
@@ -1861,7 +1826,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
'sticker_master_id' => $sticker->id,
|
'sticker_master_id' => $sticker->id,
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
'invoice_quantity' => $bundleQty,
|
|
||||||
'quantity' => $bundleQty,
|
'quantity' => $bundleQty,
|
||||||
'operator_id' => $operatorName,
|
'operator_id' => $operatorName,
|
||||||
'created_by' => $operatorName,
|
'created_by' => $operatorName,
|
||||||
@@ -1895,7 +1859,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
'sticker_master_id' => $sticker->id,
|
'sticker_master_id' => $sticker->id,
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
'invoice_quantity' => $totalExcelQty,
|
|
||||||
'quantity' => $totalExcelQty,
|
'quantity' => $totalExcelQty,
|
||||||
'operator_id' => $operatorName,
|
'operator_id' => $operatorName,
|
||||||
'created_by' => $operatorName,
|
'created_by' => $operatorName,
|
||||||
@@ -3384,7 +3347,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$createdDt = $record->created_at;
|
$createdDt = $record->created_at;
|
||||||
$stickMasterId = $record->sticker_master_id;
|
$stickMasterId = $record->sticker_master_id;
|
||||||
$curExistQty = $record->quantity;
|
$curExistQty = $record->quantity;
|
||||||
$curItemInvQty = $record->invoice_quantity;
|
|
||||||
// $curScanQty = 2;
|
// $curScanQty = 2;
|
||||||
|
|
||||||
if ($curExistQty > $curScanQty) { // 5 > 2
|
if ($curExistQty > $curScanQty) { // 5 > 2
|
||||||
@@ -3400,7 +3362,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
'serial_number' => $serialNumber,
|
'serial_number' => $serialNumber,
|
||||||
'batch_number' => $batchNumber,
|
'batch_number' => $batchNumber,
|
||||||
'invoice_quantity' => $curItemInvQty,
|
|
||||||
'quantity' => $curScanQty,
|
'quantity' => $curScanQty,
|
||||||
'created_at' => $createdDt,
|
'created_at' => $createdDt,
|
||||||
'operator_id' => $operatorName,
|
'operator_id' => $operatorName,
|
||||||
@@ -3584,7 +3545,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
|
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TN01/BOX22/SERIAL999 >> PANEL BOX QR
|
|
||||||
// /^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/
|
// /^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/
|
||||||
if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/', $serNo, $matches)) {
|
if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/', $serNo, $matches)) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use App\Filament\Exports\LineExporter;
|
|||||||
use App\Filament\Imports\LineImporter;
|
use App\Filament\Imports\LineImporter;
|
||||||
use App\Filament\Resources\LineResource\Pages;
|
use App\Filament\Resources\LineResource\Pages;
|
||||||
use App\Models\Block;
|
use App\Models\Block;
|
||||||
use App\Models\Item;
|
|
||||||
use App\Models\Line;
|
use App\Models\Line;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\WorkGroupMaster;
|
use App\Models\WorkGroupMaster;
|
||||||
@@ -25,11 +24,6 @@ use Illuminate\Database\Eloquent\Builder;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use Illuminate\Validation\Rules\Unique;
|
use Illuminate\Validation\Rules\Unique;
|
||||||
use Filament\Forms\Components\DateTimePicker;
|
|
||||||
use Filament\Forms\Components\FileUpload;
|
|
||||||
use Filament\Forms\Components\Select;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
use Filament\Tables\Filters\Filter;
|
|
||||||
|
|
||||||
class LineResource extends Resource
|
class LineResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -1190,207 +1184,7 @@ class LineResource extends Resource
|
|||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
Filter::make('advanced_filters')
|
|
||||||
->label('Advanced Filters')
|
|
||||||
->form([
|
|
||||||
Select::make('Plant')
|
|
||||||
->label('Search by Plant Name')
|
|
||||||
->nullable()
|
|
||||||
->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();
|
|
||||||
if ($userHas && strlen($userHas) > 0) {
|
|
||||||
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
|
||||||
} else {
|
|
||||||
return Plant::whereHas('items', function ($query) {
|
|
||||||
$query->whereNotNull('id');
|
|
||||||
})->orderBy('code')->pluck('name', 'id')->toArray();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
->searchable()
|
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
|
||||||
$set('code', null);
|
|
||||||
$set('operator_id', null);
|
|
||||||
}),
|
|
||||||
Select::make('name')
|
|
||||||
->label('Search by Line Name')
|
|
||||||
->nullable()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('Plant');
|
|
||||||
|
|
||||||
return $plantId ? Line::where('plant_id', $plantId)->pluck('name', 'id') : [];
|
|
||||||
})
|
|
||||||
->searchable()
|
|
||||||
->reactive(),
|
|
||||||
Select::make('type')
|
|
||||||
->label('Search by Line Type')
|
|
||||||
->nullable()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('Plant');
|
|
||||||
|
|
||||||
return $plantId ? Line::where('plant_id', $plantId)->distinct()->pluck('type', 'type')->toArray(): [];
|
|
||||||
|
|
||||||
})
|
|
||||||
->searchable()
|
|
||||||
->reactive(),
|
|
||||||
Select::make('work_group_id')
|
|
||||||
->label('Search by WorkGroupCenter')
|
|
||||||
->nullable()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('Plant');
|
|
||||||
|
|
||||||
$workGroupIds = Line::where('plant_id', $plantId)
|
|
||||||
->get([
|
|
||||||
'work_group1_id',
|
|
||||||
'work_group2_id',
|
|
||||||
'work_group3_id',
|
|
||||||
'work_group4_id',
|
|
||||||
'work_group5_id',
|
|
||||||
'work_group6_id',
|
|
||||||
'work_group7_id',
|
|
||||||
'work_group8_id',
|
|
||||||
'work_group9_id',
|
|
||||||
'work_group10_id',
|
|
||||||
])
|
|
||||||
->flatMap(function ($line) {
|
|
||||||
return [
|
|
||||||
$line->work_group1_id,
|
|
||||||
$line->work_group2_id,
|
|
||||||
$line->work_group3_id,
|
|
||||||
$line->work_group4_id,
|
|
||||||
$line->work_group5_id,
|
|
||||||
$line->work_group6_id,
|
|
||||||
$line->work_group7_id,
|
|
||||||
$line->work_group8_id,
|
|
||||||
$line->work_group9_id,
|
|
||||||
$line->work_group10_id,
|
|
||||||
];
|
|
||||||
})
|
|
||||||
->filter()
|
|
||||||
->unique()
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
return WorkGroupMaster::whereIn('id', $workGroupIds)
|
|
||||||
->pluck('name', 'id')
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
})
|
|
||||||
->searchable()
|
|
||||||
->reactive(),
|
|
||||||
DateTimePicker::make(name: 'created_from')
|
|
||||||
->label('Created From')
|
|
||||||
->placeholder(placeholder: 'Select From DateTime')
|
|
||||||
->reactive()
|
|
||||||
->native(false),
|
|
||||||
DateTimePicker::make('created_to')
|
|
||||||
->label('Created To')
|
|
||||||
->placeholder(placeholder: 'Select To DateTime')
|
|
||||||
->reactive()
|
|
||||||
->native(false),
|
|
||||||
])
|
|
||||||
->query(function ($query, array $data) {
|
|
||||||
// Hide all records initially if no filters are applied
|
|
||||||
if (empty($data['Plant']) && empty($data['name']) && empty($data['type']) && empty($data['work_group_id']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_from']) && empty($data['updated_to'])) {
|
|
||||||
// return $query->whereRaw('1 = 0');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['Plant'])) { // $plant = $data['Plant'] ?? null
|
|
||||||
$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['name'])) {
|
|
||||||
$query->where('id', $data['name']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['type'])) {
|
|
||||||
$query->where('type', $data['type']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (! empty($data['work_group_id'])) {
|
|
||||||
// $query->where('name', $data['work_group_id']);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (! empty($data['work_group_id'])) {
|
|
||||||
|
|
||||||
$query->where(function ($q) use ($data) {
|
|
||||||
|
|
||||||
$q->where('work_group1_id', $data['work_group_id'])
|
|
||||||
->orWhere('work_group2_id', $data['work_group_id'])
|
|
||||||
->orWhere('work_group3_id', $data['work_group_id'])
|
|
||||||
->orWhere('work_group4_id', $data['work_group_id'])
|
|
||||||
->orWhere('work_group5_id', $data['work_group_id'])
|
|
||||||
->orWhere('work_group6_id', $data['work_group_id'])
|
|
||||||
->orWhere('work_group7_id', $data['work_group_id'])
|
|
||||||
->orWhere('work_group8_id', $data['work_group_id'])
|
|
||||||
->orWhere('work_group9_id', $data['work_group_id'])
|
|
||||||
->orWhere('work_group10_id', $data['work_group_id']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['created_from'])) {
|
|
||||||
$query->where('created_at', '>=', $data['created_from']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['created_to'])) {
|
|
||||||
$query->where('created_at', '<=', $data['created_to']);
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
->indicateUsing(function (array $data) {
|
|
||||||
$indicators = [];
|
|
||||||
|
|
||||||
if (! empty($data['Plant'])) {
|
|
||||||
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
|
|
||||||
} else {
|
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
|
||||||
|
|
||||||
if ($userHas && strlen($userHas) > 0) {
|
|
||||||
return 'Plant: Choose plant to filter records.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['name'])) {
|
|
||||||
$indicators[] = 'Line Name: '.Line::where('id', $data['name'])->value('name');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['type'])) {
|
|
||||||
$indicators[] = 'Line Type: '.Line::where('type', $data['type'])->value('type');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['work_group_id'])) {
|
|
||||||
$indicators[] = 'Work Group: ' .
|
|
||||||
WorkGroupMaster::where('id', $data['work_group_id'])->value('name');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['created_from'])) {
|
|
||||||
$indicators[] = 'From: '.$data['created_from'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['created_to'])) {
|
|
||||||
$indicators[] = 'To: '.$data['created_to'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['updated_from'])) {
|
|
||||||
$indicators[] = 'From: '.$data['updated_from'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['updated_to'])) {
|
|
||||||
$indicators[] = 'To: '.$data['updated_to'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $indicators;
|
|
||||||
}),
|
|
||||||
])
|
])
|
||||||
->filtersFormMaxHeight('280px')
|
|
||||||
->actions([
|
->actions([
|
||||||
Tables\Actions\ViewAction::make(),
|
Tables\Actions\ViewAction::make(),
|
||||||
Tables\Actions\EditAction::make(),
|
Tables\Actions\EditAction::make(),
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,269 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\PanelBoxValidationResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\PanelBoxValidationResource;
|
|
||||||
use App\Models\ProductCharacteristicsMaster;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
|
||||||
use Illuminate\Validation\ValidationException;
|
|
||||||
|
|
||||||
class CreatePanelBoxValidation extends CreateRecord {
|
|
||||||
|
|
||||||
protected static string $resource = PanelBoxValidationResource::class;
|
|
||||||
|
|
||||||
|
|
||||||
public $showChecklist = false;
|
|
||||||
public $checklist;
|
|
||||||
|
|
||||||
public $skipChecklistValidation = false;
|
|
||||||
|
|
||||||
public bool $shouldSkipChecklist = false;
|
|
||||||
|
|
||||||
public $existingRecords = [];
|
|
||||||
|
|
||||||
protected $listeners = [
|
|
||||||
'checklistUpdated' => 'setChecklist',
|
|
||||||
'checklist-cancelled' => 'handleChecklistCancel',
|
|
||||||
'checklist-saved' => 'checkListSaved',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function setChecklist($checklist)
|
|
||||||
{
|
|
||||||
$this->data['checklist'] = $checklist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function doCreate()
|
|
||||||
{
|
|
||||||
$this->create();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mount(): void
|
|
||||||
{
|
|
||||||
parent::mount();
|
|
||||||
|
|
||||||
session()->forget([
|
|
||||||
'last_selected_plant_id',
|
|
||||||
'last_selected_line',
|
|
||||||
'last_selected_production',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handleChecklistCancel()
|
|
||||||
{
|
|
||||||
$this->skipChecklistValidation = true;
|
|
||||||
$this->showChecklist = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function mutateFormDataBeforeCreate(array $data): array
|
|
||||||
{
|
|
||||||
// if ($this->shouldSkipChecklist) {
|
|
||||||
// return $data;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if ($this->checkIfHasCharacteristics($data)) {
|
|
||||||
$this->showChecklist = true;
|
|
||||||
$this->halt();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function checkIfHasCharacteristics(array $data)
|
|
||||||
{
|
|
||||||
$plantId = $data['plant_id'] ?? null;
|
|
||||||
$itemCode = $data['item_id'] ?? null;
|
|
||||||
$lineId = $data['line_id'] ?? null;
|
|
||||||
|
|
||||||
if (!$plantId || !$itemCode || !$lineId) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$item = \App\Models\Item::where('code', $itemCode)
|
|
||||||
->where('plant_id', $plantId)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
$categoryName = trim($item->category) ?? null;
|
|
||||||
|
|
||||||
if (!$item) {
|
|
||||||
$this->existingRecords = collect();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plantId)
|
|
||||||
->where('category', $categoryName)
|
|
||||||
->where('line_id', $lineId)
|
|
||||||
->get();
|
|
||||||
|
|
||||||
return $this->existingRecords->isNotEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkListSaved()
|
|
||||||
{
|
|
||||||
$this->showChecklist = false;
|
|
||||||
|
|
||||||
$plantId = $this->data['plant_id'] ?? null;
|
|
||||||
$lineId = $this->data['line_id'] ?? null;
|
|
||||||
$productionOrder = $this->data['production_order'] ?? null;
|
|
||||||
|
|
||||||
return redirect()->to(
|
|
||||||
static::getResource()::getUrl('create', [
|
|
||||||
'plant_id' => $this->data['plant_id'] ?? null,
|
|
||||||
'line_id' => $this->data['line_id'] ?? null,
|
|
||||||
'production_order' => $this->data['production_order'] ?? null,
|
|
||||||
])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function beforeCreate(): void
|
|
||||||
{
|
|
||||||
$errors = [];
|
|
||||||
|
|
||||||
if (!empty($this->data['validationError'])) {
|
|
||||||
$errors['validationError'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->data['serialPanelError'])) {
|
|
||||||
$errors['serialPanelError'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->data['packSlipPanelError'])) {
|
|
||||||
$errors['packSlipPanelError'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->data['namePlatePanelError'])) {
|
|
||||||
$errors['namePlatePanelError'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
//..name plate
|
|
||||||
|
|
||||||
if (!empty($this->data['tubeStickerPanelError'])) {
|
|
||||||
$errors['tubeStickerPanelError'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->data['warrantyCardPanelError'])) {
|
|
||||||
$errors['warrantyCardPanelError'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
//..part validations
|
|
||||||
|
|
||||||
if (!empty($this->data['part_validation1_error'])) {
|
|
||||||
$errors['part_validation1_error'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->data['part_validation2_error'])) {
|
|
||||||
$errors['part_validation2_error'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->data['part_validation3_error'])) {
|
|
||||||
$errors['part_validation3_error'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->data['part_validation4_error'])) {
|
|
||||||
$errors['part_validation4_error'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->data['part_validation5_error'])) {
|
|
||||||
$errors['part_validation5_error'] = ['Fix the errors before submitting.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($errors)) {
|
|
||||||
throw ValidationException::withMessages($errors);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->checkExisting();
|
|
||||||
|
|
||||||
$checklist = $this->data['data']['checklist'] ?? [];
|
|
||||||
|
|
||||||
if (count($this->existingRecords) > 0){
|
|
||||||
|
|
||||||
$this->showChecklist = true;
|
|
||||||
$this->halt();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$this->showChecklist = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkExisting()
|
|
||||||
{
|
|
||||||
$plant_id = $this->data['plant_id'] ?? null;
|
|
||||||
$item_code = $this->data['item_id'] ?? null;
|
|
||||||
$line_id = $this->data['line_id'] ?? null;
|
|
||||||
|
|
||||||
|
|
||||||
$item = \App\Models\Item::where('code', $item_code)->where('plant_id', $plant_id)->first();
|
|
||||||
|
|
||||||
if (!$item) {
|
|
||||||
$this->existingRecords = collect();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// $item_id = $item->id;
|
|
||||||
$categoryName = trim($item->category) ?? null;
|
|
||||||
|
|
||||||
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plant_id)
|
|
||||||
->where('category', $categoryName)
|
|
||||||
->where('line_id', $line_id)
|
|
||||||
->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function afterCreate(): void
|
|
||||||
{
|
|
||||||
// Get the value from the hidden field 'plant'
|
|
||||||
$plant = $this->form->getState()['plant'] ?? null;
|
|
||||||
$line = $this->form->getState()['line'] ?? null;
|
|
||||||
$production = $this->form->getState()['production'] ?? null;
|
|
||||||
|
|
||||||
// $this->skipChecklistValidation = false;
|
|
||||||
// $this->showChecklist = false;
|
|
||||||
// $this->checklist = [];
|
|
||||||
|
|
||||||
// $this->form->fill();
|
|
||||||
|
|
||||||
// reset checklist
|
|
||||||
$this->checklist = [];
|
|
||||||
|
|
||||||
$this->skipChecklistValidation = false;
|
|
||||||
$this->showChecklist = false;
|
|
||||||
|
|
||||||
$this->form->fill([]);
|
|
||||||
|
|
||||||
$this->data = [];
|
|
||||||
|
|
||||||
$this->resetValidation();
|
|
||||||
$this->resetErrorBag();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'plant_id' => null,
|
|
||||||
'line_id' => null,
|
|
||||||
'production_order' => null,
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
|
||||||
// $this->dispatch('focus-item-id');
|
|
||||||
session()->flash('focus_item_id_after_redirect', true);
|
|
||||||
logger('Focus flag set in session');
|
|
||||||
|
|
||||||
if ($plant) {
|
|
||||||
session(['last_selected_plant_id' => $plant]);
|
|
||||||
}
|
|
||||||
if ($line) {
|
|
||||||
session(['last_selected_line' => $line]);
|
|
||||||
}
|
|
||||||
if ($production) {
|
|
||||||
session(['last_selected_production' => $production]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
//return $this->getResource()::getUrl('create'); // Stay on Create Page after savin
|
|
||||||
|
|
||||||
return $this->getResource()::getUrl('create', [
|
|
||||||
'plant_id' => $this->data['plant_id'] ?? null,
|
|
||||||
'line_id' => $this->data['line_id'] ?? null,
|
|
||||||
'production_order' => $this->data['production_order'] ?? null,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\PanelBoxValidationResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\PanelBoxValidationResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\EditRecord;
|
|
||||||
|
|
||||||
class EditPanelBoxValidation extends EditRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = PanelBoxValidationResource::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\PanelBoxValidationResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\PanelBoxValidationResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ListRecords;
|
|
||||||
|
|
||||||
class ListPanelBoxValidations extends ListRecords
|
|
||||||
{
|
|
||||||
protected static string $resource = PanelBoxValidationResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\CreateAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\PanelBoxValidationResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\PanelBoxValidationResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ViewRecord;
|
|
||||||
|
|
||||||
class ViewPanelBoxValidation extends ViewRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = PanelBoxValidationResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\EditAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -253,9 +253,9 @@ class ProductionCharacteristicResource extends Resource
|
|||||||
->label('Spec. Value')
|
->label('Spec. Value')
|
||||||
// ->searchable()
|
// ->searchable()
|
||||||
->formatStateUsing(function ($record) {
|
->formatStateUsing(function ($record) {
|
||||||
$specVal = ProductCharacteristicsMaster::where('plant_id', $record->plant_id)->where('item_id', $record->item_id)->where('line_id', $record->line_id)->where('machine_id', $record->machine_id)->where('name', $record->characteristic_name)->first();
|
$specVal = ProductCharacteristicsMaster::where('plant_id', $record->plant_id)->where('item_id', $record->item_id)->where('line_id', $record->line_id)->where('machine_id', $record->machine_id)->first();
|
||||||
// return $record?->plant_id.'-'.$record?->item_id.'-'.$record->line_id.'-'.$record?->machine_id;
|
|
||||||
|
|
||||||
|
// return $record?->plant_id.'-'.$record?->item_id.'-'.$record->line_id.'-'.$record?->machine_id;
|
||||||
return $specVal?->lower.' - '.$specVal?->upper;
|
return $specVal?->lower.' - '.$specVal?->upper;
|
||||||
})
|
})
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -276,7 +276,7 @@ class ProductionCharacteristicResource extends Resource
|
|||||||
'Not Ok' => 'danger',
|
'Not Ok' => 'danger',
|
||||||
'NotOk' => 'danger',
|
'NotOk' => 'danger',
|
||||||
'ConditionallyAccepted' => 'success',
|
'ConditionallyAccepted' => 'success',
|
||||||
default => 'black',
|
default => 'gray',
|
||||||
})
|
})
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|||||||
@@ -3529,80 +3529,14 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
$mPlantName = $mailData['plant_name'];
|
$mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
$emails = $mailData['emails'];
|
||||||
$ccEmails = $mailData['cc_emails'] ?? [];
|
|
||||||
$mUserName = Filament::auth()->user()->name;
|
$mUserName = Filament::auth()->user()->name;
|
||||||
|
|
||||||
// if (! empty($emails)) {
|
if (! empty($emails)) {
|
||||||
// if (is_array($emails)) {
|
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||||
// $emailList = collect($emails)
|
Mail::to($emails)->send(
|
||||||
// ->flatMap(fn ($email) => explode(',', $email))
|
new InvalidQualityMail($state, $mPorder, $mPlantName, $mLinePart, $mUserName, $mExpectedValue, 'InvalidPartNumber')
|
||||||
// ->map(fn ($email) => trim($email))
|
);
|
||||||
// ->filter()
|
} else {
|
||||||
// ->toArray();
|
|
||||||
// } else {
|
|
||||||
// $emailList = array_map('trim', explode(',', $emails));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $ccList = [];
|
|
||||||
|
|
||||||
// if (!empty($cc_emails)) {
|
|
||||||
// if (is_array($cc_emails)) {
|
|
||||||
// $ccList = collect($cc_emails)
|
|
||||||
// ->flatMap(fn ($email) => explode(',', $email))
|
|
||||||
// ->map(fn ($email) => trim($email))
|
|
||||||
// ->filter()
|
|
||||||
// ->toArray();
|
|
||||||
// } else {
|
|
||||||
// $ccList = collect(explode(',', $cc_emails))
|
|
||||||
// ->map(fn ($email) => trim($email))
|
|
||||||
// ->filter()
|
|
||||||
// ->toArray();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Mail::to($emailList)
|
|
||||||
// ->cc($ccList)
|
|
||||||
// ->send(
|
|
||||||
// new InvalidQualityMail(
|
|
||||||
// $state,
|
|
||||||
// $mPorder,
|
|
||||||
// $mPlantName,
|
|
||||||
// $mLinePart,
|
|
||||||
// $mUserName,
|
|
||||||
// $mExpectedValue,
|
|
||||||
// 'InvalidPartNumber'
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
if (!empty($emails)) {
|
|
||||||
|
|
||||||
$emailList = collect(is_array($emails) ? $emails : explode(',', $emails))
|
|
||||||
->flatMap(fn ($email) => explode(',', $email))
|
|
||||||
->map(fn ($email) => trim($email))
|
|
||||||
->filter()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$ccList = collect(is_array($ccEmails) ? $ccEmails : explode(',', $ccEmails))
|
|
||||||
->flatMap(fn ($email) => explode(',', $email))
|
|
||||||
->map(fn ($email) => trim($email))
|
|
||||||
->filter()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
Mail::to($emailList)
|
|
||||||
->cc($ccList)
|
|
||||||
->send(
|
|
||||||
new InvalidQualityMail(
|
|
||||||
$state,
|
|
||||||
$mPorder,
|
|
||||||
$mPlantName,
|
|
||||||
$mLinePart,
|
|
||||||
$mUserName,
|
|
||||||
$mExpectedValue,
|
|
||||||
'InvalidPartNumber'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
\Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
\Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
||||||
}
|
}
|
||||||
$set('part_validation1', null);
|
$set('part_validation1', null);
|
||||||
@@ -4044,7 +3978,6 @@ class QualityValidationResource extends Resource
|
|||||||
->where('module', 'QualityValidation')
|
->where('module', 'QualityValidation')
|
||||||
->where('rule_name', 'QualityMail')
|
->where('rule_name', 'QualityMail')
|
||||||
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
|
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
|
||||||
// ->get()
|
|
||||||
->pluck('email')
|
->pluck('email')
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
@@ -4062,16 +3995,13 @@ class QualityValidationResource extends Resource
|
|||||||
->where('module', 'QualityValidation')
|
->where('module', 'QualityValidation')
|
||||||
->where('rule_name', 'QualityMail')
|
->where('rule_name', 'QualityMail')
|
||||||
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
|
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
|
||||||
->get(['email', 'cc_emails']);
|
->pluck('email')
|
||||||
// ->pluck('email')
|
->toArray();
|
||||||
// ->toArray();
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'plant_name' => $mPlantName,
|
'plant_name' => $mPlantName,
|
||||||
'emails' => $emails->pluck('email')->filter()->toArray(),
|
'emails' => $emails,
|
||||||
'cc_emails' => $emails->pluck('cc_emails')->filter()->toArray(),
|
|
||||||
// 'emails' => $emails,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -813,7 +813,7 @@ class TestingPanelReadingResource extends Resource
|
|||||||
if ($plantId) {
|
if ($plantId) {
|
||||||
return MotorTestingMaster::whereHas('testingPanelReadings', function ($query) {
|
return MotorTestingMaster::whereHas('testingPanelReadings', function ($query) {
|
||||||
$query->whereNotNull('id');
|
$query->whereNotNull('id');
|
||||||
})->whereNotNull('subassembly_code')->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
|
})->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
// return Item::whereHas('motorTestingMasters')
|
// return Item::whereHas('motorTestingMasters')
|
||||||
|
|||||||
@@ -450,9 +450,7 @@ class VisitorEntryResource extends Resource
|
|||||||
|| !empty($data['created_to']);
|
|| !empty($data['created_to']);
|
||||||
|
|
||||||
if (!$hasAnyFilter) {
|
if (!$hasAnyFilter) {
|
||||||
// $query->whereDate('created_at', today());
|
$query->whereDate('created_at', today());
|
||||||
$query->whereDate('visitor_entries.created_at', today())
|
|
||||||
->whereNull('out_time');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -581,9 +581,6 @@ class InvoiceDataTable extends Component
|
|||||||
return [
|
return [
|
||||||
'sticker_master_id' => $record->sticker_master_id,
|
'sticker_master_id' => $record->sticker_master_id,
|
||||||
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
||||||
'invoice_quantity' => $record->invoice_quantity ?? 0,
|
|
||||||
'scanned_quantity' => ($record->invoice_quantity == null) ? 0 : ($record->invoice_quantity - $record->quantity) ?? 0,
|
|
||||||
// 'scanned_quantity' => number_format(($record->invoice_quantity == null ? 0 : ($record->invoice_quantity - $record->quantity)), 3, '.', ''),
|
|
||||||
'quantity' => $record->quantity ?? '',
|
'quantity' => $record->quantity ?? '',
|
||||||
'serial_number' => $record->serial_number ?? '',
|
'serial_number' => $record->serial_number ?? '',
|
||||||
'batch_number' => $record->batch_number ?? '',
|
'batch_number' => $record->batch_number ?? '',
|
||||||
@@ -600,17 +597,12 @@ class InvoiceDataTable extends Component
|
|||||||
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||||
if ($matType == 1) {
|
if ($matType == 1) {
|
||||||
$row['material_type'] = 'Individual';
|
$row['material_type'] = 'Individual';
|
||||||
$row['invoice_quantity'] = $row['quantity'];
|
|
||||||
} elseif ($matType == 2) {
|
} elseif ($matType == 2) {
|
||||||
$row['material_type'] = 'Bundle';
|
$row['material_type'] = 'Bundle';
|
||||||
$row['invoice_quantity'] = $row['quantity'];
|
|
||||||
} elseif ($matType == 3) {
|
} elseif ($matType == 3) {
|
||||||
$row['material_type'] = 'Quantity';
|
$row['material_type'] = 'Quantity';
|
||||||
$row['invoice_quantity'] = number_format($row['invoice_quantity'], 3, '.', '');
|
|
||||||
$row['scanned_quantity'] = number_format($row['scanned_quantity'], 3, '.', '');
|
|
||||||
} elseif ($matType == 4) {
|
} elseif ($matType == 4) {
|
||||||
$row['material_type'] = 'Bundle Individual';
|
$row['material_type'] = 'Bundle Individual';
|
||||||
$row['invoice_quantity'] = $row['quantity'];
|
|
||||||
} else {
|
} else {
|
||||||
$row['material_type'] = 'N/A';
|
$row['material_type'] = 'N/A';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,266 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Livewire;
|
|
||||||
|
|
||||||
use App\Models\AlertMailRule;
|
|
||||||
use App\Models\Item;
|
|
||||||
use App\Models\Line;
|
|
||||||
use App\Models\PanelBoxValidation;
|
|
||||||
use App\Models\Plant;
|
|
||||||
use App\Models\ProductCharacteristicsMaster;
|
|
||||||
use App\Models\ProductionCharacteristic;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Livewire\Component;
|
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Illuminate\Support\Facades\Mail;
|
|
||||||
use App\Mail\InvalidQualityMail;
|
|
||||||
|
|
||||||
class PanelCheckList extends Component
|
|
||||||
{
|
|
||||||
|
|
||||||
public $records = [];
|
|
||||||
|
|
||||||
public $existingRecords = [];
|
|
||||||
|
|
||||||
// public bool $shouldSkipChecklist = false;
|
|
||||||
|
|
||||||
public array $checklist = [];
|
|
||||||
|
|
||||||
public $showChecklist = false;
|
|
||||||
|
|
||||||
// public $skipChecklistValidation = false;
|
|
||||||
|
|
||||||
// protected $listeners = ['focus-item-id' => 'handleFocus', 'trigger-create' => 'doCreate',];
|
|
||||||
|
|
||||||
public $data =
|
|
||||||
[
|
|
||||||
'item_id' => '',
|
|
||||||
'plant_id' => '',
|
|
||||||
];
|
|
||||||
|
|
||||||
public $data1 = [
|
|
||||||
'checklist' => [],
|
|
||||||
];
|
|
||||||
|
|
||||||
// public function doCreate()
|
|
||||||
// {
|
|
||||||
// $this->create();
|
|
||||||
|
|
||||||
// $this->shouldSkipChecklist = false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function mount($records = [])
|
|
||||||
{
|
|
||||||
// $this->records = collect($records);
|
|
||||||
$this->records = $records;
|
|
||||||
|
|
||||||
// foreach ($records as $record) {
|
|
||||||
// $this->checklist[$record['id']] = 'ok';
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cancel()
|
|
||||||
{
|
|
||||||
$this->dispatch('checklist-cancelled');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function saveChecklist()
|
|
||||||
{
|
|
||||||
if (empty($this->checklist) || count($this->checklist) != count($this->records)) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Incomplete Checklist')
|
|
||||||
->body('Please complete all checklist fields before submitting.')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$item = Item::where('code', $this->data['item_id'])->first();
|
|
||||||
|
|
||||||
if (! $item) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Invalid Item Code')
|
|
||||||
->body('Item not found for given code.')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemAgaPlant = Item::where('code', $this->data['item_id'])->where('plant_id', $this->data['plant_id'])->first();
|
|
||||||
|
|
||||||
$plant = Plant::find($this->data['plant_id']);
|
|
||||||
|
|
||||||
if (! $itemAgaPlant) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Invalid Item Code')
|
|
||||||
->body("Item code '$this->data['item_id']' not found for given plant code '{$plant?->code}'.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemId = $itemAgaPlant->id;
|
|
||||||
|
|
||||||
$exists = PanelBoxValidation::where('plant_id', $this->data['plant_id'] ?? null)
|
|
||||||
->where('serial_number', $this->data['serial_number'] ?? null)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
$plan = Plant::find($this->data['plant_id']);
|
|
||||||
|
|
||||||
if ($exists) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Duplicate Serial Number')
|
|
||||||
->body("serial number {$this->data['serial_number']} already exists for the selected plant $plan->code.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$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,
|
|
||||||
'created_by' => $this->data['created_by'] ?? null,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (! $qualityValidation || ! $qualityValidation->exists) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Failed to save Panel Box Validation')
|
|
||||||
->body('Something went wrong while inserting data.')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->checklist as $characteristicId => $value) {
|
|
||||||
|
|
||||||
// $status = 'Ok';
|
|
||||||
|
|
||||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
|
||||||
|
|
||||||
if (($characteristic?->inspection_type ?? null) === 'Value') {
|
|
||||||
if (
|
|
||||||
$characteristic &&
|
|
||||||
is_numeric($value) &&
|
|
||||||
$value >= $characteristic->lower &&
|
|
||||||
$value <= $characteristic->upper
|
|
||||||
) {
|
|
||||||
$status = 'Ok';
|
|
||||||
} else {
|
|
||||||
$status = 'NotOk';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$status = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProductionCharacteristic::create([
|
|
||||||
'plant_id' => $this->data['plant_id'] ?? null,
|
|
||||||
'item_id' => $itemId ?? null,
|
|
||||||
'line_id' => $this->data['line_id'] ?? null,
|
|
||||||
'machine_id' => $characteristic?->machine_id ?? null,
|
|
||||||
'production_order' => $this->data['production_order'] ?? null,
|
|
||||||
'serial_number' => $this->data['serial_number'] ?? null,
|
|
||||||
'characteristic_name' => $characteristic?->name ?? null,
|
|
||||||
'observed_value' => $value ?? null,
|
|
||||||
'status' => $status,
|
|
||||||
'inspection_status' => $finalInspectionStatus ?? null,
|
|
||||||
'created_by' => $this->data['operator_id'] ?? null,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->showChecklist = false;
|
|
||||||
|
|
||||||
$this->dispatch('checklist-saved');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function canSaveChecklist(): bool
|
|
||||||
{
|
|
||||||
if (empty($this->checklist) || count($this->checklist) != count($this->records)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->checklist as $characteristicId => $value) {
|
|
||||||
|
|
||||||
if ($value == null || $value == '') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
|
||||||
|
|
||||||
if (! $characteristic || ! is_numeric($value) || $value <= $characteristic->lower || $value >= $characteristic->upper){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCharacteristicStatus($characteristicId): ?string
|
|
||||||
{
|
|
||||||
$value = $this->checklist[$characteristicId] ?? null;
|
|
||||||
|
|
||||||
if ($value == null || $value == '') {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
|
||||||
|
|
||||||
if (! $characteristic || ! is_numeric($value)) {
|
|
||||||
return 'Not Ok';
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($value > $characteristic->lower && $value < $characteristic->upper) ? 'Ok' : 'Not Ok';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// public static function getMailData($plantId)
|
|
||||||
// {
|
|
||||||
// $globalEmails = AlertMailRule::where('plant', 0)
|
|
||||||
// ->where('module', 'QualityValidation')
|
|
||||||
// ->where('rule_name', 'QualityMail')
|
|
||||||
// ->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
|
|
||||||
// ->pluck('email')
|
|
||||||
// ->toArray();
|
|
||||||
|
|
||||||
// if (! empty($globalEmails)) {
|
|
||||||
// return [
|
|
||||||
// 'plant_id' => 0,
|
|
||||||
// 'plant_name' => 'All Plants',
|
|
||||||
// 'emails' => $globalEmails,
|
|
||||||
// ];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $mPlantName = Plant::where('id', $plantId)->value('name');
|
|
||||||
|
|
||||||
// $emails = AlertMailRule::where('plant', $plantId)
|
|
||||||
// ->where('module', 'QualityValidation')
|
|
||||||
// ->where('rule_name', 'QualityMail')
|
|
||||||
// ->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
|
|
||||||
// ->pluck('email')
|
|
||||||
// ->toArray();
|
|
||||||
|
|
||||||
// return [
|
|
||||||
// 'plant_id' => $plantId,
|
|
||||||
// 'plant_name' => $mPlantName,
|
|
||||||
// 'emails' => $emails,
|
|
||||||
// ];
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
return view('livewire.panel-check-list');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -51,7 +51,7 @@ class ImportTransitMail extends Mailable
|
|||||||
{
|
{
|
||||||
$now = now();
|
$now = now();
|
||||||
$reportDate = $now->format('d/m/Y');
|
$reportDate = $now->format('d/m/Y');
|
||||||
$greeting = '<b>Dear Sir/Madam</b>,<br>Kindly find attached the Pending Import Shipment Status Report as on ' . $reportDate . ' for your reference.<br>We request you to review the shipments highlighted in <span style="background-color: yellow; font-weight: bold;">yellow</span> and arrange for their clearance at the earliest to avoid further delays and additional charges.<br>Please note that for shipments pending under <b>Telex Release</b> and <b>Duty Payment</b>, CFS charges will be commenced post ETA. We therefore urge you to expedite the necessary actions at your end.<br>FCL shipment will take 5-6 Days for clearance & LCL shipment will take 7-8 Days for clearance after arrival of the shipment @ destination Port.</br>';
|
$greeting = '<b>Dear Sir/Madam</b>,<br>Kindly find attached the Pending Import Shipment Status Report as on ' . $reportDate . ' for your reference.<br>We request you to review the shipments highlighted in <span style="background-color: yellow; font-weight: bold;">yellow</span> and arrange for their clearance at the earliest to avoid further delays and additional charges.<br>Please note that for shipments pending under <b>Telex Release</b> and <b>Duty Payment</b>, CFS charges will be commenced post ETA. We therefore urge you to expedite the necessary actions at your end.';
|
||||||
|
|
||||||
//$greeting1 = 'Dear C.R.I Branch Team, <br><br> Please follow and ensure the same';
|
//$greeting1 = 'Dear C.R.I Branch Team, <br><br> Please follow and ensure the same';
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ class InvoiceValidation extends Model
|
|||||||
'upload_status',
|
'upload_status',
|
||||||
'batch_number',
|
'batch_number',
|
||||||
'quantity',
|
'quantity',
|
||||||
'invoice_quantity',
|
|
||||||
'operator_id',
|
'operator_id',
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_by',
|
'updated_by',
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
|
|
||||||
class PanelBoxValidation extends Model
|
|
||||||
{
|
|
||||||
use SoftDeletes;
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'plant_id',
|
|
||||||
'line_id',
|
|
||||||
'sticker_master_id',
|
|
||||||
'production_order',
|
|
||||||
'serial_number',
|
|
||||||
'serial_number_panel',
|
|
||||||
'pack_slip_panel',
|
|
||||||
'name_plate_panel',
|
|
||||||
'tube_sticker_panel',
|
|
||||||
'warranty_card_panel',
|
|
||||||
'part_validation1',
|
|
||||||
'part_validation2',
|
|
||||||
'part_validation3',
|
|
||||||
'part_validation4',
|
|
||||||
'part_validation5',
|
|
||||||
'created_by',
|
|
||||||
'updated_by'
|
|
||||||
];
|
|
||||||
public function plant(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Plant::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function line(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Line::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function stickerMaster(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(StickerMaster::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Policies;
|
|
||||||
|
|
||||||
use Illuminate\Auth\Access\Response;
|
|
||||||
use App\Models\PanelBoxValidation;
|
|
||||||
use App\Models\User;
|
|
||||||
|
|
||||||
class PanelBoxValidationPolicy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view any models.
|
|
||||||
*/
|
|
||||||
public function viewAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('view-any PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view the model.
|
|
||||||
*/
|
|
||||||
public function view(User $user, PanelBoxValidation $panelboxvalidation): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('view PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can create models.
|
|
||||||
*/
|
|
||||||
public function create(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('create PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can update the model.
|
|
||||||
*/
|
|
||||||
public function update(User $user, PanelBoxValidation $panelboxvalidation): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('update PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete the model.
|
|
||||||
*/
|
|
||||||
public function delete(User $user, PanelBoxValidation $panelboxvalidation): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('delete PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete any models.
|
|
||||||
*/
|
|
||||||
public function deleteAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('delete-any PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore the model.
|
|
||||||
*/
|
|
||||||
public function restore(User $user, PanelBoxValidation $panelboxvalidation): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('restore PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore any models.
|
|
||||||
*/
|
|
||||||
public function restoreAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('restore-any PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can replicate the model.
|
|
||||||
*/
|
|
||||||
public function replicate(User $user, PanelBoxValidation $panelboxvalidation): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('replicate PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can reorder the models.
|
|
||||||
*/
|
|
||||||
public function reorder(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('reorder PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete the model.
|
|
||||||
*/
|
|
||||||
public function forceDelete(User $user, PanelBoxValidation $panelboxvalidation): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('force-delete PanelBoxValidation');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete any models.
|
|
||||||
*/
|
|
||||||
public function forceDeleteAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('force-delete-any PanelBoxValidation');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"alperenersoy/filament-export": "^3.0",
|
"alperenersoy/filament-export": "^3.0",
|
||||||
"althinect/filament-spatie-roles-permissions": "^2.3",
|
"althinect/filament-spatie-roles-permissions": "^2.3",
|
||||||
"diogogpinto/filament-auth-ui-enhancer": "^1.0",
|
"diogogpinto/filament-auth-ui-enhancer": "^1.0",
|
||||||
"erag/laravel-pwa": "^1.9",
|
"erag/laravel-pwa": "^2.0",
|
||||||
"filament/filament": "^3.3",
|
"filament/filament": "^3.3",
|
||||||
"intervention/image": "^3.11",
|
"intervention/image": "^3.11",
|
||||||
"irazasyed/telegram-bot-sdk": "^3.15",
|
"irazasyed/telegram-bot-sdk": "^3.15",
|
||||||
|
|||||||
@@ -1,56 +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 panel_box_validations (
|
|
||||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
|
||||||
|
|
||||||
plant_id BIGINT NOT NULL,
|
|
||||||
line_id BIGINT NOT NULL,
|
|
||||||
sticker_master_id BIGINT NOT NULL,
|
|
||||||
production_order TEXT DEFAULT NULL,
|
|
||||||
serial_number TEXT DEFAULT NULL,
|
|
||||||
serial_number_panel TEXT DEFAULT NULL,
|
|
||||||
pack_slip_panel TEXT DEFAULT NULL,
|
|
||||||
name_plate_panel TEXT DEFAULT NULL,
|
|
||||||
tube_sticker_panel TEXT DEFAULT NULL,
|
|
||||||
warranty_card_panel TEXT DEFAULT NULL,
|
|
||||||
part_validation1 TEXT DEFAULT NULL,
|
|
||||||
part_validation2 TEXT DEFAULT NULL,
|
|
||||||
part_validation3 TEXT DEFAULT NULL,
|
|
||||||
part_validation4 TEXT DEFAULT NULL,
|
|
||||||
part_validation5 TEXT DEFAULT NULL,
|
|
||||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
||||||
updated_at TIMESTAMP,
|
|
||||||
created_by TEXT DEFAULT NULL,
|
|
||||||
updated_by TEXT DEFAULT NULL,
|
|
||||||
deleted_at TIMESTAMP,
|
|
||||||
|
|
||||||
UNIQUE (plant_id, serial_number),
|
|
||||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
|
||||||
FOREIGN KEY (line_id) REFERENCES lines (id),
|
|
||||||
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id)
|
|
||||||
);
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
DB::statement($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('panel_box_validations');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,29 +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
|
|
||||||
{
|
|
||||||
DB::statement(<<<'SQL'
|
|
||||||
ALTER TABLE invoice_validations
|
|
||||||
ADD COLUMN invoice_quantity NUMERIC(10,3) NULL;
|
|
||||||
SQL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
// Schema::table('invoice_validations', function (Blueprint $table) {
|
|
||||||
// //
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<div>
|
|
||||||
@livewire('panel-check-list', [
|
|
||||||
'records' => $existingRecords,
|
|
||||||
'data' => $data
|
|
||||||
])
|
|
||||||
</div>
|
|
||||||
@@ -229,9 +229,7 @@
|
|||||||
<th class="border px-4 py-2">No</th>
|
<th class="border px-4 py-2">No</th>
|
||||||
<th class="border px-4 py-2">Material Code</th>
|
<th class="border px-4 py-2">Material Code</th>
|
||||||
<th class="border px-4 py-2">Material Type</th>
|
<th class="border px-4 py-2">Material Type</th>
|
||||||
<th class="border px-4 py-2">Invoice Quantity</th>
|
<th class="border px-4 py-2">Material Quantity</th>
|
||||||
<th class="border px-4 py-2">To Be Scanned</th>
|
|
||||||
<th class="border px-4 py-2">Scanned Quantity</th>
|
|
||||||
<th class="border px-4 py-2">Serial Number</th>
|
<th class="border px-4 py-2">Serial Number</th>
|
||||||
<th class="border px-4 py-2">Batch Number</th>
|
<th class="border px-4 py-2">Batch Number</th>
|
||||||
<th class="border px-4 py-2">TimeStamp</th>
|
<th class="border px-4 py-2">TimeStamp</th>
|
||||||
@@ -246,23 +244,9 @@
|
|||||||
<td class="border px-4 py-2">{{ $row['material_type'] ?? 'N/A' }}</td>
|
<td class="border px-4 py-2">{{ $row['material_type'] ?? 'N/A' }}</td>
|
||||||
<td class="border px-4 py-2">
|
<td class="border px-4 py-2">
|
||||||
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
|
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
|
||||||
{{ number_format((float)($row['invoice_quantity'] ?? 0), 0) }}
|
{{ number_format((float)($row['quantity'] ?? 0), 0) }}
|
||||||
@else
|
@else
|
||||||
{{ $row['invoice_quantity'] ?? 'N/A' }}
|
{{ $row['quantity'] ?? 'N/A' }}
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td class="border px-4 py-2">
|
|
||||||
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
|
|
||||||
{{ number_format((float)($row['quantity'] ?? 0), 0) }}
|
|
||||||
@else
|
|
||||||
{{ $row['quantity'] ?? 'N/A' }}
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td class="border px-4 py-2">
|
|
||||||
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
|
|
||||||
{{ number_format((float)($row['scanned_quantity'] ?? 0), 0) }}
|
|
||||||
@else
|
|
||||||
{{ $row['scanned_quantity'] ?? 'N/A' }}
|
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td class="border px-4 py-2">{{ $row['serial_number'] ?? 'N/A' }}</td>
|
<td class="border px-4 py-2">{{ $row['serial_number'] ?? 'N/A' }}</td>
|
||||||
|
|||||||
@@ -1,141 +0,0 @@
|
|||||||
<div class="fixed inset-0 flex items-center justify-center z-50">
|
|
||||||
|
|
||||||
{{-- <div class="bg-white max-h-[80vh] overflow-hidden p-6 rounded-lg shadow-lg pointer-events-auto"
|
|
||||||
style="width:30vw !important; max-width:none !important;"> --}}
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="bg-white rounded-lg shadow-lg pointer-events-auto
|
|
||||||
w-full max-w-2xl max-h-[90vh] flex flex-col">
|
|
||||||
|
|
||||||
{{-- @if($records && $records->count()) --}}
|
|
||||||
@if(!empty($records) && count($records))
|
|
||||||
<div style="max-height:250px; overflow-y:auto; border:1px solid #ccc;">
|
|
||||||
|
|
||||||
{{-- <table class="min-w-full border"> --}}
|
|
||||||
<table class="w-full table-fixed border text-sm">
|
|
||||||
<thead>
|
|
||||||
<tr class="bg-gray-100">
|
|
||||||
<th class="border px-2 py-1 w-2/3">Characteristics</th>
|
|
||||||
<th class="border px-2 py-1 w-1/3">Value</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach($records as $record)
|
|
||||||
<tr>
|
|
||||||
<td class="border p-2">
|
|
||||||
{{ $record['name'] }}
|
|
||||||
</td>
|
|
||||||
|
|
||||||
{{-- <td class="border p-2">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
wire:model.defer="checklist.{{ $record['id'] }}"
|
|
||||||
wire:model.live="checklist.{{ $record['id'] }}"
|
|
||||||
class="w-full border rounded px-2 py-1"
|
|
||||||
placeholder="Enter value"
|
|
||||||
>
|
|
||||||
</td> --}}
|
|
||||||
|
|
||||||
{{-- <td class="border p-2">
|
|
||||||
@php
|
|
||||||
$status = $this->getCharacteristicStatus($record['id']);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
wire:model.live="checklist.{{ $record['id'] }}"
|
|
||||||
class="w-full rounded px-2 py-1 border-2 transition-all duration-200"
|
|
||||||
style="
|
|
||||||
@if($status === 'Ok')
|
|
||||||
border-color: #22c55e;
|
|
||||||
box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
|
|
||||||
@elseif($status === 'Not Ok')
|
|
||||||
border-color: #ef4444;
|
|
||||||
box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
|
|
||||||
@else
|
|
||||||
border-color: #d1d5db;
|
|
||||||
@endif
|
|
||||||
"
|
|
||||||
placeholder="Enter value"
|
|
||||||
>
|
|
||||||
</td> --}}
|
|
||||||
|
|
||||||
<td class="border p-2">
|
|
||||||
@php
|
|
||||||
$status = $this->getCharacteristicStatus($record['id']);
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if(($record['inspection_type'] ?? null) === 'Visual')
|
|
||||||
|
|
||||||
<div class="flex gap-4">
|
|
||||||
<label class="flex items-center gap-1">
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
wire:model.live="checklist.{{ $record['id'] }}"
|
|
||||||
value="Ok"
|
|
||||||
>
|
|
||||||
Ok
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label class="flex items-center gap-1">
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
wire:model.live="checklist.{{ $record['id'] }}"
|
|
||||||
value="NotOk"
|
|
||||||
>
|
|
||||||
Not Ok
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@else
|
|
||||||
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
wire:model.live="checklist.{{ $record['id'] }}"
|
|
||||||
class="w-full rounded px-2 py-1 border-2 transition-all duration-200"
|
|
||||||
style="
|
|
||||||
@if($status === 'Ok')
|
|
||||||
border-color: #22c55e;
|
|
||||||
box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
|
|
||||||
@elseif($status === 'Not Ok')
|
|
||||||
border-color: #ef4444;
|
|
||||||
box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
|
|
||||||
@else
|
|
||||||
border-color: #d1d5db;
|
|
||||||
@endif
|
|
||||||
"
|
|
||||||
placeholder="Enter value"
|
|
||||||
>
|
|
||||||
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<p>No records found.</p>
|
|
||||||
@endif
|
|
||||||
<div class="border-t mt-6 pt-4 flex justify-end gap-3">
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
wire:click="cancel"
|
|
||||||
style="background-color:#dc2626; color:white;"
|
|
||||||
class="px-6 py-2 rounded-lg shadow-md"
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
wire:click="saveChecklist"
|
|
||||||
style="background-color:#16a34a; color:white;"
|
|
||||||
{{-- @disabled(!$this->canSaveChecklist()) --}}
|
|
||||||
class="px-6 py-2 rounded-lg shadow-md disabled:opacity-50 disabled:cursor-not-allowed"
|
|
||||||
>
|
|
||||||
Save
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -29,10 +29,6 @@
|
|||||||
<td>Item Code</td>
|
<td>Item Code</td>
|
||||||
<td style="text-align: center;">{{ $request->item->code ?? $request->code }}</td>
|
<td style="text-align: center;">{{ $request->item->code ?? $request->code }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>Description</td>
|
|
||||||
<td style="text-align: center;">{{ $request->item->description ?? $request->description }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Job Number</td>
|
<td>Job Number</td>
|
||||||
<td style="text-align: center;">{{ $request->aufnr }}</td>
|
<td style="text-align: center;">{{ $request->aufnr }}</td>
|
||||||
|
|||||||
@@ -89,27 +89,38 @@
|
|||||||
<tr style="{{ $row['is_transit_identified'] == 1 ? 'background-color:#FFFF00;' . 'font-weight: bold;' : '' }}">
|
<tr style="{{ $row['is_transit_identified'] == 1 ? 'background-color:#FFFF00;' . 'font-weight: bold;' : '' }}">
|
||||||
<td>{{ $loop->iteration }}</td>
|
<td>{{ $loop->iteration }}</td>
|
||||||
<td>{{ $row['cri_rfq_number'] }}</td>
|
<td>{{ $row['cri_rfq_number'] }}</td>
|
||||||
|
{{-- <td>{{ $row['mail_received_date'] }}</td> --}}
|
||||||
|
{{-- <td>{{ \Carbon\Carbon::parse($row['mail_received_date'])->format('Y-m-d') }}</td> --}}
|
||||||
|
{{-- <td>{{ $row['pricol_ref_number'] }}</td> --}}
|
||||||
<td>{{ $row['requester'] }}</td>
|
<td>{{ $row['requester'] }}</td>
|
||||||
<td>{{ $row['shipper'] }}</td>
|
<td>{{ $row['shipper'] }}</td>
|
||||||
<td>{{ $row['shipper_location'] }}</td>
|
<td>{{ $row['shipper_location'] }}</td>
|
||||||
<td>{{ $row['shipper_invoice'] }}</td>
|
<td>{{ $row['shipper_invoice'] }}</td>
|
||||||
{{-- <td>{{ \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') }}</td> --}}
|
{{-- <td>{{ $row['shipper_invoice_date'] }}</td> --}}
|
||||||
<td>
|
<td>{{ \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') }}</td>
|
||||||
{{ !empty($row['shipper_invoice_date']) ? \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') : '' }}
|
|
||||||
</td>
|
|
||||||
<td>{{ $row['customs_agent_name'] }}</td>
|
<td>{{ $row['customs_agent_name'] }}</td>
|
||||||
{{-- <td>{{ \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') }}</td> --}}
|
{{-- <td>{{ $row['eta_date'] }}</td> --}}
|
||||||
<td>
|
<td>{{ \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') }}</td>
|
||||||
{{ !empty($row['eta_date']) ? \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') : '' }}
|
{{-- <td>{{ $row['status'] }}</td> --}}
|
||||||
</td>
|
|
||||||
<td class="status-column">
|
<td class="status-column">
|
||||||
{{ $row['status'] }}
|
{{ $row['status'] }}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $row['delivery_location'] }}</td>
|
<td>{{ $row['delivery_location'] }}</td>
|
||||||
{{-- <td>{{ \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') }}</td> --}}
|
{{-- <td>{{ $row['etd_date'] }}</td> --}}
|
||||||
<td>
|
<td>{{ \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') }}</td>
|
||||||
{{ !empty($row['etd_date']) ? \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') : '' }}
|
{{-- <td>{{ $row['mode'] }}</td>
|
||||||
</td>
|
<td>{{ $row['inco_terms'] }}</td>
|
||||||
|
<td>{{ $row['port_of_loading'] }}</td>
|
||||||
|
<td>{{ $row['port_of_discharge'] }}</td>
|
||||||
|
<td>{{ $row['delivery_city'] }}</td>
|
||||||
|
<td>{{ $row['packages'] }}</td>
|
||||||
|
<td>{{ $row['type_of_package'] }}</td>
|
||||||
|
<td>{{ $row['gross_weight'] }}</td>
|
||||||
|
<td>{{ $row['volume'] }}</td>
|
||||||
|
<td>{{ $row['bill_number'] }}</td> --}}
|
||||||
|
{{-- <td>{{ $row['bill_received_date'] }}</td> --}}
|
||||||
|
{{-- <td>{{ \Carbon\Carbon::parse($row['bill_received_date'])->format('Y-m-d') }}</td>
|
||||||
|
<td>{{ $row['vessel_number'] }}</td> --}}
|
||||||
<td>{{ $row['remark'] }}</td>
|
<td>{{ $row['remark'] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
Reference in New Issue
Block a user