Compare commits
51 Commits
da8b2a00fb
...
ranjith-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f93f2bd92 | ||
|
|
d19b8120e2 | ||
|
|
8fb42203c3 | ||
|
|
bb2f5082b1 | ||
|
|
3215cd39ad | ||
|
|
7755d15741 | ||
|
|
4586fc0d60 | ||
|
|
65fc5202a4 | ||
|
|
770f0c9af3 | ||
|
|
47a0cf31d2 | ||
|
|
e5f23303d9 | ||
|
|
b9e164725e | ||
|
|
4699de9a77 | ||
|
|
196117f07f | ||
|
|
84b617f8fb | ||
|
|
9f6959784f | ||
|
|
bbdd9fb75c | ||
|
|
cc788ea6d4 | ||
|
|
8c0af96b94 | ||
|
|
b02954d0a2 | ||
|
|
9b098864bc | ||
|
|
50f542c3d1 | ||
|
|
dfb48055ea | ||
|
|
881e2fa6d9 | ||
|
|
3a7104513c | ||
|
|
25cfaa6479 | ||
|
|
b7e8182309 | ||
|
|
bce19056c7 | ||
|
|
8e2a0e79dc | ||
|
|
63c1cc14b2 | ||
|
|
1ddd27433c | ||
|
|
80d7258ae0 | ||
|
|
f10b4daddf | ||
|
|
b183a1d350 | ||
|
|
dd57d14f79 | ||
|
|
71e89c7927 | ||
|
|
a230208718 | ||
|
|
e27871d0c0 | ||
|
|
b188714b06 | ||
|
|
9bb6e05589 | ||
|
|
6cb33879f5 | ||
|
|
27164556ee | ||
|
|
b70d078ca9 | ||
|
|
2f36fe7270 | ||
|
|
bc874e23d2 | ||
|
|
fcd7d1ccc1 | ||
|
|
b409a021c4 | ||
|
|
48e6732257 | ||
|
|
653026a36d | ||
|
|
7a423d0f62 | ||
|
|
a6d3add1ac |
@@ -40,6 +40,7 @@ class Scheduler extends Command
|
||||
{
|
||||
|
||||
$this->call('approval:trigger-mails');
|
||||
// $this->call('sftp:process-files');
|
||||
|
||||
// --- Production Rules ---
|
||||
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||
@@ -234,6 +235,55 @@ class Scheduler extends Command
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$ImportTransitRules = AlertMailRule::where('module', 'ImportTransit')
|
||||
->where('rule_name', 'ImportTransitMail')
|
||||
->select('plant', 'schedule_type')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
foreach ($ImportTransitRules as $rule) {
|
||||
|
||||
switch ($rule->schedule_type) {
|
||||
case 'Live':
|
||||
// Run every minute
|
||||
\Artisan::call('send-import-transit', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
break;
|
||||
case 'Hourly':
|
||||
if (now()->minute == 0) {
|
||||
\Artisan::call('send-import-transit', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '11:10') {
|
||||
try {
|
||||
\Artisan::call('send-import-transit', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
|
||||
Log::info('Invoice Transit executed', [
|
||||
'plant' => $rule->plant,
|
||||
'type' => $rule->schedule_type,
|
||||
]);
|
||||
}
|
||||
catch (\Throwable $e) {
|
||||
Log::error('Invoice Transit FAILED', [
|
||||
'plant' => $rule->plant,
|
||||
'error' => $e->getMessage(),
|
||||
'trace' => $e->getTraceAsString(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
138
app/Console/Commands/SendImportTransit.php
Normal file
138
app/Console/Commands/SendImportTransit.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\ImportTransitMail;
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\ImportTransit;
|
||||
use App\Models\Plant;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SendImportTransit extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'send-import-transit {schedule_type} {plant}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$scheduleType = $this->argument('schedule_type');
|
||||
$plantId = (int) $this->argument('plant');
|
||||
|
||||
$mailRules = AlertMailRule::where('module', 'ImportTransit')
|
||||
->where('rule_name', 'ImportTransitMail')
|
||||
->where('schedule_type', $scheduleType)
|
||||
->where('plant', $plantId)
|
||||
->get();
|
||||
|
||||
$plants = ($plantId == 0)
|
||||
? Plant::all()
|
||||
: Plant::where('id', $plantId)->get();
|
||||
|
||||
$plantCodes = $plants->pluck('name', 'id');
|
||||
|
||||
if ($plants->isEmpty()) {
|
||||
$this->error('No valid plant(s) found.');
|
||||
|
||||
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',
|
||||
])
|
||||
->where('status', '!=', 'Delivered')
|
||||
->get();
|
||||
|
||||
if ($tableData->isEmpty()) {
|
||||
$this->info('No pending Import Transit records found. Mail skipped.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (strtolower($scheduleType) == 'daily')
|
||||
{
|
||||
foreach ($mailRules as $rule) {
|
||||
|
||||
$mailSubject = 'Daily Import Transit Report';
|
||||
|
||||
$mail = new ImportTransitMail(
|
||||
$scheduleType,
|
||||
$tableData,
|
||||
$mailSubject
|
||||
);
|
||||
|
||||
$toEmails = collect(explode(',', $rule->email))
|
||||
->map(fn ($e) => trim($e))
|
||||
->filter()
|
||||
->unique()
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
$ccEmails = collect(explode(',', $rule->cc_emails))
|
||||
->map(fn ($e) => trim($e))
|
||||
->filter()
|
||||
->unique()
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
if (empty($toEmails)) {
|
||||
$this->warn("Skipping rule {$rule->id} — no To emails.");
|
||||
continue;
|
||||
}
|
||||
|
||||
\Mail::to($toEmails)
|
||||
->cc($ccEmails)
|
||||
->send($mail);
|
||||
|
||||
$this->info(
|
||||
"Mail sent → Rule {$rule->id} | To: " . implode(', ', $toEmails)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,8 @@ class SendInvoiceReport extends Command
|
||||
// $scheduleType = $this->argument('scheduleType');
|
||||
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
||||
|
||||
// $mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||
|
||||
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||
|
||||
// $startDate = now()->setTime(8, 0, 0);
|
||||
@@ -91,6 +93,7 @@ class SendInvoiceReport extends Command
|
||||
|
||||
$serialTableData[] = [
|
||||
'no' => $no,
|
||||
'plant_id' => $plantId,
|
||||
'plant' => $plantName,
|
||||
'totalInvoice' => $totalSerialCount,
|
||||
'scannedInvoice' => $scannedSerialCount,
|
||||
@@ -127,6 +130,7 @@ class SendInvoiceReport extends Command
|
||||
|
||||
$materialTableData[] = [
|
||||
'no' => $no,
|
||||
'plant_id' => $plantId,
|
||||
'plant' => $plantName,
|
||||
'totalInvoice' => $totalMatCount,
|
||||
'scannedInvoice' => $scannedMatCount,
|
||||
@@ -163,6 +167,7 @@ class SendInvoiceReport extends Command
|
||||
|
||||
$bundleTableData[] = [
|
||||
'no' => $no,
|
||||
'plant_id' => $plantId,
|
||||
'plant' => $plantName,
|
||||
'totalInvoice' => $totalBundleCount,
|
||||
'scannedInvoice' => $scannedBundleCount,
|
||||
@@ -206,7 +211,26 @@ class SendInvoiceReport extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
\Mail::to($toEmails)->cc($ccEmails)->send(new test($serialTableData, [], [], $schedule));
|
||||
if ($rule->plant == 0) {
|
||||
$filteredSerialData = $serialTableData;
|
||||
|
||||
} else {
|
||||
$filteredSerialData = collect($serialTableData)
|
||||
->where('plant_id', $rule->plant)
|
||||
->values()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
\Mail::to($toEmails)
|
||||
->cc($ccEmails)
|
||||
->send(new test(
|
||||
$filteredSerialData,
|
||||
[],
|
||||
[],
|
||||
$schedule
|
||||
));
|
||||
|
||||
// \Mail::to($toEmails)->cc($ccEmails)->send(new test($serialTableData, [], [], $schedule));
|
||||
|
||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
||||
}
|
||||
@@ -240,7 +264,35 @@ class SendInvoiceReport extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
\Mail::to($toEmails)->cc($ccEmails)->send(new test([], $materialTableData, $bundleTableData, $schedule));
|
||||
// FILTER DATA
|
||||
if ($rule->plant == 0) {
|
||||
|
||||
$filteredMaterialData = $materialTableData;
|
||||
$filteredBundleData = $bundleTableData;
|
||||
|
||||
} else {
|
||||
|
||||
$filteredMaterialData = collect($materialTableData)
|
||||
->where('plant_id', $rule->plant)
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
$filteredBundleData = collect($bundleTableData)
|
||||
->where('plant_id', $rule->plant)
|
||||
->values()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
\Mail::to($toEmails)
|
||||
->cc($ccEmails)
|
||||
->send(new test(
|
||||
[],
|
||||
$filteredMaterialData,
|
||||
$filteredBundleData,
|
||||
$schedule
|
||||
));
|
||||
|
||||
// \Mail::to($toEmails)->cc($ccEmails)->send(new test([], $materialTableData, $bundleTableData, $schedule));
|
||||
|
||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
||||
}
|
||||
@@ -275,7 +327,41 @@ class SendInvoiceReport extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
\Mail::to($toEmails)->cc($ccEmails)->send(new test($serialTableData, $materialTableData, $bundleTableData, $schedule));
|
||||
// FILTER DATA
|
||||
if ($rule->plant == 0) {
|
||||
|
||||
$filteredSerialData = $serialTableData;
|
||||
$filteredMaterialData = $materialTableData;
|
||||
$filteredBundleData = $bundleTableData;
|
||||
|
||||
} else {
|
||||
|
||||
$filteredSerialData = collect($serialTableData)
|
||||
->where('plant_id', $rule->plant)
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
$filteredMaterialData = collect($materialTableData)
|
||||
->where('plant_id', $rule->plant)
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
$filteredBundleData = collect($bundleTableData)
|
||||
->where('plant_id', $rule->plant)
|
||||
->values()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
\Mail::to($toEmails)
|
||||
->cc($ccEmails)
|
||||
->send(new test(
|
||||
$filteredSerialData,
|
||||
$filteredMaterialData,
|
||||
$filteredBundleData,
|
||||
$schedule
|
||||
));
|
||||
|
||||
// \Mail::to($toEmails)->cc($ccEmails)->send(new test($serialTableData, $materialTableData, $bundleTableData, $schedule));
|
||||
|
||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
||||
}
|
||||
|
||||
@@ -5,9 +5,12 @@ namespace App\Console\Commands;
|
||||
use App\Mail\CharacteristicApprovalMail;
|
||||
use App\Models\CharacteristicApproverMaster;
|
||||
use App\Models\RequestCharacteristic;
|
||||
use App\Models\TempClassCharacteristic;
|
||||
// use App\Models\TempClassCharacteristic;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class TriggerPendingApprovalMails extends Command
|
||||
{
|
||||
@@ -40,6 +43,8 @@ class TriggerPendingApprovalMails extends Command
|
||||
|
||||
public $subjectLine;
|
||||
|
||||
// public $tempCharacteristics = [];
|
||||
|
||||
public $wfId;
|
||||
|
||||
public function handle()
|
||||
@@ -195,6 +200,38 @@ class TriggerPendingApprovalMails extends Command
|
||||
$updateData['mail_status'] = 'Sent-Mail3';
|
||||
}
|
||||
|
||||
$totalMinutes =
|
||||
$this->convertToMinutes($approver->duration1 ?? 0) +
|
||||
$this->convertToMinutes($approver->duration2 ?? 0) +
|
||||
$this->convertToMinutes($approver->duration3 ?? 0);
|
||||
|
||||
$expiryTime = Carbon::parse($first->created_at)
|
||||
->copy()
|
||||
->addMinutes($totalMinutes);
|
||||
|
||||
$ids = $groupRecords->pluck('id');
|
||||
|
||||
$this->info("Expiry Time for ID {$first->id}: {$expiryTime}, Now: {$now}");
|
||||
|
||||
// --- AUTO REJECT ---
|
||||
if (
|
||||
$first->mail_status == 'Sent-Mail3' &&
|
||||
(is_null($first->approver_status1) || $first->approver_status1 == 'Hold') &&
|
||||
(is_null($first->approver_status2) || $first->approver_status2 == 'Hold') &&
|
||||
(is_null($first->approver_status3) || $first->approver_status3 == 'Hold') &&
|
||||
$now->gte($expiryTime)
|
||||
) {
|
||||
RequestCharacteristic::whereIn('id', $ids)
|
||||
->update([
|
||||
'approver_status3' => 'Rejected',
|
||||
'approver_remark3' => 'Time Limit Reached',
|
||||
'approved3_at' => now(),
|
||||
]);
|
||||
|
||||
$this->info("Auto Rejected ID: {$first->id}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$level || !$mail) {
|
||||
continue;
|
||||
}
|
||||
@@ -203,6 +240,8 @@ class TriggerPendingApprovalMails extends Command
|
||||
|
||||
$subjectLine = 'Characteristic Approval Mail';
|
||||
|
||||
// $emails = array_map('trim', explode(',', $mail));
|
||||
|
||||
Mail::to($mail)->send(
|
||||
new CharacteristicApprovalMail(
|
||||
$first,
|
||||
@@ -251,6 +290,23 @@ class TriggerPendingApprovalMails extends Command
|
||||
return $approver && $approver->approver_type == 'Quality';
|
||||
});
|
||||
|
||||
// $approvers = CharacteristicApproverMaster::where('approver_type', 'Quality')
|
||||
// ->get()
|
||||
// ->keyBy('id');
|
||||
|
||||
// $qualityRecords = RequestCharacteristic::where(function ($q) {
|
||||
// $q->whereNull('approver_status1')->orWhere('approver_status1', 'Hold');
|
||||
// })
|
||||
// ->where(function ($q) {
|
||||
// $q->whereNull('approver_status2')->orWhere('approver_status2', 'Hold');
|
||||
// })
|
||||
// ->where(function ($q) {
|
||||
// $q->whereNull('approver_status3')->orWhere('approver_status3', 'Hold');
|
||||
// })
|
||||
// ->whereIn('characteristic_approver_master_id', $approvers->keys())
|
||||
// ->get();
|
||||
|
||||
|
||||
if ($qualityRecords->isEmpty()) {
|
||||
$this->info('No quality pending approvals');
|
||||
return;
|
||||
@@ -283,6 +339,43 @@ class TriggerPendingApprovalMails extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
$columns = Schema::getColumnListing('temp_class_characteristics');
|
||||
|
||||
$exclude = ['id', 'plant_id', 'machine_id', 'item_id', 'aufnr', 'class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_heading', 'created_at', 'updated_at', 'deleted_at', 'has_work_flow_id', 'model_type', 'created_by', 'updated_by' ];
|
||||
|
||||
$filteredColumns = array_diff($columns, $exclude);
|
||||
|
||||
$row1 = TempClassCharacteristic::where('plant_id', $first->plant_id)
|
||||
->where('machine_id', $first->machine_id)
|
||||
->where('aufnr', $first->aufnr)
|
||||
->where('model_type', $first->model_type)
|
||||
->latest()
|
||||
->first();
|
||||
|
||||
$this->info(json_encode([
|
||||
'id' => $row1->id,
|
||||
'plant_id' => $row1->plant_id,
|
||||
'machine_id' => $row1->machine_id,
|
||||
'aufnr' => $row1->aufnr,
|
||||
'motor_speed' => $row1->zmm_motor_speed,
|
||||
'all_data' => $row1->toArray(),
|
||||
]));
|
||||
|
||||
$data = [];
|
||||
|
||||
if ($row1) {
|
||||
foreach ($filteredColumns as $column) {
|
||||
|
||||
$value = $row1->getAttribute($column);
|
||||
|
||||
if ($value != null && $value != '') {
|
||||
$data[$column] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$characteristics = $data;
|
||||
|
||||
$level = null;
|
||||
$mail = null;
|
||||
$name = null;
|
||||
@@ -359,6 +452,38 @@ class TriggerPendingApprovalMails extends Command
|
||||
$updateData['mail_status'] = 'Sent-Mail3';
|
||||
}
|
||||
|
||||
$totalMinutes =
|
||||
$this->convertToMinutes($approver->duration1 ?? 0) +
|
||||
$this->convertToMinutes($approver->duration2 ?? 0) +
|
||||
$this->convertToMinutes($approver->duration3 ?? 0);
|
||||
|
||||
$expiryTime = Carbon::parse($first->created_at)
|
||||
->copy()
|
||||
->addMinutes($totalMinutes);
|
||||
|
||||
$ids = $groupRecords->pluck('id');
|
||||
|
||||
$this->info("Expiry Time for ID {$first->id}: {$expiryTime}, Now: {$now}");
|
||||
|
||||
// --- AUTO REJECT ---
|
||||
if (
|
||||
$first->mail_status == 'Sent-Mail3' &&
|
||||
(is_null($first->approver_status1) || $first->approver_status1 == 'Hold') &&
|
||||
(is_null($first->approver_status2) || $first->approver_status2 == 'Hold') &&
|
||||
(is_null($first->approver_status3) || $first->approver_status3 == 'Hold') &&
|
||||
$now->gte($expiryTime)
|
||||
) {
|
||||
RequestCharacteristic::whereIn('id', $ids)
|
||||
->update([
|
||||
'approver_status3' => 'Rejected',
|
||||
'approver_remark3' => 'Time Limit Reached',
|
||||
'approved3_at' => now(),
|
||||
]);
|
||||
|
||||
$this->info("Auto Rejected ID: {$first->id}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$level || !$mail) {
|
||||
continue;
|
||||
}
|
||||
@@ -381,8 +506,8 @@ class TriggerPendingApprovalMails extends Command
|
||||
$pdfPath,
|
||||
$pendingApprovers,
|
||||
$approverNameFromMaster,
|
||||
$subjectLine
|
||||
// $characteristics
|
||||
$subjectLine,
|
||||
$characteristics
|
||||
)
|
||||
);
|
||||
|
||||
@@ -406,4 +531,16 @@ class TriggerPendingApprovalMails extends Command
|
||||
|
||||
$this->info('Approval mail job completed');
|
||||
}
|
||||
|
||||
public function convertToMinutes($duration)
|
||||
{
|
||||
if (!$duration) return 0;
|
||||
|
||||
$parts = explode('.', (string)$duration);
|
||||
|
||||
$hours = (int)($parts[0] ?? 0);
|
||||
$minutes = (int)($parts[1] ?? 0);
|
||||
|
||||
return ($hours * 60) + $minutes;
|
||||
}
|
||||
}
|
||||
|
||||
97
app/Filament/Exports/ImportTransitExporter.php
Normal file
97
app/Filament/Exports/ImportTransitExporter.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\ImportTransit;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class ImportTransitExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = ImportTransit::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('cri_rfq_number')
|
||||
->label('CRI RFQ NUMBER'),
|
||||
ExportColumn::make('mail_received_date')
|
||||
->label('MAIL RECEIVED DATE'),
|
||||
ExportColumn::make('pricol_ref_number')
|
||||
->label('PRICOL REF NUMBER'),
|
||||
ExportColumn::make('requester')
|
||||
->label('REQUESTER'),
|
||||
ExportColumn::make('shipper')
|
||||
->label('SHIPPER'),
|
||||
ExportColumn::make('shipper_location')
|
||||
->label('SHIPPER LOCATION'),
|
||||
ExportColumn::make('shipper_invoice')
|
||||
->label('SHIPPER INVOICE'),
|
||||
ExportColumn::make('shipper_invoice_date')
|
||||
->label('SHIPPER INVOICE DATE'),
|
||||
ExportColumn::make('customs_agent_name')
|
||||
->label('CUSTOMS AGENT NAME'),
|
||||
ExportColumn::make('eta_date')
|
||||
->label('ETA DATE'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
ExportColumn::make('delivery_location')
|
||||
->label('DELIVERY LOCATION'),
|
||||
ExportColumn::make('etd_date')
|
||||
->label('ETD DATE'),
|
||||
ExportColumn::make('mode')
|
||||
->label('MODE'),
|
||||
ExportColumn::make('inco_terms')
|
||||
->label('INCO TERMS'),
|
||||
ExportColumn::make('port_of_loading')
|
||||
->label('PORT OF LOADING'),
|
||||
ExportColumn::make('port_of_discharge')
|
||||
->label('PORT OF DISCHARGE'),
|
||||
ExportColumn::make('delivery_city')
|
||||
->label('DELIVERY CITY'),
|
||||
ExportColumn::make('packages')
|
||||
->label('PACKAGES'),
|
||||
ExportColumn::make('type_of_package')
|
||||
->label('TYPE OF PACKAGE'),
|
||||
ExportColumn::make('gross_weight')
|
||||
->label('GROSS WEIGHT'),
|
||||
ExportColumn::make('volume')
|
||||
->label('VOLUME'),
|
||||
ExportColumn::make('bill_number')
|
||||
->label('BILL NUMBER'),
|
||||
ExportColumn::make('bill_received_date')
|
||||
->label('BILL RECEIVED DATE'),
|
||||
ExportColumn::make('vessel_number')
|
||||
->label('VESSEL NUMBER'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your import transit export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,8 @@ class PlantExporter extends Exporter
|
||||
->label('CODE'),
|
||||
ExportColumn::make('name')
|
||||
->label('NAME'),
|
||||
ExportColumn::make('warehouse_number')
|
||||
->label('WAREHOUSE_NUMBER'),
|
||||
ExportColumn::make('address')
|
||||
->label('ADDRESS'),
|
||||
ExportColumn::make('created_at')
|
||||
@@ -44,10 +46,10 @@ class PlantExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your plant export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
$body = 'Your plant export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -59,7 +59,6 @@ class ProcessOrderExporter extends Exporter
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ class InvoiceValidationImporter extends Importer
|
||||
ImportColumn::make('operator_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('OPERATOR ID')
|
||||
->example('USER1')
|
||||
->example('USER00001')
|
||||
->label('OPERATOR ID')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('created_at')
|
||||
@@ -122,19 +122,19 @@ class InvoiceValidationImporter extends Importer
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('CREATED BY')
|
||||
->example('USER1')
|
||||
->example('USER00001')
|
||||
->label('CREATED BY')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_at')
|
||||
->requiredMapping()
|
||||
->exampleHeader('UPDATED AT')
|
||||
->example('USER1')
|
||||
->example('')
|
||||
->label('UPDATED AT')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('UPDATED BY')
|
||||
->example('')
|
||||
->example('USER00001')
|
||||
->label('UPDATED BY')
|
||||
->rules(['required']),
|
||||
];
|
||||
|
||||
@@ -37,6 +37,12 @@ class PlantImporter extends Importer
|
||||
->example('Ransar Industries-I')
|
||||
->label('NAME')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('warehouse_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('WAREHOUSE_NUMBER')
|
||||
->example('001')
|
||||
->label('WAREHOUSE_NUMBER')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('address')
|
||||
->requiredMapping()
|
||||
->exampleHeader('ADDRESS')
|
||||
@@ -53,6 +59,7 @@ class PlantImporter extends Importer
|
||||
$comp = trim($this->data['company']) ?? null;
|
||||
$code = trim($this->data['code']) ?? null;
|
||||
$name = trim($this->data['name']) ?? null;
|
||||
$wareHouseNo = trim($this->data['warehouse_number']) ?? null;
|
||||
$addr = trim($this->data['address']) ?? null;
|
||||
|
||||
if ($comp == null || $comp == '' || ! $comp) {
|
||||
@@ -74,6 +81,13 @@ class PlantImporter extends Importer
|
||||
} elseif (Str::length($name) < 5) {
|
||||
$warnMsg[] = 'Name should contain at least 5 characters!';
|
||||
}
|
||||
if ($wareHouseNo == null || $wareHouseNo == '' || ! $wareHouseNo) {
|
||||
$warnMsg[] = "Warehouse number can't be empty!";
|
||||
} elseif (! is_numeric($wareHouseNo)) {
|
||||
$warnMsg[] = 'Warehouse number should contain only numeric values!';
|
||||
} elseif (Str::length($wareHouseNo) == 3) {
|
||||
$warnMsg[] = 'Warehouse number must contain 3 digits only!';
|
||||
}
|
||||
if ($addr == null || $addr == '' || ! $addr) {
|
||||
$warnMsg[] = "Address can't be empty!";
|
||||
} elseif (Str::length($addr) < 5) {
|
||||
@@ -92,6 +106,7 @@ class PlantImporter extends Importer
|
||||
}
|
||||
|
||||
$plantCN = Plant::where('code', $code)->where('name', $name)->first();
|
||||
$plantCW = Plant::where('code', $code)->where('warehouse_number', $wareHouseNo)->first();
|
||||
if (! $plantCN) {
|
||||
$plantCode = Plant::where('code', $code)->first();
|
||||
$plantName = Plant::where('name', $name)->first();
|
||||
@@ -99,6 +114,16 @@ class PlantImporter extends Importer
|
||||
throw new RowImportFailedException('Duplicate plant name found!');
|
||||
} elseif ($plantCode) {
|
||||
throw new RowImportFailedException('Duplicate plant code found!');
|
||||
} elseif (! $plantCW) {
|
||||
$wareHouse = Plant::where('warehouse_number', $wareHouseNo)->first();
|
||||
if ($wareHouse) {
|
||||
throw new RowImportFailedException('Duplicate warehouse number found!');
|
||||
}
|
||||
}
|
||||
} elseif (! $plantCW) {
|
||||
$wareHouse = Plant::where('warehouse_number', $wareHouseNo)->first();
|
||||
if ($wareHouse) {
|
||||
throw new RowImportFailedException('Duplicate warehouse number found!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +132,7 @@ class PlantImporter extends Importer
|
||||
'name' => $name,
|
||||
],
|
||||
[
|
||||
'warehouse_number' => $wareHouseNo,
|
||||
'address' => $addr,
|
||||
'company_id' => $compId,
|
||||
]
|
||||
|
||||
@@ -102,7 +102,6 @@ class ProductCharacteristicsMasterImporter extends Importer
|
||||
|
||||
public function resolveRecord(): ?ProductCharacteristicsMaster
|
||||
{
|
||||
|
||||
$warnMsg = [];
|
||||
$plantCod = trim($this->data['plant']) ?? null;
|
||||
$itemCod = trim($this->data['item']) ?? null;
|
||||
|
||||
@@ -2,10 +2,17 @@
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProductionCharacteristic;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
|
||||
class ProductionCharacteristicImporter extends Importer
|
||||
{
|
||||
@@ -16,40 +23,170 @@ class ProductionCharacteristicImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->exampleHeader('PLANT CODE')
|
||||
->example('1200')
|
||||
->label('PLANT CODE')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
->exampleHeader('LINE NAME')
|
||||
->example('Poly Wrapped Wire SFG')
|
||||
->label('LINE NAME')
|
||||
->relationship(resolveUsing: 'name'),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->exampleHeader('ITEM CODE')
|
||||
->example('123456')
|
||||
->label('ITEM CODE')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
ImportColumn::make('machine_name')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->exampleHeader('MACHINE NAME')
|
||||
->example('RMI001234')
|
||||
->label('MACHINE NAME')
|
||||
// ->relationship(resolveUsing: 'work_center')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('production_order'),
|
||||
ImportColumn::make('serial_number'),
|
||||
ImportColumn::make('characteristic_name'),
|
||||
ImportColumn::make('observed_value'),
|
||||
ImportColumn::make('status'),
|
||||
ImportColumn::make('inspection_status'),
|
||||
ImportColumn::make('remark'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
ImportColumn::make('production_order')
|
||||
->requiredMapping()
|
||||
->exampleHeader('PRODUCTION ORDER')
|
||||
->example('1880231')
|
||||
->label('PRODUCTION ORDER')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('serial_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('SERIAL NUMBER')
|
||||
->example('20001202121')
|
||||
->label('SERIAL NUMBER')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('characteristic_name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('CHARACTERISTIC NAME')
|
||||
->example('Voltage')
|
||||
->label('CHARACTERISTIC NAME'),
|
||||
ImportColumn::make('observed_value')
|
||||
->exampleHeader('OBSERVED VALUE')
|
||||
->example('0')
|
||||
->label('OBSERVED VALUE'),
|
||||
ImportColumn::make('status')
|
||||
->exampleHeader('STATUS')
|
||||
->example('Ok')
|
||||
->label('STATUS'),
|
||||
ImportColumn::make('remark')
|
||||
->exampleHeader('REMARK')
|
||||
->example('Issue')
|
||||
->label('REMARK'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?ProductionCharacteristic
|
||||
{
|
||||
// return ProductionCharacteristic::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new ProductionCharacteristic();
|
||||
$warnMsg = [];
|
||||
$plant = null;
|
||||
$plantCod = trim($this->data['plant']) ?? '';
|
||||
$plantId = null;
|
||||
$iCode = trim($this->data['item']) ?? '';
|
||||
$itemId = null;
|
||||
$lineNam = trim($this->data['line']) ?? '';
|
||||
$lineId = null;
|
||||
$machineName = trim($this->data['machine_name'] ?? '');
|
||||
$pOrder = trim($this->data['production_order'] ?? '');
|
||||
$sNo = trim($this->data['serial_number'] ?? '');
|
||||
$charName = trim($this->data['characteristic_name'] ?? '');
|
||||
$obsValue = trim($this->data['observed_value'] ?? '');
|
||||
$status = trim($this->data['status'] ?? '');
|
||||
$remark = trim($this->data['remark'] ?? '');
|
||||
|
||||
if ($plantCod == null || $plantCod == '') {
|
||||
$warnMsg[] = "Plant code can't be empty!";
|
||||
} elseif (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
}
|
||||
if ($iCode == null || $iCode == '') {
|
||||
$warnMsg[] = "Item code can't be empty!";
|
||||
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||
$warnMsg[] = 'Invalid item code found!';
|
||||
}
|
||||
if ($machineName != null && $machineName != '' && Str::length($machineName) > 18) {
|
||||
$warnMsg[] = 'Invalid machine name found!';
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found!';
|
||||
} else {
|
||||
$plantId = $plant->id;
|
||||
}
|
||||
|
||||
$itemCode = Item::where('code', $iCode)->first();
|
||||
if (! $itemCode) {
|
||||
$warnMsg[] = 'Item code not found!';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$itemCode = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
|
||||
if (! $itemCode) {
|
||||
$warnMsg[] = 'Item code not found for the given plant!';
|
||||
} else {
|
||||
$itemId = $itemCode->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$lineExists = Line::where('name', $lineNam)->first();
|
||||
if (! $lineExists) {
|
||||
$warnMsg[] = 'Line name not found!';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$lineAgainstPlant = Line::where('name', $lineNam)->where('plant_id', $plantId)->first();
|
||||
if (! $lineAgainstPlant) {
|
||||
$warnMsg[] = 'Line name not found for the given plant!';
|
||||
} else {
|
||||
$lineId = $lineAgainstPlant->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$machineExists = Machine::where('work_center', $machineName)->first();
|
||||
if (! $machineExists) {
|
||||
$warnMsg[] = 'Machine not found!';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$machineAgainstPlant = Machine::where('work_center', $machineName)->where('plant_id', $plantId)->first();
|
||||
if (! $machineAgainstPlant) {
|
||||
$warnMsg[] = 'Machine not found for the given plant!';
|
||||
} else {
|
||||
$machineId = $machineAgainstPlant->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
ProductionCharacteristic::Create(
|
||||
[
|
||||
'plant_id' => $plantId,
|
||||
'line_id' => $lineId,
|
||||
'item_id' => $itemId,
|
||||
'machine_id' => $machineId,
|
||||
'production_order' => $pOrder,
|
||||
'serial_number' => $sNo,
|
||||
'characteristic_name' => $charName,
|
||||
'observed_value' => $obsValue,
|
||||
'status' => $status,
|
||||
'remark' => $remark,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
'created_by' => Filament::auth()->user()->name,
|
||||
'updated_by' => Filament::auth()->user()->name,
|
||||
]
|
||||
);
|
||||
|
||||
return null;
|
||||
|
||||
// return new ProductionCharacteristic();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
|
||||
141
app/Filament/Imports/RequestCharacteristicImporter.php
Normal file
141
app/Filament/Imports/RequestCharacteristicImporter.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\RequestCharacteristic;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class RequestCharacteristicImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = RequestCharacteristic::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('PLANT CODE')
|
||||
->example('1000')
|
||||
->label('PLANT CODE')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->exampleHeader('WORK CENTER')
|
||||
->example('RMGLAS01')
|
||||
->label('WORK CENTER')
|
||||
->relationship(resolveUsing: 'work_center')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->exampleHeader('ITEM CODE')
|
||||
->example('630214')
|
||||
->label('ITEM CODE')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('characteristicApproverMaster')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('aufnr')
|
||||
->label('AUFNR')
|
||||
->exampleHeader('AUFNR')
|
||||
->example('1234567'),
|
||||
ImportColumn::make('characteristic_name')
|
||||
->label('CHARACTERISTIC NAME')
|
||||
->exampleHeader('CHARACTERISTIC NAME')
|
||||
->example('ZMM_PUMPSET_MODEL'),
|
||||
ImportColumn::make('current_value')
|
||||
->label('CURRENT VALUE')
|
||||
->exampleHeader('CURRENT VALUE')
|
||||
->example('MVN-32/02 D R'),
|
||||
ImportColumn::make('update_value')
|
||||
->label('UPDATE VALUE')
|
||||
->exampleHeader('UPDATE VALUE')
|
||||
->example('MVN-32/02 TR3'),
|
||||
ImportColumn::make('approver_status1')
|
||||
->label('APPROVER STATUS 1')
|
||||
->exampleHeader('APPROVER STATUS 1')
|
||||
->example('Hold'),
|
||||
ImportColumn::make('approver_status2')
|
||||
->label('APPROVER STATUS 2')
|
||||
->exampleHeader('APPROVER STATUS 2')
|
||||
->example('Approved'),
|
||||
ImportColumn::make('approver_status3')
|
||||
->label('APPROVER STATUS 3')
|
||||
->exampleHeader('APPROVER STATUS 3')
|
||||
->example('Rejected'),
|
||||
ImportColumn::make('approver_remark1')
|
||||
->label('APPROVER REMARK 1')
|
||||
->exampleHeader('APPROVER REMARK 1')
|
||||
->example('Hold for review'),
|
||||
ImportColumn::make('approver_remark2')
|
||||
->label('APPROVER REMARK 2')
|
||||
->exampleHeader('APPROVER REMARK 2')
|
||||
->example('Approved with comments'),
|
||||
ImportColumn::make('approver_remark3')
|
||||
->label('APPROVER REMARK 3')
|
||||
->exampleHeader('APPROVER REMARK 3')
|
||||
->example('Rejected due to incorrect value'),
|
||||
ImportColumn::make('work_flow_id')
|
||||
->label('WORK FLOW ID')
|
||||
->exampleHeader('WORK FLOW ID')
|
||||
->example('WF-260303-0001'),
|
||||
ImportColumn::make('mail_status')
|
||||
->label('MAIL STATUS')
|
||||
->exampleHeader('MAIL STATUS')
|
||||
->example('Sent'),
|
||||
ImportColumn::make('trigger_at')
|
||||
->label('TRIGGER AT')
|
||||
->exampleHeader('MAIL STATUS')
|
||||
->rules(['datetime']),
|
||||
ImportColumn::make('approved1_at')
|
||||
->label('APPROVED1 AT')
|
||||
->exampleHeader('APPROVED1 AT')
|
||||
->rules(['datetime']),
|
||||
ImportColumn::make('approved2_at')
|
||||
->label('APPROVED2 AT')
|
||||
->exampleHeader('APPROVED2 AT')
|
||||
->rules(['datetime']),
|
||||
ImportColumn::make('approved3_at')
|
||||
->label('APPROVED3 AT')
|
||||
->exampleHeader('APPROVED3 AT')
|
||||
->rules(['datetime']),
|
||||
ImportColumn::make('created_by')
|
||||
->label('CREATED BY')
|
||||
->exampleHeader('CREATED BY')
|
||||
->example('RAW01234'),
|
||||
ImportColumn::make('updated_by')
|
||||
->label('UPDATED BY')
|
||||
->exampleHeader('UPDATED BY')
|
||||
->example('RAW01234'),
|
||||
ImportColumn::make('model_type')
|
||||
->label('MODEL TYPE')
|
||||
->exampleHeader('MODEL TYPE')
|
||||
->example('PUMP'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?RequestCharacteristic
|
||||
{
|
||||
// return RequestCharacteristic::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new RequestCharacteristic();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your request characteristic import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ use Filament\Forms\Form;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
|
||||
class InvoiceDashboard extends Page
|
||||
{
|
||||
@@ -27,9 +28,13 @@ class InvoiceDashboard extends Page
|
||||
public function mount(): void
|
||||
{
|
||||
session()->forget(['selec_plant', 'select_invoice']);
|
||||
session()->forget(['from_date']);
|
||||
session()->forget(['to_date']);
|
||||
$this->filtersForm->fill([
|
||||
'plant' => null,
|
||||
'invoice' => null,
|
||||
'from_date' => null,
|
||||
'to_date' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -62,9 +67,23 @@ class InvoiceDashboard extends Page
|
||||
->afterStateUpdated(function ($state) {
|
||||
session(['select_invoice' => $state]);
|
||||
$this->dispatch('invoiceChart');
|
||||
})
|
||||
}),
|
||||
DatePicker::make('created_from')
|
||||
->label('Created From')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state,callable $set) {
|
||||
session(['from_date' => $state]);
|
||||
$this->dispatch('invoiceChart');
|
||||
}),
|
||||
DatePicker::make('created_to')
|
||||
->label('Created To')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state,callable $set) {
|
||||
session(['to_date' => $state]);
|
||||
$this->dispatch('invoiceChart');
|
||||
}),
|
||||
])
|
||||
->columns(2);
|
||||
->columns(4);
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
|
||||
@@ -291,7 +291,6 @@ class ProductionQuantityPage extends Page implements HasForms
|
||||
$machineId = $get('machine_id');
|
||||
|
||||
$this->mNam = $machineId;
|
||||
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
// 'class' => $get('pqLineError') ? 'border-red-500' : '',
|
||||
|
||||
@@ -58,6 +58,7 @@ class AlertMailRuleResource extends Resource
|
||||
'ProductionQuantities' => 'ProductionQuantities',
|
||||
'QualityValidation' => 'QualityValidation',
|
||||
'InvoiceTransit' => 'InvoiceTransit',
|
||||
'ImportTransit' => 'ImportTransit',
|
||||
]),
|
||||
Forms\Components\Select::make('rule_name')
|
||||
->label('Rule Name')
|
||||
@@ -69,6 +70,7 @@ class AlertMailRuleResource extends Resource
|
||||
'InvoiceDataMail' => 'Invoice Data Mail',
|
||||
'QualityMail' => 'Quality Mail',
|
||||
'InvoiceTransitMail' => 'Invoice Transit Mail',
|
||||
'ImportTransitMail' => 'Import Transit Mail',
|
||||
])
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('email')
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Filament\Exports\CharacteristicApproverMasterExporter;
|
||||
use App\Filament\Imports\CharacteristicApproverMasterImporter;
|
||||
use App\Filament\Resources\CharacteristicApproverMasterResource\Pages;
|
||||
use App\Models\CharacteristicApproverMaster;
|
||||
use App\Models\Item;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use Filament\Facades\Filament;
|
||||
@@ -20,6 +21,10 @@ use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
|
||||
class CharacteristicApproverMasterResource extends Resource
|
||||
{
|
||||
@@ -392,7 +397,203 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
->form([
|
||||
Select::make('Plant')
|
||||
->label('Search by Plant Name')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||
} else {
|
||||
return Plant::whereHas('requestCharacteristics', function ($query) {
|
||||
$query->whereNotNull('id');
|
||||
})->orderBy('code')->pluck('name', 'id');
|
||||
}
|
||||
|
||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||
$set('machine', null);
|
||||
// $set('aufnr', null);
|
||||
}),
|
||||
Select::make('machine')
|
||||
->label('Search by Work Center')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::whereHas('requestCharacteristics', function ($query) use ($plantId) {
|
||||
if ($plantId) {
|
||||
$query->where('plant_id', $plantId);
|
||||
}
|
||||
})->pluck('work_center', 'id');
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||
// $set('item_id', null);
|
||||
// $set('aufnr', null);
|
||||
}),
|
||||
Select::make('approver_type')
|
||||
->label('Approver Type')
|
||||
->options([
|
||||
'Characteristic' => 'Characteristic',
|
||||
'Quality' => 'Quality',
|
||||
])
|
||||
->placeholder('Select Type')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('name1', null);
|
||||
$set('name2', null);
|
||||
$set('name3', null);
|
||||
}),
|
||||
TextInput::make('machine_name')
|
||||
->label('Machine Name')
|
||||
->placeholder('Enter Machine Name'),
|
||||
TextInput::make('characteristic_field')
|
||||
->label('Characteristic Field')
|
||||
->placeholder('Enter Characteristic Field'),
|
||||
TextInput::make('name1')
|
||||
->label('Approver Name 1')
|
||||
->placeholder('Enter Approver Name 2')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('name2', null);
|
||||
$set('name3', null);
|
||||
}),
|
||||
TextInput::make('name2')
|
||||
->label('Approver Name 2')
|
||||
->placeholder('Enter Approver Name 2')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('name3', null);
|
||||
}),
|
||||
TextInput::make('name3')
|
||||
->label('Approver Name 3')
|
||||
->placeholder('Enter Approver Name 2'),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder('Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('created_to')
|
||||
->label('Created To')
|
||||
->placeholder('Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['machine_name']) && empty($data['characteristic_field']) && empty($data['approver_type']) && empty($data['name1']) && empty($data['name2']) && empty($data['name3']) && empty($data['created_from']) && empty($data['created_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['machine'])) {
|
||||
$query->where('machine_id', $data['machine']);
|
||||
}
|
||||
|
||||
if (! empty($data['machine_name'])) {
|
||||
$query->where('machine_name', 'like', '%'.$data['machine_name'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['characteristic_field'])) {
|
||||
$query->where('characteristic_field', 'like', '%'.$data['characteristic_field'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['approver_type'])) {
|
||||
$query->where('approver_type', 'like', '%'.$data['approver_type'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['name1'])) {
|
||||
$query->where('name1', 'like', '%'.$data['name1'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['name2'])) {
|
||||
$query->where('name2', 'like', '%'.$data['name2'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['name3'])) {
|
||||
$query->where('name3', 'like', '%'.$data['name3'].'%');
|
||||
}
|
||||
|
||||
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 Name: '.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['machine'])) {
|
||||
$indicators[] = 'Work Center: '.Machine::where('id', $data['machine'])->value('work_center');
|
||||
}
|
||||
|
||||
if (! empty($data['machine_name'])) {
|
||||
$indicators[] = 'Machine Name: '.$data['machine_name'];
|
||||
}
|
||||
|
||||
if (! empty($data['characteristic_field'])) {
|
||||
$indicators[] = 'Characteristic Field: '.$data['characteristic_field'];
|
||||
}
|
||||
|
||||
if (! empty($data['approver_type'])) {
|
||||
$indicators[] = 'Approver Type: '.$data['approver_type'];
|
||||
}
|
||||
|
||||
if (! empty($data['name1'])) {
|
||||
$indicators[] = 'Approver Name 1: '.$data['name1'];
|
||||
}
|
||||
|
||||
if (! empty($data['name2'])) {
|
||||
$indicators[] = 'Approver Name 2: '.$data['name2'];
|
||||
}
|
||||
|
||||
if (! empty($data['name3'])) {
|
||||
$indicators[] = 'Approver Name 3: '.$data['name3'];
|
||||
}
|
||||
|
||||
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(),
|
||||
|
||||
@@ -2028,6 +2028,12 @@ class ClassCharacteristicResource extends Resource
|
||||
TextInput::make('gernr')
|
||||
->label('Serial Number')
|
||||
->placeholder('Enter Serial Number'),
|
||||
TextInput::make('zmm_heading')
|
||||
->label('Heading')
|
||||
->placeholder('Enter Heading'),
|
||||
TextInput::make('model_type')
|
||||
->label('Model Type')
|
||||
->placeholder('Enter Model Type'),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder('Select From DateTime')
|
||||
@@ -2041,7 +2047,7 @@ class ClassCharacteristicResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['gernr']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['gernr']) && empty($data['zmm_heading']) && empty($data['model_type']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -2071,6 +2077,14 @@ class ClassCharacteristicResource extends Resource
|
||||
$query->where('gernr', 'like', '%'.$data['gernr'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['zmm_heading'])) {
|
||||
$query->where('zmm_heading', 'like', '%'.$data['zmm_heading'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['model_type'])) {
|
||||
$query->where('model_type', 'like', '%'.$data['model_type'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
@@ -2108,6 +2122,14 @@ class ClassCharacteristicResource extends Resource
|
||||
$indicators[] = 'Serial Number: '.$data['gernr'];
|
||||
}
|
||||
|
||||
if (! empty($data['zmm_heading'])) {
|
||||
$indicators[] = 'Heading: '.$data['zmm_heading'];
|
||||
}
|
||||
|
||||
if (! empty($data['model_type'])) {
|
||||
$indicators[] = 'Model Type: '.$data['model_type'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$indicators[] = 'From: '.$data['created_from'];
|
||||
}
|
||||
|
||||
664
app/Filament/Resources/ImportTransitResource.php
Normal file
664
app/Filament/Resources/ImportTransitResource.php
Normal file
@@ -0,0 +1,664 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\ImportTransitExporter;
|
||||
use App\Filament\Resources\ImportTransitResource\Pages;
|
||||
use App\Filament\Resources\ImportTransitResource\RelationManagers;
|
||||
use App\Models\ImportTransit;
|
||||
use App\Models\InvoiceDataValidation;
|
||||
use App\Models\Plant;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
// use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
class ImportTransitResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ImportTransit::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Manufacturing SD';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('cri_rfq_number')
|
||||
->label('CRI/RFQ Number')
|
||||
->disabled(fn ($operation) => $operation == 'edit')
|
||||
->unique(ignoreRecord: true),
|
||||
Forms\Components\DatePicker::make('mail_received_date')
|
||||
->label('Mail Received Date')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('pricol_ref_number')
|
||||
->label('Pricol Ref Number')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('requester')
|
||||
->label('Requester')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('shipper')
|
||||
->label('Shipper')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('shipper_location')
|
||||
->label('Shipper Location')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('shipper_invoice')
|
||||
->label('Shipper Invoice')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\DatePicker::make('shipper_invoice_date')
|
||||
->label('Shipper Invoice Date')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('customs_agent_name')
|
||||
->label('Customs Agent Name')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\DatePicker::make('eta_date')
|
||||
->label('ETA Date')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\Select::make('status')
|
||||
->label('Status')
|
||||
->options([
|
||||
'Under Service Provider Finalization' => 'Under Service Provider Finalization',
|
||||
'Yet to pick up' => 'Yet to pick up',
|
||||
'Awaiting Vessel Loading' => 'Awaiting Vessel Loading',
|
||||
'In Transit' => 'In Transit',
|
||||
'Under Import Customs Clearance in Destination' => 'Under Import Customs Clearance in Destination',
|
||||
'Delivered' => 'Delivered',
|
||||
])
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('delivery_location')
|
||||
->label('Delivery Location')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\DatePicker::make('etd_date')
|
||||
->label('ETD Date')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('mode')
|
||||
->label('Mode')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('inco_terms')
|
||||
->label('Inco Terms')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('port_of_loading')
|
||||
->label('Port of Loading')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('port_of_discharge')
|
||||
->label('Port of Discharge')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('delivery_city')
|
||||
->label('Delivery City')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('packages')
|
||||
->label('Packages')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('type_of_package')
|
||||
->label('Type of Package')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('gross_weight')
|
||||
->label('Gross Weight')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('volume')
|
||||
->label('Volume')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('bill_number')
|
||||
->label('Bill Number')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\DatePicker::make('bill_received_date')
|
||||
->label('Bill Received Date')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('vessel_number')
|
||||
->label('Vessel Number')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->alignCenter()
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('cri_rfq_number')
|
||||
->label('CRI/RFQ Number')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mail_received_date')
|
||||
->label('Mail Received Date')
|
||||
->date()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('pricol_ref_number')
|
||||
->label('Pricol Ref Number')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requester')
|
||||
->label('Requester')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('shipper')
|
||||
->label('Shipper')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('shipper_location')
|
||||
->label('Shipper Location')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('shipper_invoice')
|
||||
->label('Shipper Invoice')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('shipper_invoice_date')
|
||||
->label('Shipper Invoice Date')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('customs_agent_name')
|
||||
->label('Customs Agent Name')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('eta_date')
|
||||
->label('ETA Date')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->label('Status')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('delivery_location')
|
||||
->label('Delivery Location')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('etd_date')
|
||||
->label('ETD Date')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mode')
|
||||
->label('Mode')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('inco_terms')
|
||||
->label('Inco Terms')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('port_of_loading')
|
||||
->label('Port of Loading')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('port_of_discharge')
|
||||
->label('Port of Discharge')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('delivery_city')
|
||||
->label('Delivery City')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('packages')
|
||||
->label('Packages')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('type_of_package')
|
||||
->label('Type of Package')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('gross_weight')
|
||||
->label('Gross Weight')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('volume')
|
||||
->label('Volume')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('bill_number')
|
||||
->label('Bill Number')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('bill_received_date')
|
||||
->label('Bill Received Date')
|
||||
->alignCenter()
|
||||
->date()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('vessel_number')
|
||||
->label('Vessel Number')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\Action::make('Import Transit')
|
||||
->label('Import Transit')
|
||||
->form([
|
||||
FileUpload::make('import_transit_file')
|
||||
->label('Import Transit')
|
||||
// ->required()
|
||||
->preserveFilenames()
|
||||
->storeFiles(false)
|
||||
->reactive()
|
||||
->required()
|
||||
->disk('local')
|
||||
// ->visible(fn (Get $get) => !empty($get('plant_id')))
|
||||
->directory('uploads/ImportTransit'),
|
||||
])
|
||||
->action(function (array $data) {
|
||||
$uploadedFile = $data['import_transit_file'];
|
||||
|
||||
$disk = Storage::disk('local');
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
// Get original filename
|
||||
$originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx
|
||||
|
||||
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
|
||||
|
||||
// Store manually using storeAs to keep original name
|
||||
$path = $uploadedFile->storeAs('uploads/ImportTransit', $originalName, 'local'); // returns relative path
|
||||
|
||||
$fullPath = Storage::disk('local')->path($path);
|
||||
|
||||
if ($fullPath && file_exists($fullPath)) {
|
||||
$rows = Excel::toArray(null, $fullPath)[0];
|
||||
|
||||
if ((count($rows) - 1) <= 0) {
|
||||
Notification::make()
|
||||
->title('Records Not Found')
|
||||
->body("Import the valid 'Import Transit' file to proceed..!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path))
|
||||
{
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$invalidCriNo = [];
|
||||
|
||||
foreach ($rows as $index => $row)
|
||||
{
|
||||
if ($index == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rowNumber = $index + 1;
|
||||
|
||||
$criRfqNo = trim($row[1] ?? '');
|
||||
$mailRcvdDate = trim($row[2] ?? '');
|
||||
$pricolRefNo = trim($row[3] ?? '');
|
||||
$requester = trim($row[4] ?? '');
|
||||
$shipper = trim($row[5] ?? '');
|
||||
$shipperLocation = trim($row[6] ?? '');
|
||||
$shipperInv = trim($row[7] ?? '');
|
||||
$shipperInvDate = trim($row[8] ?? '');
|
||||
$cha = trim($row[9] ?? '');
|
||||
$eta = trim($row[10] ?? '');
|
||||
$status = trim($row[11] ?? '');
|
||||
$dlyLoc = trim($row[12] ?? '');
|
||||
$etd = trim($row[13] ?? '');
|
||||
$mode = trim($row[14] ?? '');
|
||||
$incoTerms = trim($row[15] ?? '');
|
||||
$portOfLoading = trim($row[16] ?? '');
|
||||
$portOfDischarge = trim($row[17] ?? '');
|
||||
$deliveryCity = trim($row[18] ?? '');
|
||||
$packages = trim($row[19] ?? '');
|
||||
$typeOfPkg = trim($row[20] ?? '');
|
||||
$grossWeight = trim($row[21] ?? '');
|
||||
$volumeWeight = trim($row[22] ?? '');
|
||||
$blNo = trim($row[23] ?? '');
|
||||
$blRcvdDate = trim($row[24] ?? '');
|
||||
$vesselNo = trim($row[25] ?? '');
|
||||
|
||||
if (empty($criRfqNo)) {
|
||||
$invalidCriNo[] = $rowNumber;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($invalidCriNo)){
|
||||
|
||||
$errorMsg = '';
|
||||
|
||||
if (! empty($invalidCriNo)) {
|
||||
$errorMsg .= 'Missing CRI Rfq No in rows: '.implode(', ', $invalidCriNo).'<br>';
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Missing Mandatory Fields')
|
||||
->body($errorMsg)
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// $spreadsheet = IOFactory::load($fullPath);
|
||||
|
||||
// foreach ($spreadsheet->getAllSheets() as $sheet) {
|
||||
// $state = $sheet->getSheetState();
|
||||
// if ($state == \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN ||
|
||||
// $state == \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VERYHIDDEN) {
|
||||
// Notification::make()
|
||||
// ->title('Import Failed')
|
||||
// ->body("Hidden sheet found: \"{$sheet->getTitle()}\". Please remove all hidden sheets and try again.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
try
|
||||
{
|
||||
foreach ($rows as $index => $row)
|
||||
{
|
||||
if ($index == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rowNumber = $index + 1;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
$formattedDate = null;
|
||||
$formattedShipperDate = null;
|
||||
$etaDate = null;
|
||||
$etdDate = null;
|
||||
$formattedBlRcvdDate = null;
|
||||
|
||||
$criRfqNo = trim($row[1] ?? '');
|
||||
$mailRcvdDate = trim($row[2] ?? '');
|
||||
$pricolRefNo = trim($row[3] ?? '');
|
||||
$requester = trim($row[4] ?? '');
|
||||
$shipper = trim($row[5] ?? '');
|
||||
$shipperLocation = trim($row[6] ?? '');
|
||||
$shipperInv = trim($row[7] ?? '');
|
||||
$shipperInvDate = trim($row[8] ?? '');
|
||||
$cha = trim($row[9] ?? '');
|
||||
$eta = trim($row[10] ?? '');
|
||||
$status = trim($row[11] ?? '');
|
||||
$dlyLoc = trim($row[12] ?? '');
|
||||
$etd = trim($row[13] ?? '');
|
||||
$mode = trim($row[14] ?? '');
|
||||
$incoTerms = trim($row[15] ?? '');
|
||||
$portOfLoading = trim($row[16] ?? '');
|
||||
$portOfDischarge = trim($row[17] ?? '');
|
||||
$deliveryCity = trim($row[18] ?? '');
|
||||
$packages = trim($row[19] ?? '');
|
||||
$typeOfPkg = trim($row[20] ?? '');
|
||||
$grossWeight = trim($row[21] ?? '');
|
||||
$volumeWeight = trim($row[22] ?? '');
|
||||
$blNo = trim($row[23] ?? '');
|
||||
$blRcvdDate = trim($row[24] ?? '');
|
||||
$vesselNo = trim($row[25] ?? '');
|
||||
|
||||
|
||||
if (! empty($mailRcvdDate)) {
|
||||
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $mailRcvdDate)) {
|
||||
[$day, $month, $year] = preg_split('/[-\/]/', $mailRcvdDate);
|
||||
$formattedDate = "{$year}-{$month}-{$day}";
|
||||
} elseif (is_numeric($mailRcvdDate)) {
|
||||
$formattedDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($mailRcvdDate)->format('Y-m-d');
|
||||
} else {
|
||||
$formattedDate = date('Y-m-d', strtotime($mailRcvdDate));
|
||||
}
|
||||
}
|
||||
if (! empty($shipperInvDate)) {
|
||||
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $shipperInvDate)) {
|
||||
[$day, $month, $year] = preg_split('/[-\/]/', $shipperInvDate);
|
||||
$formattedShipperDate = "{$year}-{$month}-{$day}";
|
||||
} elseif (is_numeric($shipperInvDate)) {
|
||||
$formattedShipperDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($shipperInvDate)->format('Y-m-d');
|
||||
} else {
|
||||
$formattedShipperDate = date('Y-m-d', strtotime($shipperInvDate));
|
||||
}
|
||||
}
|
||||
if (! empty($eta)) {
|
||||
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $eta)) {
|
||||
[$day, $month, $year] = preg_split('/[-\/]/', $eta);
|
||||
$etaDate = "{$year}-{$month}-{$day}";
|
||||
} elseif (is_numeric($eta)) {
|
||||
$etaDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($eta)->format('Y-m-d');
|
||||
} else {
|
||||
$etaDate = date('Y-m-d', strtotime($eta));
|
||||
}
|
||||
}
|
||||
if (! empty($etd)) {
|
||||
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $etd)) {
|
||||
[$day, $month, $year] = preg_split('/[-\/]/', $etd);
|
||||
$etdDate = "{$year}-{$month}-{$day}";
|
||||
} elseif (is_numeric($etd)) {
|
||||
$etdDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($etd)->format('Y-m-d');
|
||||
} else {
|
||||
$etdDate = date('Y-m-d', strtotime($etd));
|
||||
}
|
||||
}
|
||||
if (! empty($blRcvdDate)) {
|
||||
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $blRcvdDate)) {
|
||||
[$day, $month, $year] = preg_split('/[-\/]/', $blRcvdDate);
|
||||
$formattedBlRcvdDate = "{$year}-{$month}-{$day}";
|
||||
} elseif (is_numeric($blRcvdDate)) {
|
||||
$formattedBlRcvdDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($blRcvdDate)->format('Y-m-d');
|
||||
} else {
|
||||
$formattedBlRcvdDate = date('Y-m-d', strtotime($blRcvdDate));
|
||||
}
|
||||
}
|
||||
|
||||
$inserted = ImportTransit::updateOrCreate(
|
||||
[
|
||||
'cri_rfq_number' => $criRfqNo,
|
||||
],
|
||||
[
|
||||
'mail_received_date' => $formattedDate ?? null,
|
||||
'pricol_ref_number' => $pricolRefNo ?? null,
|
||||
'requester' => $requester ?? null,
|
||||
'shipper' => $shipper ?? null,
|
||||
'shipper_location' => $shipperLocation ?? null,
|
||||
'shipper_invoice' => $shipperInv ?? null,
|
||||
'shipper_invoice_date' => $formattedShipperDate ?? null,
|
||||
'customs_agent_name' => $cha ?? null,
|
||||
'eta_date' => $etaDate ?? null,
|
||||
'status' => $status ?? null,
|
||||
'delivery_location' => $dlyLoc ?? null,
|
||||
'etd_date' => $etdDate ?? null,
|
||||
'mode' => $mode ?? null,
|
||||
'inco_terms' => $incoTerms ?? null,
|
||||
'port_of_loading' => $portOfLoading ?? null,
|
||||
'port_of_discharge' => $portOfDischarge ?? null,
|
||||
'delivery_city' => $deliveryCity ?? null,
|
||||
'packages' => $packages ?? null,
|
||||
'type_of_package' => $typeOfPkg ?? null,
|
||||
'gross_weight' => $grossWeight ?? null,
|
||||
'volume' => $volumeWeight ?? null,
|
||||
'bill_number' => $blNo ?? null,
|
||||
'bill_received_date' => $formattedBlRcvdDate ?? null,
|
||||
'vessel_number' => $vesselNo ?? null,
|
||||
'created_by' => $operatorName,
|
||||
]
|
||||
);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
Notification::make()
|
||||
->title('Import Failed')
|
||||
->body("Error occurred while processing row. Error : {$e->getMessage()}")
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
if (! $inserted) {
|
||||
Notification::make()
|
||||
->title('Failed')
|
||||
->body("Records insertion failed!")
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
else{
|
||||
Notification::make()
|
||||
->title('Success')
|
||||
->body("Records inserted successfully!")
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
Notification::make()
|
||||
->title('Import Failed')
|
||||
->body("No records were inserted. Error : {$e->getMessage()}")
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
})
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import transit');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Import Transit')
|
||||
->color('warning')
|
||||
->exporter(ImportTransitExporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export import transit');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListImportTransits::route('/'),
|
||||
'create' => Pages\CreateImportTransit::route('/create'),
|
||||
'view' => Pages\ViewImportTransit::route('/{record}'),
|
||||
'edit' => Pages\EditImportTransit::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ImportTransitResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ImportTransitResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateImportTransit extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ImportTransitResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ImportTransitResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ImportTransitResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditImportTransit extends EditRecord
|
||||
{
|
||||
protected static string $resource = ImportTransitResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ImportTransitResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ImportTransitResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListImportTransits extends ListRecords
|
||||
{
|
||||
protected static string $resource = ImportTransitResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ImportTransitResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ImportTransitResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewImportTransit extends ViewRecord
|
||||
{
|
||||
protected static string $resource = ImportTransitResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ class PlantResource extends Resource
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('code')
|
||||
->label('Code')
|
||||
->required()
|
||||
->unique(ignoreRecord: true)
|
||||
->integer()
|
||||
@@ -78,7 +79,8 @@ class PlantResource extends Resource
|
||||
->hint(fn ($get) => $get('pCodeError') ? $get('pCodeError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Select::make('company_id')
|
||||
// ->placeholder('Choose the valid company name')
|
||||
->label('Company')
|
||||
->placeholder('Choose the valid company nany')
|
||||
->relationship('company', 'name')
|
||||
->required()
|
||||
->reactive()
|
||||
@@ -104,9 +106,10 @@ class PlantResource extends Resource
|
||||
->hintColor('danger'),
|
||||
Forms\Components\TextInput::make('name')
|
||||
->required()
|
||||
->label('Name')
|
||||
->placeholder('Scan the valid name')
|
||||
->unique(ignoreRecord: true)
|
||||
->columnSpanFull()
|
||||
// ->columnSpanFull()
|
||||
->reactive()
|
||||
->minLength(5)
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
@@ -128,8 +131,38 @@ class PlantResource extends Resource
|
||||
])
|
||||
->hint(fn ($get) => $get('pNameError') ? $get('pNameError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\TextInput::make('warehouse_number')
|
||||
->required()
|
||||
->label('Warehouse Number')
|
||||
->placeholder('Scan the valid warehouse number')
|
||||
->unique(ignoreRecord: true)
|
||||
->reactive()
|
||||
->numeric()
|
||||
->length(3),
|
||||
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
// $codeId = $get('warehouse_number');
|
||||
// // Ensure `linestop_id` is not cleared
|
||||
// if (! $codeId) {
|
||||
// $set('wNumberError', 'Scan the valid warehouse number.');
|
||||
|
||||
// return;
|
||||
// } else {
|
||||
// if (strlen($codeId) != 3) {
|
||||
// $set('wNumberError', 'Warehouse number must be exactly 3 digits!');
|
||||
|
||||
// return;
|
||||
// }
|
||||
// $set('wNumberError', null);
|
||||
// }
|
||||
// })
|
||||
// ->extraAttributes(fn ($get) => [
|
||||
// 'class' => $get('wNumberError') ? 'border-red-500' : '',
|
||||
// ])
|
||||
// ->hint(fn ($get) => $get('wNumberError') ? $get('wNumberError') : null)
|
||||
// ->hintColor('danger'),
|
||||
Forms\Components\Textarea::make('address')
|
||||
->required()
|
||||
->label('Address')
|
||||
->placeholder('Scan the valid address')
|
||||
->unique(ignoreRecord: true)
|
||||
->columnSpanFull()
|
||||
@@ -190,6 +223,11 @@ class PlantResource extends Resource
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('warehouse_number')
|
||||
->label('Warehouse Number')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('address')
|
||||
->label('Address')
|
||||
->alignCenter()
|
||||
|
||||
@@ -339,8 +339,9 @@ class ProductionCharacteristicResource extends Resource
|
||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Item', null);
|
||||
$set('Line', null);
|
||||
$set('Item', null);
|
||||
$set('Machine', null);
|
||||
}),
|
||||
Select::make('Line')
|
||||
->label('Search by Line Name')
|
||||
@@ -361,7 +362,7 @@ class ProductionCharacteristicResource extends Resource
|
||||
})->pluck('name', 'id');
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('process_order', null);
|
||||
$set('Machine', null);
|
||||
}),
|
||||
Select::make('Item')
|
||||
->label('Search by Item Code')
|
||||
|
||||
@@ -203,7 +203,6 @@ class ProductionOrderResource extends Resource
|
||||
->label('Production Order')
|
||||
->readOnly()
|
||||
->visible(fn ($get) => $get('quantity') > 0),
|
||||
// ->visible(fn ($get) => $get('show_extra_fields')),
|
||||
Forms\Components\TextInput::make('from_serial_number')
|
||||
->label('From Serial Number')
|
||||
->readOnly()
|
||||
|
||||
@@ -245,7 +245,6 @@ class CreateProductionOrder extends CreateRecord
|
||||
} else {
|
||||
return redirect()->route('production-orders.printpanel', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function getFormActions(): array
|
||||
|
||||
@@ -94,7 +94,7 @@ class QualityValidationResource extends Resource
|
||||
Forms\Components\Hidden::make('plant')
|
||||
->default(fn () => session('last_selected_plant_id'))
|
||||
->afterStateHydrated(function ($state, $set) {
|
||||
if (!$state && request()->has('plant_id')) {
|
||||
if (! $state && request()->has('plant_id')) {
|
||||
$set('plant_id', request()->get('plant_id'));
|
||||
}
|
||||
}),
|
||||
@@ -136,7 +136,7 @@ class QualityValidationResource extends Resource
|
||||
Forms\Components\Hidden::make('line')
|
||||
->default(fn () => session('last_selected_line'))
|
||||
->afterStateHydrated(function ($state, $set) {
|
||||
if (!$state && request()->has('line_id')) {
|
||||
if (! $state && request()->has('line_id')) {
|
||||
$set('line_id', request()->get('line_id'));
|
||||
}
|
||||
}),
|
||||
@@ -178,7 +178,7 @@ class QualityValidationResource extends Resource
|
||||
Forms\Components\Hidden::make('production')
|
||||
->default(fn () => session('last_selected_production'))
|
||||
->afterStateHydrated(function ($state, $set) {
|
||||
if (!$state && request()->has('production_order')) {
|
||||
if (! $state && request()->has('production_order')) {
|
||||
$set('production_order', request()->get('production_order'));
|
||||
}
|
||||
}),
|
||||
@@ -2423,7 +2423,6 @@ class QualityValidationResource extends Resource
|
||||
$emails = $mailData['emails'];
|
||||
$mUserName = Filament::auth()->user()->name;
|
||||
|
||||
|
||||
if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
@@ -2519,7 +2518,6 @@ class QualityValidationResource extends Resource
|
||||
$emails = $mailData['emails'];
|
||||
$mUserName = Filament::auth()->user()->name;
|
||||
|
||||
|
||||
if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
@@ -2711,7 +2709,6 @@ class QualityValidationResource extends Resource
|
||||
$emails = $mailData['emails'];
|
||||
$mUserName = Filament::auth()->user()->name;
|
||||
|
||||
|
||||
if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
@@ -2864,16 +2861,6 @@ class QualityValidationResource extends Resource
|
||||
'showChecklist' => $livewire->showChecklist,
|
||||
]),
|
||||
|
||||
// Forms\Components\View::make('components.production-checklist-wrapper')
|
||||
// ->statePath('checklist')
|
||||
// ->key('checklist-view')
|
||||
// ->viewData(fn ($livewire) => [
|
||||
// 'existingRecords' => is_array($livewire->existingRecords)
|
||||
// ? $livewire->existingRecords
|
||||
// : $livewire->existingRecords->toArray(),
|
||||
// 'showChecklist' => $livewire->showChecklist,
|
||||
// ]),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -3066,7 +3053,6 @@ class QualityValidationResource extends Resource
|
||||
])
|
||||
|
||||
->filters([
|
||||
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\RequestCharacteristicExporter;
|
||||
use App\Filament\Imports\RequestCharacteristicImporter;
|
||||
use App\Filament\Resources\RequestCharacteristicResource\Pages;
|
||||
use App\Models\CharacteristicApproverMaster;
|
||||
use App\Models\Item;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\RequestCharacteristic;
|
||||
use App\Models\StickerMaster;
|
||||
use Closure;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
@@ -19,6 +21,7 @@ use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Forms\Set;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
@@ -27,6 +30,7 @@ use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
@@ -128,6 +132,16 @@ class RequestCharacteristicResource extends Resource
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\Hidden::make('show_validation_image')
|
||||
->reactive()
|
||||
->default(false),
|
||||
Forms\Components\Hidden::make('validation1_image_url')
|
||||
->reactive(),
|
||||
|
||||
Forms\Components\View::make('components.part-validation-error-icon')
|
||||
->statePath('validation1_image_url')
|
||||
->visible(fn ($get) => $get('show_validation_image') == true)
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('work_flow_id')
|
||||
->label('Work Flow ID')
|
||||
->readOnly()
|
||||
@@ -139,7 +153,42 @@ class RequestCharacteristicResource extends Resource
|
||||
return self::isNewWorkFlow($get);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
})
|
||||
->suffixAction(
|
||||
Forms\Components\Actions\Action::make('toggleValidationImage')
|
||||
->icon(fn (callable $get) => $get('show_validation_image') ? 'heroicon-o-eye-slash' : 'heroicon-o-eye')
|
||||
->tooltip('View Validation Image')
|
||||
->action(function (callable $get, $set) {
|
||||
|
||||
$currentState = $get('show_validation_image');
|
||||
$set('show_validation_image', ! $currentState);
|
||||
|
||||
if ($currentState == true) {
|
||||
$set('validation1_image_url', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$workFlowId = $get('work_flow_id');
|
||||
|
||||
if (!$workFlowId) {
|
||||
Notification::make()
|
||||
->title('Missing Workflow ID')
|
||||
->body('Please select a Workflow ID.')
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
// Build filename
|
||||
$fileName = "{$workFlowId}.png";
|
||||
|
||||
$imageUrl = route('workflow.image', [
|
||||
'filename' => $fileName,
|
||||
]);
|
||||
|
||||
$set('validation1_image_url', $imageUrl);
|
||||
})
|
||||
),
|
||||
// ->rule(function (callable $get) {
|
||||
// return Rule::unique('request_characteristics', 'work_flow_id')
|
||||
// ->where('plant_id', $get('plant_id'))
|
||||
@@ -312,7 +361,7 @@ class RequestCharacteristicResource extends Resource
|
||||
Forms\Components\Select::make('characteristic_approver_master_id')
|
||||
->label('Master Characteristic Field')
|
||||
// ->relationship('characteristicApproverMaster', 'characteristic_field')
|
||||
->columnSpan(2)
|
||||
// ->columnSpan(2)
|
||||
->reactive()
|
||||
->nullable()
|
||||
->searchable()
|
||||
@@ -340,6 +389,17 @@ class RequestCharacteristicResource extends Resource
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('model_type')
|
||||
->label('Model Type')
|
||||
->reactive()
|
||||
->nullable()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('characteristic_name', null);
|
||||
$set('current_value', null);
|
||||
$set('update_value', null);
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required(),
|
||||
// ->disabled(fn ($get) => self::isFieldDisabled($get))
|
||||
Section::make('Request Characteristic Details')
|
||||
// ->columnSpan(['default' => 2, 'sm' => 4])
|
||||
@@ -500,6 +560,7 @@ class RequestCharacteristicResource extends Resource
|
||||
Forms\Components\TextInput::make('approver_remark1')
|
||||
->label('Approver Remark')
|
||||
->live()
|
||||
->maxLength(60)
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$appStat = $get('approver_status1');
|
||||
if ($appStat && $state) {
|
||||
@@ -615,6 +676,7 @@ class RequestCharacteristicResource extends Resource
|
||||
Forms\Components\TextInput::make('approver_remark2')
|
||||
->label('Approver Remark')
|
||||
->live()
|
||||
->maxLength(60)
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$appStat = $get('approver_status2');
|
||||
if ($appStat && $state) {
|
||||
@@ -727,6 +789,7 @@ class RequestCharacteristicResource extends Resource
|
||||
Forms\Components\TextInput::make('approver_remark3')
|
||||
->label('Approver Remark')
|
||||
->live()
|
||||
->maxLength(60)
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$appStat = $get('approver_status3');
|
||||
if ($appStat && $state) {
|
||||
@@ -916,6 +979,11 @@ class RequestCharacteristicResource extends Resource
|
||||
->formatStateUsing(fn (string $state): string => strtoupper(__($state)))
|
||||
->extraAttributes(['class' => 'uppercase'])
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('model_type')
|
||||
->label('Model Type')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('characteristic_name')
|
||||
->label('Characteristic Name')
|
||||
->default('-')
|
||||
@@ -956,12 +1024,14 @@ class RequestCharacteristicResource extends Resource
|
||||
default => 'gray',
|
||||
})
|
||||
->alignCenter()
|
||||
->default('-')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approver_remark1')
|
||||
->label('Approver Remark 1')
|
||||
// ->color('success')
|
||||
->alignCenter()
|
||||
->default('-')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approved1_at')
|
||||
@@ -984,12 +1054,14 @@ class RequestCharacteristicResource extends Resource
|
||||
default => 'gray',
|
||||
})
|
||||
->alignCenter()
|
||||
->default('-')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approver_remark2')
|
||||
->label('Approver Remark 2')
|
||||
// ->color('success')
|
||||
->alignCenter()
|
||||
->default('-')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approved2_at')
|
||||
@@ -1012,12 +1084,14 @@ class RequestCharacteristicResource extends Resource
|
||||
default => 'gray',
|
||||
})
|
||||
->alignCenter()
|
||||
->default('-')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approver_remark3')
|
||||
->label('Approver Remark 3')
|
||||
// ->color('success')
|
||||
->alignCenter()
|
||||
->default('-')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('approved3_at')
|
||||
@@ -1160,6 +1234,67 @@ class RequestCharacteristicResource extends Resource
|
||||
->numeric()
|
||||
->minlength(7)
|
||||
->maxlength(10),
|
||||
TextInput::make('work_flow_id')
|
||||
->label('Work Flow ID')
|
||||
->placeholder('Enter Work Flow ID'),
|
||||
TextInput::make('machine_name')
|
||||
->label('Machine Name')
|
||||
->placeholder('Enter Machine Name'),
|
||||
Select::make('request_type')
|
||||
->label('Request Type')
|
||||
->options([
|
||||
'Characteristic' => 'Characteristic',
|
||||
'Quality' => 'Quality',
|
||||
])
|
||||
->placeholder('Select Request Type'),
|
||||
TextInput::make('master_characteristic_field')
|
||||
->label('Master Characteristic Field')
|
||||
->placeholder('Enter Master Characteristic Field'),
|
||||
TextInput::make('model_type')
|
||||
->label('Model Type')
|
||||
->placeholder('Enter Model Type'),
|
||||
Select::make('approver_status')
|
||||
->label('Approver Status')
|
||||
->options([
|
||||
'Approved' => 'Approved',
|
||||
'Hold' => 'Hold',
|
||||
'Rejected' => 'Rejected',
|
||||
])
|
||||
->placeholder('Select Status')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('approver_status1', null);
|
||||
$set('approver_status2', null);
|
||||
$set('approver_status3', null);
|
||||
}),
|
||||
Select::make('approver_status1')
|
||||
->label('Approver Status 1')
|
||||
->options([
|
||||
'Approved' => 'Approved',
|
||||
'Hold' => 'Hold',
|
||||
'Rejected' => 'Rejected',
|
||||
])
|
||||
->placeholder('Select Status')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('approver_status2', null);
|
||||
$set('approver_status3', null);
|
||||
}),
|
||||
Select::make('approver_status2')
|
||||
->label('Approver Status 2')
|
||||
->options([
|
||||
'Approved' => 'Approved',
|
||||
'Hold' => 'Hold',
|
||||
'Rejected' => 'Rejected',
|
||||
])
|
||||
->placeholder('Select Status'),
|
||||
Select::make('approver_status3')
|
||||
->label('Approver Status 3')
|
||||
->options([
|
||||
'Approved' => 'Approved',
|
||||
'Hold' => 'Hold',
|
||||
'Rejected' => 'Rejected',
|
||||
])
|
||||
->placeholder('Select Status'),
|
||||
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder('Select From DateTime')
|
||||
@@ -1173,7 +1308,7 @@ class RequestCharacteristicResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['model_type']) && empty($data['work_flow_id']) && empty($data['machine_name']) && empty($data['request_type']) && empty($data['master_characteristic_field'])&& empty($data['approver_status1']) && empty($data['approver_status2']) && empty($data['approver_status3']) && empty($data['approver_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -1199,6 +1334,70 @@ class RequestCharacteristicResource extends Resource
|
||||
$query->where('aufnr', 'like', '%'.$data['aufnr'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['model_type'])) {
|
||||
$query->where('model_type', 'like', '%'.$data['model_type'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['work_flow_id'])) {
|
||||
$query->where('work_flow_id', 'like', '%'.$data['work_flow_id'].'%');
|
||||
}
|
||||
|
||||
if (!empty($data['machine_name'])) {
|
||||
$query->whereHas('characteristicApproverMaster', function ($q) use ($data) {
|
||||
$q->where('characteristic_approver_masters.machine_name', '=', (string) $data['machine_name']);
|
||||
});
|
||||
}
|
||||
|
||||
if (!empty($data['request_type'])) {
|
||||
$query->whereHas('characteristicApproverMaster', function ($q) use ($data) {
|
||||
$q->where('characteristic_approver_masters.approver_type', '=', (string) $data['request_type']);
|
||||
});
|
||||
}
|
||||
|
||||
if (!empty($data['master_characteristic_field'])) {
|
||||
$query->whereHas('characteristicApproverMaster', function ($q) use ($data) {
|
||||
$q->where('characteristic_approver_masters.characteristic_field', '=', (string) $data['master_characteristic_field']);
|
||||
});
|
||||
}
|
||||
|
||||
if (! empty($data['approver_status1'])) {
|
||||
$query->where('approver_status1', 'like', '%'.$data['approver_status1'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['approver_status2'])) {
|
||||
$query->where('approver_status2', 'like', '%'.$data['approver_status2'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['approver_status3'])) {
|
||||
$query->where('approver_status3', 'like', '%'.$data['approver_status3'].'%');
|
||||
}
|
||||
|
||||
if (!empty($data['approver_status'])) {
|
||||
|
||||
$status = $data['approver_status'];
|
||||
|
||||
$query->whereRaw("
|
||||
CASE
|
||||
|
||||
-- If status3 exists, it must be considered first
|
||||
WHEN approver_status3 IS NOT NULL AND approver_status3 != ''
|
||||
THEN approver_status3
|
||||
|
||||
-- then status2 overrides only if status3 is empty
|
||||
WHEN approver_status2 IS NOT NULL AND approver_status2 != ''
|
||||
THEN approver_status2
|
||||
|
||||
-- finally status1 only if both 2 and 3 are empty
|
||||
WHEN approver_status1 IS NOT NULL AND approver_status1 != ''
|
||||
THEN approver_status1
|
||||
|
||||
ELSE NULL
|
||||
|
||||
END = ?
|
||||
", [$status]);
|
||||
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
@@ -1232,6 +1431,42 @@ class RequestCharacteristicResource extends Resource
|
||||
$indicators[] = 'Job No: '.$data['aufnr'];
|
||||
}
|
||||
|
||||
if (! empty($data['model_type'])) {
|
||||
$indicators[] = 'Model Type: '.$data['model_type'];
|
||||
}
|
||||
|
||||
if (! empty($data['work_flow_id'])) {
|
||||
$indicators[] = 'Work Flow ID: '.$data['work_flow_id'];
|
||||
}
|
||||
|
||||
if (! empty($data['machine_name'])) {
|
||||
$indicators[] = 'Machine Name: '.$data['machine_name'];
|
||||
}
|
||||
|
||||
if (! empty($data['request_type'])) {
|
||||
$indicators[] = 'Request Type: '.$data['request_type'];
|
||||
}
|
||||
|
||||
if (! empty($data['master_characteristic_field'])) {
|
||||
$indicators[] = 'Master Characteristic Field: '.$data['master_characteristic_field'];
|
||||
}
|
||||
|
||||
if (! empty($data['approver_status'])) {
|
||||
$indicators[] = 'Approver Status: '.$data['approver_status'];
|
||||
}
|
||||
|
||||
if (! empty($data['approver_status1'])) {
|
||||
$indicators[] = 'Approver Status 1: '.$data['approver_status1'];
|
||||
}
|
||||
|
||||
if (! empty($data['approver_status2'])) {
|
||||
$indicators[] = 'Approver Status 2: '.$data['approver_status2'];
|
||||
}
|
||||
|
||||
if (! empty($data['approver_status3'])) {
|
||||
$indicators[] = 'Approver Status 3: '.$data['approver_status3'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$indicators[] = 'From: '.$data['created_from'];
|
||||
}
|
||||
@@ -1256,13 +1491,13 @@ class RequestCharacteristicResource extends Resource
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
// ImportAction::make()
|
||||
// ->label('Import Request Characteristics')
|
||||
// ->color('warning')
|
||||
// ->importer(RequestCharacteristicImporter::class)
|
||||
// ->visible(function () {
|
||||
// return Filament::auth()->user()->can('view import request characteristic');
|
||||
// }),
|
||||
ImportAction::make()
|
||||
->label('Import Request Characteristics')
|
||||
->color('warning')
|
||||
->importer(RequestCharacteristicImporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import request characteristic');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Request Characteristics')
|
||||
->color('warning')
|
||||
|
||||
@@ -5,28 +5,27 @@ namespace App\Filament\Resources;
|
||||
use App\Filament\Exports\TempClassCharacteristicExporter;
|
||||
use App\Filament\Imports\TempClassCharacteristicImporter;
|
||||
use App\Filament\Resources\TempClassCharacteristicResource\Pages;
|
||||
use App\Filament\Resources\TempClassCharacteristicResource\RelationManagers;
|
||||
use App\Models\Item;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\TempClassCharacteristic;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Get;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class TempClassCharacteristicResource extends Resource
|
||||
{
|
||||
@@ -1029,6 +1028,10 @@ class TempClassCharacteristicResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('model_type')
|
||||
->label('MODEL TYPE')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('aufnr')
|
||||
->label('AUFNR')
|
||||
->alignCenter()
|
||||
@@ -1055,10 +1058,6 @@ class TempClassCharacteristicResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('model_type')
|
||||
->label('MODEL TYPE')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zz1_cn_bill_ord')
|
||||
->label('ZZ1 CN BILL ORD')
|
||||
->alignCenter()
|
||||
@@ -1181,6 +1180,7 @@ class TempClassCharacteristicResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_ratedpower')
|
||||
->label('ZMM RATEDPOWER')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_region')
|
||||
->label('ZMM REGION')
|
||||
@@ -1577,14 +1577,12 @@ class TempClassCharacteristicResource extends Resource
|
||||
Tables\Columns\TextColumn::make('winded_serial_number')
|
||||
->label('WINDED SERIAL NUMBER')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('part_validation_1')
|
||||
->label('PART VALIDATION 1')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('part_validation_2')
|
||||
->label('PART VALIDATION 2')
|
||||
Tables\Columns\TextColumn::make('model_type')
|
||||
->label('MODEL TYPE')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('has_work_flow_id')
|
||||
->label('HAS WORK FLOW ID')
|
||||
@@ -1599,14 +1597,28 @@ class TempClassCharacteristicResource extends Resource
|
||||
};
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('CREATED AT')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('CREATED BY')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('UPDATED AT')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('UPDATED BY')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
@@ -1690,6 +1702,12 @@ class TempClassCharacteristicResource extends Resource
|
||||
TextInput::make('gernr')
|
||||
->label('Serial Number')
|
||||
->placeholder('Enter Serial Number'),
|
||||
TextInput::make('zmm_heading')
|
||||
->label('Heading')
|
||||
->placeholder('Enter Heading'),
|
||||
TextInput::make('model_type')
|
||||
->label('Model Type')
|
||||
->placeholder('Enter Model Type'),
|
||||
Select::make('work_flow_status')
|
||||
->label('Work Flow Status')
|
||||
->placeholder('Select Work Flow Status')
|
||||
@@ -1711,7 +1729,7 @@ class TempClassCharacteristicResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['gernr']) && empty($data['created_from']) && empty($data['created_to']) && !array_key_exists('work_flow_status', $data)) {
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['gernr']) && empty($data['zmm_heading']) && empty($data['model_type']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -1741,6 +1759,14 @@ class TempClassCharacteristicResource extends Resource
|
||||
$query->where('gernr', 'like', '%'.$data['gernr'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['zmm_heading'])) {
|
||||
$query->where('zmm_heading', 'like', '%'.$data['zmm_heading'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['model_type'])) {
|
||||
$query->where('model_type', 'like', '%'.$data['model_type'].'%');
|
||||
}
|
||||
|
||||
if (array_key_exists('work_flow_status', $data) && $data['work_flow_status'] != '') {
|
||||
$query->where('has_work_flow_id', $data['work_flow_status']);
|
||||
}
|
||||
@@ -1782,6 +1808,14 @@ class TempClassCharacteristicResource extends Resource
|
||||
$indicators[] = 'Serial Number: '.$data['gernr'];
|
||||
}
|
||||
|
||||
if (! empty($data['zmm_heading'])) {
|
||||
$indicators[] = 'Heading: '.$data['zmm_heading'];
|
||||
}
|
||||
|
||||
if (! empty($data['model_type'])) {
|
||||
$indicators[] = 'Model Type: '.$data['model_type'];
|
||||
}
|
||||
|
||||
if (array_key_exists('work_flow_status', $data) && $data['work_flow_status'] != '') {
|
||||
$statusMap = [
|
||||
'1' => 'Pending Approval',
|
||||
@@ -1789,7 +1823,7 @@ class TempClassCharacteristicResource extends Resource
|
||||
'0' => 'Approved',
|
||||
];
|
||||
|
||||
$indicators[] = 'Work Flow Status: ' . ($statusMap[$data['work_flow_status']] ?? '');
|
||||
$indicators[] = 'Work Flow Status: '.($statusMap[$data['work_flow_status']] ?? '');
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
|
||||
@@ -630,7 +630,7 @@ class TestingPanelReadingResource extends Resource
|
||||
->options(function () {
|
||||
// return Plant::pluck('name', 'id');
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||
} else {
|
||||
|
||||
@@ -37,6 +37,9 @@ class VehicleEntryResource extends Resource
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('uuid')
|
||||
->label('Uuid')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('vehicle_number')
|
||||
->label('Vehicle Number')
|
||||
->required(),
|
||||
@@ -102,6 +105,11 @@ class VehicleEntryResource extends Resource
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('uuid')
|
||||
->label('UUID')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('vehicle_number')
|
||||
->label('Vehicle Number')
|
||||
->alignCenter()
|
||||
|
||||
@@ -22,6 +22,10 @@ class InvoiceChart extends ChartWidget
|
||||
{
|
||||
$selectedPlant = session('selec_plant');
|
||||
$selectedInvoice = session('select_invoice');
|
||||
|
||||
$fromDt = session('from_date');
|
||||
$toDt = session('to_date');
|
||||
|
||||
$activeFilter = $this->filter; // Assuming filter is passed and activeFilter can be 'yesterday', 'this_week', 'this_month'
|
||||
|
||||
if (!$selectedPlant || !$selectedInvoice) {
|
||||
@@ -31,23 +35,33 @@ class InvoiceChart extends ChartWidget
|
||||
];
|
||||
}
|
||||
|
||||
// Define the date range based on the active filter
|
||||
if ($activeFilter == 'yesterday') {
|
||||
$startDate = now()->subDay()->setTime(8, 0, 0);
|
||||
$endDate = now()->setTime(8, 0, 0);
|
||||
$groupBy = 'none'; // No grouping by hour
|
||||
} elseif ($activeFilter == 'this_week') {
|
||||
$startDate = now()->startOfWeek()->setTime(8, 0, 0);
|
||||
$endDate = now()->endOfWeek()->addDay()->setTime(8, 0, 0);
|
||||
$groupBy = 'day_of_week';
|
||||
} elseif ($activeFilter == 'this_month') {
|
||||
$startDate = now()->startOfMonth()->setTime(8, 0, 0);
|
||||
$endDate = now()->endOfMonth()->setTime(8, 0, 0);
|
||||
$groupBy = 'week_of_month';
|
||||
} else {
|
||||
$startDate = now()->setTime(8, 0, 0);
|
||||
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
$groupBy = 'none'; // No grouping by hour
|
||||
$isCustomDate = !empty($fromDt) && !empty($toDt);
|
||||
|
||||
if (!empty($fromDt) && !empty($toDt)) {
|
||||
$startDate = \Carbon\Carbon::parse($fromDt)->setTime(8, 0, 0);
|
||||
$endDate = \Carbon\Carbon::parse($toDt)->addDay()->setTime(8, 0, 0);
|
||||
$groupBy = 'none';
|
||||
}
|
||||
else{
|
||||
|
||||
// Define the date range based on the active filter
|
||||
if ($activeFilter == 'yesterday') {
|
||||
$startDate = now()->subDay()->setTime(8, 0, 0);
|
||||
$endDate = now()->setTime(8, 0, 0);
|
||||
$groupBy = 'none'; // No grouping by hour
|
||||
} elseif ($activeFilter == 'this_week') {
|
||||
$startDate = now()->startOfWeek()->setTime(8, 0, 0);
|
||||
$endDate = now()->endOfWeek()->addDay()->setTime(8, 0, 0);
|
||||
$groupBy = 'day_of_week';
|
||||
} elseif ($activeFilter == 'this_month') {
|
||||
$startDate = now()->startOfMonth()->setTime(8, 0, 0);
|
||||
$endDate = now()->endOfMonth()->setTime(8, 0, 0);
|
||||
$groupBy = 'week_of_month';
|
||||
} else {
|
||||
$startDate = now()->setTime(8, 0, 0);
|
||||
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
$groupBy = 'none'; // No grouping by hour
|
||||
}
|
||||
}
|
||||
|
||||
// Get the counts for Imported Invoices (unique invoice numbers) and Completed Invoices
|
||||
@@ -111,7 +125,11 @@ class InvoiceChart extends ChartWidget
|
||||
$labels = []; // Labels for each bar
|
||||
$datasets = []; // Datasets for the chart
|
||||
|
||||
if (in_array($activeFilter, ['yesterday'])) {
|
||||
if (!empty($fromDt) && !empty($toDt)) {
|
||||
$activeFilter = null;
|
||||
}
|
||||
|
||||
if ($isCustomDate || in_array($activeFilter, ['yesterday'])) {
|
||||
$labels = ['Imported Invoice', 'Completed Invoice'];
|
||||
$datasets = [[
|
||||
'label' => 'Invoices',
|
||||
@@ -120,8 +138,7 @@ class InvoiceChart extends ChartWidget
|
||||
'fill' => false,
|
||||
]];
|
||||
}
|
||||
|
||||
elseif ($activeFilter == 'this_week')
|
||||
elseif ($isCustomDate || $activeFilter == 'this_week')
|
||||
{
|
||||
$daysOfWeek = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
||||
$importedInvoicesPerDay = array_fill(0, 7, 0);
|
||||
@@ -191,7 +208,7 @@ class InvoiceChart extends ChartWidget
|
||||
],
|
||||
];
|
||||
}
|
||||
elseif ($activeFilter == 'this_month') {
|
||||
elseif ($isCustomDate || $activeFilter == 'this_month') {
|
||||
$startOfMonth = now()->startOfMonth()->setTime(8, 0, 0);
|
||||
$endOfMonth = now()->endOfMonth()->addDay()->setTime(23, 59, 59); // include full last day
|
||||
$monthName = $startOfMonth->format('M');
|
||||
@@ -279,7 +296,7 @@ class InvoiceChart extends ChartWidget
|
||||
],
|
||||
];
|
||||
}
|
||||
else
|
||||
elseif (!$isCustomDate)
|
||||
{
|
||||
$labels = ['Imported Invoice', 'Completed Invoice'];
|
||||
$datasets = [[
|
||||
@@ -354,7 +371,7 @@ class InvoiceChart extends ChartWidget
|
||||
|
||||
public static function canView(): bool
|
||||
{
|
||||
// dd('Checking route:', request()->route()->getName());
|
||||
// dd('Checking route:', request()->route()->getName());
|
||||
// to avoid showing the widget in other pages
|
||||
return request()->routeIs('filament.admin.pages.invoice-dashboard');
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\CharacteristicApproverMaster;
|
||||
use App\Models\ClassCharacteristic;
|
||||
use App\Models\RequestCharacteristic;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class CharacteristicApprovalController extends Controller
|
||||
{
|
||||
@@ -358,10 +360,26 @@ class CharacteristicApprovalController extends Controller
|
||||
->where('work_flow_id', $record->work_flow_id)
|
||||
->get();
|
||||
|
||||
$approverMasterNames = CharacteristicApproverMaster::find($record->characteristic_approver_master_id);
|
||||
|
||||
if (! $approverMasterNames) {
|
||||
abort(500, 'Approver master not found');
|
||||
}
|
||||
|
||||
$approverNameColumn = match ($level) {
|
||||
1 => 'name1',
|
||||
2 => 'name2',
|
||||
3 => 'name3',
|
||||
default => null,
|
||||
};
|
||||
|
||||
$updatedBy = $approverNameColumn ? $approverMasterNames->$approverNameColumn : null;
|
||||
|
||||
$updateData = [
|
||||
$statusColumn => $status,
|
||||
$remarkColumn => $request->input('remark'),
|
||||
$approvedAtColumn => Carbon::now(),
|
||||
'updated_by' => $updatedBy,
|
||||
];
|
||||
|
||||
if (in_array($status, ['Approved', 'Rejected'])) {
|
||||
@@ -386,6 +404,14 @@ class CharacteristicApprovalController extends Controller
|
||||
// ->where('aufnr', $record->aufnr)
|
||||
// ->update(['has_work_flow_id' => $record->work_flow_id]);
|
||||
|
||||
if ($status == 'Rejected') {
|
||||
$filePath = 'uploads/LaserDocs/'.$record->work_flow_id.'.png';
|
||||
|
||||
if (Storage::disk('local')->exists($filePath)) {
|
||||
Storage::disk('local')->delete($filePath);
|
||||
}
|
||||
}
|
||||
|
||||
if ($returnView) {
|
||||
return match ($status) {
|
||||
'Approved' => view('approval.success'),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -107,7 +107,7 @@ class PalletPrintController extends Controller
|
||||
|
||||
$index = $completedPallets->search($pallet);
|
||||
|
||||
$currentPalletNo = ($index != false) ? $index + 1 : 0;
|
||||
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
||||
|
||||
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
||||
|
||||
|
||||
@@ -29,30 +29,30 @@ class PlantController extends Controller
|
||||
public function get_all_data(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser . ':' . $expectedPw;
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
|
||||
if ("Bearer " . $expectedToken != $header_auth)
|
||||
{
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!'
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
$plants = Plant::with('company')->orderBy('code')->get();
|
||||
$plantsData = $plants->map(function($plant) {
|
||||
$plantsData = $plants->map(function ($plant) {
|
||||
return [
|
||||
'company' => $plant->company ? $plant->company->name : "", // Get company name
|
||||
'plant_code' => (String)$plant->code,
|
||||
'plant_name' => $plant->name,
|
||||
'plant_address' => $plant->address,
|
||||
'company' => $plant->company ? $plant->company->name : '', // Get company name
|
||||
'plant_code' => (string) $plant->code,
|
||||
'plant_name' => $plant->name,
|
||||
'plant_warehouse_number' => (string) $plant->warehouse_number,
|
||||
'plant_address' => $plant->address,
|
||||
];
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'plants' => $plantsData
|
||||
'plants' => $plantsData,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProductionOrder;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -68,8 +69,27 @@ class ProductionOrderController extends Controller
|
||||
}
|
||||
|
||||
public function printpanel($production_order, $plantCode){
|
||||
|
||||
\Log::info('Print Panel Started', [
|
||||
'production_order' => $production_order,
|
||||
'plantCode' => $plantCode,
|
||||
]);
|
||||
|
||||
$order = ProductionOrder::where('production_order', $production_order)->first();
|
||||
|
||||
$wareHouseNo = Plant::where('code', $plantCode)->first();
|
||||
|
||||
$wareNo = $wareHouseNo->warehouse_number;
|
||||
|
||||
\Log::info('Plant Data', [
|
||||
'plant' => $wareHouseNo ? $wareHouseNo->toArray() : null,
|
||||
]);
|
||||
|
||||
\Log::info('Warehouse Number', [
|
||||
'warehouse_number' => $wareNo,
|
||||
'final_code' => $plantCode . $wareNo,
|
||||
]);
|
||||
|
||||
if (!$order) {
|
||||
abort(404, 'Production Order not found');
|
||||
}
|
||||
@@ -88,12 +108,11 @@ class ProductionOrderController extends Controller
|
||||
{
|
||||
|
||||
$serial = str_pad($i, 6, '0', STR_PAD_LEFT);
|
||||
$serialCount = substr(str_pad($i, 6, '0', STR_PAD_LEFT), -5);
|
||||
$serialCount = substr(str_pad($i, 6, '0', STR_PAD_LEFT), -6);
|
||||
|
||||
$qrData = $plantCode . '/' . $itemCode . '/' . $year.$month . '/' . $serialCount;
|
||||
|
||||
$panel = $plantCode . '/' . $itemCode . '/' . $year.$month . '/' . $serialCount;
|
||||
$qrData = $plantCode . $wareNo . '/' . $itemCode . '/' . $year.$month . '/' . $serialCount;
|
||||
|
||||
$panel = $plantCode . $wareNo . '/' . $itemCode . '/' . $year.$month . '/' . $serialCount;
|
||||
|
||||
$qrCode = new QrCode($qrData);
|
||||
$output = new Output\Png;
|
||||
|
||||
@@ -41,12 +41,11 @@ class VehicleController extends Controller
|
||||
|
||||
if (!ctype_digit((string) $plantCode)) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'status' => 'ERROR',
|
||||
'status_description' => "plant code must be $plantCode a numeric value",
|
||||
], 404);
|
||||
}
|
||||
|
||||
|
||||
$plantCod = Plant::where('code', $plantCode)->first();
|
||||
|
||||
if(!$plantCod){
|
||||
@@ -58,100 +57,167 @@ class VehicleController extends Controller
|
||||
|
||||
$plantId = $plantCod->id;
|
||||
|
||||
$data = $request->all();
|
||||
// $data = $request->all();
|
||||
|
||||
$vehicleNo = $data['vehicle_number'] ?? '';
|
||||
$entryTimeRaw = $data['entry_time'] ?? '';
|
||||
$exitTimeRaw = $data['exit_time'] ?? '';
|
||||
$duration = $data['duration'] ?? '';
|
||||
$type = $data['type'] ?? '';
|
||||
$data = $request->json()->all();
|
||||
|
||||
if(!$vehicleNo)
|
||||
$results = [];
|
||||
|
||||
foreach ($data as $item) {
|
||||
|
||||
$uuid = $item['uuid'] ?? '';
|
||||
$vehicleNo = trim($item['vehicle_number'] ?? '');
|
||||
$entryTimeRaw = $item['entry_time'] ?? '';
|
||||
$exitTimeRaw = $item['exit_time'] ?? '';
|
||||
$duration = $item['duration'] ?? '';
|
||||
$type = $item['type'] ?? '';
|
||||
|
||||
if (!$vehicleNo) {
|
||||
|
||||
$results[] = [
|
||||
'uuid' => $uuid,
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Vehicle number can't be empty!"
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
elseif (strlen($vehicleNo) < 8) {
|
||||
|
||||
$results[] = [
|
||||
'uuid' => $uuid,
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Vehicle number '$vehicleNo' must be at least 8 characters long"
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
elseif (!$entryTimeRaw) {
|
||||
|
||||
$results[] = [
|
||||
'uuid' => $uuid,
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Entry time can't be empty!"
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
elseif (!$type) {
|
||||
|
||||
$results[] = [
|
||||
'uuid' => $uuid,
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Type can't be empty!"
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
elseif ($entryTimeRaw && !Carbon::hasFormat($entryTimeRaw, 'd/m/Y h:i:s A')) {
|
||||
$results[] = [
|
||||
'uuid' => $uuid,
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Invalid Entry time format $entryTimeRaw. Expected dd/mm/yyyy hh:mm:ss AM/PM"
|
||||
];
|
||||
continue;
|
||||
}
|
||||
else if ($exitTimeRaw && !Carbon::hasFormat($exitTimeRaw, 'd/m/Y h:i:s A')) {
|
||||
|
||||
$results[] = [
|
||||
'uuid' => $uuid,
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Invalid Exit time format $exitTimeRaw. Expected dd/mm/yyyy hh:mm:ss AM/PM"
|
||||
];
|
||||
continue;
|
||||
}
|
||||
elseif ($duration && !preg_match('/^\d{2}:\d{2}:\d{2}$/', $duration)) {
|
||||
|
||||
$results[] = [
|
||||
'uuid' => $uuid,
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Invalid duration format $duration"
|
||||
];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($results)){
|
||||
return response()->json($results, 404);
|
||||
}
|
||||
|
||||
foreach ($data as $item) {
|
||||
|
||||
$uuid = $item['uuid'] ?? '';
|
||||
$vehicleNo = trim($item['vehicle_number'] ?? '');
|
||||
$entryTimeRaw = $item['entry_time'] ?? '';
|
||||
$exitTimeRaw = $item['exit_time'] ?? '';
|
||||
$duration = $item['duration'] ?? '';
|
||||
$type = $item['type'] ?? '';
|
||||
|
||||
if(!empty($entryTimeRaw)){
|
||||
$entryTime = $entryTimeRaw
|
||||
? Carbon::createFromFormat('d/m/Y h:i:s A', $entryTimeRaw)
|
||||
: null;
|
||||
}
|
||||
|
||||
$exitTime = null;
|
||||
|
||||
if(!empty($exitTimeRaw)){
|
||||
|
||||
$exitTime = $exitTimeRaw
|
||||
? Carbon::createFromFormat('d/m/Y h:i:s A', $exitTimeRaw)
|
||||
: null;
|
||||
}
|
||||
|
||||
if (
|
||||
empty($duration) &&
|
||||
!empty($entryTime) &&
|
||||
!empty($exitTime)
|
||||
) {
|
||||
|
||||
$totalSeconds = $entryTime->diffInSeconds($exitTime);
|
||||
|
||||
$hours = floor($totalSeconds / 3600);
|
||||
$minutes = floor(($totalSeconds % 3600) / 60);
|
||||
$seconds = $totalSeconds % 60;
|
||||
|
||||
$duration = sprintf(
|
||||
'%02d:%02d:%02d',
|
||||
$hours,
|
||||
$minutes,
|
||||
$seconds
|
||||
);
|
||||
}
|
||||
|
||||
$record = VehicleEntry::updateOrInsert(
|
||||
[
|
||||
'plant_id' => $plantId,
|
||||
'uuid' => $uuid
|
||||
],
|
||||
[
|
||||
'vehicle_number' => $vehicleNo,
|
||||
'entry_time' => $entryTime,
|
||||
'exit_time' => $exitTime ?? null,
|
||||
'duration' => $duration ?: null,
|
||||
'type' => $type,
|
||||
'updated_at' => now(),
|
||||
'created_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if($record){
|
||||
return response()->json([
|
||||
'status' => 'SUCCESS',
|
||||
'status_description' => 'Vehicle entry inserted successfully'
|
||||
], 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json([
|
||||
'status' => 'ERROR',
|
||||
'status_description' => "Vehicle number cant't be empty!",
|
||||
'status_description' => 'Failed to insert record in the table vehicle entry'
|
||||
], 404);
|
||||
}
|
||||
else if (strlen($vehicleNo) < 8) {
|
||||
return response()->json([
|
||||
'status' => 'ERROR',
|
||||
'status_description' => "vehicle number '$vehicleNo' must be at least 8 characters long",
|
||||
], 404);
|
||||
}
|
||||
else if(!$entryTimeRaw)
|
||||
{
|
||||
return response()->json([
|
||||
'status' => 'ERROR',
|
||||
'status_description' => "Entry time cant't be empty!",
|
||||
], 404);
|
||||
}
|
||||
else if(!$exitTimeRaw)
|
||||
{
|
||||
return response()->json([
|
||||
'status' => 'ERROR',
|
||||
'status_description' => "Exit time cant't be empty!",
|
||||
], 404);
|
||||
}
|
||||
else if(!$duration)
|
||||
{
|
||||
return response()->json([
|
||||
'status' => 'ERROR',
|
||||
'status_description' => "Duration cant't be empty!",
|
||||
], 404);
|
||||
}
|
||||
else if(!$type)
|
||||
{
|
||||
return response()->json([
|
||||
'status' => 'ERROR',
|
||||
'status_description' => "type cant't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
|
||||
if ($entryTimeRaw && !Carbon::hasFormat($entryTimeRaw, 'd/m/Y h:i:s A')) {
|
||||
return response()->json([
|
||||
'status' => 'ERROR',
|
||||
'status_description' => "Invalid Entry time format $entryTimeRaw. Expected dd/mm/yyyy hh:mm:ss AM/PM",
|
||||
], 404);
|
||||
}
|
||||
else if ($exitTimeRaw && !Carbon::hasFormat($exitTimeRaw, 'd/m/Y h:i:s A')) {
|
||||
return response()->json([
|
||||
'status' => 'ERROR',
|
||||
'status_description' => "Invalid Exit time format $exitTimeRaw. Expected dd/mm/yyyy hh:mm:ss AM/PM",
|
||||
], 404);
|
||||
}
|
||||
else if ($duration && !preg_match('/^\d{2}:\d{2}:\d{2}$/', $duration)) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'status_description' => "Invalid duration format $duration. Expected HH:MM:SS",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$entryTime = $entryTimeRaw
|
||||
? Carbon::createFromFormat('d/m/Y h:i:s A', $entryTimeRaw)
|
||||
: null;
|
||||
|
||||
$exitTime = $exitTimeRaw
|
||||
? Carbon::createFromFormat('d/m/Y h:i:s A', $exitTimeRaw)
|
||||
: null;
|
||||
|
||||
VehicleEntry::insert([
|
||||
'plant_id' => $plantId,
|
||||
'vehicle_number' => $vehicleNo,
|
||||
'entry_time' => $entryTime,
|
||||
'exit_time' => $exitTime,
|
||||
'duration' => $duration,
|
||||
'type' => $type,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'status_description' => 'Vehicle entry inserted successfully'
|
||||
], 200);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,8 @@ class CharacteristicApprovalMail extends Mailable
|
||||
|
||||
public $subjectLine;
|
||||
|
||||
public $characteristics;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
|
||||
93
app/Mail/ImportTransitMail.php
Normal file
93
app/Mail/ImportTransitMail.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use DateTime;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ImportTransitMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $scheduleType;
|
||||
|
||||
public $tableData;
|
||||
|
||||
public $mailSubject;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($scheduleType, $tableData, $mailSubject)
|
||||
{
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
$this->mailSubject = $mailSubject ?? 'Import Transit';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Import Transit Mail',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = '<b>Dear Sir</b>';
|
||||
|
||||
//$greeting1 = 'Dear C.R.I Branch Team, <br><br> Please follow and ensure the same';
|
||||
|
||||
if ($this->scheduleType == 'daily') {
|
||||
$reportPeriod = "The following report presents results";
|
||||
$greeting .= $reportPeriod;
|
||||
}
|
||||
|
||||
if ($this->scheduleType == 'Hourly') {
|
||||
$now = now();
|
||||
$fromHour = $now->copy()->subHour()->format('H:i:s');
|
||||
$toHour = $now->format('H:i:s');
|
||||
$reportDate = $now->format('d/m/Y');
|
||||
$greeting .= "from: $reportDate, $fromHour to $toHour. <br><br>Please arrange to receipt the same immediately.";
|
||||
}
|
||||
|
||||
if ($this->scheduleType == 'Live') {
|
||||
$now = now();
|
||||
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
|
||||
$toMinute = $now->format('d/m/Y H:i:s');
|
||||
$greeting .= "from: $fromMinute to $toMinute. <br><br>Please arrange to receipt the same immediately.";
|
||||
}
|
||||
|
||||
return new Content(
|
||||
view: 'mail.import_transit_report',
|
||||
with: [
|
||||
'company' => 'CRI Digital Manufacturing Solutions',
|
||||
'greeting' => $greeting,
|
||||
'tableData' => $this->tableData,
|
||||
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -4,28 +4,42 @@ namespace App\Mail;
|
||||
|
||||
use DateTime;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
// use App\Exports\ProductionExport;
|
||||
// use Illuminate\Mail\Mailables\Attachment;
|
||||
// use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class ProductionMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $tableData;
|
||||
|
||||
public $scheduleType;
|
||||
// public $excelData;
|
||||
// public $dates;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($scheduleType,$tableData = [])
|
||||
public function __construct($scheduleType, $tableData = [])
|
||||
{
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
}
|
||||
|
||||
// public function __construct($scheduleType,$tableData = [],$excelData = [],$dates = [])
|
||||
// {
|
||||
// $this->scheduleType = $scheduleType;
|
||||
// $this->tableData = $tableData;
|
||||
// $this->excelData = $excelData;
|
||||
// $this->dates = $dates;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
@@ -52,13 +66,14 @@ class ProductionMail extends Mailable
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,";
|
||||
|
||||
if ($this->scheduleType == 'Daily') {
|
||||
$fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i') . ':000';
|
||||
$toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i') . ':999';
|
||||
$fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i').':000';
|
||||
$toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i').':999';
|
||||
$reportPeriod = "The following report presents results from: $fromDate to $toDate.";
|
||||
$greeting .= $reportPeriod;
|
||||
}
|
||||
@@ -74,22 +89,21 @@ class ProductionMail extends Mailable
|
||||
if ($this->scheduleType == 'Live') {
|
||||
$now = now();
|
||||
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
|
||||
$toMinute = $now->format('d/m/Y H:i:s');
|
||||
$toMinute = $now->format('d/m/Y H:i:s');
|
||||
$greeting .= "The following report presents results from: $fromMinute to $toMinute.";
|
||||
}
|
||||
|
||||
return new Content(
|
||||
view: 'mail.production_report',
|
||||
with: [
|
||||
'company' => "CRI Digital Manufacturing Solutions",
|
||||
'company' => 'CRI Digital Manufacturing Solutions',
|
||||
'greeting' => $greeting,
|
||||
'tableData' => $this->tableData,
|
||||
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
||||
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
@@ -98,5 +112,19 @@ class ProductionMail extends Mailable
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
// return [
|
||||
// Attachment::fromData(
|
||||
// fn () => Excel::raw(
|
||||
// new ProductionExport(
|
||||
// $this->excelData,
|
||||
// $this->dates
|
||||
// ),
|
||||
// \Maatwebsite\Excel\Excel::XLSX
|
||||
// ),
|
||||
// 'production_plan_data.xlsx'
|
||||
// )->withMime(
|
||||
// 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
// ),
|
||||
// ];
|
||||
}
|
||||
}
|
||||
|
||||
45
app/Models/ImportTransit.php
Normal file
45
app/Models/ImportTransit.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ImportTransit extends Model
|
||||
{
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'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',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_at',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
}
|
||||
@@ -54,6 +54,11 @@ class Item extends Model
|
||||
return $this->hasMany(ProcessOrder::class);
|
||||
}
|
||||
|
||||
public function productionOrders()
|
||||
{
|
||||
return $this->hasMany(ProductionOrder::class);
|
||||
}
|
||||
|
||||
public function productCharacteristicsMasters()
|
||||
{
|
||||
return $this->hasMany(ProductCharacteristicsMaster::class);
|
||||
|
||||
@@ -16,6 +16,7 @@ class Plant extends Model
|
||||
'company_id',
|
||||
'name',
|
||||
'address',
|
||||
'warehouse_number',
|
||||
];
|
||||
|
||||
public function company(): BelongsTo
|
||||
@@ -108,6 +109,11 @@ class Plant extends Model
|
||||
return $this->hasMany(ProcessOrder::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function productionOrder()
|
||||
{
|
||||
return $this->hasMany(ProductionOrder::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function productCharacteristicsMasters()
|
||||
{
|
||||
return $this->hasMany(ProductCharacteristicsMaster::class, 'plant_id', 'id');
|
||||
|
||||
@@ -34,7 +34,7 @@ class RequestCharacteristic extends Model
|
||||
'mail_status',
|
||||
'trigger_at',
|
||||
'work_flow_id',
|
||||
|
||||
'model_type',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
|
||||
@@ -17,6 +17,7 @@ class VehicleEntry extends Model
|
||||
'exit_time',
|
||||
'duration',
|
||||
'type',
|
||||
'uuid',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_at',
|
||||
|
||||
106
app/Policies/ImportTransitPolicy.php
Normal file
106
app/Policies/ImportTransitPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\ImportTransit;
|
||||
use App\Models\User;
|
||||
|
||||
class ImportTransitPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, ImportTransit $importtransit): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, ImportTransit $importtransit): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, ImportTransit $importtransit): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, ImportTransit $importtransit): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, ImportTransit $importtransit): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, ImportTransit $importtransit): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete ImportTransit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any ImportTransit');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE request_characteristics
|
||||
ADD COLUMN model_type TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('request_characteristics', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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 import_transits (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
cri_rfq_number TEXT DEFAULT NULL,
|
||||
mail_received_date DATE DEFAULT NULL,
|
||||
pricol_ref_number TEXT DEFAULT NULL,
|
||||
requester TEXT DEFAULT NULL,
|
||||
shipper TEXT DEFAULT NULL,
|
||||
shipper_location TEXT DEFAULT NULL,
|
||||
shipper_invoice TEXT DEFAULT NULL,
|
||||
shipper_invoice_date DATE DEFAULT NULL,
|
||||
customs_agent_name TEXT DEFAULT NULL,
|
||||
eta_date DATE DEFAULT NULL,
|
||||
status TEXT DEFAULT NULL,
|
||||
delivery_location TEXT DEFAULT NULL,
|
||||
etd_date DATE DEFAULT NULL,
|
||||
mode TEXT DEFAULT NULL,
|
||||
inco_terms TEXT DEFAULT NULL,
|
||||
port_of_loading TEXT DEFAULT NULL,
|
||||
port_of_discharge TEXT DEFAULT NULL,
|
||||
delivery_city TEXT DEFAULT NULL,
|
||||
packages TEXT DEFAULT NULL,
|
||||
type_of_package TEXT DEFAULT NULL,
|
||||
gross_weight TEXT DEFAULT NULL,
|
||||
volume TEXT DEFAULT NULL,
|
||||
bill_number TEXT DEFAULT NULL,
|
||||
bill_received_date DATE DEFAULT NULL,
|
||||
vessel_number TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('import_transits');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE plants
|
||||
ADD COLUMN warehouse_number TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('plants', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE vehicle_entries
|
||||
ADD COLUMN uuid TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('vehicle_entries', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -210,7 +210,20 @@ class PermissionSeeder extends Seeder
|
||||
Permission::updateOrCreate(['name' => 'view import temp class characteristic']);
|
||||
Permission::updateOrCreate(['name' => 'view export temp class characteristic']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view import production temp']);
|
||||
Permission::updateOrCreate(['name' => 'view export production temp']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view import production orders']);
|
||||
Permission::updateOrCreate(['name' => 'view export production orders']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view import transit']);
|
||||
Permission::updateOrCreate(['name' => 'view export import transit']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view reprint production order']);
|
||||
Permission::updateOrCreate(['name' => 'create osp production sticker reprint page']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view print production order button']);
|
||||
Permission::updateOrCreate(['name' => 'view save production order button']);
|
||||
Permission::updateOrCreate(['name' => 'view print panel production order button']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,84 +948,80 @@ function cameraCapture() {
|
||||
|
||||
|
||||
async verifyPhoto() {
|
||||
if (!this.capturedPhoto) {
|
||||
alert("Please capture a photo first!");
|
||||
return;
|
||||
}
|
||||
if (!this.capturedPhoto) {
|
||||
alert("Please capture a photo first!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isWorkerReady) {
|
||||
alert("OCR worker not ready yet!");
|
||||
return;
|
||||
}
|
||||
if (!this.isWorkerReady) {
|
||||
alert("OCR worker not ready yet!");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const img = new Image();
|
||||
img.src = this.capturedPhoto;
|
||||
try {
|
||||
const img = new Image();
|
||||
img.src = this.capturedPhoto;
|
||||
|
||||
img.onload = async () => {
|
||||
img.onload = async () => {
|
||||
|
||||
// Reuse the same temp canvas (no memory leak)
|
||||
this.tempCanvas.width = img.width;
|
||||
this.tempCanvas.height = img.height;
|
||||
this.tempCtx.drawImage(img, 0, 0);
|
||||
// Reuse the same temp canvas (no memory leak)
|
||||
this.tempCanvas.width = img.width;
|
||||
this.tempCanvas.height = img.height;
|
||||
this.tempCtx.drawImage(img, 0, 0);
|
||||
|
||||
// Worker OCR — much faster
|
||||
const result = await this.ocrWorker.recognize(this.tempCanvas);
|
||||
// Worker OCR — much faster
|
||||
const result = await this.ocrWorker.recognize(this.tempCanvas);
|
||||
|
||||
const detectedText = result.data.text.trim();
|
||||
console.log("Detected Text:", detectedText);
|
||||
const detectedText = result.data.text.trim();
|
||||
console.log("Detected Text:", detectedText);
|
||||
|
||||
// -------------------------------------------------------
|
||||
// SERIAL EXTRACTION LOGIC — SAME AS YOUR ORIGINAL
|
||||
// -------------------------------------------------------
|
||||
const serialWithLabelRegex = /Serial\s*No[:\-]?\s*([A-Za-z0-9]+)/i;
|
||||
const match = detectedText.match(serialWithLabelRegex);
|
||||
const serialWithLabelRegex = /Serial\s*No[:\-]?\s*([A-Za-z0-9]+)/i;
|
||||
const match = detectedText.match(serialWithLabelRegex);
|
||||
|
||||
if (match && match[1]) {
|
||||
// "Serial No: XXXXX"
|
||||
this.serialNumbers = [match[1].trim()];
|
||||
console.log("Serial with Label:", this.serialNumbers[0]);
|
||||
} else {
|
||||
// Extract first 4 alphanumeric sequences of 4+ chars
|
||||
const generalNums = detectedText.match(/[A-Za-z0-9]{4,}/g) || [];
|
||||
this.serialNumbers = generalNums.slice(0, 4);
|
||||
if (match && match[1]) {
|
||||
this.serialNumbers = [match[1].trim()];
|
||||
console.log("Serial with Label:", this.serialNumbers[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
const generalNums = detectedText.match(/[A-Za-z0-9]{4,}/g) || [];
|
||||
this.serialNumbers = generalNums.slice(0, 4);
|
||||
|
||||
if (this.serialNumbers.length === 0) {
|
||||
alert("No serial numbers detected!");
|
||||
return;
|
||||
if (this.serialNumbers.length == 0) {
|
||||
alert("No serial numbers detected!");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Serial Numbers List:", this.serialNumbers);
|
||||
}
|
||||
|
||||
console.log("Serial Numbers List:", this.serialNumbers);
|
||||
// Save into hidden input (your original logic)
|
||||
this.$refs.hiddenInputSerials.value = JSON.stringify(this.serialNumbers);
|
||||
|
||||
alert("Serial numbers:\n" + this.$refs.hiddenInputSerials.value);
|
||||
|
||||
fetch('/save-serials-to-session', {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
serial_numbers: this.serialNumbers,
|
||||
}),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log("Session Updated:", data);
|
||||
alert("✅ Serial numbers saved to session!");
|
||||
});
|
||||
};
|
||||
} catch (err) {
|
||||
console.error("OCR verify error:", err);
|
||||
alert("OCR verify failed:\n" + (err.message || err));
|
||||
}
|
||||
|
||||
// Save into hidden input (your original logic)
|
||||
this.$refs.hiddenInputSerials.value = JSON.stringify(this.serialNumbers);
|
||||
|
||||
alert("Serial numbers:\n" + this.$refs.hiddenInputSerials.value);
|
||||
|
||||
fetch('/save-serials-to-session', {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
serial_numbers: this.serialNumbers,
|
||||
}),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log("Session Updated:", data);
|
||||
alert("✅ Serial numbers saved to session!");
|
||||
});
|
||||
};
|
||||
|
||||
} catch (err) {
|
||||
console.error("OCR verify error:", err);
|
||||
alert("OCR verify failed:\n" + (err.message || err));
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
startDetection() {
|
||||
if (this.textDetectionInterval) {
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
if (!scanInput) return;
|
||||
|
||||
scanInput.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Enter') {
|
||||
if (event.key == 'Enter') {
|
||||
event.preventDefault();
|
||||
|
||||
const value = scanInput.value.trim();
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
<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;">
|
||||
|
||||
@if($records && $records->count())
|
||||
{{-- @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"> --}}
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
<td>Job Number</td>
|
||||
<td style="text-align: center;">{{ $request->aufnr }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Model Type</td>
|
||||
<td style="text-align: center;">{{ $request->model_type }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Work Flow ID</td>
|
||||
<td style="text-align: center;">{{ $request->work_flow_id }}</td>
|
||||
@@ -103,8 +107,8 @@
|
||||
<td style="text-align: center;">
|
||||
<a href="{{ $approveUrl }}" style="color: #28a745; font-weight: bold; text-decoration: underline;">Approve</a>
|
||||
|
|
||||
<a href="{{ $holdUrl }}" style="color: #FF8800; font-weight: bold; text-decoration: underline;">Hold</a>
|
||||
|
|
||||
{{-- <a href="{{ $holdUrl }}" style="color: #FF8800; font-weight: bold; text-decoration: underline;">Hold</a>
|
||||
| --}}
|
||||
<a href="{{ $rejectUrl }}" style="color: #dc3545; font-weight: bold; text-decoration: underline;">Reject</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -123,6 +127,30 @@
|
||||
@endif
|
||||
</table>
|
||||
@elseif($approverNameFromMaster && $approverNameFromMaster->approver_type == 'Quality')
|
||||
{{-- <table style="margin-left: 3%" border="1" width="30%" cellpadding="6" cellspacing="0"> --}}
|
||||
<table style="margin-left: 3%; " border="1" width="30%" cellpadding="6" cellspacing="0">
|
||||
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: center; font-weight: bold;">
|
||||
TEMPLATE CHARACTERISTICS
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
|
||||
@forelse ($tableData as $key => $value)
|
||||
<tr>
|
||||
<td style="text-align: center;">{{ strtoupper($key) }}</td>
|
||||
<td style="text-align: center;">{{ $value }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="2">No Characteristics Found</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</table>
|
||||
<br>
|
||||
<table style="margin-left: 3%" border="1" width="50%" cellpadding="6" cellspacing="0">
|
||||
<tr>
|
||||
@@ -159,8 +187,8 @@
|
||||
<td style="text-align: center;">
|
||||
<a href="{{ $approveUrl }}" style="color: #28a745; font-weight: bold; text-decoration: underline;">Approve</a>
|
||||
|
|
||||
<a href="{{ $holdUrl }}" style="color: #FF8800; font-weight: bold; text-decoration: underline;">Hold</a>
|
||||
|
|
||||
{{-- <a href="{{ $holdUrl }}" style="color: #FF8800; font-weight: bold; text-decoration: underline;">Hold</a>
|
||||
| --}}
|
||||
<a href="{{ $rejectUrl }}" style="color: #dc3545; font-weight: bold; text-decoration: underline;">Reject</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
130
resources/views/mail/import_transit_report.blade.php
Normal file
130
resources/views/mail/import_transit_report.blade.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Import Transit Report</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', Arial, sans-serif;
|
||||
background-color: #f9fafb;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
h2 {
|
||||
color: #215c98;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #020813da;
|
||||
padding: 8px 10px;
|
||||
text-align: center;
|
||||
white-space: nowrap !important;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.td-left {
|
||||
text-align: left !important;
|
||||
}
|
||||
th {
|
||||
background-color: #215c98;
|
||||
color: #fff;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color: #f3f4f6;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: center; font-weight: bold;">
|
||||
{{ $company }}
|
||||
</div>
|
||||
<br>
|
||||
<p>{!! $greeting !!}</p>
|
||||
<div class="container">
|
||||
@if(empty($tableData))
|
||||
<p style="text-align:center;">No invoice in transit data available.</p>
|
||||
@else
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>CRI RFQ Number</th>
|
||||
<th>Mail Received Date</th>
|
||||
<th>Pricol Ref Number</th>
|
||||
<th>Requestor</th>
|
||||
<th>Shipper</th>
|
||||
<th>Shipper Location</th>
|
||||
<th>Shipper Invoice</th>
|
||||
<th>Shipper Invoice Date</th>
|
||||
<th>Custom Agent Name</th>
|
||||
<th>ETA Date</th>
|
||||
<th>Status</th>
|
||||
<th>Delivery Location</th>
|
||||
<th>ETD Date</th>
|
||||
<th>Mode</th>
|
||||
<th>Inco Terms</th>
|
||||
<th>Port Of Loading</th>
|
||||
<th>Port Of Discharge</th>
|
||||
<th>Delivery City</th>
|
||||
<th>Packages</th>
|
||||
<th>Type of package</th>
|
||||
<th>Gross Weight</th>
|
||||
<th>Volume</th>
|
||||
<th>Bill Number</th>
|
||||
<th>Bill Received Date</th>
|
||||
<th>Vessel Number</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($tableData as $row)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $row['cri_rfq_number'] }}</td>
|
||||
<td>{{ $row['mail_received_date'] }}</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>{{ $row['shipper_invoice_date'] }}</td>
|
||||
<td>{{ $row['customs_agent_name'] }}</td>
|
||||
<td>{{ $row['eta_date'] }}</td>
|
||||
<td>{{ $row['status'] }}</td>
|
||||
<td>{{ $row['delivery_location'] }}</td>
|
||||
<td>{{ $row['etd_date'] }}</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>{{ $row['vessel_number'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
<p>{!! $wishes !!}</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -106,7 +106,6 @@
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
|
||||
{{-- <td>{{ $row['lr_bl_aw_date'] }}</td> --}}
|
||||
<td>{{ $row['transit_days'] }}</td>
|
||||
<td>{{ $row['status'] }}</td>
|
||||
|
||||
@@ -62,14 +62,21 @@ use Illuminate\Support\Facades\Route;
|
||||
// 'data' => $request->all()
|
||||
// ]);
|
||||
// });
|
||||
|
||||
// OBD
|
||||
|
||||
Route::get('obd/get-test-datas', [ObdController::class, 'get_test']);
|
||||
|
||||
Route::get('obd/get-data', [ObdController::class, 'get_obd']);
|
||||
|
||||
Route::post('obd/store-data', [ObdController::class, 'store_obd']);
|
||||
|
||||
// Plant
|
||||
|
||||
Route::get('plant/get-all-data', [PlantController::class, 'get_all_data']);
|
||||
|
||||
// Sticker Master Model Type
|
||||
|
||||
Route::get('sticker/get-master-type-data', [StickerMasterController::class, 'get_master_type']);
|
||||
|
||||
Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrPdf'])->name('download-qr-pdf');
|
||||
|
||||
Reference in New Issue
Block a user