1 Commits

Author SHA1 Message Date
c841ff830d Update dependency erag/laravel-pwa to v2
Some checks failed
renovate/artifacts Artifact file update failure
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Failing after 1m27s
Laravel Larastan / larastan (pull_request) Failing after 1m31s
2026-06-14 00:01:08 +00:00
10 changed files with 79 additions and 409 deletions

View File

@@ -53,12 +53,50 @@ class SendImportTransit extends Command
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("
CASE
WHEN cri_rfq_number ~ '[0-9]+'
THEN CAST(regexp_replace(cri_rfq_number, '[^0-9]', '', 'g') AS INTEGER)
ELSE NULL
END NULLS LAST
CAST(
regexp_replace(cri_rfq_number, '.*-([0-9]+).*', '\\1')
AS INTEGER
)
")->get();

View File

@@ -24,10 +24,6 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
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;
class ImportTransitResource extends Resource
@@ -406,100 +402,7 @@ class ImportTransitResource extends Resource
])
->filters([
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([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),

View File

@@ -6,7 +6,6 @@ use App\Filament\Exports\LineExporter;
use App\Filament\Imports\LineImporter;
use App\Filament\Resources\LineResource\Pages;
use App\Models\Block;
use App\Models\Item;
use App\Models\Line;
use App\Models\Plant;
use App\Models\WorkGroupMaster;
@@ -25,11 +24,6 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Validation\Rule;
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
{
@@ -1190,207 +1184,7 @@ class LineResource extends Resource
])
->filters([
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([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),

View File

@@ -3529,80 +3529,14 @@ class QualityValidationResource extends Resource
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
$ccEmails = $mailData['cc_emails'] ?? [];
$mUserName = Filament::auth()->user()->name;
// if (! empty($emails)) {
// if (is_array($emails)) {
// $emailList = collect($emails)
// ->flatMap(fn ($email) => explode(',', $email))
// ->map(fn ($email) => trim($email))
// ->filter()
// ->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 {
if (! empty($emails)) {
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send(
new InvalidQualityMail($state, $mPorder, $mPlantName, $mLinePart, $mUserName, $mExpectedValue, 'InvalidPartNumber')
);
} else {
\Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
}
$set('part_validation1', null);
@@ -4044,7 +3978,6 @@ class QualityValidationResource extends Resource
->where('module', 'QualityValidation')
->where('rule_name', 'QualityMail')
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
// ->get()
->pluck('email')
->toArray();
@@ -4062,16 +3995,13 @@ class QualityValidationResource extends Resource
->where('module', 'QualityValidation')
->where('rule_name', 'QualityMail')
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
->get(['email', 'cc_emails']);
// ->pluck('email')
// ->toArray();
->pluck('email')
->toArray();
return [
'plant_id' => $plantId,
'plant_name' => $mPlantName,
'emails' => $emails->pluck('email')->filter()->toArray(),
'cc_emails' => $emails->pluck('cc_emails')->filter()->toArray(),
// 'emails' => $emails,
'emails' => $emails,
];
}

View File

@@ -813,7 +813,7 @@ class TestingPanelReadingResource extends Resource
if ($plantId) {
return MotorTestingMaster::whereHas('testingPanelReadings', function ($query) {
$query->whereNotNull('id');
})->whereNotNull('subassembly_code')->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
})->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
} else {
return [];
// return Item::whereHas('motorTestingMasters')

View File

@@ -450,9 +450,7 @@ class VisitorEntryResource extends Resource
|| !empty($data['created_to']);
if (!$hasAnyFilter) {
// $query->whereDate('created_at', today());
$query->whereDate('visitor_entries.created_at', today())
->whereNull('out_time');
$query->whereDate('created_at', today());
return;
}

View File

@@ -51,7 +51,7 @@ class ImportTransitMail extends Mailable
{
$now = now();
$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';

View File

@@ -10,7 +10,7 @@
"alperenersoy/filament-export": "^3.0",
"althinect/filament-spatie-roles-permissions": "^2.3",
"diogogpinto/filament-auth-ui-enhancer": "^1.0",
"erag/laravel-pwa": "^1.9",
"erag/laravel-pwa": "^2.0",
"filament/filament": "^3.3",
"intervention/image": "^3.11",
"irazasyed/telegram-bot-sdk": "^3.15",

View File

@@ -29,10 +29,6 @@
<td>Item Code</td>
<td style="text-align: center;">{{ $request->item->code ?? $request->code }}</td>
</tr>
<tr>
<td>Description</td>
<td style="text-align: center;">{{ $request->item->description ?? $request->description }}</td>
</tr>
<tr>
<td>Job Number</td>
<td style="text-align: center;">{{ $request->aufnr }}</td>

View File

@@ -89,27 +89,38 @@
<tr style="{{ $row['is_transit_identified'] == 1 ? 'background-color:#FFFF00;' . 'font-weight: bold;' : '' }}">
<td>{{ $loop->iteration }}</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['shipper'] }}</td>
<td>{{ $row['shipper_location'] }}</td>
<td>{{ $row['shipper_invoice'] }}</td>
{{-- <td>{{ \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') }}</td> --}}
<td>
{{ !empty($row['shipper_invoice_date']) ? \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') : '' }}
</td>
{{-- <td>{{ $row['shipper_invoice_date'] }}</td> --}}
<td>{{ \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') }}</td>
<td>{{ $row['customs_agent_name'] }}</td>
{{-- <td>{{ \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') }}</td> --}}
<td>
{{ !empty($row['eta_date']) ? \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') : '' }}
</td>
{{-- <td>{{ $row['eta_date'] }}</td> --}}
<td>{{ \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') }}</td>
{{-- <td>{{ $row['status'] }}</td> --}}
<td class="status-column">
{{ $row['status'] }}
</td>
<td>{{ $row['delivery_location'] }}</td>
{{-- <td>{{ \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') }}</td> --}}
<td>
{{ !empty($row['etd_date']) ? \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') : '' }}
</td>
{{-- <td>{{ $row['etd_date'] }}</td> --}}
<td>{{ \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') }}</td>
{{-- <td>{{ $row['mode'] }}</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>
</tr>
@endforeach