Compare commits
20 Commits
ranjith-de
...
58e6cbfac0
| Author | SHA1 | Date | |
|---|---|---|---|
| 58e6cbfac0 | |||
| 1ace049687 | |||
| e5e85a8eea | |||
| 555802ab35 | |||
| 587b743f12 | |||
| 42555d4a81 | |||
| fd1e554076 | |||
| 022654f192 | |||
| 55f1088fda | |||
| f9233f44d8 | |||
| e0fec6b07c | |||
| 6bda9c1459 | |||
| 39bdd3df57 | |||
| 5bcf0703d9 | |||
| 80e522b7e6 | |||
| ee101f80ea | |||
| 37a99d03c1 | |||
| 5fdced003a | |||
| 0b0bb90efb | |||
| 32ce6da2c1 |
23
.github/workflows/gemini-pr-review.yaml
vendored
23
.github/workflows/gemini-pr-review.yaml
vendored
@@ -5,20 +5,15 @@ name: Gemini PR Review
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
gemini-pr-review:
|
||||
review:
|
||||
runs-on: ubuntu-latest
|
||||
name: Gemini PR Review
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0 # This fetches the full history
|
||||
|
||||
@@ -27,6 +22,7 @@ jobs:
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
|
||||
- name: Get npm cache directory
|
||||
id: npm-cache-dir
|
||||
run: |
|
||||
@@ -40,14 +36,8 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-npm-global-
|
||||
|
||||
- name: Install Gemini CLI globally (if not already installed)
|
||||
run: |
|
||||
if ! command -v gemini &> /dev/null; then
|
||||
echo "Gemini CLI not found, installing..."
|
||||
npm install -g --loglevel=http @google/gemini-cli
|
||||
else
|
||||
echo "Gemini CLI already installed."
|
||||
fi
|
||||
- name: Install Gemini CLI globally
|
||||
run: npm install -g --loglevel=http @google/gemini-cli
|
||||
|
||||
- name: Generate git diff and review with Gemini
|
||||
id: review
|
||||
@@ -62,6 +52,7 @@ jobs:
|
||||
|
||||
cat /tmp/gemini-client-error*.json || true
|
||||
|
||||
|
||||
- name: Post output to PR comment
|
||||
id: post_comment
|
||||
run: |
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\LaserStopMail;
|
||||
use App\Models\ClassCharacteristic;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class LaserStopConsolidateReport extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'send:laser-stop-consolidate-report {schedule_type} {plant} {machine_id}';
|
||||
|
||||
/**
|
||||
* 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');
|
||||
$machineId = (int) $this->argument('machine_id');
|
||||
|
||||
$mailRules = \App\Models\AlertMailRule::where('module', 'LaserStopReport')
|
||||
->where('rule_name', 'LaserStopMail')
|
||||
->where('schedule_type', $scheduleType)
|
||||
->where('plant', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
->get();
|
||||
|
||||
$emails = $mailRules
|
||||
->pluck('email')
|
||||
->filter()
|
||||
->flatMap(function ($email) {
|
||||
return array_map('trim', explode(',', $email));
|
||||
})
|
||||
->unique()
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
$ccEmails = $mailRules
|
||||
->pluck('cc_emails')
|
||||
->filter()
|
||||
->flatMap(function ($email) {
|
||||
return array_map('trim', explode(',', $email));
|
||||
})
|
||||
->unique()
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
$plants = $plantId == 0
|
||||
? Plant::all()
|
||||
: Plant::where('id', $plantId)->get();
|
||||
|
||||
if ($plants->isEmpty()) {
|
||||
$this->error('No valid plant(s) found.');
|
||||
return;
|
||||
}
|
||||
if (strtolower($scheduleType) == 'daily') {
|
||||
$startDate = now()->subDay()->setTime(8, 0, 0);
|
||||
$endDate = now()->setTime(8, 0, 0);
|
||||
}
|
||||
|
||||
$plant = Plant::find($plantId);
|
||||
|
||||
$plantName = $plant?->name ?? $plantId;
|
||||
|
||||
$machine = Machine::find($machineId);
|
||||
|
||||
$machineName = $machine?->work_center ?? $machineId;
|
||||
|
||||
$records = ClassCharacteristic::where('is_stopped', '!=', 0)
|
||||
->where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->get();
|
||||
|
||||
if ($records->isEmpty()) {
|
||||
$this->info('No laser stop records found.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Send mail to mapped email IDs
|
||||
Mail::to($emails)
|
||||
->cc($ccEmails)
|
||||
->send(
|
||||
new LaserStopMail(
|
||||
$records,
|
||||
$plantId,
|
||||
$machineId,
|
||||
$plantName,
|
||||
$machineName,
|
||||
)
|
||||
);
|
||||
|
||||
$this->info('Laser stop final report mail sent successfully.');
|
||||
}
|
||||
}
|
||||
@@ -1,490 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use App\Models\AlertMailRule;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class Scheduler extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
// protected $signature = 'app:scheduler';
|
||||
|
||||
protected $signature = 'custom:scheduler';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
// protected $description = 'Command description';
|
||||
|
||||
protected $description = 'Manually trigger scheduler logic';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
// public function handle()
|
||||
// {
|
||||
// //
|
||||
// }
|
||||
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$this->call('approval:trigger-mails');
|
||||
// $this->call('sftp:process-files');
|
||||
|
||||
// --- Production Rules ---
|
||||
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||
->where('rule_name', 'ProductionMail')
|
||||
->select('plant', 'schedule_type')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
foreach ($productionRules as $rule) {
|
||||
switch ($rule->schedule_type) {
|
||||
case 'Live':
|
||||
// Run every minute
|
||||
\Artisan::call('send:production-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
break;
|
||||
case 'Hourly':
|
||||
if (now()->minute == 0) {
|
||||
\Artisan::call('send:production-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '07:59') {
|
||||
\Artisan::call('send:production-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Invoice Validation Rules --- (Invoice Mail)
|
||||
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||
->where('rule_name', 'InvoiceMail')
|
||||
->select('plant', 'schedule_type')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
foreach ($invoiceRules as $rule) {
|
||||
|
||||
switch ($rule->schedule_type) {
|
||||
case 'Live':
|
||||
// Run every minute
|
||||
\Artisan::call('send:invoice-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
break;
|
||||
|
||||
case 'Hourly':
|
||||
if (now()->minute == 0) {
|
||||
\Artisan::call('send:invoice-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '07:59') {
|
||||
\Artisan::call('send:invoice-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//..SerialInvoice
|
||||
|
||||
$invoiceSerialRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||
->where('rule_name', 'SerialInvoiceMail')
|
||||
->select('plant', 'schedule_type')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
foreach ($invoiceSerialRules as $rule) {
|
||||
|
||||
switch ($rule->schedule_type) {
|
||||
case 'Live':
|
||||
// Run every minute
|
||||
\Artisan::call('send:invoice-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
break;
|
||||
|
||||
case 'Hourly':
|
||||
if (now()->minute == 0) {
|
||||
\Artisan::call('send:invoice-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '07:59') {
|
||||
\Artisan::call('send:invoice-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//..MaterialInvoice
|
||||
|
||||
$invoiceMaterialRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||
->where('rule_name', 'MaterialInvoiceMail')
|
||||
->select('plant', 'schedule_type')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
foreach ($invoiceMaterialRules as $rule) {
|
||||
|
||||
switch ($rule->schedule_type) {
|
||||
case 'Live':
|
||||
// Run every minute
|
||||
\Artisan::call('send:invoice-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
break;
|
||||
|
||||
case 'Hourly':
|
||||
if (now()->minute == 0) {
|
||||
\Artisan::call('send:invoice-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '07:59') {
|
||||
\Artisan::call('send:invoice-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// foreach ($invoiceRules as $rule) {
|
||||
|
||||
// switch ($rule->schedule_type) {
|
||||
// case 'Live':
|
||||
// try {
|
||||
// Artisan::call('send:invoice-report', [
|
||||
// 'schedule_type' => $rule->schedule_type,
|
||||
// 'plant' => $rule->plant,
|
||||
// ]);
|
||||
|
||||
// Log::info('Invoice report sent | Plant: '.$rule->plant);
|
||||
// } catch (\Throwable $e) {
|
||||
// Log::error("Invoice Live Failed ({$rule->plant}): ".$e->getMessage());
|
||||
// }
|
||||
// break;
|
||||
|
||||
// case 'Hourly':
|
||||
// if (now()->minute == 0) {
|
||||
// Artisan::call('send:invoice-report', [
|
||||
// 'schedule_type' => $rule->schedule_type,
|
||||
// 'plant' => $rule->plant,
|
||||
// ]);
|
||||
// }
|
||||
// break;
|
||||
|
||||
// case 'Daily':
|
||||
// if (now()->format('H:i') == '07:59') {
|
||||
// Artisan::call('send:invoice-report', [
|
||||
// 'schedule_type' => $rule->schedule_type,
|
||||
// 'plant' => $rule->plant,
|
||||
// ]);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// --- Invoice Data Report Rules ---
|
||||
$invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
|
||||
->where('rule_name', 'InvoiceDataMail')
|
||||
->select('plant', 'schedule_type')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
foreach ($invoiceDataRules as $rule) {
|
||||
|
||||
switch ($rule->schedule_type) {
|
||||
case 'Live':
|
||||
// Run every minute
|
||||
\Artisan::call('send:invoice-data-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
break;
|
||||
case 'Hourly':
|
||||
if (now()->minute == 0) {
|
||||
\Artisan::call('send:invoice-data-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '11:30') {
|
||||
\Artisan::call('send:invoice-data-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$invoiceTransitRules = AlertMailRule::where('module', 'InvoiceTransit')
|
||||
->where('rule_name', 'InvoiceTransitMail')
|
||||
->select('plant', 'schedule_type')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
foreach ($invoiceTransitRules as $rule) {
|
||||
|
||||
switch ($rule->schedule_type) {
|
||||
case 'Live':
|
||||
// Run every minute
|
||||
\Artisan::call('send:invoice-transit-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
break;
|
||||
case 'Hourly':
|
||||
if (now()->minute == 0) {
|
||||
\Artisan::call('send:invoice-transit-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '11:00') {
|
||||
try {
|
||||
\Artisan::call('send:invoice-transit-report', [
|
||||
'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;
|
||||
}
|
||||
}
|
||||
|
||||
$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') == '08:00') {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
$vehicleReports = AlertMailRule::where('module', 'VehicleReport')
|
||||
->where('rule_name', 'VehicleReportMail')
|
||||
->select('plant', 'schedule_type')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
foreach ($vehicleReports as $rule) {
|
||||
switch ($rule->schedule_type) {
|
||||
case 'Live':
|
||||
// Run every minute
|
||||
\Artisan::call('send:vehicle-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
break;
|
||||
case 'Hourly':
|
||||
if (now()->minute == 0) {
|
||||
\Artisan::call('send:vehicle-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '07:59') {
|
||||
\Artisan::call('send:vehicle-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//..Laser Stop Report
|
||||
$laserStopReport = AlertMailRule::where('module', 'LaserStopAlert')
|
||||
->where('rule_name', 'LaserStopAlertMail')
|
||||
->select('plant', 'schedule_type', 'machine_id')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
foreach ($laserStopReport as $rule) {
|
||||
switch ($rule->schedule_type) {
|
||||
case 'Live':
|
||||
// Run every minute
|
||||
\Artisan::call('send:laser-stop-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
'machine_id' => $rule->machine_id,
|
||||
]);
|
||||
break;
|
||||
case 'Hourly':
|
||||
if (now()->minute == 0) {
|
||||
\Artisan::call('send:laser-stop-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
'machine_id' => $rule->machine_id,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '07:59') {
|
||||
\Artisan::call('send:laser-stop-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
'machine_id' => $rule->machine_id,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//..Laser Stop Final Report
|
||||
|
||||
$laserStopFinalReport = AlertMailRule::where('module', 'LaserStopReport')
|
||||
->where('rule_name', 'LaserStopMail')
|
||||
->select('plant', 'schedule_type', 'machine_id')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
foreach ($laserStopFinalReport as $rule) {
|
||||
switch ($rule->schedule_type) {
|
||||
case 'Live':
|
||||
// Run every minute
|
||||
\Artisan::call('send:laser-stop-consolidate-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
'machine_id' => $rule->machine_id,
|
||||
]);
|
||||
break;
|
||||
case 'Hourly':
|
||||
if (now()->minute == 0) {
|
||||
\Artisan::call('send:laser-stop-consolidate-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
'machine_id' => $rule->machine_id,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'Daily':
|
||||
if (now()->format('H:i') == '08:00') {
|
||||
\Artisan::call('send:laser-stop-consolidate-report', [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
'machine_id' => $rule->machine_id,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to call Artisan commands with parameters.
|
||||
*/
|
||||
protected function callArtisanCommand($commandName, $rule)
|
||||
{
|
||||
\Artisan::call($commandName, [
|
||||
'schedule_type' => $rule->schedule_type,
|
||||
'plant' => $rule->plant,
|
||||
]);
|
||||
|
||||
$this->info("Executed {$commandName} for plant: {$rule->plant}");
|
||||
\Log::info("Executed {$commandName} for plant: {$rule->plant}");
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\ImportTransitMail;
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\EmployeeMaster;
|
||||
use App\Models\ImportTransit;
|
||||
use App\Models\Plant;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Console\Command;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Exports\ImportTransitReportExport;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
$tableData = ImportTransit::where('status', '!=', 'Delivered')->orderByRaw("
|
||||
CASE
|
||||
WHEN cri_rfq_number ~ '[0-9]+'
|
||||
THEN CAST(regexp_replace(cri_rfq_number, '[^0-9]', '', 'g') AS INTEGER)
|
||||
ELSE NULL
|
||||
END NULLS LAST
|
||||
")->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';
|
||||
|
||||
$fileName = 'reports/pending_import_shipment_' . now()->format('Ymd_His') . '.xlsx';
|
||||
|
||||
Excel::store(
|
||||
new ImportTransitReportExport($tableData),
|
||||
$fileName,
|
||||
'local'
|
||||
);
|
||||
|
||||
$updatedBy = $tableData->last()?->updated_by;
|
||||
|
||||
$employee = EmployeeMaster::where('code', $updatedBy)
|
||||
->select('name', 'mobile_number')
|
||||
->first();
|
||||
|
||||
$employeeName = $employee?->name;
|
||||
$mobileNumber = $employee?->mobile_number;
|
||||
|
||||
$mail = new ImportTransitMail(
|
||||
$scheduleType,
|
||||
$tableData,
|
||||
$mailSubject,
|
||||
$fileName,
|
||||
$employeeName,
|
||||
$mobileNumber,
|
||||
);
|
||||
|
||||
$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));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,12 @@ use App\Mail\InvoiceDataMail;
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\InvoiceDataValidation;
|
||||
use App\Models\InvoiceOutValidation;
|
||||
use App\Models\Line;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProductionPlan;
|
||||
use App\Models\ProductionQuantity;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class SendInvoiceDataReport extends Command
|
||||
{
|
||||
@@ -45,14 +49,7 @@ class SendInvoiceDataReport extends Command
|
||||
$plants = ($plantId == 0) ? Plant::all() : Plant::where('id', $plantId)->get();
|
||||
|
||||
if ($plants->isEmpty()) {
|
||||
$this->error('No valid plant(s) found.');
|
||||
return;
|
||||
}
|
||||
|
||||
$todayRecordExists = InvoiceDataValidation::whereDate('created_at', now()->toDateString())->first();
|
||||
|
||||
if (!$todayRecordExists) {
|
||||
$this->info('No records created today. Mail not sent.');
|
||||
$this->error("No valid plant(s) found.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,7 +105,7 @@ class SendInvoiceDataReport extends Command
|
||||
->where('distribution_channel_desc', $selectedDistribution)
|
||||
->whereBetween('document_date', [$startDate, $endDate])
|
||||
->orderBy('document_date', 'asc')
|
||||
->select('customer_code', 'document_number', 'document_date', 'customer_trade_name', 'customer_location', 'location', 'remark')
|
||||
->select('customer_code', 'document_number', 'document_date', 'customer_trade_name', 'customer_location', 'location')
|
||||
->get()
|
||||
->unique('document_number')
|
||||
->values();
|
||||
@@ -117,6 +114,7 @@ class SendInvoiceDataReport extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
// Filter invoices directly — exclude ones with '-' in document_number
|
||||
$invoices = $invoices->filter(function ($inv) {
|
||||
return !empty($inv->document_number) && !str_contains($inv->document_number, '-');
|
||||
});
|
||||
@@ -136,6 +134,7 @@ class SendInvoiceDataReport extends Command
|
||||
->map(fn($n) => preg_replace('/\s+/', '', strtoupper((string) $n)))
|
||||
->toArray();
|
||||
|
||||
//where('plant_id', $plant->id)
|
||||
$wentOutInvoices = InvoiceOutValidation::whereIn('qr_code', $invoiceNumbers)
|
||||
//->whereBetween('scanned_at', [$startDate, $endDate])
|
||||
->distinct('qr_code')
|
||||
@@ -165,6 +164,7 @@ class SendInvoiceDataReport extends Command
|
||||
return !in_array($doc, $wentOutInvoices, true);
|
||||
});
|
||||
|
||||
|
||||
if ($pendingInvoices->isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ class SendInvoiceDataReport extends Command
|
||||
}
|
||||
|
||||
$tableData[] = [
|
||||
// 'no' => $no++,
|
||||
//'no' => $no++,
|
||||
'plant' => $plant->name,
|
||||
// 'distribution_type' => $selectedDistribution,
|
||||
'customer_code' => $inv->customer_code,
|
||||
@@ -194,7 +194,6 @@ class SendInvoiceDataReport extends Command
|
||||
'no_of_days_pending' => abs((int)now()->diffInDays($documentDate)),
|
||||
'status' => 'Pending',
|
||||
'status_class' => $statusColor,
|
||||
'remark' => $inv->remark,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -204,7 +203,6 @@ class SendInvoiceDataReport extends Command
|
||||
->values()
|
||||
->map(function ($item, $index) {
|
||||
$item['no'] = $index + 1;
|
||||
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
@@ -216,7 +214,7 @@ class SendInvoiceDataReport extends Command
|
||||
|
||||
$this->info($contentVars['greeting'] ?? 'Invoice Data Report');
|
||||
$this->table(
|
||||
['No', 'Plant', 'Customer Code', 'Document Number', 'Document Date', 'Trade Name', 'Location', 'Pending Days', 'Status', 'Remark'],// 'Distribution Type'
|
||||
['No', 'Plant', 'Customer Code', 'Document Number', 'Document Date', 'Trade Name', 'Location', 'Pending Days', 'Status'],//'Distribution Type'
|
||||
$tableData
|
||||
);
|
||||
$this->info($contentVars['wishes'] ?? '');
|
||||
@@ -238,13 +236,13 @@ class SendInvoiceDataReport extends Command
|
||||
->toArray();
|
||||
|
||||
if (empty($toEmails)) {
|
||||
$this->info("Skipping rule ID {$rule->id} — no valid To emails found.");
|
||||
$this->warn("Skipping rule ID {$rule->id} — no valid To emails found.");
|
||||
continue;
|
||||
}
|
||||
|
||||
\Mail::to($toEmails)->cc($ccEmails)->send($mail);
|
||||
|
||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
||||
$this->info("Mail sent for rule ID {$rule->id} → To: " . implode(', ', $toEmails) . ($ccEmails ? " | CC: " . implode(', ', $ccEmails) : ''));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\test;
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\InvoiceValidation;
|
||||
use App\Models\Plant;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\test;
|
||||
|
||||
class SendInvoiceReport extends Command
|
||||
{
|
||||
@@ -16,8 +15,9 @@ class SendInvoiceReport extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
// protected $signature = 'app:send-invoice-report';
|
||||
protected $signature = 'send:invoice-report {schedule_type} {plant}';
|
||||
// protected $signature = 'app:send-invoice-report';
|
||||
protected $signature = 'send:invoice-report{schedule_type} {plant}';
|
||||
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -29,49 +29,41 @@ class SendInvoiceReport extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$schedule = $this->argument('schedule_type');
|
||||
$plantIdArg = (int) $this->argument('plant');
|
||||
//$scheduleType = $this->argument('scheduleType');
|
||||
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
||||
|
||||
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||
->where('rule_name', 'InvoiceMail')
|
||||
->where('plant', $plantIdArg)
|
||||
->get();
|
||||
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||
|
||||
$serialRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||
->where('rule_name', 'SerialInvoiceMail')
|
||||
->where('plant', $plantIdArg)
|
||||
->get();
|
||||
|
||||
$materialRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||
->where('rule_name', 'MaterialInvoiceMail')
|
||||
->where('plant', $plantIdArg)
|
||||
->get();
|
||||
|
||||
// $this->info('Invoice Rules: ' . $invoiceRules->toJson());
|
||||
// $this->info('Serial Rules: ' . $serialRules->toJson());
|
||||
// $this->info('Material Rules: ' . $materialRules->toJson());
|
||||
// $startDate = now()->setTime(8, 0, 0);
|
||||
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
|
||||
$serialTableData = [];
|
||||
$materialTableData = [];
|
||||
$bundleTableData = [];
|
||||
|
||||
// Get plant IDs: either one plant or all
|
||||
$plantIds = $plantIdArg == 0
|
||||
? InvoiceValidation::select('plant_id')->distinct()->pluck('plant_id')->toArray()
|
||||
: [$plantIdArg];
|
||||
|
||||
$isPlantRun = $plantIdArg != 0;
|
||||
|
||||
$no = 1;
|
||||
if (strtolower($schedule) == 'daily') {
|
||||
if (strtolower($schedule) == 'daily')
|
||||
{
|
||||
$startDate = now()->subDay()->setTime(8, 0, 0);
|
||||
$endDate = now()->setTime(8, 0, 0);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$startDate = now()->setTime(8, 0, 0);
|
||||
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
}
|
||||
foreach ($plantIds as $plantId) {
|
||||
foreach ($plantIds as $plantId)
|
||||
{
|
||||
$plant = Plant::find($plantId);
|
||||
$plantName = $plant ? $plant->name : $plantId;
|
||||
|
||||
@@ -85,7 +77,7 @@ class SendInvoiceReport extends Command
|
||||
$scannedSerialCount = InvoiceValidation::select('invoice_number')
|
||||
->where('plant_id', $plantId)
|
||||
->whereNull('quantity')
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->whereBetween('updated_at', [$startDate, $endDate])
|
||||
->groupBy('invoice_number')
|
||||
->havingRaw("COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)")
|
||||
->count();
|
||||
@@ -97,16 +89,15 @@ class SendInvoiceReport extends Command
|
||||
|
||||
$scannedInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
|
||||
->where('scanned_status', 'Scanned')
|
||||
->where(function ($query) {
|
||||
->where(function($query) {
|
||||
$query->whereNull('quantity')
|
||||
->orWhere('quantity', 0);
|
||||
})
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->whereBetween('updated_at', [$startDate, $endDate])
|
||||
->count();
|
||||
|
||||
$serialTableData[] = [
|
||||
'no' => $no,
|
||||
'plant_id' => $plantId,
|
||||
'plant' => $plantName,
|
||||
'totalInvoice' => $totalSerialCount,
|
||||
'scannedInvoice' => $scannedSerialCount,
|
||||
@@ -124,7 +115,7 @@ class SendInvoiceReport extends Command
|
||||
$scannedMatCount = InvoiceValidation::select('invoice_number')
|
||||
->where('plant_id', $plantId)
|
||||
->where('quantity', 1)
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->whereBetween('updated_at', [$startDate, $endDate])
|
||||
->groupBy('invoice_number')
|
||||
->havingRaw("COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)")
|
||||
->count();
|
||||
@@ -137,13 +128,12 @@ class SendInvoiceReport extends Command
|
||||
$scannedMatInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
|
||||
->where('quantity', 1)
|
||||
->whereNotNull('serial_number')
|
||||
->where('serial_number', '!=', '')
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->where('serial_number','!=', '')
|
||||
->whereBetween('updated_at', [$startDate, $endDate])
|
||||
->count();
|
||||
|
||||
$materialTableData[] = [
|
||||
'no' => $no,
|
||||
'plant_id' => $plantId,
|
||||
'plant' => $plantName,
|
||||
'totalInvoice' => $totalMatCount,
|
||||
'scannedInvoice' => $scannedMatCount,
|
||||
@@ -161,7 +151,7 @@ class SendInvoiceReport extends Command
|
||||
$scannedBundleCount = InvoiceValidation::select('invoice_number')
|
||||
->where('plant_id', $plantId)
|
||||
->where('quantity', '>', 1)
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->whereBetween('updated_at', [$startDate, $endDate])
|
||||
->groupBy('invoice_number')
|
||||
->havingRaw("COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)")
|
||||
->count();
|
||||
@@ -174,13 +164,12 @@ class SendInvoiceReport extends Command
|
||||
$scannedBundleInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
|
||||
->where('quantity', '>', 1)
|
||||
->whereNotNull('serial_number')
|
||||
->where('serial_number', '!=', '')
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->where('serial_number','!=', '')
|
||||
->whereBetween('updated_at', [$startDate, $endDate])
|
||||
->count();
|
||||
|
||||
$bundleTableData[] = [
|
||||
'no' => $no,
|
||||
'plant_id' => $plantId,
|
||||
'plant' => $plantName,
|
||||
'totalInvoice' => $totalBundleCount,
|
||||
'scannedInvoice' => $scannedBundleCount,
|
||||
@@ -191,293 +180,48 @@ class SendInvoiceReport extends Command
|
||||
$no++;
|
||||
}
|
||||
|
||||
// $mail = new test($serialTableData, $materialTableData, $bundleTableData, $schedule);
|
||||
// $contentVars = $mail->content()->with;
|
||||
$mail = new test($serialTableData, $materialTableData, $bundleTableData, $schedule);
|
||||
$contentVars = $mail->content()->with;
|
||||
|
||||
$this->info($contentVars['greeting'] ?? 'Invoice Report');
|
||||
|
||||
// Send to SerialInvoiceMail recipients
|
||||
// if ($mailRules->has('SerialInvoiceMail')) {
|
||||
|
||||
// foreach ($mailRules->get('SerialInvoiceMail') as $rule) {
|
||||
|
||||
// $filteredSerialData = [];
|
||||
|
||||
// $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 ID {$rule->id} — no valid To emails found.");
|
||||
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// if ($rule->plant == 0) {
|
||||
// $filteredSerialData = $serialTableData;
|
||||
|
||||
// } else {
|
||||
// $filteredSerialData = collect($serialTableData)
|
||||
// ->where('plant_id', $rule->plant)
|
||||
// ->values()
|
||||
// ->toArray();
|
||||
// }
|
||||
|
||||
// if (empty($filteredSerialData)) {
|
||||
// $this->warn("Skipping empty mail for rule {$rule->id}");
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// // \Mail::to($toEmails)
|
||||
// // ->cc($ccEmails)
|
||||
// // ->send(new test(
|
||||
// // $filteredSerialData,
|
||||
// // [],
|
||||
// // [],
|
||||
// // $schedule
|
||||
// // ));
|
||||
|
||||
// $mail = new test(
|
||||
// $filteredSerialData,
|
||||
// [],
|
||||
// [],
|
||||
// $schedule
|
||||
// );
|
||||
|
||||
// \Mail::to($toEmails)
|
||||
// ->cc($ccEmails)
|
||||
// ->send($mail);
|
||||
|
||||
// // \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) : ''));
|
||||
// }
|
||||
// }
|
||||
|
||||
if ($serialRules->isNotEmpty()) {
|
||||
|
||||
foreach ($serialRules as $rule) {
|
||||
|
||||
if (
|
||||
$isPlantRun &&
|
||||
$plantIdArg != 0 &&
|
||||
$rule->plant != 0 &&
|
||||
$rule->plant != $plantIdArg
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
$plantIdArg == 0 &&
|
||||
$rule->plant != 0
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data = collect($serialTableData)
|
||||
->when($rule->plant != 0, fn ($q) => $q->where('plant_id', $rule->plant))
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
if (empty($data)) continue;
|
||||
|
||||
\Mail::to($rule->email)
|
||||
->cc($rule->cc_emails ?? [])
|
||||
->send(new test($data, [], [], $schedule));
|
||||
if ($mailRules->has('SerialInvoiceMail')) {
|
||||
$emails = $mailRules['SerialInvoiceMail']->pluck('email')->unique()->toArray();
|
||||
foreach ($emails as $email) {
|
||||
Mail::to($email)->send(new test($serialTableData, [], [], $schedule));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Send to MaterialInvoiceMail recipients (material + bundle table)
|
||||
if ($materialRules->isNotEmpty()) {
|
||||
// $emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
|
||||
// foreach ($emails as $email) {
|
||||
// Mail::to($email)->send(new test([], $materialTableData, $bundleTableData, $schedule));
|
||||
// }
|
||||
foreach ($materialRules as $rule) {
|
||||
|
||||
$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 ID {$rule->id} — no valid To emails found.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// 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) : ''));
|
||||
if ($mailRules->has('MaterialInvoiceMail')) {
|
||||
$emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
|
||||
foreach ($emails as $email) {
|
||||
Mail::to($email)->send(new test([], $materialTableData, $bundleTableData, $schedule));
|
||||
}
|
||||
}
|
||||
|
||||
if ($invoiceRules->isNotEmpty()) {
|
||||
|
||||
foreach ($invoiceRules as $rule) {
|
||||
|
||||
// During global run, only execute plant=0 rule
|
||||
if ($plantIdArg == 0 && $rule->plant != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// During plant run, only execute matching rule
|
||||
if (
|
||||
$plantIdArg != 0 &&
|
||||
$rule->plant != 0 &&
|
||||
$rule->plant != $plantIdArg
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$filteredSerialData = [];
|
||||
$filteredMaterialData = [];
|
||||
$filteredBundleData = [];
|
||||
|
||||
$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 ID {$rule->id} — no valid To emails found.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// Prevent empty mails
|
||||
if (
|
||||
empty($filteredSerialData) &&
|
||||
empty($filteredMaterialData) &&
|
||||
empty($filteredBundleData)
|
||||
) {
|
||||
$this->warn("Skipping empty mail for rule {$rule->id}");
|
||||
continue;
|
||||
}
|
||||
|
||||
// \Mail::to($toEmails)
|
||||
// ->cc($ccEmails)
|
||||
// ->send(new test(
|
||||
// $filteredSerialData,
|
||||
// $filteredMaterialData,
|
||||
// $filteredBundleData,
|
||||
// $schedule
|
||||
// ));
|
||||
|
||||
$mail = new test(
|
||||
$filteredSerialData,
|
||||
$filteredMaterialData,
|
||||
$filteredBundleData,
|
||||
$schedule
|
||||
);
|
||||
|
||||
\Mail::to($toEmails)
|
||||
->cc($ccEmails)
|
||||
->send($mail);
|
||||
|
||||
// \Mail::raw('Test mail', function ($message) use ($toEmails, $ccEmails) {
|
||||
// $message->to($toEmails)
|
||||
// ->cc($ccEmails)
|
||||
// ->subject('Test');
|
||||
// });
|
||||
|
||||
// \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) : ''));
|
||||
// Send to InvoiceMail recipients (all three tables)
|
||||
if ($mailRules->has('InvoiceMail')) {
|
||||
$emails = $mailRules['InvoiceMail']->pluck('email')->unique()->toArray();
|
||||
foreach ($emails as $email) {
|
||||
Mail::to($email)->send(new test($serialTableData, $materialTableData, $bundleTableData, $schedule));
|
||||
}
|
||||
}
|
||||
|
||||
// Show preview in console
|
||||
$this->info('--- Serial Invoice Table ---');
|
||||
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $serialTableData);
|
||||
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $serialTableData);
|
||||
|
||||
$this->info('--- Material Invoice Table ---');
|
||||
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $materialTableData);
|
||||
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $materialTableData);
|
||||
|
||||
$this->info('--- Bundle Invoice Table ---');
|
||||
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $bundleTableData);
|
||||
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $bundleTableData);
|
||||
|
||||
$this->info($contentVars['wishes'] ?? '');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\InvoiceTransitMail;
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\InvoiceInTransit;
|
||||
use App\Models\InvoiceMaster;
|
||||
use App\Models\Plant;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SendInvoiceTransitReport extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'send:invoice-transit-report {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', 'InvoiceTransit')
|
||||
->where('rule_name', 'InvoiceTransitMail')
|
||||
->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 = InvoiceInTransit::whereDate('created_at', now()->toDateString())->first();
|
||||
|
||||
if (!$todayRecordExists) {
|
||||
$this->info('No records created today. Mail not sent.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (strtolower($scheduleType) == 'daily') {
|
||||
$results = DB::table('invoice_in_transits as it')
|
||||
->join('invoice_masters as im', function ($join) {
|
||||
$join->on('im.receiving_plant_name', '=', 'it.receiving_plant_name')->on('im.transport_name', '=', 'it.transport_name');
|
||||
})
|
||||
->select(
|
||||
'it.invoice_number',
|
||||
'it.receiving_plant',
|
||||
'it.plant_id',
|
||||
'it.receiving_plant_name',
|
||||
'it.lr_bl_aw_date',
|
||||
'it.lr_bl_aw_number',
|
||||
'im.id as invoice_master_id',
|
||||
'im.transport_name',
|
||||
DB::raw('CAST(im.transit_days AS INTEGER) as transit_days'),
|
||||
// DB::raw('(CURRENT_DATE - CAST(it.lr_bl_aw_date AS DATE)) as delayed_days')
|
||||
// DB::raw('
|
||||
// GREATEST(
|
||||
// 0,
|
||||
// (CURRENT_DATE - CAST(it.lr_bl_aw_date AS DATE) - 1)
|
||||
// - CAST(im.transit_days AS INTEGER)
|
||||
// ) AS delayed_days
|
||||
// ')
|
||||
DB::raw('
|
||||
GREATEST(
|
||||
1,
|
||||
(CURRENT_DATE - CAST(it.lr_bl_aw_date AS DATE))
|
||||
- CAST(im.transit_days AS INTEGER)
|
||||
) AS delayed_days
|
||||
')
|
||||
|
||||
)
|
||||
->when($plantId != 0, fn ($q) => $q->where('it.plant_id', $plantId))
|
||||
->whereNotNull('it.lr_bl_aw_date')
|
||||
->whereRaw('
|
||||
(CURRENT_DATE - CAST(it.lr_bl_aw_date AS DATE))
|
||||
- CAST(im.transit_days AS INTEGER) > 0
|
||||
')
|
||||
->distinct('it.invoice_number')
|
||||
->get();
|
||||
|
||||
if ($results->isEmpty()) {
|
||||
$this->info('No invoice transit records found for today.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$tableData = [];
|
||||
|
||||
foreach ($mailRules as $rule) {
|
||||
|
||||
$ruleInvoices = $results->where('invoice_master_id', $rule->invoice_master_id);
|
||||
// $ruleInvoices = $results->filter(fn($item) => $item->invoice_master_id == (int)$rule->invoice_master_id);
|
||||
|
||||
if ($ruleInvoices->isEmpty()) {
|
||||
$this->info("Skipping rule {$rule->id} — no invoice transit data.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$invoiceMaster = InvoiceMaster::find($rule->invoice_master_id);
|
||||
|
||||
$mailSubject = $invoiceMaster
|
||||
? "Despatch Invoice In Transit ({$invoiceMaster->receiving_plant_name} - {$invoiceMaster->transport_name})"
|
||||
: 'Despatch Invoice In Transit';
|
||||
|
||||
if ($ruleInvoices->isEmpty()) {
|
||||
$tableData = [];
|
||||
$this->info("No despatch invoices in transit found for rule {$rule->id}.");
|
||||
} else {
|
||||
|
||||
$tableData = $ruleInvoices->values()->map(function ($item, $index) use ($plantCodes) {
|
||||
return [
|
||||
'no' => $index + 1,
|
||||
'plant' => $plantCodes[$item->plant_id],
|
||||
'receiving_plant' => $item->receiving_plant,
|
||||
'receiving_plant_name' => $item->receiving_plant_name,
|
||||
'invoice_number' => $item->invoice_number,
|
||||
'transport_name' => $item->transport_name,
|
||||
'lr_bl_aw_date' => $item->lr_bl_aw_date,
|
||||
'lr_bl_aw_number' => $item->lr_bl_aw_number,
|
||||
'transit_days' => $item->transit_days,
|
||||
'status' => $item->delayed_days.' Days',
|
||||
];
|
||||
})->toArray();
|
||||
|
||||
}
|
||||
|
||||
$mail = new InvoiceTransitMail($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} | Invoice Master ID: {$rule->invoice_master_id} | To: ".implode(', ', $toEmails)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\LaserStopReportMail;
|
||||
use App\Models\ClassCharacteristic;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class SendLaserStopReport extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'send:laser-stop-report {schedule_type} {plant} {machine_id}';
|
||||
|
||||
/**
|
||||
* 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');
|
||||
$machineId = (int) $this->argument('machine_id');
|
||||
|
||||
$mailRules = \App\Models\AlertMailRule::where('module', 'LaserStopAlert')
|
||||
->where('rule_name', 'LaserStopAlertMail')
|
||||
->where('schedule_type', $scheduleType)
|
||||
->where('plant', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
->get();
|
||||
|
||||
$emails = $mailRules
|
||||
->pluck('email')
|
||||
->filter()
|
||||
->flatMap(function ($email) {
|
||||
return array_map('trim', explode(',', $email));
|
||||
})
|
||||
->unique()
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
$ccEmails = $mailRules
|
||||
->pluck('cc_emails')
|
||||
->filter()
|
||||
->flatMap(function ($email) {
|
||||
return array_map('trim', explode(',', $email));
|
||||
})
|
||||
->unique()
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
$plants = $plantId == 0
|
||||
? Plant::all()
|
||||
: Plant::where('id', $plantId)->get();
|
||||
|
||||
if ($plants->isEmpty()) {
|
||||
$this->error('No valid plant(s) found.');
|
||||
return;
|
||||
}
|
||||
|
||||
$plant = Plant::find($plantId);
|
||||
|
||||
$plantName = $plant?->name ?? $plantId;
|
||||
|
||||
$machine = Machine::find($machineId);
|
||||
|
||||
$machineName = $machine?->work_center ?? $machineId;
|
||||
|
||||
$records = ClassCharacteristic::where('is_stopped', 2)
|
||||
->where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
->get();
|
||||
|
||||
if ($records->isEmpty()) {
|
||||
$this->info('No laser stop records found.');
|
||||
return;
|
||||
}
|
||||
|
||||
$recordIds = $records->pluck('id');
|
||||
|
||||
// Send mail to mapped email IDs
|
||||
Mail::to($emails)
|
||||
->cc($ccEmails)
|
||||
->send(
|
||||
new LaserStopReportMail(
|
||||
$records,
|
||||
$plantId,
|
||||
$machineId,
|
||||
$plantName,
|
||||
$machineName,
|
||||
)
|
||||
);
|
||||
|
||||
ClassCharacteristic::whereIn('id', $recordIds)
|
||||
->update([
|
||||
'is_stopped' => 1,
|
||||
]);
|
||||
|
||||
$this->info('Laser stop report mail sent successfully.');
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,15 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\ProductionMail;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
use App\Models\InvoiceValidation;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProductionPlan;
|
||||
use App\Models\ProductionQuantity;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\ProductionMail;
|
||||
use App\Models\Line;
|
||||
use App\Models\ProductionPlan;
|
||||
use App\Models\ProductionQuantity;
|
||||
use DB;
|
||||
|
||||
class SendProductionReport extends Command
|
||||
{
|
||||
@@ -18,7 +19,7 @@ class SendProductionReport extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
// protected $signature = 'send:production-report';
|
||||
//protected $signature = 'send:production-report';
|
||||
protected $signature = 'send:production-report {schedule_type} {plant}';
|
||||
|
||||
/**
|
||||
@@ -31,10 +32,11 @@ class SendProductionReport extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
|
||||
public function handle()
|
||||
{
|
||||
// ini_set('max_execution_time', 0); // disable limit
|
||||
// set_time_limit(0);
|
||||
ini_set('max_execution_time', 0); // disable limit
|
||||
set_time_limit(0);
|
||||
|
||||
$scheduleType = $this->argument('schedule_type');
|
||||
$plantId = (int) $this->argument('plant'); // cast to int for safety
|
||||
@@ -53,272 +55,98 @@ class SendProductionReport extends Command
|
||||
: Plant::where('id', $plantId)->get();
|
||||
|
||||
if ($plants->isEmpty()) {
|
||||
$this->error('No valid plant(s) found.');
|
||||
|
||||
$this->error("No valid plant(s) found.");
|
||||
return;
|
||||
}
|
||||
|
||||
// $startDate = now()->setTime(8, 0, 0);
|
||||
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
if (strtolower($scheduleType) == 'daily') {
|
||||
if (strtolower($scheduleType) == 'daily')
|
||||
{
|
||||
$startDate = now()->subDay()->setTime(8, 0, 0);
|
||||
$endDate = now()->setTime(8, 0, 0);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$startDate = now()->setTime(8, 0, 0);
|
||||
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
}
|
||||
|
||||
$PlanstartDate = now()->subDay()->setTime(8, 0, 0);
|
||||
$planendDate = now()->setTime(7, 59, 0);
|
||||
$PlanstartDate = now()->setTime(8, 0, 0);
|
||||
$planendDate = now()->copy()->addDay()->setTime(7, 59, 0);
|
||||
|
||||
$tableData = [];
|
||||
$no = 1;
|
||||
|
||||
// .
|
||||
|
||||
// foreach ($plants as $plant) {
|
||||
// $lines = Line::where('plant_id', $plant->id)->get();
|
||||
|
||||
// foreach ($lines as $line) {
|
||||
|
||||
// $month = $startDate->month;
|
||||
// $year = $startDate->year;
|
||||
|
||||
// $workingDays = ProductionPlan::where('plant_id', $plantId)
|
||||
// ->whereMonth('created_at', $month)
|
||||
// ->whereYear('created_at', $year)
|
||||
// ->value('working_days') ?? 0;
|
||||
|
||||
// $totalTargetQuantity = 0;
|
||||
|
||||
// $monthlyPlan = ProductionPlan::where('plant_id', $plantId)
|
||||
// ->where('line_id', $line->id)
|
||||
// ->whereMonth('created_at', $month)
|
||||
// ->whereYear('created_at', $year)
|
||||
// ->sum('plan_quantity'); // / $workingDays
|
||||
|
||||
// $dailyTarget = $workingDays > 0
|
||||
// ? $monthlyPlan / $workingDays
|
||||
// : 0;
|
||||
|
||||
// $dailyTarget = round($dailyTarget, 2);
|
||||
|
||||
// // $totalTargetQuantity = round($totalTargetQuantity, 2);
|
||||
|
||||
// $monthStart = $startDate->copy()->startOfMonth();
|
||||
// $completedDays = $monthStart->diffInDays($startDate);
|
||||
|
||||
// $expectedTillYesterday = $dailyTarget * $completedDays;
|
||||
|
||||
// if (strtolower($line->type) == 'fg line') {
|
||||
// $productionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
|
||||
// ->where('line_id', $line->id)
|
||||
// ->whereBetween('created_at', [$startDate, $endDate])
|
||||
// ->count();
|
||||
// } else {
|
||||
// $productionQuantity = ProductionQuantity::where('plant_id', $plant->id)
|
||||
// ->where('line_id', $line->id)
|
||||
// ->whereBetween('created_at', [$startDate, $endDate])
|
||||
// ->count();
|
||||
// }
|
||||
|
||||
// $previousRemaining = max(0, $expectedTillYesterday - $productionQuantity);
|
||||
|
||||
// $totalTargetQuantity = round($dailyTarget + $previousRemaining, 2);
|
||||
|
||||
// $tableData[] = [
|
||||
// 'no' => $no++,
|
||||
// 'plant' => $plant->name,
|
||||
// 'line' => $line->name,
|
||||
// 'type' => $line->type,
|
||||
// 'targetQuantity' => $totalTargetQuantity,
|
||||
// 'productionQuantity' => $productionQuantity,
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
//..New Logic
|
||||
|
||||
foreach ($plants as $plant) {
|
||||
//.
|
||||
|
||||
foreach ($plants as $plant)
|
||||
{
|
||||
$lines = Line::where('plant_id', $plant->id)->get();
|
||||
|
||||
foreach ($lines as $line) {
|
||||
|
||||
$month = $startDate->month;
|
||||
$year = $startDate->year;
|
||||
|
||||
$workingDays = ProductionPlan::where('plant_id', $plant->id)
|
||||
$targetQuantity = ProductionPlan::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereMonth('created_at', $month)
|
||||
->whereYear('created_at', $year)
|
||||
->value('working_days') ?? 0;
|
||||
|
||||
$monthlyPlan = ProductionPlan::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereMonth('created_at', $month)
|
||||
->whereYear('created_at', $year)
|
||||
->whereBetween('created_at', [$PlanstartDate, $planendDate])
|
||||
->sum('plan_quantity');
|
||||
|
||||
$dailyTarget = $workingDays > 0 ? $monthlyPlan / $workingDays : 0;
|
||||
|
||||
$dailyTarget = round($dailyTarget, 2);
|
||||
|
||||
$leaveDatesString = ProductionPlan::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereMonth('created_at', $month)
|
||||
->whereYear('created_at', $year)
|
||||
->value('leave_dates');
|
||||
|
||||
$leaveDates = $leaveDatesString ? explode(',', $leaveDatesString) : [];
|
||||
|
||||
$monthStart = $startDate->copy()->startOfMonth();
|
||||
$yesterday = $startDate->copy()->subDay();
|
||||
|
||||
$completedDays = 0;
|
||||
$currentDate = $monthStart->copy();
|
||||
|
||||
while ($currentDate->lte($yesterday)) {
|
||||
|
||||
if (!in_array($currentDate->format('Y-m-d'), $leaveDates)) {
|
||||
$completedDays++;
|
||||
}
|
||||
|
||||
$currentDate->addDay();
|
||||
}
|
||||
|
||||
$expectedTillYesterday = $dailyTarget * $completedDays;
|
||||
|
||||
if (strtolower($line->type) == 'fg line') {
|
||||
|
||||
$producedTillYesterday = \App\Models\QualityValidation::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereMonth('created_at', $month)
|
||||
->whereYear('created_at', $year)
|
||||
->where('created_at', '<', $startDate)
|
||||
->count();
|
||||
|
||||
} else {
|
||||
|
||||
$producedTillYesterday = ProductionQuantity::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereMonth('created_at', $month)
|
||||
->whereYear('created_at', $year)
|
||||
->where('created_at', '<', $startDate)
|
||||
->count();
|
||||
}
|
||||
|
||||
$previousRemaining = max(0, $expectedTillYesterday - $producedTillYesterday);
|
||||
|
||||
$totalTargetQuantity = round($dailyTarget + $previousRemaining, 2);
|
||||
|
||||
$itemIds = ProductionPlan::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereMonth('created_at', $month)
|
||||
->whereYear('created_at', $year)
|
||||
->distinct()
|
||||
->pluck('item_id');
|
||||
|
||||
$totalHourlyQuantity = Item::whereIn('id', $itemIds)
|
||||
->sum('hourly_quantity');
|
||||
|
||||
$capacityQuan = $totalHourlyQuantity * 22.5;
|
||||
|
||||
if (strtolower($line->type) == 'fg line') {
|
||||
|
||||
$productionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->count();
|
||||
|
||||
} else {
|
||||
|
||||
$productionQuantity = ProductionQuantity::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->count();
|
||||
}
|
||||
|
||||
if ($capacityQuan > 0) {
|
||||
$efficiency = ($productionQuantity / $capacityQuan) * 100;
|
||||
} else {
|
||||
$efficiency = 0;
|
||||
}
|
||||
|
||||
$efficiency = round($efficiency, 2);
|
||||
|
||||
$tableData[] = [
|
||||
'no' => $no++,
|
||||
'plant' => $plant->name,
|
||||
'type' => $line->type,
|
||||
'line' => $line->name,
|
||||
'capacityQuantity' => floor($capacityQuan),
|
||||
'targetQuantity' => floor($totalTargetQuantity),
|
||||
'type' => $line->type,
|
||||
'targetQuantity' => $targetQuantity,
|
||||
'productionQuantity' => $productionQuantity,
|
||||
'efficiency' => $efficiency . '%',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// $service = new \App\Services\ProductionTargetService();
|
||||
|
||||
// $year = $startDate->year;
|
||||
// $month = $startDate->month;
|
||||
|
||||
// [$records, $dates] = $service->generate(
|
||||
// $plantId,
|
||||
// $year,
|
||||
// $month,
|
||||
// );
|
||||
//$this->table(['No', 'Plant', 'Line', 'Target Quantity', 'Production Quantity'], $fgTableData);
|
||||
|
||||
// $this->table(['No', 'Plant', 'Line', 'Target Quantity', 'Production Quantity'], $tableData);
|
||||
|
||||
// if (!empty($emails)) {
|
||||
// foreach ($emails as $email) {
|
||||
// Mail::to($email)->send(new ProductionMail($tableData));
|
||||
// }
|
||||
// } else {
|
||||
// $this->info('No recipients found for ProductionMailAlert.');
|
||||
// }
|
||||
|
||||
// $this->info("Production report sent to " . count($emails) . " recipient(s).");
|
||||
// Preview in console
|
||||
$mail = new ProductionMail($scheduleType, $tableData);
|
||||
|
||||
// $mail = new ProductionMail($scheduleType,$tableData,$records,$dates);
|
||||
|
||||
$contentVars = $mail->content()->with;
|
||||
|
||||
$this->info($contentVars['greeting'] ?? 'Production Report');
|
||||
$this->table(
|
||||
['No', 'Plant', 'Line', 'Type', 'Capacity Quantity', 'Target Quantity', 'Production Quantity'],
|
||||
['No', 'Plant', 'Line', 'Type', 'Target Quantity', 'Production Quantity'],
|
||||
$tableData
|
||||
);
|
||||
$this->info($contentVars['wishes'] ?? '');
|
||||
|
||||
// Send mails
|
||||
// if (! empty($emails)) {
|
||||
// foreach ($emails as $email) {
|
||||
// Mail::to($email)->send(new ProductionMail($scheduleType, $tableData));
|
||||
// }
|
||||
// $this->info('Production report sent to '.count($emails).' recipient(s).');
|
||||
// } else {
|
||||
// $this->warn('No recipients found for ProductionMailAlert.');
|
||||
// }
|
||||
foreach ($mailRules as $rule)
|
||||
{
|
||||
$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 ID {$rule->id} — no valid To emails found.");
|
||||
|
||||
continue;
|
||||
if (!empty($emails)) {
|
||||
foreach ($emails as $email) {
|
||||
Mail::to($email)->send(new ProductionMail($scheduleType, $tableData));
|
||||
}
|
||||
|
||||
\Mail::to($toEmails)->cc($ccEmails)->send($mail);
|
||||
|
||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
||||
$this->info("Production report sent to " . count($emails) . " recipient(s).");
|
||||
} else {
|
||||
$this->warn('No recipients found for ProductionMailAlert.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\VehicleEntryMail;
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\Plant;
|
||||
use App\Models\VehicleEntry;
|
||||
use Illuminate\Console\Command;
|
||||
use Mail;
|
||||
|
||||
class SendVehicleReport extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'send:vehicle-report {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', 'VehicleReport')
|
||||
->where('rule_name', 'VehicleReportMail')
|
||||
->where('schedule_type', $scheduleType)
|
||||
->get();
|
||||
|
||||
$plants = ($plantId == 0)
|
||||
? Plant::all()
|
||||
: Plant::where('id', $plantId)->get();
|
||||
|
||||
if ($plants->isEmpty()) {
|
||||
$this->error('No valid plant(s) found.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (strtolower($scheduleType) == 'daily') {
|
||||
$startDate = now()->subDay()->setTime(8, 0, 0);
|
||||
$endDate = now()->setTime(8, 0, 0);
|
||||
} else {
|
||||
$startDate = now()->setTime(8, 0, 0);
|
||||
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
}
|
||||
|
||||
foreach ($plants as $plant) {
|
||||
|
||||
$vehicleEntries = VehicleEntry::select([
|
||||
'vehicle_number',
|
||||
'boom_opened',
|
||||
'entry_time',
|
||||
'exit_time',
|
||||
'duration',
|
||||
'type',
|
||||
])
|
||||
->where('plant_id', $plant->id)
|
||||
->whereBetween('entry_time', [$startDate, $endDate])
|
||||
->get();
|
||||
|
||||
if ($vehicleEntries->isEmpty()) {
|
||||
$this->warn("No records for {$plant->name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
$tableData = [];
|
||||
$no = 1;
|
||||
|
||||
foreach ($vehicleEntries as $vehicleEntry) {
|
||||
$tableData[] = [
|
||||
'no' => $no++,
|
||||
'plant' => $plant->name,
|
||||
'vehicleNumber' => strtoupper($vehicleEntry->vehicle_number),
|
||||
'entryTime' => $vehicleEntry->entry_time,
|
||||
'exitTime' => $vehicleEntry->exit_time,
|
||||
'duration' => $vehicleEntry->duration,
|
||||
'type' => $vehicleEntry->type,
|
||||
'boom' => $vehicleEntry->boom_opened,
|
||||
];
|
||||
}
|
||||
|
||||
if ($plantId == 0) {
|
||||
$rule = $mailRules->first();
|
||||
} else {
|
||||
$rule = $mailRules->where('plant', $plant->id)->first();
|
||||
}
|
||||
|
||||
if (!$rule) {
|
||||
$this->warn("No mail rule for {$plant->name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
$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();
|
||||
|
||||
$mail = new VehicleEntryMail(
|
||||
$scheduleType,
|
||||
$tableData,
|
||||
'Daily Vehicle Transit Report'
|
||||
);
|
||||
|
||||
Mail::to($toEmails)->cc($ccEmails)->send($mail);
|
||||
|
||||
$this->info("Mail sent for {$plant->name}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,546 +0,0 @@
|
||||
<?php
|
||||
|
||||
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
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
// protected $signature = 'app:trigger-pending-approval-mails';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
// protected $description = 'Command description';
|
||||
|
||||
// /**
|
||||
// * Execute the console command.
|
||||
// */
|
||||
// public function handle()
|
||||
// {
|
||||
// //
|
||||
// }
|
||||
|
||||
protected $signature = 'approval:trigger-mails';
|
||||
protected $description = 'Trigger approval mail manually';
|
||||
|
||||
public $pdfPath;
|
||||
|
||||
public $subjectLine;
|
||||
|
||||
// public $tempCharacteristics = [];
|
||||
|
||||
public $wfId;
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$this->info('Approval mail job started');
|
||||
|
||||
// .. Characteristic Mail trigger logic
|
||||
|
||||
// $records = RequestCharacteristic::whereNull('approver_status1')
|
||||
// ->whereNull('approver_status2')
|
||||
// ->whereNull('approver_status3')
|
||||
// ->get();
|
||||
|
||||
$records = 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');
|
||||
})
|
||||
->get();
|
||||
|
||||
$records = $records->filter(function ($item) {
|
||||
$approver = CharacteristicApproverMaster::find($item->characteristic_approver_master_id);
|
||||
return $approver && $approver->approver_type == 'Characteristic';
|
||||
});
|
||||
|
||||
if ($records->isEmpty()) {
|
||||
$this->info('No characteristics pending approvals');
|
||||
}else{
|
||||
$grouped = $records->groupBy(function ($item) {
|
||||
$this->wfId = $item->work_flow_id;
|
||||
return $item->plant_id . '|' . $item->machine_id . '|' . $item->aufnr . '|' . $item->work_flow_id;
|
||||
});
|
||||
|
||||
$pendingApprovers = RequestCharacteristic::where('work_flow_id', $this->wfId)->latest()->first();
|
||||
|
||||
$this->info($pendingApprovers->approver_status1, $pendingApprovers->approver_status2);
|
||||
|
||||
|
||||
$approverNameFromMaster = null;
|
||||
if ($pendingApprovers && $pendingApprovers->characteristic_approver_master_id) {
|
||||
$approverNameFromMaster = CharacteristicApproverMaster::find($pendingApprovers->characteristic_approver_master_id);
|
||||
}
|
||||
|
||||
$rows = [];
|
||||
|
||||
foreach ($grouped as $groupRecords) {
|
||||
|
||||
$first = $groupRecords->first();
|
||||
|
||||
$approver = CharacteristicApproverMaster::where('plant_id', $first->plant_id)
|
||||
->where('machine_id', $first->machine_id)
|
||||
->where('id', $first->characteristic_approver_master_id)
|
||||
->first();
|
||||
|
||||
if (!$approver) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$characteristics = $groupRecords->map(fn ($r) => [
|
||||
'work_flow_id' => $r->work_flow_id,
|
||||
'characteristic_name' => $r->characteristic_name,
|
||||
'current_value' => $r->current_value,
|
||||
'update_value' => $r->update_value,
|
||||
])->toArray();
|
||||
|
||||
$level = null;
|
||||
$mail = null;
|
||||
$name = null;
|
||||
$updateData = [];
|
||||
$now = Carbon::now();
|
||||
|
||||
// --- FIRST MAIL ---
|
||||
if (is_null($first->mail_status)){
|
||||
$level = 1;
|
||||
$mail = $approver->mail1;
|
||||
$name = $approver->name1;
|
||||
|
||||
$updateData['mail_status'] = 'Sent';
|
||||
|
||||
if ($approver->duration1 > 0)
|
||||
{
|
||||
|
||||
$duration = number_format((float)$approver->duration1, 2, '.', '');
|
||||
[$hours, $minutes] = explode('.', $duration);
|
||||
|
||||
$totalMinutes = ((int)$hours * 60) + (int)$minutes;
|
||||
|
||||
$updateData['trigger_at'] = $now
|
||||
->copy()
|
||||
->addMinutes($totalMinutes)
|
||||
->startOfMinute();
|
||||
}
|
||||
else
|
||||
{
|
||||
$updateData['trigger_at'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
// --- SECOND MAIL ---
|
||||
elseif (
|
||||
$first->mail_status == 'Sent' &&
|
||||
(is_null($first->approver_status1) || $first->approver_status1 == 'Hold') &&
|
||||
$first->trigger_at &&
|
||||
\Carbon\Carbon::parse($first->trigger_at)->lte($now)
|
||||
) {
|
||||
|
||||
$this->info(
|
||||
"mail_status: {$first->mail_status}, ".
|
||||
"approver_status1: {$first->approver_status1}, ".
|
||||
"trigger_at: {$first->trigger_at}, ".
|
||||
"now: {$now}"
|
||||
);
|
||||
|
||||
$level = 2;
|
||||
$mail = $approver->mail2;
|
||||
$name = $approver->name2;
|
||||
|
||||
if ($approver->duration2 > 0) {
|
||||
|
||||
$duration = number_format((float)$approver->duration2, 2, '.', '');
|
||||
[$hours, $minutes] = explode('.', $duration);
|
||||
|
||||
$totalMinutes = ((int)$hours * 60) + (int)$minutes;
|
||||
|
||||
$updateData['trigger_at'] = $now->copy()->addMinutes($totalMinutes);
|
||||
} else {
|
||||
$updateData['trigger_at'] = null;
|
||||
}
|
||||
|
||||
$updateData['mail_status'] = 'Sent-Mail2';
|
||||
}
|
||||
|
||||
// --- THIRD MAIL ---
|
||||
elseif (
|
||||
$first->mail_status == 'Sent-Mail2' &&
|
||||
(is_null($first->approver_status1) || $first->approver_status1 == 'Hold') &&
|
||||
(is_null($first->approver_status2) || $first->approver_status2 == 'Hold') &&
|
||||
$first->trigger_at &&
|
||||
\Carbon\Carbon::parse($first->trigger_at)->lte($now)
|
||||
) {
|
||||
$level = 3;
|
||||
$mail = $approver->mail3;
|
||||
$name = $approver->name3;
|
||||
|
||||
$updateData['trigger_at'] = null;
|
||||
$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;
|
||||
}
|
||||
|
||||
$pdfPath = 'uploads/LaserDocs/' . $first->work_flow_id . '.pdf';
|
||||
|
||||
$subjectLine = 'Characteristic Approval Mail';
|
||||
|
||||
// $emails = array_map('trim', explode(',', $mail));
|
||||
|
||||
Mail::to($mail)->send(
|
||||
new CharacteristicApprovalMail(
|
||||
$first,
|
||||
$name,
|
||||
$level,
|
||||
$pdfPath,
|
||||
$pendingApprovers,
|
||||
$approverNameFromMaster,
|
||||
$subjectLine,
|
||||
$characteristics
|
||||
)
|
||||
);
|
||||
|
||||
RequestCharacteristic::whereIn('id', $groupRecords->pluck('id'))
|
||||
->update($updateData);
|
||||
|
||||
$rows[] = [
|
||||
$first->id,
|
||||
$first->plant_id,
|
||||
$first->machine_id,
|
||||
"Level $level",
|
||||
$mail,
|
||||
'SENT'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// .. Quality Mail trigger logic
|
||||
|
||||
$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');
|
||||
})
|
||||
->get();
|
||||
|
||||
$qualityRecords = $qualityRecords->filter(function ($item) {
|
||||
$approver = CharacteristicApproverMaster::find($item->characteristic_approver_master_id);
|
||||
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;
|
||||
}
|
||||
|
||||
$grouped = $qualityRecords->groupBy(function ($item) {
|
||||
$this->wfId = $item->work_flow_id;
|
||||
return $item->plant_id . '|' . $item->machine_id . '|' . $item->aufnr . '|' . $item->work_flow_id;
|
||||
});
|
||||
|
||||
$pendingApprovers = RequestCharacteristic::where('work_flow_id', $this->wfId)->latest()->first();
|
||||
|
||||
$approverNameFromMaster = null;
|
||||
if ($pendingApprovers && $pendingApprovers->characteristic_approver_master_id) {
|
||||
$approverNameFromMaster = CharacteristicApproverMaster::find($pendingApprovers->characteristic_approver_master_id);
|
||||
}
|
||||
|
||||
$rows = [];
|
||||
|
||||
foreach ($grouped as $groupRecords) {
|
||||
|
||||
$first = $groupRecords->first();
|
||||
|
||||
$approver = CharacteristicApproverMaster::where('plant_id', $first->plant_id)
|
||||
->where('machine_id', $first->machine_id)
|
||||
->where('id', $first->characteristic_approver_master_id)
|
||||
->first();
|
||||
|
||||
if (!$approver) {
|
||||
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;
|
||||
$updateData = [];
|
||||
$now = Carbon::now();
|
||||
|
||||
// --- FIRST MAIL ---
|
||||
if (is_null($first->mail_status)){
|
||||
$level = 1;
|
||||
$mail = $approver->mail1;
|
||||
$name = $approver->name1;
|
||||
|
||||
$updateData['mail_status'] = 'Sent';
|
||||
|
||||
if ($approver->duration1 > 0)
|
||||
{
|
||||
|
||||
$duration = number_format((float)$approver->duration1, 2, '.', '');
|
||||
[$hours, $minutes] = explode('.', $duration);
|
||||
|
||||
$totalMinutes = ((int)$hours * 60) + (int)$minutes;
|
||||
|
||||
$updateData['trigger_at'] = $now
|
||||
->copy()
|
||||
->addMinutes($totalMinutes)
|
||||
->startOfMinute();
|
||||
}
|
||||
else
|
||||
{
|
||||
$updateData['trigger_at'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
// --- SECOND MAIL ---
|
||||
elseif (
|
||||
$first->mail_status == 'Sent' &&
|
||||
(is_null($first->approver_status1) || $first->approver_status1 == 'Hold') &&
|
||||
$first->trigger_at &&
|
||||
\Carbon\Carbon::parse($first->trigger_at)->lte($now)
|
||||
) {
|
||||
$level = 2;
|
||||
$mail = $approver->mail2;
|
||||
$name = $approver->name2;
|
||||
|
||||
if ($approver->duration2 > 0) {
|
||||
|
||||
$duration = number_format((float)$approver->duration2, 2, '.', '');
|
||||
[$hours, $minutes] = explode('.', $duration);
|
||||
|
||||
$totalMinutes = ((int)$hours * 60) + (int)$minutes;
|
||||
|
||||
// IMPORTANT: use NOW, not old trigger
|
||||
$updateData['trigger_at'] = $now->copy()->addMinutes($totalMinutes);
|
||||
} else {
|
||||
$updateData['trigger_at'] = null;
|
||||
}
|
||||
|
||||
$updateData['mail_status'] = 'Sent-Mail2';
|
||||
}
|
||||
|
||||
// --- THIRD MAIL ---
|
||||
elseif (
|
||||
$first->mail_status == 'Sent-Mail2' &&
|
||||
(is_null($first->approver_status1) || $first->approver_status1 == 'Hold') &&
|
||||
(is_null($first->approver_status2) || $first->approver_status2 == 'Hold') &&
|
||||
$first->trigger_at &&
|
||||
\Carbon\Carbon::parse($first->trigger_at)->lte($now)
|
||||
) {
|
||||
$level = 3;
|
||||
$mail = $approver->mail3;
|
||||
$name = $approver->name3;
|
||||
|
||||
$updateData['trigger_at'] = null;
|
||||
$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;
|
||||
}
|
||||
|
||||
$pdfPath = ($f = glob(storage_path('app/private/uploads/LaserDocs/' . $first->work_flow_id . '.*')))
|
||||
? 'uploads/LaserDocs/' . basename($f[0])
|
||||
: null;
|
||||
|
||||
$this->info( $pdfPath);
|
||||
|
||||
$subjectLine = 'Quality Approval Mail';
|
||||
|
||||
$emails = array_map('trim', explode(',', $mail));
|
||||
|
||||
Mail::to($emails)->send(
|
||||
new CharacteristicApprovalMail(
|
||||
$first,
|
||||
$name,
|
||||
$level,
|
||||
$pdfPath,
|
||||
$pendingApprovers,
|
||||
$approverNameFromMaster,
|
||||
$subjectLine,
|
||||
$characteristics
|
||||
)
|
||||
);
|
||||
|
||||
RequestCharacteristic::whereIn('id', $groupRecords->pluck('id'))
|
||||
->update($updateData);
|
||||
|
||||
$rows[] = [
|
||||
$first->id,
|
||||
$first->plant_id,
|
||||
$first->machine_id,
|
||||
"Level $level",
|
||||
$mail,
|
||||
'SENT'
|
||||
];
|
||||
}
|
||||
|
||||
$this->table(
|
||||
['ID', 'Plant', 'Machine', 'Level', 'Mail', 'Status'],
|
||||
$rows
|
||||
);
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
|
||||
class ImportTransitReportExport implements FromCollection, WithHeadings, WithMapping, WithEvents
|
||||
{
|
||||
protected $data;
|
||||
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'No',
|
||||
'CRI RFQ Number',
|
||||
'Requestor',
|
||||
'Shipper',
|
||||
'Shipper Location',
|
||||
'Shipper Invoice',
|
||||
'Shipper Invoice Date',
|
||||
'Custom Agent Name',
|
||||
'ETA',
|
||||
'Status',
|
||||
'Delivery Location',
|
||||
'ETD Date',
|
||||
'Remark',
|
||||
];
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return collect($this->data);
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
static $srNo = 0;
|
||||
$srNo++;
|
||||
|
||||
return [
|
||||
$srNo,
|
||||
$row->cri_rfq_number,
|
||||
$row->requester,
|
||||
$row->shipper,
|
||||
$row->shipper_location,
|
||||
$row->shipper_invoice,
|
||||
$row->shipper_invoice_date,
|
||||
$row->customs_agent_name,
|
||||
$row->eta_date,
|
||||
$row->status,
|
||||
$row->delivery_location,
|
||||
$row->etd_date,
|
||||
$row->remark,
|
||||
];
|
||||
}
|
||||
|
||||
public function registerEvents(): array
|
||||
{
|
||||
|
||||
return [
|
||||
AfterSheet::class => function (AfterSheet $event) {
|
||||
|
||||
$rowNumber = 2; // Excel row starts after header
|
||||
|
||||
foreach ($this->data as $row) {
|
||||
|
||||
if ((int) $row->is_transit_identified == 1) {
|
||||
|
||||
$event->sheet
|
||||
->getStyle("A{$rowNumber}:M{$rowNumber}")
|
||||
->applyFromArray([
|
||||
'fill' => [
|
||||
'fillType' => Fill::FILL_SOLID,
|
||||
'startColor' => [
|
||||
'rgb' => 'FFFF00',
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
$rowNumber++;
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\FromArray;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
|
||||
class InvoicePendingReasonExport implements FromArray, WithHeadings, WithMapping
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected array $data;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function array(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Plant Code',
|
||||
'Document Number',
|
||||
'Remark',
|
||||
'Customer Trade Name',
|
||||
'Location',
|
||||
];
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row['plant_id'] ?? '',
|
||||
$row['document_number'] ?? '',
|
||||
$row['remark'] ?? '',
|
||||
$row['customer_trade_name'] ?? '',
|
||||
$row['location'] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Support\Facades\View as FacadesView;
|
||||
use Illuminate\View\View as ViewView;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromArray;
|
||||
use Maatwebsite\Excel\Concerns\WithChunkReading;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithCustomStartCell;
|
||||
// use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithStartRow;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
|
||||
use Maatwebsite\Excel\Events\BeforeExport;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
// {
|
||||
// public function __construct(
|
||||
// public $records,
|
||||
// ) {}
|
||||
|
||||
// // public function view(): View
|
||||
// // {
|
||||
// // return view('exports.export-isi-pdf', [
|
||||
// // 'records' => $this->records,
|
||||
// // ]);
|
||||
// // }
|
||||
|
||||
// public function collection()
|
||||
// {
|
||||
// return $this->records;
|
||||
// }
|
||||
|
||||
// public function headings(): array
|
||||
// {
|
||||
// // Top two rows (Company info + Motor KW/HP)
|
||||
// return [
|
||||
// ['C.R.I. Pumps Private Limited', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'Unit: MOTOR FREE RUN TEST REGISTER'],
|
||||
// ['Motor KW/HP : - / -', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'Phase : -'],
|
||||
// // Column headers
|
||||
// [
|
||||
// 'Date', 'Motor SNo', 'Item Code', 'Motor Type',
|
||||
// 'Voltage', 'Current', 'Power', 'IR.Hot', 'IR.Cool', 'Frequency', 'Speed', 'Leakage Current', // AFTER FREE RUN
|
||||
// 'Voltage', 'Current', 'Power', // LOCKED ROTOR TEST
|
||||
// 'No Load Pickup Voltage', 'Room Temp.', 'High Voltage Test', 'Result', 'Remark'
|
||||
// ]
|
||||
// ];
|
||||
// }
|
||||
|
||||
// public function registerEvents(): array
|
||||
// {
|
||||
// return [
|
||||
// AfterSheet::class => function (AfterSheet $event) {
|
||||
// $sheet = $event->sheet->getDelegate();
|
||||
|
||||
// // Merge top rows for company info
|
||||
// $sheet->mergeCells('A1:S1'); // Company Name
|
||||
// $sheet->mergeCells('T1:T1'); // Unit/Register info
|
||||
// $sheet->mergeCells('A2:S2'); // Motor KW/HP row
|
||||
// $sheet->mergeCells('T2:T2'); // Phase
|
||||
|
||||
// // Merge headers for grouped columns (AFTER FREE RUN & LOCKED ROTOR TEST)
|
||||
// $sheet->mergeCells('E3:L3'); // AFTER FREE RUN
|
||||
// $sheet->mergeCells('M3:O3'); // LOCKED ROTOR TEST
|
||||
|
||||
// // Optional: style headers
|
||||
// $sheet->getStyle('A1:T3')->getFont()->setBold(true);
|
||||
// $sheet->getStyle('A1:T3')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
// $sheet->getStyle('A1:T3')->getBorders()->getAllBorders()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN);
|
||||
|
||||
// // Set column widths (optional for better visibility)
|
||||
// $columns = range('A', 'T');
|
||||
// foreach ($columns as $col) {
|
||||
// $sheet->getColumnDimension($col)->setAutoSize(true);
|
||||
// }
|
||||
// },
|
||||
// ];
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// class MotorFreeRunExport implements FromCollection, WithMapping, WithStartRow
|
||||
// {
|
||||
// protected Collection $records;
|
||||
|
||||
// public function __construct(Collection $records)
|
||||
// {
|
||||
// $this->records = $records;
|
||||
// }
|
||||
|
||||
// public function collection()
|
||||
// {
|
||||
// return $this->records;
|
||||
// }
|
||||
|
||||
// public function startRow(): int
|
||||
// {
|
||||
// return 3; // insert data starting from row 3
|
||||
// }
|
||||
|
||||
// public function map($record): array
|
||||
// {
|
||||
// return [
|
||||
// $record['Date'] ?? '',
|
||||
// $record['Output'] ?? '',
|
||||
// $record['Motor SNo'] ?? '',
|
||||
// $record['Item Code'] ?? '',
|
||||
// $record['Motor Type'] ?? '',
|
||||
// $record['kw'] ?? '',
|
||||
// $record['hp'] ?? '',
|
||||
// $record['phase'] ?? '',
|
||||
// $record['isi_model'] ?? '',
|
||||
// $record['Voltage_Before'] ?? '',
|
||||
// $record['Current_Before'] ?? '',
|
||||
// $record['Power_Before'] ?? '',
|
||||
// $record['Resistance_RY'] ?? '',
|
||||
// $record['Resistance_YB'] ?? '',
|
||||
// $record['Resistance_BR'] ?? '',
|
||||
// $record['Insulation_Resistance'] ?? '',
|
||||
// $record['Frequency_Before'] ?? '',
|
||||
// $record['Speed_Before'] ?? '',
|
||||
// $record['Voltage_After'] ?? '',
|
||||
// $record['Current_After'] ?? '',
|
||||
// $record['Power_After'] ?? '',
|
||||
// $record['IR_Hot'] ?? '',
|
||||
// $record['IR_Cool'] ?? '',
|
||||
// $record['Leakage_Current'] ?? '',
|
||||
// $record['Frequency_After'] ?? '',
|
||||
// $record['Speed_After'] ?? '',
|
||||
// $record['Voltage_Locked'] ?? '',
|
||||
// $record['Current_Locked'] ?? '',
|
||||
// $record['Power_Locked'] ?? '',
|
||||
// $record['No_Load_Pickup_Voltage'] ?? '',
|
||||
// $record['Room_Temp'] ?? '',
|
||||
// $record['High_Voltage_Test'] ?? '',
|
||||
// $record['Batch_Number'] ?? '',
|
||||
// $record['Batch_Count'] ?? '',
|
||||
// $record['Result'] ?? '',
|
||||
// $record['Remark'] ?? '',
|
||||
// $record['Tested_By'] ?? '',
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
class MotorFreeRunExport implements WithCustomStartCell, WithMapping, WithStartRow, WithChunkReading
|
||||
{
|
||||
protected $records;
|
||||
protected $templatePath;
|
||||
|
||||
public function __construct($records)
|
||||
{
|
||||
$this->records = $records;
|
||||
// dd($this->records);
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return $this->records;
|
||||
}
|
||||
|
||||
public function startRow(): int
|
||||
{
|
||||
return 7; // Start inserting data from row 7
|
||||
}
|
||||
|
||||
public function startCell(): string
|
||||
{
|
||||
return 'A7'; // Start inserting data from row 7 column A
|
||||
}
|
||||
|
||||
public function map($record): array
|
||||
{
|
||||
return [
|
||||
$record['Date'] ?? '',
|
||||
$record['Output'] ?? '',
|
||||
$record['Motor SNo'] ?? '',
|
||||
$record['Item Code'] ?? '',
|
||||
$record['Motor Type'] ?? '',
|
||||
$record['kw'] ?? '',
|
||||
$record['hp'] ?? '',
|
||||
$record['phase'] ?? '',
|
||||
$record['isi_model'] ?? '',
|
||||
$record['Voltage_Before'] ?? '',
|
||||
$record['Current_Before'] ?? '',
|
||||
$record['Power_Before'] ?? '',
|
||||
$record['Resistance_RY'] ?? '',
|
||||
$record['Resistance_YB'] ?? '',
|
||||
$record['Resistance_BR'] ?? '',
|
||||
$record['Insulation_Resistance'] ?? '',
|
||||
$record['Frequency_Before'] ?? '',
|
||||
$record['Speed_Before'] ?? '',
|
||||
$record['Voltage_After'] ?? '',
|
||||
$record['Current_After'] ?? '',
|
||||
$record['Power_After'] ?? '',
|
||||
$record['IR_Hot'] ?? '',
|
||||
$record['IR_Cool'] ?? '',
|
||||
$record['Leakage_Current'] ?? '',
|
||||
$record['Frequency_After'] ?? '',
|
||||
$record['Speed_After'] ?? '',
|
||||
$record['Voltage_Locked'] ?? '',
|
||||
$record['Current_Locked'] ?? '',
|
||||
$record['Power_Locked'] ?? '',
|
||||
$record['No_Load_Pickup_Voltage'] ?? '',
|
||||
$record['Room_Temp'] ?? '',
|
||||
$record['High_Voltage_Test'] ?? '',
|
||||
$record['Batch_Number'] ?? '',
|
||||
$record['Batch_Count'] ?? '',
|
||||
$record['Result'] ?? '',
|
||||
$record['Remark'] ?? '',
|
||||
$record['Tested_By'] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
public function chunkSize(): int
|
||||
{
|
||||
return 1000; // load 1000 records at a time
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\FromArray;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
|
||||
class ProductionPlanExport implements FromArray, WithHeadings, WithMapping
|
||||
{
|
||||
|
||||
protected array $data;
|
||||
protected array $dates;
|
||||
|
||||
public function __construct(array $data, array $dates)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->dates = $dates;
|
||||
}
|
||||
|
||||
public function array(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
$headings = [
|
||||
'Plant Name',
|
||||
'Line Name',
|
||||
'Item Code',
|
||||
];
|
||||
|
||||
// Add dynamic headings for each date: Target / Produced
|
||||
foreach ($this->dates as $date) {
|
||||
$headings[] = $date . ' - Item Quantity';
|
||||
$headings[] = $date . ' - Target Plan';
|
||||
$headings[] = $date . ' - Produced Quantity';
|
||||
}
|
||||
|
||||
return $headings;
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
$mapped = [
|
||||
$row['plant_name'] ?? '',
|
||||
$row['line_name'] ?? '',
|
||||
$row['item_code'] ?? '',
|
||||
];
|
||||
|
||||
foreach ($this->dates as $date) {
|
||||
$mapped[] = $row['daily_hourly_quantity'][$date] ?? '-';
|
||||
$mapped[] = $row['daily_target_dynamic'][$date] ?? '-';
|
||||
$mapped[] = $row['produced_quantity'][$date] ?? '-';
|
||||
}
|
||||
return $mapped;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Illuminate\Support\Collection;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder;
|
||||
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
|
||||
|
||||
class SerialExport extends DefaultValueBinder implements FromCollection, WithHeadings, WithCustomValueBinder
|
||||
, WithColumnFormatting
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
||||
protected $itemCode;
|
||||
protected $fromSerial;
|
||||
protected $toSerial;
|
||||
|
||||
public function __construct($itemCode, $fromSerial, $toSerial)
|
||||
{
|
||||
$this->itemCode = $itemCode;
|
||||
$this->fromSerial = $fromSerial;
|
||||
$this->toSerial = $toSerial;
|
||||
}
|
||||
|
||||
public function bindValue(Cell $cell, $value)
|
||||
{
|
||||
$cell->setValueExplicit((string) $value, DataType::TYPE_STRING);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$rows = [];
|
||||
|
||||
for ($i = $this->fromSerial; $i <= $this->toSerial; $i++) {
|
||||
$rows[] = [
|
||||
'item_code' => $this->itemCode,
|
||||
'serial_number' => str_pad($i, 6, '0', STR_PAD_LEFT),
|
||||
];
|
||||
}
|
||||
|
||||
return new Collection($rows);
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'B' => NumberFormat::FORMAT_TEXT,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Item Code',
|
||||
'Serial Number',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\TestingPanelReading;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithChunkReading;
|
||||
// use Maatwebsite\Excel\Concerns\ShouldQueue;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
// class TestingPanelReadingExport implements FromCollection
|
||||
// {
|
||||
// /**
|
||||
// * @return \Illuminate\Support\Collection
|
||||
// */
|
||||
// public function collection()
|
||||
// {
|
||||
// return TestingPanelReading::all();
|
||||
// }
|
||||
// }
|
||||
|
||||
// class TestingPanelReadingExport implements FromQuery, WithChunkReading, ShouldQueue, WithHeadings
|
||||
// {
|
||||
// protected array $ids;
|
||||
// protected int $counter = 0;
|
||||
|
||||
// public function __construct(array $ids)
|
||||
// {
|
||||
// $this->ids = $ids;
|
||||
// }
|
||||
// public function query()
|
||||
// {
|
||||
// return TestingPanelReading::query()
|
||||
// ->whereIn('id', $this->ids)
|
||||
// ->select('id', 'plant_id', 'line_id', 'motor_testing_master_id', 'machine_id', 'output', 'serial_number', 'winded_serial_number', 'before_fr_volt', 'before_fr_cur', 'before_fr_pow', 'before_fr_res_ry', 'before_fr_res_yb', 'before_fr_res_br', 'before_fr_ir', 'before_fr_ir_r', 'before_fr_ir_y', 'before_fr_ir_b', 'before_fr_freq', 'before_fr_speed', 'after_fr_vol', 'after_fr_cur', 'after_fr_pow', 'after_fr_ir_hot','after_fr_ir_hot_r', 'after_fr_ir_hot_y', 'after_fr_ir_hot_b', 'after_fr_ir_cool', 'after_fr_ir_cool_r', 'after_fr_ir_cool_y', 'after_fr_ir_cool_b', 'after_fr_freq', 'after_fr_speed', 'after_fr_leak_cur', 'locked_rt_volt', 'locked_rt_cur', 'locked_rt_pow', 'no_load_pickup_volt', 'room_temperature', 'hv_test', 'batch_number', 'batch_count', 'result', 'remark', 'rework_count', 'update_count', 'output_flag', 'tested_by', 'updated_by', 'created_at', 'updated_at', 'scanned_at', 'created_at');
|
||||
// }
|
||||
|
||||
// public function chunkSize(): int
|
||||
// {
|
||||
// return 1000; // process 1000 rows at a time
|
||||
// }
|
||||
|
||||
// public function headings(): array
|
||||
// {
|
||||
// return ['NO', 'PLANT', 'LINE', 'MOTORTESTINGMASTER', 'MACHINE', 'OUTPUT', 'SERIAL NUMBER', 'WINDED SERIAL NUMBER', 'BEFORE FR VOLT', 'BEFORE FR CUR', 'BEFORE FR POW', 'BEFORE FR RES RY', 'BEFORE FR RES YB', 'BEFORE FR RES BR', 'BEFORE FR IR', 'BEFORE FR IR R', 'BEFORE FR IR Y', 'BEFORE FR IR B', 'BEFORE FR FREQ', 'BEFORE FR SPEED', 'AFTER FR VOL', 'AFTER FR CUR', 'AFTER FR POW', 'AFTER FR IR HOT', 'AFTER FR IR HOT R', 'AFTER FR IR HOT Y', 'AFTER FR IR HOT B', 'AFTER FR IR COOL', 'AFTER FR IR COOL R', 'AFTER FR IR COOL Y', 'AFTER FR IR COOL B', 'AFTER FR FREQ', 'AFTER FR SPEED', 'AFTER FR LEAK CUR', 'LOCKED RT VOLT', 'LOCKED RT CUR', 'LOCKED RT POW', 'NO LOAD PICKUP VOLT', 'ROOM TEMPERATURE', 'HV TEST', 'BATCH NUMBER', 'BATCH COUNT', 'RESULT', 'REMARK', 'REWORK COUNT', 'UPDATE COUNT', 'OUTPUT FLAG', 'TETSED BY', 'UPDATED BY', 'CREATED AT', 'UPDATED AT', 'SCANNED AT', 'CREATED AT'];
|
||||
// }
|
||||
|
||||
// public function map($record): array
|
||||
// {
|
||||
// $this->counter++;
|
||||
// return [
|
||||
// $this->counter, // No.
|
||||
// $record->plant_id,
|
||||
// $record->line_id,
|
||||
// $record->motor_testing_master_id,
|
||||
// $record->machine_id,
|
||||
// $record->output,
|
||||
// $record->serial_number,
|
||||
// $record->winded_serial_number,
|
||||
// $record->before_fr_volt,
|
||||
// $record->before_fr_cur,
|
||||
// $record->before_fr_pow,
|
||||
// $record->before_fr_res_ry,
|
||||
// $record->before_fr_res_yb,
|
||||
// $record->before_fr_res_br,
|
||||
// $record->before_fr_ir,
|
||||
// $record->before_fr_ir_r,
|
||||
// $record->before_fr_ir_y,
|
||||
// $record->before_fr_ir_b,
|
||||
// $record->before_fr_freq,
|
||||
// $record->before_fr_speed,
|
||||
// $record->after_fr_vol,
|
||||
// $record->after_fr_cur,
|
||||
// $record->after_fr_pow,
|
||||
// $record->after_fr_ir_hot,
|
||||
// $record->after_fr_ir_hot_r,
|
||||
// $record->after_fr_ir_hot_y,
|
||||
// $record->after_fr_ir_hot_b,
|
||||
// $record->after_fr_ir_cool,
|
||||
// $record->after_fr_ir_cool_r,
|
||||
// $record->after_fr_ir_cool_y,
|
||||
// $record->after_fr_ir_cool_b,
|
||||
// $record->after_fr_freq,
|
||||
// $record->after_fr_speed,
|
||||
// $record->after_fr_leak_cur,
|
||||
// $record->locked_rt_volt,
|
||||
// $record->locked_rt_cur,
|
||||
// $record->locked_rt_pow,
|
||||
// $record->no_load_pickup_volt,
|
||||
// $record->room_temperature,
|
||||
// $record->hv_test,
|
||||
// $record->batch_number,
|
||||
// $record->batch_count,
|
||||
// $record->result,
|
||||
// $record->remark,
|
||||
// $record->rework_count,
|
||||
// $record->update_count,
|
||||
// $record->output_flag,
|
||||
// $record->tested_by,
|
||||
// $record->updated_by,
|
||||
// // $record->created_at,
|
||||
// $record->updated_at,
|
||||
// $record->scanned_at,
|
||||
// $record->created_at,
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
|
||||
class TestingPanelReadingExport implements FromCollection, WithHeadings
|
||||
{
|
||||
protected $records;
|
||||
protected $isAllStarDelta;
|
||||
|
||||
public function __construct($records, $isAllStarDelta)
|
||||
{
|
||||
$this->records = $records;
|
||||
$this->isAllStarDelta = $isAllStarDelta;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return collect($this->records)->map(function ($record) {
|
||||
if (!$this->isAllStarDelta) {
|
||||
return [
|
||||
'Date' => date('Y-m-d', strtotime($record['created_at'] ?? '')),
|
||||
'Output' => $record['output'] ?? '',
|
||||
'Motor SNo' => $record['serial_number'] ?? '',
|
||||
'Item Code' => $record->motorTestingMaster->item->code ?? '',
|
||||
'Motor Type' => $record->motorTestingMaster->item->description ?? '',
|
||||
'IR_Hot' => $record['after_fr_ir_hot'] ?? '',
|
||||
'IR_Cool' => $record['after_fr_ir_cool'] ?? '',
|
||||
'Leakage_Current' => $record['after_fr_leak_cur'] ?? '',
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'Date' => date('Y-m-d', strtotime($record['created_at'] ?? '')),
|
||||
'Output' => $record['output'] ?? '',
|
||||
'Motor SNo' => $record['serial_number'] ?? '',
|
||||
'Item Code' => $record->motorTestingMaster->item->code ?? '',
|
||||
'Motor Type' => $record->motorTestingMaster->item->description ?? '',
|
||||
'IR_Hot_R' => $record['after_fr_ir_hot_r'] ?? '',
|
||||
'IR_Hot_Y' => $record['after_fr_ir_hot_y'] ?? '',
|
||||
'IR_Hot_B' => $record['after_fr_ir_hot_b'] ?? '',
|
||||
'IR_Cool_R' => $record['after_fr_ir_cool_r'] ?? '',
|
||||
'IR_Cool_Y' => $record['after_fr_ir_cool_y'] ?? '',
|
||||
'IR_Cool_B' => $record['after_fr_ir_cool_b'] ?? '',
|
||||
'Leakage_Current' => $record['after_fr_leak_cur'] ?? '',
|
||||
];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return array_keys($this->collection()->first() ?? []);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\Plant;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class AlertMailRuleExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = AlertMailRule::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('module')
|
||||
->label('MODULE'),
|
||||
ExportColumn::make('rule_name')
|
||||
->label('RULE NAME'),
|
||||
ExportColumn::make('email')
|
||||
->label('EMAIL'),
|
||||
ExportColumn::make('schedule_type')
|
||||
->label('SCHEDULE TYPE'),
|
||||
ExportColumn::make('plant')
|
||||
->label('PLANT CODE')
|
||||
->formatStateUsing(function ($state) {
|
||||
// $state is the plant ID from the database
|
||||
if ($state == 0) {
|
||||
return 'All Plants';
|
||||
}
|
||||
|
||||
$plant = Plant::find($state);
|
||||
return $plant ? $plant->code : 'Unknown';
|
||||
}),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('cc_emails')
|
||||
->label('CC EMAILS'),
|
||||
ExportColumn::make('invoiceMaster.receiving_plant_name')
|
||||
->label('RECEIVING PLANT NAME'),
|
||||
ExportColumn::make('invoiceMaster.transport_name')
|
||||
->label('TRANSPORT NAME'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your alert mail rule 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;
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\AsrsItemValidation;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class AsrsItemValidationExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = AsrsItemValidation::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('item_code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('item_description')
|
||||
->label('ITEM DESCRIPTION'),
|
||||
ExportColumn::make('uom')
|
||||
->label('UOM'),
|
||||
ExportColumn::make('material_type')
|
||||
->label('MATERIAL TYPE'),
|
||||
ExportColumn::make('material_group')
|
||||
->label('MATERIAL GROUP'),
|
||||
ExportColumn::make('mhe')
|
||||
->label('MHE'),
|
||||
ExportColumn::make('bin_quantity')
|
||||
->label('BIN QUANTITY'),
|
||||
ExportColumn::make('asrs')
|
||||
->label('ASRS'),
|
||||
ExportColumn::make('asrs_category')
|
||||
->label('ASRS CATEGORY'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
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 asrs item validation 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;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\Axn;
|
||||
use App\Models\InvoiceValidation;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class AxnExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = InvoiceValidation::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
// static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('no')
|
||||
// ->label('NO')
|
||||
// ->state(function ($record) use (&$rowNumber) {
|
||||
// // Increment and return the row number
|
||||
// return ++$rowNumber;
|
||||
// }),
|
||||
// ExportColumn::make('plant.code')
|
||||
// ->label('PLANT CODE'),
|
||||
// ExportColumn::make('invoice_number')
|
||||
// ->label('INVOICE NUMBER'),
|
||||
ExportColumn::make('year')
|
||||
->label('YEAR')
|
||||
->state(function ($record) {
|
||||
return substr($record->serial_number, 0, 2);
|
||||
}),
|
||||
ExportColumn::make('month')
|
||||
->label('MONTH')
|
||||
->state(function ($record) {
|
||||
return substr($record->serial_number, 2, 2);
|
||||
}),
|
||||
ExportColumn::make('vendor')
|
||||
->label('VENDOR NUMBER')
|
||||
->state(function ($record) {
|
||||
return substr($record->serial_number, 4, 4);
|
||||
}),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER')
|
||||
->state(function ($record) {
|
||||
$sn = $record->serial_number;
|
||||
|
||||
$offset = 2 + 2 + 4;
|
||||
|
||||
return substr($sn, $offset);
|
||||
}),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your axn 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;
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\BeforeTestReading;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class BeforeTestReadingExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = BeforeTestReading::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
ExportColumn::make('machine.name')
|
||||
->label('MACHINE NAME'),
|
||||
ExportColumn::make('motorTestingMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('motorTestingMaster.item.description')
|
||||
->label('MODEL DESCRIPTION'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('motorTestingMaster.kw')
|
||||
->label('KW'),
|
||||
ExportColumn::make('motorTestingMaster.hp')
|
||||
->label('HP'),
|
||||
ExportColumn::make('motorTestingMaster.phase')
|
||||
->label('PHASE'),
|
||||
ExportColumn::make('motorTestingMaster.connection')
|
||||
->label('CONNECTION'),
|
||||
ExportColumn::make('motorTestingMaster.isi_model')
|
||||
->label('ISI MODEL'),
|
||||
ExportColumn::make('before_fr_res_ry')
|
||||
->label('BEFORE FR RESISTANCE RY'),
|
||||
ExportColumn::make('before_fr_res_yb')
|
||||
->label('BEFORE FR RESISTANCE YB'),
|
||||
ExportColumn::make('before_fr_res_br')
|
||||
->label('BEFORE FR RESISTANCE BR'),
|
||||
ExportColumn::make('before_fr_ir')
|
||||
->label('BEFORE FR IR'),
|
||||
ExportColumn::make('tested_by')
|
||||
->label('TESTED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('scanned_at')
|
||||
->label('SCANNED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your before test reading 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;
|
||||
}
|
||||
}
|
||||
@@ -24,27 +24,26 @@ class BlockExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('name')
|
||||
->label('BLOCK NAME'),
|
||||
->label('NAME'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT')
|
||||
->enabledByDefault(true),
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your block export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your block 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;
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\CharacteristicApproverMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class CharacteristicApproverMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = CharacteristicApproverMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('approver_type')
|
||||
->label('APPROVER TYPE'),
|
||||
ExportColumn::make('machine_name')
|
||||
->label('MACHINE NAME'),
|
||||
ExportColumn::make('characteristic_field')
|
||||
->label('MASTER CHARACTERISTIC FIELD'),
|
||||
ExportColumn::make('name1')
|
||||
->label('APPROVER NAME 1'),
|
||||
ExportColumn::make('mail1')
|
||||
->label('MAIL 1'),
|
||||
ExportColumn::make('duration1')
|
||||
->label('DURATION 1'),
|
||||
ExportColumn::make('name2')
|
||||
->label('APPROVER NAME 2'),
|
||||
ExportColumn::make('mail2')
|
||||
->label('MAIL 2'),
|
||||
ExportColumn::make('duration2')
|
||||
->label('DURATION 2'),
|
||||
ExportColumn::make('name3')
|
||||
->label('APPROVER NAME 3'),
|
||||
ExportColumn::make('mail3')
|
||||
->label('MAIL 3'),
|
||||
ExportColumn::make('duration3')
|
||||
->label('DURATION 3'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your characteristic approver master 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;
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\CharacteristicValue;
|
||||
use App\Models\ProductCharacteristicsMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class CharacteristicValueExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = CharacteristicValue::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('item.description')
|
||||
->label('DESCRIPTION'),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('process_order')
|
||||
->label('PROCESS ORDER'),
|
||||
ExportColumn::make('coil_number')
|
||||
->label('COIL NUMBER'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
ExportColumn::make('spec_value')
|
||||
->label('Spec. Value')
|
||||
->formatStateUsing(function ($record) {
|
||||
|
||||
$specVal = ProductCharacteristicsMaster::where('plant_id', $record->plant_id)
|
||||
->where('item_id', $record->item_id)
|
||||
->where('line_id', $record->line_id)
|
||||
->where('machine_id', $record->machine_id)
|
||||
->first();
|
||||
|
||||
return $specVal?->lower . ' - ' . $specVal?->upper;
|
||||
}),
|
||||
ExportColumn::make('observed_value')
|
||||
->label('OBSERVED VALUE'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your characteristic value 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;
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,8 @@ class CheckPointNameExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('name')
|
||||
->label('CHECK POINT NAME'),
|
||||
ExportColumn::make('created_at')
|
||||
@@ -42,10 +42,10 @@ class CheckPointNameExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your check point name export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your check point name 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;
|
||||
|
||||
@@ -24,8 +24,8 @@ class CheckPointTimeExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('checkPointNames1.name')
|
||||
->label('CHECK POINT 1'),
|
||||
ExportColumn::make('checkPointNames2.name')
|
||||
@@ -50,10 +50,10 @@ class CheckPointTimeExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your check point time export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your check point time 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;
|
||||
|
||||
@@ -1,415 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\ClassCharacteristic;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class ClassCharacteristicExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = ClassCharacteristic::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('item.description')
|
||||
->label('DESCRIPTION')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('item.category')
|
||||
->label('CATEGORY')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('item.uom')
|
||||
->label('UNIT OF MEASURE')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('aufnr')
|
||||
->label('AUFNR'),
|
||||
ExportColumn::make('class')
|
||||
->label('CLASS'),
|
||||
ExportColumn::make('arbid')
|
||||
->label('ARBID'),
|
||||
ExportColumn::make('gamng')
|
||||
->label('GAMNG'),
|
||||
ExportColumn::make('lmnga')
|
||||
->label('LMNGA'),
|
||||
ExportColumn::make('gernr')
|
||||
->label('GERNR'),
|
||||
ExportColumn::make('zz1_cn_bill_ord')
|
||||
->label('ZZ1 CN BILL ORD'),
|
||||
ExportColumn::make('zmm_amps')
|
||||
->label('ZMM AMPS'),
|
||||
ExportColumn::make('zmm_brand')
|
||||
->label('ZMM BRAND'),
|
||||
ExportColumn::make('zmm_degreeofprotection')
|
||||
->label('ZMM DEGREEOFPROTECTION'),
|
||||
ExportColumn::make('zmm_delivery')
|
||||
->label('ZMM DELIVERY'),
|
||||
ExportColumn::make('zmm_dir_rot')
|
||||
->label('ZMM DIR ROT'),
|
||||
ExportColumn::make('zmm_discharge')
|
||||
->label('ZMM DISCHARGE'),
|
||||
ExportColumn::make('zmm_discharge_max')
|
||||
->label('ZMM DISCHARGE MAX'),
|
||||
ExportColumn::make('zmm_discharge_min')
|
||||
->label('ZMM DISCHARGE MIN'),
|
||||
ExportColumn::make('zmm_duty')
|
||||
->label('ZMM DUTY'),
|
||||
ExportColumn::make('zmm_eff_motor')
|
||||
->label('ZMM EFF MOTOR'),
|
||||
ExportColumn::make('zmm_eff_pump')
|
||||
->label('ZMM EFF PUMP'),
|
||||
ExportColumn::make('zmm_frequency')
|
||||
->label('ZMM FREQUENCY'),
|
||||
ExportColumn::make('zmm_head')
|
||||
->label('ZMM HEAD'),
|
||||
ExportColumn::make('zmm_heading')
|
||||
->label('ZMM HEADING'),
|
||||
ExportColumn::make('zmm_head_max')
|
||||
->label('ZMM HEAD MAX'),
|
||||
ExportColumn::make('zmm_head_minimum')
|
||||
->label('ZMM HEAD MINIMUM'),
|
||||
ExportColumn::make('zmm_idx_eff_mtr')
|
||||
->label('ZMM IDX EFF MTR'),
|
||||
ExportColumn::make('zmm_idx_eff_pump')
|
||||
->label('ZMM IDX EFF PUMP'),
|
||||
ExportColumn::make('zmm_kvacode')
|
||||
->label('ZMM KVACODE'),
|
||||
ExportColumn::make('zmm_maxambtemp')
|
||||
->label('ZMM MAXAMBTEMP'),
|
||||
ExportColumn::make('zmm_mincoolingflow')
|
||||
->label('ZMM MINCOOLINGFLOW'),
|
||||
ExportColumn::make('zmm_motorseries')
|
||||
->label('ZMM MOTORSERIES'),
|
||||
ExportColumn::make('zmm_motor_model')
|
||||
->label('ZMM MOTOR MODEL'),
|
||||
ExportColumn::make('zmm_outlet')
|
||||
->label('ZMM OUTLET'),
|
||||
ExportColumn::make('zmm_phase')
|
||||
->label('ZMM PHASE'),
|
||||
ExportColumn::make('zmm_pressure')
|
||||
->label('ZMM PRESSURE'),
|
||||
ExportColumn::make('zmm_pumpflowtype')
|
||||
->label('ZMM PUMPFLOWTYPE'),
|
||||
ExportColumn::make('zmm_pumpseries')
|
||||
->label('ZMM PUMPSERIES'),
|
||||
ExportColumn::make('zmm_pump_model')
|
||||
->label('ZMM PUMP MODEL'),
|
||||
ExportColumn::make('zmm_ratedpower')
|
||||
->label('ZMM RATEDPOWER'),
|
||||
ExportColumn::make('zmm_region')
|
||||
->label('ZMM REGION'),
|
||||
ExportColumn::make('zmm_servicefactor')
|
||||
->label('ZMM SERVICEFACTOR'),
|
||||
ExportColumn::make('zmm_servicefactormaximumamps')
|
||||
->label('ZMM SERVICEFACTORMAXIMUMAMPS'),
|
||||
ExportColumn::make('zmm_speed')
|
||||
->label('ZMM SPEED'),
|
||||
ExportColumn::make('zmm_suction')
|
||||
->label('ZMM SUCTION'),
|
||||
ExportColumn::make('zmm_suctionxdelivery')
|
||||
->label('ZMM SUCTIONXDELIVERY'),
|
||||
ExportColumn::make('zmm_supplysource')
|
||||
->label('ZMM SUPPLYSOURCE'),
|
||||
ExportColumn::make('zmm_temperature')
|
||||
->label('ZMM TEMPERATURE'),
|
||||
ExportColumn::make('zmm_thrustload')
|
||||
->label('ZMM THRUSTLOAD'),
|
||||
ExportColumn::make('zmm_volts')
|
||||
->label('ZMM VOLTS'),
|
||||
ExportColumn::make('zmm_wire')
|
||||
->label('ZMM WIRE'),
|
||||
ExportColumn::make('zmm_package')
|
||||
->label('ZMM PACKAGE'),
|
||||
ExportColumn::make('zmm_pvarrayrating')
|
||||
->label('ZMM PVARRAYRATING'),
|
||||
ExportColumn::make('zmm_isi')
|
||||
->label('ZMM ISI'),
|
||||
ExportColumn::make('zmm_isimotor')
|
||||
->label('ZMM ISIMOTOR'),
|
||||
ExportColumn::make('zmm_isipump')
|
||||
->label('ZMM ISIPUMP'),
|
||||
ExportColumn::make('zmm_isipumpset')
|
||||
->label('ZMM ISIPUMPSET'),
|
||||
ExportColumn::make('zmm_pumpset_model')
|
||||
->label('ZMM PUMPSET MODEL'),
|
||||
ExportColumn::make('zmm_stages')
|
||||
->label('ZMM STAGES'),
|
||||
ExportColumn::make('zmm_headrange')
|
||||
->label('ZMM HEADRANGE'),
|
||||
ExportColumn::make('zmm_overall_efficiency')
|
||||
->label('ZMM OVERALL EFFICIENCY'),
|
||||
ExportColumn::make('zmm_connection')
|
||||
->label('ZMM CONNECTION'),
|
||||
ExportColumn::make('zmm_min_bore_size')
|
||||
->label('ZMM MIN BORE SIZE'),
|
||||
ExportColumn::make('zmm_isireference')
|
||||
->label('ZMM ISIREFERENCE'),
|
||||
ExportColumn::make('zmm_category')
|
||||
->label('ZMM CATEGORY'),
|
||||
ExportColumn::make('zmm_submergence')
|
||||
->label('ZMM SUBMERGENCE'),
|
||||
ExportColumn::make('zmm_capacitorstart')
|
||||
->label('ZMM CAPACITORSTART'),
|
||||
ExportColumn::make('zmm_capacitorrun')
|
||||
->label('ZMM CAPACITORRUN'),
|
||||
ExportColumn::make('zmm_inch')
|
||||
->label('ZMM INCH'),
|
||||
ExportColumn::make('zmm_motor_type')
|
||||
->label('ZMM MOTOR TYPE'),
|
||||
ExportColumn::make('zmm_dismantle_direction')
|
||||
->label('ZMM DISMANTLE DIRECTION'),
|
||||
ExportColumn::make('zmm_eff_ovrall')
|
||||
->label('ZMM EFF OVRALL'),
|
||||
ExportColumn::make('zmm_bodymoc')
|
||||
->label('ZMM BODYMOC'),
|
||||
ExportColumn::make('zmm_rotormoc')
|
||||
->label('ZMM ROTORMOC'),
|
||||
ExportColumn::make('zmm_dlwl')
|
||||
->label('ZMM DLWL'),
|
||||
ExportColumn::make('zmm_inputpower')
|
||||
->label('ZMM INPUTPOWER'),
|
||||
ExportColumn::make('zmm_imp_od')
|
||||
->label('ZMM IMP OD'),
|
||||
ExportColumn::make('zmm_ambtemp')
|
||||
->label('ZMM AMBTEMP'),
|
||||
ExportColumn::make('zmm_de')
|
||||
->label('ZMM DE'),
|
||||
ExportColumn::make('zmm_dischargerange')
|
||||
->label('ZMM DISCHARGERANGE'),
|
||||
ExportColumn::make('zmm_efficiency_class')
|
||||
->label('ZMM EFFICIENCY CLASS'),
|
||||
ExportColumn::make('zmm_framesize')
|
||||
->label('ZMM FRAMESIZE'),
|
||||
ExportColumn::make('zmm_impellerdiameter')
|
||||
->label('ZMM IMPELLERDIAMETER'),
|
||||
ExportColumn::make('zmm_insulationclass')
|
||||
->label('ZMM INSULATIONCLASS'),
|
||||
ExportColumn::make('zmm_maxflow')
|
||||
->label('ZMM MAXFLOW'),
|
||||
ExportColumn::make('zmm_minhead')
|
||||
->label('ZMM MINHEAD'),
|
||||
ExportColumn::make('zmm_mtrlofconst')
|
||||
->label('ZMM MTRLOFCONST'),
|
||||
ExportColumn::make('zmm_nde')
|
||||
->label('ZMM NDE'),
|
||||
ExportColumn::make('zmm_powerfactor')
|
||||
->label('ZMM POWERFACTOR'),
|
||||
ExportColumn::make('zmm_tagno')
|
||||
->label('ZMM TAGNO'),
|
||||
ExportColumn::make('zmm_year')
|
||||
->label('ZMM YEAR'),
|
||||
ExportColumn::make('zmm_laser_name')
|
||||
->label('ZMM LASER NAME'),
|
||||
ExportColumn::make('zmm_logo_cp')
|
||||
->label('ZMM LOGO CP'),
|
||||
ExportColumn::make('zmm_logo_ce')
|
||||
->label('ZMM LOGO CE'),
|
||||
ExportColumn::make('zmm_logo_nsf')
|
||||
->label('ZMM LOGO NSF'),
|
||||
ExportColumn::make('zmm_logo_eac')
|
||||
->label('ZMM LOGO EAC'),
|
||||
ExportColumn::make('zmm_beenote')
|
||||
->label('ZMM BEENOTE'),
|
||||
ExportColumn::make('zmm_beenumber')
|
||||
->label('ZMM BEENUMBER'),
|
||||
ExportColumn::make('zmm_beestar')
|
||||
->label('ZMM BEESTAR'),
|
||||
ExportColumn::make('zmm_codeclass')
|
||||
->label('ZMM CODECLASS'),
|
||||
ExportColumn::make('zmm_colour')
|
||||
->label('ZMM COLOUR'),
|
||||
ExportColumn::make('zmm_grade')
|
||||
->label('ZMM GRADE'),
|
||||
ExportColumn::make('zmm_grwt_pset')
|
||||
->label('ZMM GRWT PSET'),
|
||||
ExportColumn::make('zmm_grwt_cable')
|
||||
->label('ZMM GRWT CABLE'),
|
||||
ExportColumn::make('zmm_grwt_motor')
|
||||
->label('ZMM GRWT MOTOR'),
|
||||
ExportColumn::make('zmm_grwt_pf')
|
||||
->label('ZMM GRWT PF'),
|
||||
ExportColumn::make('zmm_grwt_pump')
|
||||
->label('ZMM GRWT PUMP'),
|
||||
ExportColumn::make('zmm_isivalve')
|
||||
->label('ZMM ISIVALVE'),
|
||||
ExportColumn::make('zmm_isi_wc')
|
||||
->label('ZMM ISI WC'),
|
||||
ExportColumn::make('zmm_labelperiod')
|
||||
->label('ZMM LABELPERIOD'),
|
||||
ExportColumn::make('zmm_length')
|
||||
->label('ZMM LENGTH'),
|
||||
ExportColumn::make('zmm_license_cml_no')
|
||||
->label('ZMM LICENSE CML NO'),
|
||||
ExportColumn::make('zmm_mfgmonyr')
|
||||
->label('ZMM MFGMONYR'),
|
||||
ExportColumn::make('zmm_modelyear')
|
||||
->label('ZMM MODELYEAR'),
|
||||
ExportColumn::make('zmm_motoridentification')
|
||||
->label('ZMM MOTORIDENTIFICATION'),
|
||||
ExportColumn::make('zmm_newt_pset')
|
||||
->label('ZMM NEWT PSET'),
|
||||
ExportColumn::make('zmm_newt_cable')
|
||||
->label('ZMM NEWT CABLE'),
|
||||
ExportColumn::make('zmm_newt_motor')
|
||||
->label('ZMM NEWT MOTOR'),
|
||||
ExportColumn::make('zmm_newt_pf')
|
||||
->label('ZMM NEWT PF'),
|
||||
ExportColumn::make('zmm_newt_pump')
|
||||
->label('ZMM NEWT PUMP'),
|
||||
ExportColumn::make('zmm_packtype')
|
||||
->label('ZMM PACKTYPE'),
|
||||
ExportColumn::make('zmm_panel')
|
||||
->label('ZMM PANEL'),
|
||||
ExportColumn::make('zmm_performance_factor')
|
||||
->label('ZMM PERFORMANCE FACTOR'),
|
||||
ExportColumn::make('zmm_pumpidentification')
|
||||
->label('ZMM PUMPIDENTIFICATION'),
|
||||
ExportColumn::make('zmm_psettype')
|
||||
->label('ZMM PSETTYPE'),
|
||||
ExportColumn::make('zmm_size')
|
||||
->label('ZMM SIZE'),
|
||||
ExportColumn::make('zmm_eff_ttl')
|
||||
->label('ZMM EFF TTL'),
|
||||
ExportColumn::make('zmm_type')
|
||||
->label('ZMM TYPE'),
|
||||
ExportColumn::make('zmm_usp')
|
||||
->label('ZMM USP'),
|
||||
ExportColumn::make('zmm_operating_range')
|
||||
->label('ZMM OPERATING RANGE'),
|
||||
ExportColumn::make('zmm_intake_air')
|
||||
->label('ZMM INTAKE AIR'),
|
||||
ExportColumn::make('zmm_oxygen_transfer_rate')
|
||||
->label('ZMM OXYGEN TRANSFER RATE'),
|
||||
ExportColumn::make('zmm_air_inlet_pipesize')
|
||||
->label('ZMM AIR INLET PIPESIZE'),
|
||||
ExportColumn::make('zmm_sump_depth')
|
||||
->label('ZMM SUMP DEPTH'),
|
||||
ExportColumn::make('zmm_poles')
|
||||
->label('ZMM POLES'),
|
||||
ExportColumn::make('zmm_motor_heading')
|
||||
->label('ZMM MOTOR HEADING'),
|
||||
ExportColumn::make('zmm_motor_speed')
|
||||
->label('ZMM MOTOR SPEED'),
|
||||
ExportColumn::make('zqmm_qty')
|
||||
->label('ZQMM QTY'),
|
||||
ExportColumn::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE'),
|
||||
ExportColumn::make('zmm_axial_force')
|
||||
->label('ZMM AXIAL FORCE'),
|
||||
ExportColumn::make('is_stopped')
|
||||
->label('IS STOPPED')
|
||||
->formatStateUsing(fn ($state) => ($state == '0') ? 'No' : ($state == '1' ? 'Yes' : 'Yes (Alert Pending)')),
|
||||
ExportColumn::make('stopped_datetime')
|
||||
->label('STOPPED DATETIME'),
|
||||
ExportColumn::make('stopped_by')
|
||||
->label('STOPPED BY'),
|
||||
ExportColumn::make('mark_status')
|
||||
->label('MARKED STATUS'),
|
||||
ExportColumn::make('marked_physical_count')
|
||||
->label('MARKED PHYSICAL COUNT'),
|
||||
ExportColumn::make('marked_expected_time')
|
||||
->label('MARKED EXPECTED TIME'),
|
||||
ExportColumn::make('marked_datetime')
|
||||
->label('MARKED DATETIME'),
|
||||
ExportColumn::make('marked_by')
|
||||
->label('MARKED BY'),
|
||||
ExportColumn::make('man_marked_status')
|
||||
->label('MANUAL MARKED PHYSICAL COUNT'),
|
||||
ExportColumn::make('man_marked_datetime')
|
||||
->label('MANUAL MARKED DATETIME'),
|
||||
ExportColumn::make('man_marked_by')
|
||||
->label('MANUAL MARKED BY'),
|
||||
ExportColumn::make('motor_marked_status')
|
||||
->label('MOTOR MARKED STATUS'),
|
||||
ExportColumn::make('motor_marked_physical_count')
|
||||
->label('MOTOR MARKED PHYSICAL COUNT'),
|
||||
ExportColumn::make('motor_expected_time')
|
||||
->label('MOTOR EXPECTED TIME'),
|
||||
ExportColumn::make('motor_marked_datetime')
|
||||
->label('MOTOR MARKED DATETIME'),
|
||||
ExportColumn::make('motor_marked_by')
|
||||
->label('MOTOR MARKED BY'),
|
||||
ExportColumn::make('pump_marked_status')
|
||||
->label('PUMP MARKED STATUS'),
|
||||
ExportColumn::make('pump_marked_physical_count')
|
||||
->label('PUMP MARKED PHYSICAL COUNT'),
|
||||
ExportColumn::make('pump_expected_time')
|
||||
->label('PUMP EXPECTED TIME'),
|
||||
ExportColumn::make('pump_marked_datetime')
|
||||
->label('PUMP MARKED DATETIME'),
|
||||
ExportColumn::make('pump_marked_by')
|
||||
->label('PUMP MARKED BY'),
|
||||
ExportColumn::make('name_plate_marked_status')
|
||||
->label('NAME PLATE MARKED STATUS'),
|
||||
ExportColumn::make('name_plate_expected_time')
|
||||
->label('NAME PLATE EXPECTED TIME'),
|
||||
ExportColumn::make('name_plate_marked_datetime')
|
||||
->label('NAME PLATE MARKED DATETIME'),
|
||||
ExportColumn::make('name_plate_marked_by')
|
||||
->label('NAME PLATE MARKED BY'),
|
||||
ExportColumn::make('motor_pump_pumpset_status')
|
||||
->label('MOTOR PUMP PUMPSET STATUS'),
|
||||
ExportColumn::make('winded_serial_number')
|
||||
->label('WINDED SERIAL NUMBER'),
|
||||
ExportColumn::make('winded_rework_status')
|
||||
->label('WINDED REWORK STATUS'),
|
||||
ExportColumn::make('motor_machine_name')
|
||||
->label('MOTOR MACHINE NAME'),
|
||||
ExportColumn::make('pump_machine_name')
|
||||
->label('PUMP MACHINE NAME'),
|
||||
ExportColumn::make('name_plate_machine_name')
|
||||
->label('NAME PLATE MACHINE NAME'),
|
||||
// ExportColumn::make('pumpset_machine_name')
|
||||
// ->label('PUMPSET MACHINE NAME'),
|
||||
ExportColumn::make('part_validation_1')
|
||||
->label('PART VALIDATION 1'),
|
||||
ExportColumn::make('part_validation_2')
|
||||
->label('PART VALIDATION 2'),
|
||||
ExportColumn::make('samlight_logged_name')
|
||||
->label('SAMLIGHT LOGGED NAME'),
|
||||
ExportColumn::make('pending_released_status')
|
||||
->label('PENDING RELEASED STATUS'),
|
||||
ExportColumn::make('has_work_flow_id')
|
||||
->label('HAS WORK FLOW ID'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT')
|
||||
->enabledByDefault(true),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY')
|
||||
->enabledByDefault(true),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your class characteristic 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;
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,11 @@ class ConfigurationExporter extends Exporter
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('line.name')
|
||||
@@ -46,10 +46,10 @@ class ConfigurationExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your configuration export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your configuration 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;
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\CustomerPoMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class CustomerPoMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = CustomerPoMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('customer_po')
|
||||
->label('CUSTOMER PO'),
|
||||
ExportColumn::make('customer_name')
|
||||
->label('CUSTOMER NAME'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
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 customer po master 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;
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\DealerVisitPlan;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class DealerVisitPlanExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = DealerVisitPlan::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('name')
|
||||
->label('DEALER NAME'),
|
||||
ExportColumn::make('company')
|
||||
->label('DEALER COMPANY'),
|
||||
ExportColumn::make('visit_plan_date')
|
||||
->label('VISIT PLAN DATE'),
|
||||
ExportColumn::make('organizer')
|
||||
->label('ORGANIZER'),
|
||||
ExportColumn::make('employeeMaster.name')
|
||||
->label('RECIPIENT NAME'),
|
||||
ExportColumn::make('number_of_person')
|
||||
->label('NUMBER OF PERSON'),
|
||||
ExportColumn::make('purpose_of_visit')
|
||||
->label('PURPOSE OF VISIT'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
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 dealer visit plan 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;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ class DeviceMasterExporter extends Exporter
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
@@ -22,32 +21,32 @@ class DeviceMasterExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('name')
|
||||
->label('DEVICE NAME'),
|
||||
->label('DEVICE NAME'),
|
||||
ExportColumn::make('mac_address')
|
||||
->label('MAC ADDRESS'),
|
||||
->label('MAC ADDRESS'),
|
||||
ExportColumn::make('ip_address')
|
||||
->label('IP ADDRESS'),
|
||||
->label('IP ADDRESS'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
->label('CREATED BY'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your device master export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your device master 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;
|
||||
|
||||
@@ -10,118 +10,116 @@ use Filament\Actions\Exports\Models\Export;
|
||||
class EbReadingExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = EbReading::class;
|
||||
|
||||
public static $rowNumber = 0;
|
||||
|
||||
static $rowNumber = 0;
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('lcd_segment_check')
|
||||
->label('LCD SEGMENT CHECK'),
|
||||
->label('LCD SEGMENT CHECK'),
|
||||
ExportColumn::make('meter_serial_no')
|
||||
->label('METER SERIAL NO'),
|
||||
->label('METER SERIAL NO'),
|
||||
ExportColumn::make('eb_date_time')
|
||||
->label('EB DATE TIME'),
|
||||
->label('EB DATE TIME'),
|
||||
ExportColumn::make('ph_seq_of_volt')
|
||||
->label('PH SEQ OF VOLT'),
|
||||
->label('PH SEQ OF VOLT'),
|
||||
ExportColumn::make('ph_assoc_conn_check')
|
||||
->label('PH ASSOC CONN CHECK'),
|
||||
->label('PH ASSOC CONN CHECK'),
|
||||
ExportColumn::make('instantaneous_ph_volt')
|
||||
->label('INSTANTANEOUS PH VOLT'),
|
||||
->label('INSTANTANEOUS PH VOLT'),
|
||||
ExportColumn::make('instantaneous_curr')
|
||||
->label('INSTANTANEOUS CURR'),
|
||||
->label('INSTANTANEOUS CURR'),
|
||||
ExportColumn::make('instantaneous_freq')
|
||||
->label('INSTANTANEOUS FREQ'),
|
||||
->label('INSTANTANEOUS FREQ'),
|
||||
ExportColumn::make('instantaneous_kw_with_sign')
|
||||
->label('INSTANTANEOUS KW WITH SIGN'),
|
||||
->label('INSTANTANEOUS KW WITH SIGN'),
|
||||
ExportColumn::make('instantaneous_kva')
|
||||
->label('INSTANTANEOUS KVA'),
|
||||
->label('INSTANTANEOUS KVA'),
|
||||
ExportColumn::make('instantaneous_kv_ar')
|
||||
->label('INSTANTANEOUS KV AR'),
|
||||
->label('INSTANTANEOUS KV AR'),
|
||||
ExportColumn::make('instantaneous_pf_with_sign')
|
||||
->label('INSTANTANEOUS PF WITH SIGN'),
|
||||
->label('INSTANTANEOUS PF WITH SIGN'),
|
||||
ExportColumn::make('rd_with_elapsed_time_kva')
|
||||
->label('RD WITH ELAPSED TIME KVA'),
|
||||
->label('RD WITH ELAPSED TIME KVA'),
|
||||
ExportColumn::make('cum_active_import_energy')
|
||||
->label('CUM ACTIVE IMPORT ENERGY'),
|
||||
->label('CUM ACTIVE IMPORT ENERGY'),
|
||||
ExportColumn::make('tod1_active_energy_6_9')
|
||||
->label('TOD1 ACTIVE ENERGY 6-9'),
|
||||
->label('TOD1 ACTIVE ENERGY 6-9'),
|
||||
ExportColumn::make('tod2_active_energy_18_21')
|
||||
->label('TOD2 ACTIVE ENERGY 18-21'),
|
||||
->label('TOD2 ACTIVE ENERGY 18-21'),
|
||||
ExportColumn::make('tod3_active_energy_21_22')
|
||||
->label('TOD3 ACTIVE ENERGY 21-22'),
|
||||
->label('TOD3 ACTIVE ENERGY 21-22'),
|
||||
ExportColumn::make('tod4_active_energy_5_6_9_18')
|
||||
->label('TOD4 ACTIVE ENERGY 5-6-9-18'),
|
||||
->label('TOD4 ACTIVE ENERGY 5-6-9-18'),
|
||||
ExportColumn::make('tod5_active_energy_22_5')
|
||||
->label('TOD5 ACTIVE ENERGY 22-5'),
|
||||
->label('TOD5 ACTIVE ENERGY 22-5'),
|
||||
ExportColumn::make('cum_reac_lag_energy')
|
||||
->label('CUM REAC LAG ENERGY'),
|
||||
->label('CUM REAC LAG ENERGY'),
|
||||
ExportColumn::make('cum_reac_lead_energy')
|
||||
->label('CUM REAC LEAD ENERGY'),
|
||||
->label('CUM REAC LEAD ENERGY'),
|
||||
ExportColumn::make('cum_appar_energy')
|
||||
->label('CUM APPAR ENERGY'),
|
||||
->label('CUM APPAR ENERGY'),
|
||||
ExportColumn::make('tod1_appar_energy_6_9')
|
||||
->label('TOD1 APPAR ENERGY 6-9'),
|
||||
->label('TOD1 APPAR ENERGY 6-9'),
|
||||
ExportColumn::make('tod2_appar_energy_18_21')
|
||||
->label('TOD2 APPAR ENERGY 18-21'),
|
||||
->label('TOD2 APPAR ENERGY 18-21'),
|
||||
ExportColumn::make('tod3_appar_energy_21_22')
|
||||
->label('TOD3 APPAR ENERGY 21-22'),
|
||||
->label('TOD3 APPAR ENERGY 21-22'),
|
||||
ExportColumn::make('tod4_appar_energy_5_6_9_18')
|
||||
->label('TOD4 APPAR ENERGY 5-6-9-18'),
|
||||
->label('TOD4 APPAR ENERGY 5-6-9-18'),
|
||||
ExportColumn::make('tod5_appar_energy_22_5')
|
||||
->label('TOD5 APPAR ENERGY 22-5'),
|
||||
->label('TOD5 APPAR ENERGY 22-5'),
|
||||
ExportColumn::make('avg_pow_factor')
|
||||
->label('AVG POW FACTOR'),
|
||||
->label('AVG POW FACTOR'),
|
||||
ExportColumn::make('avg_freq_15min_last_ip')
|
||||
->label('AVG FREQ 15MIN LAST IP'),
|
||||
->label('AVG FREQ 15MIN LAST IP'),
|
||||
ExportColumn::make('net_kv_arh_high')
|
||||
->label('NET KV ARH HIGH'),
|
||||
->label('NET KV ARH HIGH'),
|
||||
ExportColumn::make('net_kv_arh_low')
|
||||
->label('NET KV ARH LOW'),
|
||||
->label('NET KV ARH LOW'),
|
||||
ExportColumn::make('cum_md_kva')
|
||||
->label('CUM MD KVA'),
|
||||
->label('CUM MD KVA'),
|
||||
ExportColumn::make('present_md_kva')
|
||||
->label('PRESENT MD KVA'),
|
||||
->label('PRESENT MD KVA'),
|
||||
ExportColumn::make('present_md_kva_date_time')
|
||||
->label('PRESENT MD KVA DATE TIME'),
|
||||
->label('PRESENT MD KVA DATE TIME'),
|
||||
ExportColumn::make('tod1_md_kva_6_9')
|
||||
->label('TOD1 MD KVA 6-9'),
|
||||
->label('TOD1 MD KVA 6-9'),
|
||||
ExportColumn::make('tod2_md_kva_18_21')
|
||||
->label('TOD2 MD KVA 18-21'),
|
||||
->label('TOD2 MD KVA 18-21'),
|
||||
ExportColumn::make('tod3_md_kva_21_22')
|
||||
->label('TOD3 MD KVA 21-22'),
|
||||
->label('TOD3 MD KVA 21-22'),
|
||||
ExportColumn::make('tod4_md_kva_5_6_9_18')
|
||||
->label('TOD4 MD KVA 5-6-9-18'),
|
||||
->label('TOD4 MD KVA 5-6-9-18'),
|
||||
ExportColumn::make('tod5_md_kva_22_5')
|
||||
->label('TOD5 MD KVA 22-5'),
|
||||
->label('TOD5 MD KVA 22-5'),
|
||||
ExportColumn::make('total_pow_off_hours')
|
||||
->label('TOTAL POW OFF HOURS'),
|
||||
->label('TOTAL POW OFF HOURS'),
|
||||
ExportColumn::make('programming_count')
|
||||
->label('PROGRAMMING COUNT'),
|
||||
->label('PROGRAMMING COUNT'),
|
||||
ExportColumn::make('last_occ_res_event_type')
|
||||
->label('LAST OCC RES EVENT TYPE'),
|
||||
->label('LAST OCC RES EVENT TYPE'),
|
||||
ExportColumn::make('last_occ_res_event_date_time')
|
||||
->label('LAST OCC RES EVENT DATE TIME'),
|
||||
->label('LAST OCC RES EVENT DATE TIME'),
|
||||
ExportColumn::make('tamper_count')
|
||||
->label('TAMPER COUNT'),
|
||||
->label('TAMPER COUNT'),
|
||||
ExportColumn::make('reset_count')
|
||||
->label('RESET COUNT'),
|
||||
->label('RESET COUNT'),
|
||||
ExportColumn::make('last_md_reset_date_time')
|
||||
->label('LAST MD RESET DATE TIME'),
|
||||
->label('LAST MD RESET DATE TIME'),
|
||||
ExportColumn::make('electrician_sign')
|
||||
->label('ELECTRICIAN SIGN'),
|
||||
->label('ELECTRICIAN SIGN'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('updated_by')
|
||||
@@ -131,10 +129,10 @@ class EbReadingExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your eb reading export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your eb reading 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;
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\EmployeeMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class EmployeeMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = EmployeeMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('name')
|
||||
->label('NAME'),
|
||||
ExportColumn::make('code')
|
||||
->label('CODE'),
|
||||
ExportColumn::make('department')
|
||||
->label('DEPARTMENT'),
|
||||
// ExportColumn::make('designation')
|
||||
// ->label('DESIGNATION'),
|
||||
ExportColumn::make('email')
|
||||
->label('EMAIL'),
|
||||
ExportColumn::make('mobile_number')
|
||||
->label('MOBILE 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 employee master 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;
|
||||
}
|
||||
}
|
||||
@@ -14,60 +14,59 @@ class EquipmentMasterExporter extends Exporter
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('machine.name')
|
||||
->label('MACHINE NAME'),
|
||||
->label('MACHINE NAME'),
|
||||
ExportColumn::make('name')
|
||||
->label('NAME'),
|
||||
->label('NAME'),
|
||||
ExportColumn::make('description')
|
||||
->label('DESCRIPTION'),
|
||||
->label('DESCRIPTION'),
|
||||
ExportColumn::make('make')
|
||||
->label('MAKE'),
|
||||
->label('MAKE'),
|
||||
ExportColumn::make('model')
|
||||
->label('MODEL'),
|
||||
->label('MODEL'),
|
||||
ExportColumn::make('equipment_number')
|
||||
->label('EQUIPMENT NUMBER'),
|
||||
->label('EQUIPMENT NUMBER'),
|
||||
ExportColumn::make('instrument_serial_number')
|
||||
->label('INSTRUMENT SERIAL NUMBER'),
|
||||
->label('INSTRUMENT SERIAL NUMBER'),
|
||||
ExportColumn::make('calibrated_on')
|
||||
->label('CALIBRATED ON'),
|
||||
->label('CALIBRATED ON'),
|
||||
ExportColumn::make('frequency')
|
||||
->label('FREQUENCY'),
|
||||
->label('FREQUENCY'),
|
||||
ExportColumn::make('next_calibration_date')
|
||||
->label('NEXT CALIBRATION DATE'),
|
||||
->label('NEXT CALIBRATION DATE'),
|
||||
ExportColumn::make('calibrated_by')
|
||||
->label('CALIBRATED BY'),
|
||||
->label('CALIBRATED BY'),
|
||||
ExportColumn::make('calibration_certificate')
|
||||
->label('CALIBRATION CERTIFICATE'),
|
||||
->label('CALIBRATION CERTIFICATE'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your equipment master export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your equipment master 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;
|
||||
|
||||
@@ -14,7 +14,6 @@ class GrMasterExporter extends Exporter
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
@@ -22,36 +21,36 @@ class GrMasterExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
->label('ITEM'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('gr_number')
|
||||
->label('GR NUMBER'),
|
||||
->label('GR NUMBER'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
->label('STATUS'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your gr master export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your gr master 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;
|
||||
|
||||
@@ -24,8 +24,8 @@ class GuardNameExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('name')
|
||||
->label('GUARD NAME'),
|
||||
ExportColumn::make('identification1')
|
||||
@@ -46,10 +46,10 @@ class GuardNameExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your guard name export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your guard name 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;
|
||||
|
||||
@@ -24,8 +24,8 @@ class GuardPatrolEntryExporter extends Exporter
|
||||
}),
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('guardNames.name')
|
||||
->label('GUARD NAME'),
|
||||
ExportColumn::make('checkPointNames.name')
|
||||
@@ -54,10 +54,10 @@ class GuardPatrolEntryExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your guard patrol entry export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your guard patrol entry 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;
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
<?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('inv_value')
|
||||
->label('Inv Value'),
|
||||
ExportColumn::make('freight_charge')
|
||||
->label('Freight Charge'),
|
||||
ExportColumn::make('customs_agent_name')
|
||||
->label('CUSTOMS AGENT NAME'),
|
||||
ExportColumn::make('eta_date')
|
||||
->label('ETA DATE'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
ExportColumn::make('insurance_status')
|
||||
->label('Insurance 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;
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\InvoiceInTransit;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class InvoiceInTransitExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = InvoiceInTransit::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('receiving_plant')
|
||||
->label('RECEIVING PLANT'),
|
||||
ExportColumn::make('receiving_plant_name')
|
||||
->label('RECEIVING PLANT NAME'),
|
||||
ExportColumn::make('invoice_number')
|
||||
->label('INVOICE NUMBER'),
|
||||
ExportColumn::make('invoice_date')
|
||||
->label('INVOICE DATE'),
|
||||
ExportColumn::make('item_code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('description')
|
||||
->label('DESCRIPTION'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
ExportColumn::make('transport_name')
|
||||
->label('TRANSPORT NAME'),
|
||||
ExportColumn::make('lr_bl_aw_number')
|
||||
->label('LR_BL_AW NUMBER'),
|
||||
ExportColumn::make('lr_bl_aw_date')
|
||||
->label('LR_BL_AW DATE'),
|
||||
ExportColumn::make('pending_days')
|
||||
->label('PENDING DAYS'),
|
||||
ExportColumn::make('obd_number')
|
||||
->label('OBD NUMBER'),
|
||||
ExportColumn::make('obd_date')
|
||||
->label('OBD DATE'),
|
||||
ExportColumn::make('shipment_weight')
|
||||
->label('SHIPMENT WEIGHT'),
|
||||
ExportColumn::make('unit_price')
|
||||
->label('UNIT PRICE'),
|
||||
ExportColumn::make('net_value')
|
||||
->label('NET VALUE'),
|
||||
ExportColumn::make('total_item_amount')
|
||||
->label('TOTAL ITEM AMOUNT'),
|
||||
ExportColumn::make('tax_amount')
|
||||
->label('TAX AMOUNT'),
|
||||
ExportColumn::make('transport_mode')
|
||||
->label('TRANSPORT MODE'),
|
||||
ExportColumn::make('vehicle_number')
|
||||
->label('VEHICLE NUMBER'),
|
||||
ExportColumn::make('e_waybill_number')
|
||||
->label('E_WAYBILL 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 invoice in 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;
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\InvoiceMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class InvoiceMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = InvoiceMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('receiving_plant')
|
||||
->label('Receiving Plant'),
|
||||
ExportColumn::make('receiving_plant_name')
|
||||
->label('Receiving Plant Name'),
|
||||
ExportColumn::make('transit_days')
|
||||
->label('Transit Days'),
|
||||
ExportColumn::make('transport_name')
|
||||
->label('Transport Name'),
|
||||
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 invoice master 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;
|
||||
}
|
||||
}
|
||||
@@ -24,18 +24,14 @@ class InvoiceValidationExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('invoice_number')
|
||||
->label('INVOICE NUMBER'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('stickerMaster.item.description')
|
||||
->label('ITEM DESCRIPTION'),
|
||||
ExportColumn::make('stickerMaster.item.uom')
|
||||
->label('UNIT OF MEASURE'),
|
||||
ExportColumn::make('motor_scanned_status')
|
||||
->label('MOTOR SCANNED STATUS'),
|
||||
ExportColumn::make('pump_scanned_status')
|
||||
@@ -46,8 +42,6 @@ class InvoiceValidationExporter extends Exporter
|
||||
->label('CAPACITOR SCANNED STATUS'),
|
||||
ExportColumn::make('scanned_status')
|
||||
->label('SCANNED STATUS'),
|
||||
ExportColumn::make('panel_box_code')
|
||||
->label('PANEL BOX CODE'),
|
||||
ExportColumn::make('panel_box_supplier')
|
||||
->label('PANEL BOX SUPPLIER'),
|
||||
ExportColumn::make('panel_box_serial_number')
|
||||
@@ -56,31 +50,31 @@ class InvoiceValidationExporter extends Exporter
|
||||
->label('LOAD RATE'),
|
||||
ExportColumn::make('upload_status')
|
||||
->label('UPLOAD STATUS'),
|
||||
ExportColumn::make('batch_number')
|
||||
->label('BATCH NUMBER'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
ExportColumn::make('operator_id')
|
||||
->label('OPERATOR ID'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
//->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
//->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
//->dateTimeFormat('d-m-Y H:i:s'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your serial invoice validation export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your invoice validation 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;
|
||||
|
||||
@@ -1,355 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\ItemCharacteristic;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class ItemCharacteristicExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = ItemCharacteristic::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('class')
|
||||
->label('CLASS'),
|
||||
ExportColumn::make('zz1_cn_bill_ord')
|
||||
->label('ZZ1 CN BILL ORDER'),
|
||||
ExportColumn::make('zmm_amps')
|
||||
->label('ZMM AMPS'),
|
||||
ExportColumn::make('zmm_brand')
|
||||
->label('ZMM BRAND'),
|
||||
ExportColumn::make('zmm_degreeofprotection')
|
||||
->label('ZMM DEGREE OF PROTECTION'),
|
||||
ExportColumn::make('zmm_delivery')
|
||||
->label('ZMM DELIVERY'),
|
||||
ExportColumn::make('zmm_dir_rot')
|
||||
->label('ZMM DIRECTION OF ROTATION'),
|
||||
ExportColumn::make('zmm_discharge')
|
||||
->label('ZMM DISCHARGE'),
|
||||
ExportColumn::make('zmm_discharge_max')
|
||||
->label('ZMM DISCHARGE MAX'),
|
||||
ExportColumn::make('zmm_discharge_min')
|
||||
->label('ZMM DISCHARGE MIN'),
|
||||
ExportColumn::make('zmm_duty')
|
||||
->label('ZMM DUTY'),
|
||||
ExportColumn::make('zmm_eff_motor')
|
||||
->label('ZMM EFF MOTOR'),
|
||||
ExportColumn::make('zmm_eff_pump')
|
||||
->label('ZMM EFF PUMP'),
|
||||
ExportColumn::make('zmm_frequency')
|
||||
->label('ZMM FREQUENCY'),
|
||||
ExportColumn::make('zmm_head')
|
||||
->label('ZMM HEAD'),
|
||||
ExportColumn::make('zmm_heading')
|
||||
->label('ZMM HEADING'),
|
||||
ExportColumn::make('zmm_head_max')
|
||||
->label('ZMM HEAD MAX'),
|
||||
ExportColumn::make('zmm_head_minimum')
|
||||
->label('ZMM HEAD MINIMUM'),
|
||||
ExportColumn::make('zmm_idx_eff_mtr')
|
||||
->label('ZMM IDX EFF MTR'),
|
||||
ExportColumn::make('zmm_idx_eff_pump')
|
||||
->label('ZMM IDX EFF PUMP'),
|
||||
ExportColumn::make('zmm_kvacode')
|
||||
->label('ZMM KVACODE'),
|
||||
ExportColumn::make('zmm_maxambtemp')
|
||||
->label('ZMM MAXAMB TEMP'),
|
||||
ExportColumn::make('zmm_mincoolingflow')
|
||||
->label('ZMM MIN COOLING FLOW'),
|
||||
ExportColumn::make('zmm_motorseries')
|
||||
->label('ZMM MOTOR SERIES'),
|
||||
ExportColumn::make('zmm_motor_model')
|
||||
->label('ZMM MOTOR MODEL'),
|
||||
ExportColumn::make('zmm_outlet')
|
||||
->label('ZMM OUTLET'),
|
||||
ExportColumn::make('zmm_phase')
|
||||
->label('ZMM PHASE'),
|
||||
ExportColumn::make('zmm_pressure')
|
||||
->label('ZMM PRESSURE'),
|
||||
ExportColumn::make('zmm_pumpflowtype')
|
||||
->label('ZMM PUMP FLOW TYPE'),
|
||||
ExportColumn::make('zmm_pumpseries')
|
||||
->label('ZMM PUMP SERIES'),
|
||||
ExportColumn::make('zmm_pump_model')
|
||||
->label('ZMM PUMP MODEL'),
|
||||
ExportColumn::make('zmm_ratedpower')
|
||||
->label('ZMM RATED POWER'),
|
||||
ExportColumn::make('zmm_region')
|
||||
->label('ZMM REGION'),
|
||||
ExportColumn::make('zmm_servicefactor')
|
||||
->label('ZMM SERVICE FACTOR'),
|
||||
ExportColumn::make('zmm_servicefactormaximumamps')
|
||||
->label('ZMM SERVICE FACTOR MAXIMUM AMPS'),
|
||||
ExportColumn::make('zmm_speed')
|
||||
->label('ZMM SPEED'),
|
||||
ExportColumn::make('zmm_suction')
|
||||
->label('ZMM SUCTION'),
|
||||
ExportColumn::make('zmm_suctionxdelivery')
|
||||
->label('ZMM SUCTION X DELIVERY'),
|
||||
ExportColumn::make('zmm_supplysource')
|
||||
->label('ZMM SUPPLY SOURCE'),
|
||||
ExportColumn::make('zmm_temperature')
|
||||
->label('ZMM TEMPERATURE'),
|
||||
ExportColumn::make('zmm_thrustload')
|
||||
->label('ZMM THRUST LOAD'),
|
||||
ExportColumn::make('zmm_volts')
|
||||
->label('ZMM VOLTS'),
|
||||
ExportColumn::make('zmm_wire')
|
||||
->label('ZMM WIRE'),
|
||||
ExportColumn::make('zmm_package')
|
||||
->label('ZMM PACKAGE'),
|
||||
ExportColumn::make('zmm_pvarrayrating')
|
||||
->label('ZMM PV ARRAY RATING'),
|
||||
ExportColumn::make('zmm_isi')
|
||||
->label('ZMM ISI'),
|
||||
ExportColumn::make('zmm_isimotor')
|
||||
->label('ZMM ISI MOTOR'),
|
||||
ExportColumn::make('zmm_isipump')
|
||||
->label('ZMM ISI PUMP'),
|
||||
ExportColumn::make('zmm_isipumpset')
|
||||
->label('ZMM ISI PUMPSET'),
|
||||
ExportColumn::make('zmm_pumpset_model')
|
||||
->label('ZMM PUMPSET MODEL'),
|
||||
ExportColumn::make('zmm_stages')
|
||||
->label('ZMM STAGES'),
|
||||
ExportColumn::make('zmm_headrange')
|
||||
->label('ZMM HEAD RANGE'),
|
||||
ExportColumn::make('zmm_overall_efficiency')
|
||||
->label('ZMM OVERALL EFFICIENCY'),
|
||||
ExportColumn::make('zmm_connection')
|
||||
->label('ZMM CONNECTION'),
|
||||
ExportColumn::make('zmm_min_bore_size')
|
||||
->label('ZMM MIN BORE SIZE'),
|
||||
ExportColumn::make('zmm_isireference')
|
||||
->label('ZMM ISI REFERENCE'),
|
||||
ExportColumn::make('zmm_category')
|
||||
->label('ZMM CATEGORY'),
|
||||
ExportColumn::make('zmm_submergence')
|
||||
->label('ZMM SUBMERGENCE'),
|
||||
ExportColumn::make('zmm_capacitorstart')
|
||||
->label('ZMM CAPACITOR START'),
|
||||
ExportColumn::make('zmm_capacitorrun')
|
||||
->label('ZMM CAPACITOR RUN'),
|
||||
ExportColumn::make('zmm_inch')
|
||||
->label('ZMM INCH'),
|
||||
ExportColumn::make('zmm_motor_type')
|
||||
->label('ZMM MOTOR TYPE'),
|
||||
ExportColumn::make('zmm_dismantle_direction')
|
||||
->label('ZMM DISMANTLE DIRECTION'),
|
||||
ExportColumn::make('zmm_eff_ovrall')
|
||||
->label('ZMM EFF OVRALL'),
|
||||
ExportColumn::make('zmm_bodymoc')
|
||||
->label('ZMM BODY MOC'),
|
||||
ExportColumn::make('zmm_rotormoc')
|
||||
->label('ZMM ROTOR MOC'),
|
||||
ExportColumn::make('zmm_dlwl')
|
||||
->label('ZMM DLWL'),
|
||||
ExportColumn::make('zmm_inputpower')
|
||||
->label('ZMM INPUT POWER'),
|
||||
ExportColumn::make('zmm_imp_od')
|
||||
->label('ZMM IMP OD'),
|
||||
ExportColumn::make('zmm_ambtemp')
|
||||
->label('ZMM AMBTEMP'),
|
||||
ExportColumn::make('zmm_de')
|
||||
->label('ZMM DE'),
|
||||
ExportColumn::make('zmm_dischargerange')
|
||||
->label('ZMM DISCHARGE RANGE'),
|
||||
ExportColumn::make('zmm_efficiency_class')
|
||||
->label('ZMM EFFICIENCY CLASS'),
|
||||
ExportColumn::make('zmm_framesize')
|
||||
->label('ZMM FRAME SIZE'),
|
||||
ExportColumn::make('zmm_impellerdiameter')
|
||||
->label('ZMM IMPELLER DIAMETER'),
|
||||
ExportColumn::make('zmm_insulationclass')
|
||||
->label('ZMM INSULATION CLASS'),
|
||||
ExportColumn::make('zmm_maxflow')
|
||||
->label('ZMM MAX FLOW'),
|
||||
ExportColumn::make('zmm_minhead')
|
||||
->label('ZMM MIN HEAD'),
|
||||
ExportColumn::make('zmm_mtrlofconst')
|
||||
->label('ZMM MTR LOF CONST'),
|
||||
ExportColumn::make('zmm_nde')
|
||||
->label('ZMM NDE'),
|
||||
ExportColumn::make('zmm_powerfactor')
|
||||
->label('ZMM POWER FACTOR'),
|
||||
ExportColumn::make('zmm_tagno')
|
||||
->label('ZMM TAG NO'),
|
||||
ExportColumn::make('zmm_year')
|
||||
->label('ZMM YEAR'),
|
||||
ExportColumn::make('zmm_laser_name')
|
||||
->label('ZMM LASER NAME'),
|
||||
ExportColumn::make('zmm_beenote')
|
||||
->label('ZMM BEENOTE'),
|
||||
ExportColumn::make('zmm_beenumber')
|
||||
->label('ZMM BEENUMBER'),
|
||||
ExportColumn::make('zmm_beestar')
|
||||
->label('ZMM BEESTAR'),
|
||||
ExportColumn::make('zmm_logo_ce')
|
||||
->label('ZMM LOGO CE'),
|
||||
ExportColumn::make('zmm_codeclass')
|
||||
->label('ZMM CODECLASS'),
|
||||
ExportColumn::make('zmm_colour')
|
||||
->label('ZMM COLOUR'),
|
||||
ExportColumn::make('zmm_logo_cp')
|
||||
->label('ZMM LOGO CP'),
|
||||
ExportColumn::make('zmm_grade')
|
||||
->label('ZMM GRADE'),
|
||||
ExportColumn::make('zmm_grwt_pset')
|
||||
->label('ZMM GRWT PSET'),
|
||||
ExportColumn::make('zmm_grwt_cable')
|
||||
->label('ZMM GRWT CABLE'),
|
||||
ExportColumn::make('zmm_grwt_motor')
|
||||
->label('ZMM GRWT MOTOR'),
|
||||
ExportColumn::make('zmm_grwt_pf')
|
||||
->label('ZMM GRWT PF'),
|
||||
ExportColumn::make('zmm_grwt_pump')
|
||||
->label('ZMM GRWT PUMP'),
|
||||
ExportColumn::make('zmm_isivalve')
|
||||
->label('ZMM ISI VALVE'),
|
||||
ExportColumn::make('zmm_isi_wc')
|
||||
->label('ZMM ISI WC'),
|
||||
ExportColumn::make('zmm_labelperiod')
|
||||
->label('ZMM LABEL PERIOD'),
|
||||
ExportColumn::make('zmm_length')
|
||||
->label('ZMM LENGTH'),
|
||||
ExportColumn::make('zmm_license_cml_no')
|
||||
->label('ZMM LICENSE CML NO'),
|
||||
ExportColumn::make('zmm_mfgmonyr')
|
||||
->label('ZMM MFG MON YR'),
|
||||
ExportColumn::make('zmm_modelyear')
|
||||
->label('ZMM MODEL YEAR'),
|
||||
ExportColumn::make('zmm_motoridentification')
|
||||
->label('ZMM MOTOR IDENTIFICATION'),
|
||||
ExportColumn::make('zmm_newt_pset')
|
||||
->label('ZMM NEWT PSET'),
|
||||
ExportColumn::make('zmm_newt_cable')
|
||||
->label('ZMM NEWT CABLE'),
|
||||
ExportColumn::make('zmm_newt_motor')
|
||||
->label('ZMM NEWT MOTOR'),
|
||||
ExportColumn::make('zmm_newt_pf')
|
||||
->label('ZMM NEWT PF'),
|
||||
ExportColumn::make('zmm_newt_pump')
|
||||
->label('ZMM NEWT PUMP'),
|
||||
ExportColumn::make('zmm_logo_nsf')
|
||||
->label('ZMM LOGO NSF'),
|
||||
ExportColumn::make('zmm_packtype')
|
||||
->label('ZMM PACK TYPE'),
|
||||
ExportColumn::make('zmm_panel')
|
||||
->label('ZMM PANEL'),
|
||||
ExportColumn::make('zmm_performance_factor')
|
||||
->label('ZMM PERFORMANCE FACTOR'),
|
||||
ExportColumn::make('zmm_pumpidentification')
|
||||
->label('ZMM PUMP IDENTIFICATION'),
|
||||
ExportColumn::make('zmm_psettype')
|
||||
->label('ZMM PSET TYPE'),
|
||||
ExportColumn::make('zmm_size')
|
||||
->label('ZMM SIZE'),
|
||||
ExportColumn::make('zmm_eff_ttl')
|
||||
->label('ZMM EFF TTL'),
|
||||
ExportColumn::make('zmm_type')
|
||||
->label('ZMM TYPE'),
|
||||
ExportColumn::make('zmm_usp')
|
||||
->label('ZMM USP'),
|
||||
ExportColumn::make('zmm_operating_range')
|
||||
->label('ZMM OPERATING RANGE'),
|
||||
ExportColumn::make('zmm_intake_air')
|
||||
->label('ZMM INTAKE AIR'),
|
||||
ExportColumn::make('zmm_oxygen_transfer_rate')
|
||||
->label('ZMM OXYGEN TRANSFER RATE'),
|
||||
ExportColumn::make('zmm_air_inlet_pipesize')
|
||||
->label('ZMM AIR INLET PIPE SIZE'),
|
||||
ExportColumn::make('zmm_sump_depth')
|
||||
->label('ZMM SUMP DEPTH'),
|
||||
ExportColumn::make('zmm_poles')
|
||||
->label('ZMM POLES'),
|
||||
ExportColumn::make('zmm_motor_heading')
|
||||
->label('ZMM MOTOR HEADING'),
|
||||
ExportColumn::make('zmm_motor_speed')
|
||||
->label('ZMM MOTOR SPEED'),
|
||||
ExportColumn::make('zqmm_qty')
|
||||
->label('ZMM QTY'),
|
||||
ExportColumn::make('zmm_1')
|
||||
->label('ZMM 1')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_2')
|
||||
->label('ZMM 2')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_3')
|
||||
->label('ZMM 3')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_4')
|
||||
->label('ZMM 4')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_5')
|
||||
->label('ZMM 5')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_6')
|
||||
->label('ZMM 6')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_7')
|
||||
->label('ZMM 7')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_8')
|
||||
->label('ZMM 8')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_9')
|
||||
->label('ZMM 9')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_10')
|
||||
->label('ZMM 10')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_11')
|
||||
->label('ZMM 11')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_12')
|
||||
->label('ZMM 12')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_13')
|
||||
->label('ZMM 13')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_14')
|
||||
->label('ZMM 14')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('zmm_15')
|
||||
->label('ZMM 15')
|
||||
->enabledByDefault(false),
|
||||
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 item characteristic 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;
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,8 @@ class ItemExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('category')
|
||||
->label('CATEGORY'),
|
||||
ExportColumn::make('code')
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\LeakTestReading;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class LeakTestReadingExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = LeakTestReading::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item_code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('test_status')
|
||||
->label('TEST STATUS')
|
||||
->formatStateUsing(function ($state) {
|
||||
if (! $state || $state == '' || $state == null) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return match ($state) {
|
||||
'P' => 'PASS',
|
||||
'F' => 'FAIL',
|
||||
default => '-',
|
||||
};
|
||||
}),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your leak test reading 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;
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,12 @@ class LineExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('name')
|
||||
->label('LINE NAME'),
|
||||
->label('NAME'),
|
||||
ExportColumn::make('type')
|
||||
->label('LINE TYPE'),
|
||||
->label('TYPE'),
|
||||
ExportColumn::make('no_of_operation')
|
||||
->label('NO OF OPERATION'),
|
||||
ExportColumn::make('workGroup1.name')
|
||||
@@ -84,10 +84,10 @@ class LineExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your line export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your line 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;
|
||||
|
||||
@@ -22,16 +22,16 @@ class MachineExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
->label('LINE'),
|
||||
ExportColumn::make('name')
|
||||
->label('DESCRIPTION'),
|
||||
->label('MACHINE'),
|
||||
ExportColumn::make('work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('workGroupMaster.name')
|
||||
->label('GROUP WORK CENTER'),
|
||||
->label('WORK GROUP CENTER'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
@@ -44,10 +44,10 @@ class MachineExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your machine export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your machine 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;
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\InvoiceValidation;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class MaterialInvoiceValidationExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = InvoiceValidation::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('invoice_number')
|
||||
->label('INVOICE NUMBER'),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('stickerMaster.item.description')
|
||||
->label('ITEM DESCRIPTION'),
|
||||
ExportColumn::make('stickerMaster.item.uom')
|
||||
->label('UNIT OF MEASURE'),
|
||||
ExportColumn::make('stickerMaster.material_type')
|
||||
->label('MATERIAL TYPE')
|
||||
->formatStateUsing(fn ($state) => match ($state) {
|
||||
1 => 'Individual',
|
||||
2 => 'Bundle',
|
||||
3 => 'Quantity',
|
||||
4 => 'Bundle Individual',
|
||||
default => '-',
|
||||
}),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('batch_number')
|
||||
->label('BATCH NUMBER'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
ExportColumn::make('load_rate')
|
||||
->label('LOAD RATE'),
|
||||
ExportColumn::make('upload_status')
|
||||
->label('UPLOAD STATUS'),
|
||||
ExportColumn::make('operator_id')
|
||||
->label('OPERATOR ID'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your material invoice validation 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;
|
||||
}
|
||||
}
|
||||
@@ -14,40 +14,39 @@ class MfmMeterExporter extends Exporter
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('device.name')
|
||||
->label('DEVICE NAME'),
|
||||
->label('DEVICE NAME'),
|
||||
ExportColumn::make('sequence')
|
||||
->label('SEQUENCE'),
|
||||
->label('SEQUENCE'),
|
||||
ExportColumn::make('name')
|
||||
->label('METER NAME'),
|
||||
->label('NAME'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
->label('CREATED BY'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your mfm meter export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your mfm meter 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;
|
||||
|
||||
@@ -14,49 +14,48 @@ class MfmParameterExporter extends Exporter
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('deviceName.name')
|
||||
->label('Device Name'),
|
||||
->label('Device Name'),
|
||||
ExportColumn::make('name')
|
||||
->label('PARAMETER NAME'),
|
||||
->label('NAME'),
|
||||
ExportColumn::make('mfmMeter.name')
|
||||
->label('MFM METER'),
|
||||
->label('MFM METER'),
|
||||
ExportColumn::make('register_id')
|
||||
->label('REGISTER ID'),
|
||||
->label('REGISTER ID'),
|
||||
ExportColumn::make('identifier')
|
||||
->label('IDENTIFIER'),
|
||||
->label('IDENTIFIER'),
|
||||
ExportColumn::make('byte_to_convert')
|
||||
->label('BYTE TO CONVERT'),
|
||||
->label('BYTE TO CONVERT'),
|
||||
ExportColumn::make('type_to_convert')
|
||||
->label('TYPE TO CONVERT'),
|
||||
->label('TYPE TO CONVERT'),
|
||||
ExportColumn::make('decimal_to_display')
|
||||
->label('DECIMAL TO DISPLAY'),
|
||||
->label('DECIMAL TO DISPLAY'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your mfm parameter export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your mfm parameter 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;
|
||||
|
||||
@@ -17,13 +17,13 @@ class MotorTestingMasterExporter extends Exporter
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('item.category')
|
||||
->label('CATEGORY'),
|
||||
ExportColumn::make('item.code')
|
||||
@@ -106,10 +106,10 @@ class MotorTestingMasterExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your motor testing master export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your motor testing master 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;
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\PanelBoxValidation;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class PanelBoxValidationExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = PanelBoxValidation::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT NAME'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('production_order')
|
||||
->label('PRODUCTION ORDER'),
|
||||
ExportColumn::make('inspection_lot_number')
|
||||
->label('INSPECTION LOT NUMBER'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('panel_box_supplier')
|
||||
->label('PANEL BOX SUPPLIER'),
|
||||
ExportColumn::make('panel_box_serial_number')
|
||||
->label('PANEL BOX SERIAL NUMBER'),
|
||||
ExportColumn::make('panel_box_code')
|
||||
->label('PANEL BOX CODE'),
|
||||
ExportColumn::make('serial_number_panel')
|
||||
->label('SERIAL NUMBER PANEL'),
|
||||
ExportColumn::make('pack_slip_panel')
|
||||
->label('PACK SLIP PANEL'),
|
||||
ExportColumn::make('name_plate_panel')
|
||||
->label('NAME PLATE PANEL'),
|
||||
ExportColumn::make('tube_sticker_panel')
|
||||
->label('TUBE STICKER PANEL'),
|
||||
ExportColumn::make('warranty_card_panel')
|
||||
->label('WARRANTY CARD PANEL'),
|
||||
ExportColumn::make('part_validation1')
|
||||
->label('PART VALIDATION 1'),
|
||||
ExportColumn::make('part_validation2')
|
||||
->label('PART VALIDATION 2'),
|
||||
ExportColumn::make('part_validation3')
|
||||
->label('PART VALIDATION 3'),
|
||||
ExportColumn::make('part_validation4')
|
||||
->label('PART VALIDATION 4'),
|
||||
ExportColumn::make('part_validation5')
|
||||
->label('PART VALIDATION 5'),
|
||||
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 panel box validation 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;
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\PanelGrMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class PanelGrMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = PanelGrMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT NAME'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('document_number')
|
||||
->label('DOCUMENT NUMBER'),
|
||||
ExportColumn::make('invoice_number')
|
||||
->label('INVOICE NUMBER'),
|
||||
ExportColumn::make('supplier_number')
|
||||
->label('SUPPLIER NUMBER'),
|
||||
ExportColumn::make('inspection_lot_number')
|
||||
->label('INSPECTION LOT NUMBER'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
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 panel gr master 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,8 +30,6 @@ 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')
|
||||
@@ -46,10 +44,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;
|
||||
|
||||
@@ -24,41 +24,32 @@ class ProcessOrderExporter extends Exporter
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('item.description')
|
||||
->label('ITEM DESCRIPTION'),
|
||||
ExportColumn::make('process_order')
|
||||
->label('PROCESS ORDER'),
|
||||
ExportColumn::make('coil_number')
|
||||
->label('COIL NUMBER'),
|
||||
ExportColumn::make('order_quantity')
|
||||
->label('ORDER QUANTITY'),
|
||||
ExportColumn::make('updated_order_quantity')
|
||||
->label('UPDATED ORDER QUANTITY'),
|
||||
ExportColumn::make('received_quantity')
|
||||
->label('RECEIVED QUANTITY'),
|
||||
ExportColumn::make('sfg_number')
|
||||
->label('SFG NUMBER'),
|
||||
ExportColumn::make('machine_name')
|
||||
->label('MACHINE NAME'),
|
||||
ExportColumn::make('scrap_quantity')
|
||||
->label('SCRAP QUANTITY'),
|
||||
ExportColumn::make('rework_status')
|
||||
->label('REWORK STATUS'),
|
||||
->label('MACHINE ID'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
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')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\ProductCharacteristicsMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class ProductCharacteristicsMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = ProductCharacteristicsMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('item.description')
|
||||
->label('ITEM DESCRIPTION'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'), // machine.workGroupMaster.name
|
||||
ExportColumn::make('machine.workGroupMaster.name')
|
||||
->label('GROUP WORK CENTER'),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('characteristics_type')
|
||||
->label('CHARACTERISTICS TYPE'),
|
||||
ExportColumn::make('name')
|
||||
->label('CHARACTERISTICS NAME'),
|
||||
ExportColumn::make('category')
|
||||
->label('CATEGORY'),
|
||||
ExportColumn::make('inspection_type')
|
||||
->label('INSPECTION TYPE'),
|
||||
ExportColumn::make('lower')
|
||||
->label('LOWER'),
|
||||
ExportColumn::make('middle')
|
||||
->label('MIDDLE'),
|
||||
ExportColumn::make('upper')
|
||||
->label('UPPER'),
|
||||
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 product characteristics master 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;
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\ProductionCharacteristic;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class ProductionCharacteristicExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = ProductionCharacteristic::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('production_order')
|
||||
->label('PRODUCTION ORDER'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('characteristic_name')
|
||||
->label('CHARACTERISTIC NAME'),
|
||||
ExportColumn::make('observed_value')
|
||||
->label('OBSERVED VALUE'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
ExportColumn::make('remark')
|
||||
->label('REMARK'),
|
||||
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'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your production characteristic 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;
|
||||
}
|
||||
}
|
||||
@@ -37,13 +37,13 @@ class ProductionLineStopExporter extends Exporter
|
||||
ExportColumn::make('stop_min')
|
||||
->label('STOP MINUTE'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
->label('LINE'),
|
||||
ExportColumn::make('shift.block.name')
|
||||
->label('BLOCK NAME'),
|
||||
->label('BLOCK'),
|
||||
ExportColumn::make('shift.name')
|
||||
->label('SHIFT NAME'),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
->label('SHIFT'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('operator_id')
|
||||
->label('OPERATOR ID'),
|
||||
ExportColumn::make('created_at')
|
||||
@@ -58,10 +58,10 @@ class ProductionLineStopExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your production line stop export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your production line stop 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;
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\ProductionOrder;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class ProductionOrderExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = ProductionOrder::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
ExportColumn::make('start_date')
|
||||
->label('START DATE'),
|
||||
ExportColumn::make('end_date')
|
||||
->label('END DATE'),
|
||||
ExportColumn::make('production_order')
|
||||
->label('PRODUCTION ORDER'),
|
||||
ExportColumn::make('from_serial_number')
|
||||
->label('FROM SERIAL NUMBER'),
|
||||
ExportColumn::make('to_serial_number')
|
||||
->label('TO SERIAL NUMBER'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your production order 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;
|
||||
}
|
||||
}
|
||||
@@ -29,13 +29,13 @@ class ProductionPlanExporter extends Exporter
|
||||
ExportColumn::make('production_quantity')
|
||||
->label('PRODUCTION QUANTITY'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
->label('LINE'),
|
||||
ExportColumn::make('shift.block.name')
|
||||
->label('BLOCK NAME'),
|
||||
->label('BLOCK'),
|
||||
ExportColumn::make('shift.name')
|
||||
->label('SHIFT NAME'),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
->label('SHIFT'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('operator_id')
|
||||
->label('OPERATOR ID'),
|
||||
ExportColumn::make('created_at')
|
||||
@@ -50,10 +50,10 @@ class ProductionPlanExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your production plan export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your production plan 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;
|
||||
|
||||
@@ -33,13 +33,13 @@ class ProductionQuantityExporter extends Exporter
|
||||
ExportColumn::make('item.uom')
|
||||
->label('UNIT OF MEASURE'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
->label('LINE'),
|
||||
ExportColumn::make('shift.block.name')
|
||||
->label('BLOCK NAME'),
|
||||
->label('BLOCK'),
|
||||
ExportColumn::make('shift.name')
|
||||
->label('SHIFT NAME'),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
->label('SHIFT'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('sap_msg_status')
|
||||
->label('SAP MESSAGE STATUS'),
|
||||
ExportColumn::make('sap_msg_description')
|
||||
@@ -58,10 +58,10 @@ class ProductionQuantityExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your production quantity export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your production quantity 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;
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\PumpTestingEntry;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class PumpTestingEntryExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = PumpTestingEntry::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('tested_date')
|
||||
->label('TESTED DATE'),
|
||||
ExportColumn::make('tested_type')
|
||||
->label('TESTED TYPE'),
|
||||
ExportColumn::make('pumpTestingMaster.item.code')
|
||||
->label('PUMP CODE'),
|
||||
ExportColumn::make('pumpTestingMaster.item.category')
|
||||
->label('PUMP CATEGORY')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('pumpTestingMaster.item.description')
|
||||
->label('PUMP TYPE'),
|
||||
ExportColumn::make('pumpTestingMaster.item.uom')
|
||||
->label('UNIT OF MEASURE')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('pump_serial_number')
|
||||
->label('PUMP SERIAL NUMBER'),
|
||||
ExportColumn::make('correction_head')
|
||||
->label('CORRECTION HEAD'),
|
||||
ExportColumn::make('sl_no')
|
||||
->label('SL. NO.'),
|
||||
ExportColumn::make('voltage')
|
||||
->label('VOLTAGE'),
|
||||
ExportColumn::make('frequency')
|
||||
->label('FREQUENCY'),
|
||||
ExportColumn::make('speed')
|
||||
->label('SPEED'),
|
||||
ExportColumn::make('head')
|
||||
->label('HEAD'),
|
||||
ExportColumn::make('flow_reading')
|
||||
->label('FLOW READING'),
|
||||
ExportColumn::make('current')
|
||||
->label('CURRENT'),
|
||||
ExportColumn::make('watt')
|
||||
->label('WATT'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your pump testing entry 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;
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\PumpTestingMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class PumpTestingMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = PumpTestingMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('PUMP CODE'),
|
||||
ExportColumn::make('item.category')
|
||||
->label('PUMP CATEGORY')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('item.description')
|
||||
->label('PUMP TYPE'),
|
||||
ExportColumn::make('item.uom')
|
||||
->label('UNIT OF MEASURE')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('head')
|
||||
->label('HEAD'),
|
||||
ExportColumn::make('head_type')
|
||||
->label('HEAD TYPE'),
|
||||
ExportColumn::make('discharge')
|
||||
->label('DISCHARGE'),
|
||||
ExportColumn::make('discharge_type')
|
||||
->label('DISCHARGE TYPE'),
|
||||
ExportColumn::make('motor_efficiency')
|
||||
->label('MOTOR EFFICIENCY'),
|
||||
ExportColumn::make('pump_efficiency')
|
||||
->label('PUMP EFFICIENCY'),
|
||||
ExportColumn::make('speed')
|
||||
->label('SPEED'),
|
||||
ExportColumn::make('frequency')
|
||||
->label('FREQUENCY'),
|
||||
ExportColumn::make('i_max')
|
||||
->label('I-MAX'),
|
||||
ExportColumn::make('p_input')
|
||||
->label('P-INPUT'),
|
||||
ExportColumn::make('delivery_size')
|
||||
->label('DELIVERY SIZE'),
|
||||
ExportColumn::make('no_of_stages')
|
||||
->label('NO OF STAGES'),
|
||||
ExportColumn::make('size')
|
||||
->label('SIZE'),
|
||||
ExportColumn::make('maximum_head')
|
||||
->label('MAXIMUM HEAD'),
|
||||
ExportColumn::make('motor_type')
|
||||
->label('MOTOR TYPE'),
|
||||
ExportColumn::make('motor_code')
|
||||
->label('MOTOR CODE'),
|
||||
ExportColumn::make('kw_hp')
|
||||
->label('KW / HP'),
|
||||
ExportColumn::make('connection_type')
|
||||
->label('CONNECTION TYPE'),
|
||||
ExportColumn::make('voltage')
|
||||
->label('VOLTAGE'),
|
||||
ExportColumn::make('phase')
|
||||
->label('PHASE'),
|
||||
ExportColumn::make('oh_minimum')
|
||||
->label('OH MINIMUM'),
|
||||
ExportColumn::make('oh_maximum')
|
||||
->label('OH MAXIMUM'),
|
||||
ExportColumn::make('current_minimum')
|
||||
->label('CURRENT MINIMUM'),
|
||||
ExportColumn::make('current_maximum')
|
||||
->label('CURRENT MAXIMUM'),
|
||||
ExportColumn::make('class_of_insulation')
|
||||
->label('CLASS OF INSULATION'),
|
||||
ExportColumn::make('testing_code')
|
||||
->label('TESTING CODE'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your pump testing master 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;
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\PumpTestingResult;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class PumpTestingResultExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = PumpTestingResult::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('tested_date')
|
||||
->label('TESTED DATE'),
|
||||
ExportColumn::make('tested_type')
|
||||
->label('TESTED TYPE'),
|
||||
ExportColumn::make('pumpTestingMaster.item.code')
|
||||
->label('PUMP CODE'),
|
||||
ExportColumn::make('pumpTestingMaster.item.category')
|
||||
->label('PUMP CATEGORY')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('pumpTestingMaster.item.description')
|
||||
->label('PUMP TYPE'),
|
||||
ExportColumn::make('pumpTestingMaster.item.uom')
|
||||
->label('UNIT OF MEASURE')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('pump_serial_number')
|
||||
->label('PUMP SERIAL NUMBER'),
|
||||
ExportColumn::make('correction_head')
|
||||
->label('CORRECTION HEAD'),
|
||||
ExportColumn::make('sl_no')
|
||||
->label('SL. NO.'),
|
||||
ExportColumn::make('voltage')
|
||||
->label('VOLTAGE'),
|
||||
ExportColumn::make('current')
|
||||
->label('CURRENT'),
|
||||
ExportColumn::make('watt')
|
||||
->label('WATT'),
|
||||
ExportColumn::make('frequency')
|
||||
->label('FREQUENCY'),
|
||||
ExportColumn::make('speed')
|
||||
->label('SPEED'),
|
||||
ExportColumn::make('discharge')
|
||||
->label('DISCHARGE'),
|
||||
ExportColumn::make('head')
|
||||
->label('HEAD'),
|
||||
ExportColumn::make('pump_output')
|
||||
->label('PUMP OUTPUT'),
|
||||
ExportColumn::make('power_p2')
|
||||
->label('PUMP P2'),
|
||||
ExportColumn::make('overall_efficiency')
|
||||
->label('OVERALL EFFICIENCY'),
|
||||
ExportColumn::make('pump_efficiency')
|
||||
->label('PUMP EFFICIENCY'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your pump testing result 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;
|
||||
}
|
||||
}
|
||||
@@ -24,18 +24,16 @@ class QualityValidationExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
->label('LINE'),
|
||||
ExportColumn::make('production_order')
|
||||
->label('PRODUCTION ORDER'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('stickerMaster.item.description')
|
||||
->label('ITEM DESCRIPTION'),
|
||||
ExportColumn::make('uom')
|
||||
->label('UNIT OF MEASURE'),
|
||||
ExportColumn::make('serial_number_motor')
|
||||
@@ -56,14 +54,14 @@ class QualityValidationExporter extends Exporter
|
||||
->label('NAME PLATE PUMP'),
|
||||
ExportColumn::make('name_plate_pumpset')
|
||||
->label('NAME PLATE PUMPSET'),
|
||||
ExportColumn::make('warranty_card')
|
||||
->label('WARRANTY CARD'),
|
||||
ExportColumn::make('tube_sticker_motor')
|
||||
->label('TUBE STICKER MOTOR'),
|
||||
ExportColumn::make('tube_sticker_pump')
|
||||
->label('TUBE STICKER PUMP'),
|
||||
ExportColumn::make('tube_sticker_pumpset')
|
||||
->label('TUBE STICKER PUMPSET'),
|
||||
ExportColumn::make('warranty_card')
|
||||
->label('WARRANTY CARD'),
|
||||
ExportColumn::make('part_validation1')
|
||||
->label('PART VALIDATION 1'),
|
||||
ExportColumn::make('part_validation2')
|
||||
@@ -92,10 +90,10 @@ class QualityValidationExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your quality validation export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your quality validation 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;
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\RequestCharacteristic;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class RequestCharacteristicExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = RequestCharacteristic::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
// ExportColumn::make('id')
|
||||
// ->label('ID'),
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('work_flow_id')
|
||||
->label('WORK FLOW ID'),
|
||||
ExportColumn::make('characteristicApproverMaster.machine_name')
|
||||
->label('MACHINE NAME'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('aufnr')
|
||||
->label('JOB NUMBER'),
|
||||
ExportColumn::make('characteristicApproverMaster.approver_type')
|
||||
->label('APPROVER TYPE'),
|
||||
ExportColumn::make('characteristicApproverMaster.characteristic_field')
|
||||
->label('MASTER CHARACTERISTIC FIELD'),
|
||||
ExportColumn::make('characteristic_name')
|
||||
->label('CHARACTERISTIC NAME'),
|
||||
ExportColumn::make('current_value')
|
||||
->label('CURRENT VALUE'),
|
||||
ExportColumn::make('update_value')
|
||||
->label('UPDATE VALUE'),
|
||||
ExportColumn::make('characteristicApproverMaster.name1')
|
||||
->label('APPROVER NAME 1'),
|
||||
ExportColumn::make('approver_status1')
|
||||
->label('APPROVER STATUS 1'),
|
||||
ExportColumn::make('approver_remark1')
|
||||
->label('APPROVER REMARK 1'),
|
||||
ExportColumn::make('approved1_at')
|
||||
->label('APPROVED AT 1'),
|
||||
ExportColumn::make('characteristicApproverMaster.name2')
|
||||
->label('APPROVER NAME 2'),
|
||||
ExportColumn::make('approver_status2')
|
||||
->label('APPROVER STATUS 2'),
|
||||
ExportColumn::make('approver_remark2')
|
||||
->label('APPROVER REMARK 2'),
|
||||
ExportColumn::make('approved2_at')
|
||||
->label('APPROVED AT 2'),
|
||||
ExportColumn::make('characteristicApproverMaster.name3')
|
||||
->label('APPROVER NAME 3'),
|
||||
ExportColumn::make('approver_status3')
|
||||
->label('APPROVER STATUS 3'),
|
||||
ExportColumn::make('approver_remark3')
|
||||
->label('APPROVER REMARK 3'),
|
||||
ExportColumn::make('approved3_at')
|
||||
->label('APPROVED AT 1'),
|
||||
ExportColumn::make('mail_status')
|
||||
->label('MAIL STATUS')
|
||||
->formatStateUsing(function ($state) {
|
||||
if (! $state || $state == '' || $state == null) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return match ($state) {
|
||||
'Sent' => 'Sent-M1',
|
||||
'Sent-Mail2' => 'Sent-M2',
|
||||
'Sent-Mail3' => 'Sent-M3',
|
||||
default => '-',
|
||||
};
|
||||
}),
|
||||
ExportColumn::make('trigger_at')
|
||||
->label('TRIGGERED AT'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your request characteristic 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;
|
||||
}
|
||||
}
|
||||
@@ -14,16 +14,15 @@ class SerialValidationExporter extends Exporter
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('invoice_number')
|
||||
->label('INVOICE NUMBER'),
|
||||
ExportColumn::make('serial_number')
|
||||
@@ -56,10 +55,10 @@ class SerialValidationExporter extends Exporter
|
||||
->label('OPERATOR ID'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
//->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
//->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
@@ -68,10 +67,10 @@ class SerialValidationExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your serial validation export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your serial validation 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;
|
||||
|
||||
@@ -25,11 +25,11 @@ class ShiftExporter extends Exporter
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('block.name')
|
||||
->label('BLOCK NAME'),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
->label('BLOCK'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('name')
|
||||
->label('SHIFT NAME'),
|
||||
->label('NAME'),
|
||||
ExportColumn::make('start_time')
|
||||
->label('START TIME'),
|
||||
ExportColumn::make('duration')
|
||||
@@ -50,10 +50,10 @@ class ShiftExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your shift export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your shift 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;
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StickerDetail;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StickerDetailExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StickerDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('stickerStructureDetail.sticker_id')
|
||||
->label('STICKER ID'),
|
||||
ExportColumn::make('design_element_type')
|
||||
->label('DESIGN ELEMENT TYPE'),
|
||||
ExportColumn::make('element_id')
|
||||
->label('ELEMENT ID'),
|
||||
ExportColumn::make('element_type')
|
||||
->label('ELEMENT TYPE'),
|
||||
ExportColumn::make('characteristics_type')
|
||||
->label('CHARACTERISTICS TYPE'),
|
||||
ExportColumn::make('string_value')
|
||||
->label('STRING VALUE'),
|
||||
ExportColumn::make('string_font')
|
||||
->label('STRING FONT'),
|
||||
ExportColumn::make('string_size')
|
||||
->label('STRING SIZE'),
|
||||
ExportColumn::make('element_colour')
|
||||
->label('ELEMENT COLOUR'),
|
||||
ExportColumn::make('string_align')
|
||||
->label('STRING ALIGN'),
|
||||
ExportColumn::make('string_x_value')
|
||||
->label('STRING X VALUE'),
|
||||
ExportColumn::make('string_y_value')
|
||||
->label('STRING Y VALUE'),
|
||||
ExportColumn::make('shape_name')
|
||||
->label('SHAPE NAME'),
|
||||
ExportColumn::make('shape_pen_size')
|
||||
->label('SHAPE PEN SIZE'),
|
||||
ExportColumn::make('curve_radius')
|
||||
->label('CURVE RADIUS'),
|
||||
ExportColumn::make('shape_x1_value')
|
||||
->label('SHAPE X1 VALUE'),
|
||||
ExportColumn::make('shape_y1_value')
|
||||
->label('SHAPE Y1 VALUE'),
|
||||
ExportColumn::make('shape_x2_value')
|
||||
->label('SHAPE X2 VALUE'),
|
||||
ExportColumn::make('shape_y2_value')
|
||||
->label('SHAPE Y2 VALUE'),
|
||||
ExportColumn::make('image_x')
|
||||
->label('IMAGE X'),
|
||||
ExportColumn::make('image_y')
|
||||
->label('IMAGE Y'),
|
||||
ExportColumn::make('image_width')
|
||||
->label('IMAGE WIDTH'),
|
||||
ExportColumn::make('image_height')
|
||||
->label('IMAGE HEIGHT'),
|
||||
ExportColumn::make('qr_value')
|
||||
->label('QR VALUE'),
|
||||
ExportColumn::make('qr_align')
|
||||
->label('QR ALIGN'),
|
||||
ExportColumn::make('qr_size')
|
||||
->label('QR SIZE'),
|
||||
ExportColumn::make('qr_x_value')
|
||||
->label('QR X VALUE'),
|
||||
ExportColumn::make('qr_y_value')
|
||||
->label('QR Y VALUE'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your sticker detail 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;
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StickerMappingMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StickerMappingMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StickerMappingMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('itemCharacteristic.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('sticker_structure1_id')
|
||||
->label('STICKER 1')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker1Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker1_machine_id')
|
||||
->label('WC STICKER 1')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker1Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker1_print_ip')
|
||||
->label('STICKER 1 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure2_id')
|
||||
->label('STICKER 2')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker2Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker2_machine_id')
|
||||
->label('WC STICKER 2')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker2Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker2_print_ip')
|
||||
->label('STICKER 2 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure3_id')
|
||||
->label('STICKER 3')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker3Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker3_machine_id')
|
||||
->label('WC STICKER 3')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker3Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker3_print_ip')
|
||||
->label('STICKER 3 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure4_id')
|
||||
->label('STICKER 4')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker4Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker4_machine_id')
|
||||
->label('WC STICKER 4')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker4Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker4_print_ip')
|
||||
->label('STICKER 4 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure5_id')
|
||||
->label('STICKER 5')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker5Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker5_machine_id')
|
||||
->label('WC STICKER 5')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker5Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker5_print_ip')
|
||||
->label('STICKER 5 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure6_id')
|
||||
->label('STICKER 6')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker6Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker6_machine_id')
|
||||
->label('WC STICKER 6')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker6Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker6_print_ip')
|
||||
->label('STICKER 6 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure7_id')
|
||||
->label('STICKER 7')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker7Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker7_machine_id')
|
||||
->label('WC STICKER 7')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker2Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker7_print_ip')
|
||||
->label('STICKER 7 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure8_id')
|
||||
->label('STICKER 8')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker8Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker8_machine_id')
|
||||
->label('WC STICKER 8')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker8Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker8_print_ip')
|
||||
->label('STICKER 8 PRINT IP'),
|
||||
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')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your sticker mapping master 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;
|
||||
}
|
||||
}
|
||||
@@ -24,16 +24,10 @@ class StickerMasterExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT NAME'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('item.category')
|
||||
->label('CATEGORY'),
|
||||
ExportColumn::make('item.description')
|
||||
->label('DESCRIPTION'),
|
||||
ExportColumn::make('item.uom')
|
||||
->label('UNIT OF MEASURE'),
|
||||
ExportColumn::make('serial_number_motor')
|
||||
->label('SERIAL NUMBER MOTOR'),
|
||||
ExportColumn::make('serial_number_pump')
|
||||
@@ -82,12 +76,8 @@ class StickerMasterExporter extends Exporter
|
||||
->label('MATERIAL TYPE'),
|
||||
ExportColumn::make('bundle_quantity')
|
||||
->label('BUNDLE QUANTITY'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
@@ -98,10 +88,10 @@ class StickerMasterExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your sticker master export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your sticker master 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;
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StickerPrinting;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StickerPrintingExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StickerPrinting::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('reference_number')
|
||||
->label('REFERENCE NUMBER'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL 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 sticker printing 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;
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StickerStructureDetailExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('sticker_id')
|
||||
->label('STICKER ID'),
|
||||
ExportColumn::make('sticker_width')
|
||||
->label('STICKER WIDTH'),
|
||||
ExportColumn::make('sticker_height')
|
||||
->label('STICKER HEIGHT'),
|
||||
ExportColumn::make('sticker_lmargin')
|
||||
->label('STICKER LEFT MARGIN'),
|
||||
ExportColumn::make('sticker_rmargin')
|
||||
->label('STICKER RIGHT MARGIN'),
|
||||
ExportColumn::make('sticker_tmargin')
|
||||
->label('STICKER TOP MARGIN'),
|
||||
ExportColumn::make('sticker_bmargin')
|
||||
->label('STICKER BOTTOM MARGIN'),
|
||||
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 sticker structure detail 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;
|
||||
}
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StockDataMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StockDataMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StockDataMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('type')
|
||||
->label('TYPE')
|
||||
->formatStateUsing(fn ($state) => match ($state) {
|
||||
'0' => 'FG',
|
||||
'1' => 'NON-FG',
|
||||
default => '-',
|
||||
}),
|
||||
ExportColumn::make('location')
|
||||
->label('LOCATION'),
|
||||
ExportColumn::make('bin')
|
||||
->label('BIN'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('batch')
|
||||
->label('BATCH'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
ExportColumn::make('doc_no')
|
||||
->label('DOCUMENT NUMBER'),
|
||||
ExportColumn::make('motor_scanned_status')
|
||||
->label('MOTOR SCANNED STATUS'),
|
||||
ExportColumn::make('pump_scanned_status')
|
||||
->label('PUMP SCANNED STATUS'),
|
||||
ExportColumn::make('capacitor_scanned_status')
|
||||
->label('CAPACITOR SCANNED STATUS'),
|
||||
ExportColumn::make('scanned_status_set')
|
||||
->label('SCANNED STATUS SET'),
|
||||
ExportColumn::make('panel_box_item_code')
|
||||
->label('PANEL BOX ITEM CODE'),
|
||||
ExportColumn::make('panel_box_supplier')
|
||||
->label('PANEL BOX SUPPLIER'),
|
||||
ExportColumn::make('panel_box_sno')
|
||||
->label('PANEL BOX SNO'),
|
||||
ExportColumn::make('scanned_status')
|
||||
->label('SCANNED STATUS'),
|
||||
ExportColumn::make('scanned_quantity')
|
||||
->label('SCANNED QUANTITY'),
|
||||
ExportColumn::make('system_stock')
|
||||
->label('SYSTEM STOCK')
|
||||
->state(fn ($record) => $record->quantity),
|
||||
ExportColumn::make('scanned_stock')
|
||||
->label('SCANNED STOCK')
|
||||
->state(fn ($record) => $record->scanned_quantity),
|
||||
ExportColumn::make('duplicate_stock')
|
||||
->label('DUPLICATE STOCK')
|
||||
->state(function ($record) {
|
||||
return \App\Models\DuplicateStock::where('stock_data_master_id', $record->id)->count();
|
||||
}),
|
||||
ExportColumn::make('not_in_stock')
|
||||
->label('NOT IN STOCK')
|
||||
->state(function ($record) {
|
||||
return \App\Models\NotInStock::where('serial_number', $record->serial_number)
|
||||
->where('plant_id', $record->plant_id)
|
||||
->count();
|
||||
}),
|
||||
ExportColumn::make('physical_stock')
|
||||
->label('PHYSICAL STOCK')
|
||||
->state(function ($record) {
|
||||
|
||||
$duplicate = \App\Models\DuplicateStock::where('stock_data_master_id', $record->id)->count();
|
||||
|
||||
$notInStock = \App\Models\NotInStock::where('serial_number', $record->serial_number)
|
||||
->where('plant_id', $record->plant_id)
|
||||
->count();
|
||||
|
||||
$scanned = $record->scanned_quantity ?? 0;
|
||||
|
||||
return $scanned + $duplicate + $notInStock;
|
||||
}),
|
||||
|
||||
ExportColumn::make('stock_difference')
|
||||
->label('STOCK DIFFERENCE COUNT')
|
||||
->state(function ($record) {
|
||||
|
||||
$duplicate = \App\Models\DuplicateStock::where('stock_data_master_id', $record->id)->count();
|
||||
|
||||
$notInStock = \App\Models\NotInStock::where('serial_number', $record->serial_number)
|
||||
->where('plant_id', $record->plant_id)
|
||||
->count();
|
||||
|
||||
$scanned = (int) $record->scanned_quantity;
|
||||
|
||||
$physicalStock = $scanned + $duplicate + $notInStock;
|
||||
|
||||
$systemStock = (int) $record->quantity;
|
||||
|
||||
$difference = $physicalStock - $systemStock;
|
||||
|
||||
return max($difference, 0);
|
||||
}),
|
||||
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 stock data master 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;
|
||||
}
|
||||
}
|
||||
@@ -1,335 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\TempClassCharacteristic;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class TempClassCharacteristicExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = TempClassCharacteristic::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('aufnr')
|
||||
->label('AUFNR'),
|
||||
ExportColumn::make('class')
|
||||
->label('CLASS'),
|
||||
ExportColumn::make('arbid')
|
||||
->label('ARBID'),
|
||||
ExportColumn::make('gamng')
|
||||
->label('GAMNG'),
|
||||
ExportColumn::make('lmnga')
|
||||
->label('LMNGA'),
|
||||
ExportColumn::make('gernr')
|
||||
->label('GERNR'),
|
||||
ExportColumn::make('zz1_cn_bill_ord')
|
||||
->label('ZZ1 CN BILL ORD'),
|
||||
ExportColumn::make('zmm_amps')
|
||||
->label('ZMM AMPS'),
|
||||
ExportColumn::make('zmm_brand')
|
||||
->label('ZMM BRAND'),
|
||||
ExportColumn::make('zmm_degreeofprotection')
|
||||
->label('ZMM DEGREEOFPROTECTION'),
|
||||
ExportColumn::make('zmm_delivery')
|
||||
->label('ZMM DELIVERY'),
|
||||
ExportColumn::make('zmm_dir_rot')
|
||||
->label('ZMM DIR ROT'),
|
||||
ExportColumn::make('zmm_discharge')
|
||||
->label('ZMM DISCHARGE'),
|
||||
ExportColumn::make('zmm_discharge_max')
|
||||
->label('ZMM DISCHARGE MAX'),
|
||||
ExportColumn::make('zmm_discharge_min')
|
||||
->label('ZMM DISCHARGE MIN'),
|
||||
ExportColumn::make('zmm_duty')
|
||||
->label('ZMM DUTY'),
|
||||
ExportColumn::make('zmm_eff_motor')
|
||||
->label('ZMM EFF MOTOR'),
|
||||
ExportColumn::make('zmm_eff_pump')
|
||||
->label('ZMM EFF PUMP'),
|
||||
ExportColumn::make('zmm_frequency')
|
||||
->label('ZMM FREQUENCY'),
|
||||
ExportColumn::make('zmm_head')
|
||||
->label('ZMM HEAD'),
|
||||
ExportColumn::make('zmm_heading')
|
||||
->label('ZMM HEADING'),
|
||||
ExportColumn::make('zmm_head_max')
|
||||
->label('ZMM HEAD MAX'),
|
||||
ExportColumn::make('zmm_head_minimum')
|
||||
->label('ZMM HEAD MINIMUM'),
|
||||
ExportColumn::make('zmm_idx_eff_mtr')
|
||||
->label('ZMM IDX EFF MTR'),
|
||||
ExportColumn::make('zmm_idx_eff_pump')
|
||||
->label('ZMM IDX EFF PUMP'),
|
||||
ExportColumn::make('zmm_kvacode')
|
||||
->label('ZMM KVACODE'),
|
||||
ExportColumn::make('zmm_maxambtemp')
|
||||
->label('ZMM MAXAMBTEMP'),
|
||||
ExportColumn::make('zmm_mincoolingflow')
|
||||
->label('ZMM MINCOOLINGFLOW'),
|
||||
ExportColumn::make('zmm_motorseries')
|
||||
->label('ZMM MOTORSERIES'),
|
||||
ExportColumn::make('zmm_motor_model')
|
||||
->label('ZMM MOTOR MODEL'),
|
||||
ExportColumn::make('zmm_outlet')
|
||||
->label('ZMM OUTLET'),
|
||||
ExportColumn::make('zmm_phase')
|
||||
->label('ZMM PHASE'),
|
||||
ExportColumn::make('zmm_pressure')
|
||||
->label('ZMM PRESSURE'),
|
||||
ExportColumn::make('zmm_pumpflowtype')
|
||||
->label('ZMM PUMPFLOWTYPE'),
|
||||
ExportColumn::make('zmm_pumpseries')
|
||||
->label('ZMM PUMPSERIES'),
|
||||
ExportColumn::make('zmm_pump_model')
|
||||
->label('ZMM PUMP MODEL'),
|
||||
ExportColumn::make('zmm_ratedpower')
|
||||
->label('ZMM RATEDPOWER'),
|
||||
ExportColumn::make('zmm_region')
|
||||
->label('ZMM REGION'),
|
||||
ExportColumn::make('zmm_servicefactor')
|
||||
->label('ZMM SERVICEFACTOR'),
|
||||
ExportColumn::make('zmm_servicefactormaximumamps')
|
||||
->label('ZMM SERVICEFACTORMAXIMUMAMPS'),
|
||||
ExportColumn::make('zmm_speed')
|
||||
->label('ZMM SPEED'),
|
||||
ExportColumn::make('zmm_suction')
|
||||
->label('ZMM SUCTION'),
|
||||
ExportColumn::make('zmm_suctionxdelivery')
|
||||
->label('ZMM SUCTIONXDELIVERY'),
|
||||
ExportColumn::make('zmm_supplysource')
|
||||
->label('ZMM SUPPLYSOURCE'),
|
||||
ExportColumn::make('zmm_temperature')
|
||||
->label('ZMM TEMPERATURE'),
|
||||
ExportColumn::make('zmm_thrustload')
|
||||
->label('ZMM THRUSTLOAD'),
|
||||
ExportColumn::make('zmm_volts')
|
||||
->label('ZMM VOLTS'),
|
||||
ExportColumn::make('zmm_wire')
|
||||
->label('ZMM WIRE'),
|
||||
ExportColumn::make('zmm_package')
|
||||
->label('ZMM PACKAGE'),
|
||||
ExportColumn::make('zmm_pvarrayrating')
|
||||
->label('ZMM PVARRAYRATING'),
|
||||
ExportColumn::make('zmm_isi')
|
||||
->label('ZMM ISI'),
|
||||
ExportColumn::make('zmm_isimotor')
|
||||
->label('ZMM ISIMOTOR'),
|
||||
ExportColumn::make('zmm_isipump')
|
||||
->label('ZMM ISIPUMP'),
|
||||
ExportColumn::make('zmm_isipumpset')
|
||||
->label('ZMM ISIPUMPSET'),
|
||||
ExportColumn::make('zmm_pumpset_model')
|
||||
->label('ZMM PUMPSET MODEL'),
|
||||
ExportColumn::make('zmm_stages')
|
||||
->label('ZMM STAGES'),
|
||||
ExportColumn::make('zmm_headrange')
|
||||
->label('ZMM HEADRANGE'),
|
||||
ExportColumn::make('zmm_overall_efficiency')
|
||||
->label('ZMM OVERALL EFFICIENCY'),
|
||||
ExportColumn::make('zmm_connection')
|
||||
->label('ZMM CONNECTION'),
|
||||
ExportColumn::make('zmm_min_bore_size')
|
||||
->label('ZMM MIN BORE SIZE'),
|
||||
ExportColumn::make('zmm_isireference')
|
||||
->label('ZMM ISIREFERENCE'),
|
||||
ExportColumn::make('zmm_category')
|
||||
->label('ZMM CATEGORY'),
|
||||
ExportColumn::make('zmm_submergence')
|
||||
->label('ZMM SUBMERGENCE'),
|
||||
ExportColumn::make('zmm_capacitorstart')
|
||||
->label('ZMM CAPACITORSTART'),
|
||||
ExportColumn::make('zmm_capacitorrun')
|
||||
->label('ZMM CAPACITORRUN'),
|
||||
ExportColumn::make('zmm_inch')
|
||||
->label('ZMM INCH'),
|
||||
ExportColumn::make('zmm_motor_type')
|
||||
->label('ZMM MOTOR TYPE'),
|
||||
ExportColumn::make('zmm_dismantle_direction')
|
||||
->label('ZMM DISMANTLE DIRECTION'),
|
||||
ExportColumn::make('zmm_eff_ovrall')
|
||||
->label('ZMM EFF OVRALL'),
|
||||
ExportColumn::make('zmm_bodymoc')
|
||||
->label('ZMM BODYMOC'),
|
||||
ExportColumn::make('zmm_rotormoc')
|
||||
->label('ZMM ROTORMOC'),
|
||||
ExportColumn::make('zmm_dlwl')
|
||||
->label('ZMM DLWL'),
|
||||
ExportColumn::make('zmm_inputpower')
|
||||
->label('ZMM INPUTPOWER'),
|
||||
ExportColumn::make('zmm_imp_od')
|
||||
->label('ZMM IMP OD'),
|
||||
ExportColumn::make('zmm_ambtemp')
|
||||
->label('ZMM AMBTEMP'),
|
||||
ExportColumn::make('zmm_de')
|
||||
->label('ZMM DE'),
|
||||
ExportColumn::make('zmm_dischargerange')
|
||||
->label('ZMM DISCHARGERANGE'),
|
||||
ExportColumn::make('zmm_efficiency_class')
|
||||
->label('ZMM EFFICIENCY CLASS'),
|
||||
ExportColumn::make('zmm_framesize')
|
||||
->label('ZMM FRAMESIZE'),
|
||||
ExportColumn::make('zmm_impellerdiameter')
|
||||
->label('ZMM IMPELLERDIAMETER'),
|
||||
ExportColumn::make('zmm_insulationclass')
|
||||
->label('ZMM INSULATIONCLASS'),
|
||||
ExportColumn::make('zmm_maxflow')
|
||||
->label('ZMM MAXFLOW'),
|
||||
ExportColumn::make('zmm_minhead')
|
||||
->label('ZMM MINHEAD'),
|
||||
ExportColumn::make('zmm_mtrlofconst')
|
||||
->label('ZMM MTRLOFCONST'),
|
||||
ExportColumn::make('zmm_nde')
|
||||
->label('ZMM NDE'),
|
||||
ExportColumn::make('zmm_powerfactor')
|
||||
->label('ZMM POWERFACTOR'),
|
||||
ExportColumn::make('zmm_tagno')
|
||||
->label('ZMM TANGO'),
|
||||
ExportColumn::make('zmm_year')
|
||||
->label('ZMM YEAR'),
|
||||
ExportColumn::make('zmm_laser_name')
|
||||
->label('ZMM LASER NAME'),
|
||||
ExportColumn::make('zmm_logo_cp')
|
||||
->label('ZMM LOGO CP'),
|
||||
ExportColumn::make('zmm_logo_ce')
|
||||
->label('ZMM LOGO CE'),
|
||||
ExportColumn::make('zmm_logo_nsf')
|
||||
->label('ZMM LOGO NSF'),
|
||||
ExportColumn::make('zmm_logo_eac')
|
||||
->label('ZMM LOGO EAC'),
|
||||
ExportColumn::make('zmm_beenote')
|
||||
->label('ZMM BEENOTE'),
|
||||
ExportColumn::make('zmm_beenumber')
|
||||
->label('ZMM BEENUMBER'),
|
||||
ExportColumn::make('zmm_beestar')
|
||||
->label('ZMM BEESTAR'),
|
||||
ExportColumn::make('zmm_codeclass')
|
||||
->label('ZMM CODECLASS'),
|
||||
ExportColumn::make('zmm_colour')
|
||||
->label('ZMM COLOUR'),
|
||||
ExportColumn::make('zmm_grade')
|
||||
->label('ZMM GRADE'),
|
||||
ExportColumn::make('zmm_grwt_pset')
|
||||
->label('ZMM GRWT PSET'),
|
||||
ExportColumn::make('zmm_grwt_cable')
|
||||
->label('ZMM GRWT CABLE'),
|
||||
ExportColumn::make('zmm_grwt_motor')
|
||||
->label('ZMM GRWT MOTOR'),
|
||||
ExportColumn::make('zmm_grwt_pf')
|
||||
->label('ZMM GRWT PF'),
|
||||
ExportColumn::make('zmm_grwt_pump')
|
||||
->label('ZMM GRWT PUMP'),
|
||||
ExportColumn::make('zmm_isivalve')
|
||||
->label('ZMM ISIVALVE'),
|
||||
ExportColumn::make('zmm_isi_wc')
|
||||
->label('ZMM ISI WC'),
|
||||
ExportColumn::make('zmm_labelperiod')
|
||||
->label('ZMM LABELPERIOD'),
|
||||
ExportColumn::make('zmm_length')
|
||||
->label('ZMM LENGTH'),
|
||||
ExportColumn::make('zmm_license_cml_no')
|
||||
->label('ZMM LICENSE CML NO'),
|
||||
ExportColumn::make('zmm_mfgmonyr')
|
||||
->label('ZMM MFGMONYR'),
|
||||
ExportColumn::make('zmm_modelyear')
|
||||
->label('ZMM MODELYEAR'),
|
||||
ExportColumn::make('zmm_motoridentification')
|
||||
->label('ZMM MOTORIDENTIFICATION'),
|
||||
ExportColumn::make('zmm_newt_pset')
|
||||
->label('ZMM NEWT PSET'),
|
||||
ExportColumn::make('zmm_newt_cable')
|
||||
->label('ZMM NEWT CABLE'),
|
||||
ExportColumn::make('zmm_newt_motor')
|
||||
->label('ZMM NEWT MOTOR'),
|
||||
ExportColumn::make('zmm_newt_pf')
|
||||
->label('ZMM NEWT PF'),
|
||||
ExportColumn::make('zmm_newt_pump')
|
||||
->label('ZMM NEWT PUMP'),
|
||||
ExportColumn::make('zmm_packtype')
|
||||
->label('ZMM PACKTYPE'),
|
||||
ExportColumn::make('zmm_panel')
|
||||
->label('ZMM PANEL'),
|
||||
ExportColumn::make('zmm_performance_factor')
|
||||
->label('ZMM PERFORMANCE FACTOR'),
|
||||
ExportColumn::make('zmm_pumpidentification')
|
||||
->label('ZMM PUMPIDENTIFICATION'),
|
||||
ExportColumn::make('zmm_psettype')
|
||||
->label('ZMM PSETTYPE'),
|
||||
ExportColumn::make('zmm_size')
|
||||
->label('ZMM SIZE'),
|
||||
ExportColumn::make('zmm_eff_ttl')
|
||||
->label('ZMM EFF TTL'),
|
||||
ExportColumn::make('zmm_type')
|
||||
->label('ZMM TYPE'),
|
||||
ExportColumn::make('zmm_usp')
|
||||
->label('ZMM USP'),
|
||||
ExportColumn::make('zmm_operating_range')
|
||||
->label('ZMM OPERATING RANGE'),
|
||||
ExportColumn::make('zmm_intake_air')
|
||||
->label('ZMM INTAKE AIR'),
|
||||
ExportColumn::make('zmm_oxygen_transfer_rate')
|
||||
->label('ZMM OXYGEN TRANSFER RATE'),
|
||||
ExportColumn::make('zmm_air_inlet_pipesize')
|
||||
->label('ZMM AIR INLET PIPESIZE'),
|
||||
ExportColumn::make('zmm_sump_depth')
|
||||
->label('ZMM SUMP DEPTH'),
|
||||
ExportColumn::make('zmm_poles')
|
||||
->label('ZMM POLES'),
|
||||
ExportColumn::make('zmm_motor_heading')
|
||||
->label('ZMM MOTOR HEADING'),
|
||||
ExportColumn::make('zmm_motor_speed')
|
||||
->label('ZMM MOTOR SPEED'),
|
||||
ExportColumn::make('zqmm_qty')
|
||||
->label('ZQMM QTY'),
|
||||
ExportColumn::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE'),
|
||||
ExportColumn::make('zmm_axial_force')
|
||||
->label('ZMM AXIAL FORCE'),
|
||||
ExportColumn::make('winded_serial_number')
|
||||
->label('WINDED SERIAL NUMBER'),
|
||||
ExportColumn::make('model_type')
|
||||
->label('MODEL TYPE'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT')
|
||||
->enabledByDefault(true),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY')
|
||||
->enabledByDefault(true),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your temp class characteristic 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;
|
||||
}
|
||||
}
|
||||
@@ -24,18 +24,18 @@ class TestingPanelReadingExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
->label('LINE'),
|
||||
ExportColumn::make('machine.name')
|
||||
->label('MACHINE NAME'),
|
||||
->label('MACHINE'),
|
||||
ExportColumn::make('motorTestingMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('motorTestingMaster.item.description')
|
||||
->label('MODEL DESCRIPTION'),
|
||||
->label('MODEL'),
|
||||
ExportColumn::make('output')
|
||||
->label('OUTPUT NAME'),
|
||||
->label('OUTPUT'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('winded_serial_number')
|
||||
@@ -125,7 +125,7 @@ class TestingPanelReadingExporter extends Exporter
|
||||
ExportColumn::make('rework_count')
|
||||
->label('REWORK COUNT'),
|
||||
ExportColumn::make('update_count')
|
||||
->label('UPDATED COUNT'),
|
||||
->label('UPDATE COUNT'),
|
||||
ExportColumn::make('output_flag')
|
||||
->label('OUTPUT FLAG'),
|
||||
ExportColumn::make('tested_by')
|
||||
@@ -146,10 +146,10 @@ class TestingPanelReadingExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your testing panel reading export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your testing panel reading 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;
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\VehicleEntry;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class VehicleEntryExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = VehicleEntry::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('boom_opened')
|
||||
->label('BOOM OPENED'),
|
||||
ExportColumn::make('vehicle_number')
|
||||
->label('VEHICLE NUMBER'),
|
||||
ExportColumn::make('entry_time')
|
||||
->label('ENTRY TIME'),
|
||||
ExportColumn::make('exit_time')
|
||||
->label('EXIT TIME'),
|
||||
ExportColumn::make('duration')
|
||||
->label('DURATION'),
|
||||
ExportColumn::make('type')
|
||||
->label('TYPE'),
|
||||
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 vehicle entry 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;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\VisitorEntry;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class VisitorEntryExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = VisitorEntry::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('register_id')
|
||||
->label('REGISTER ID'),
|
||||
ExportColumn::make('employeeMaster.name')
|
||||
->label('EMPLOYEE NAME'),
|
||||
ExportColumn::make('mobile_number')
|
||||
->label('MOBILE NUMBER'),
|
||||
ExportColumn::make('name')
|
||||
->label('VISITOR NAME'),
|
||||
ExportColumn::make('company')
|
||||
->label('COMPANY'),
|
||||
ExportColumn::make('purpose_of_visit')
|
||||
->label('PURPOSE OF VISIT'),
|
||||
ExportColumn::make('type')
|
||||
->label('TYPE'),
|
||||
ExportColumn::make('photo')
|
||||
->label('PHOTO')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('number_of_person')
|
||||
->label('NUMBER OF PERSON'),
|
||||
ExportColumn::make('in_time')
|
||||
->label('IN TIME'),
|
||||
ExportColumn::make('out_time')
|
||||
->label('OUT TIME'),
|
||||
ExportColumn::make('valid_upto')
|
||||
->label('VALID UPTO'),
|
||||
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'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your visitor entry 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;
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,12 @@ class WeightValidationExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('obd_number')
|
||||
->label('OBD / GR NUMBER'),
|
||||
->label('OBD NUMBER'),
|
||||
ExportColumn::make('line_number')
|
||||
->label('LINE NUMBER'),
|
||||
ExportColumn::make('batch_number')
|
||||
@@ -41,7 +41,7 @@ class WeightValidationExporter extends Exporter
|
||||
ExportColumn::make('vehicle_number')
|
||||
->label('VEHICLE NUMBER'),
|
||||
ExportColumn::make('bundle_number')
|
||||
->label('BUNDLE / COIL NUMBER'),
|
||||
->label('BUNDLE NUMBER'),
|
||||
ExportColumn::make('picked_weight')
|
||||
->label('PICKED WEIGHT'),
|
||||
ExportColumn::make('scanned_by')
|
||||
@@ -58,10 +58,10 @@ class WeightValidationExporter extends Exporter
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your weight validation export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your weight validation 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;
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\WindedSerialValidationError;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class WindedSerialValidationErrorExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = WindedSerialValidationError::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('item.description')
|
||||
->label('DESCRIPTION')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('item.category')
|
||||
->label('CATEGORY')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('item.uom')
|
||||
->label('UNIT OF MEASURE')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('machine.work_center')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('machine_name')
|
||||
->label('MACHINE NAME'),
|
||||
ExportColumn::make('aufnr')
|
||||
->label('AUFNR'),
|
||||
ExportColumn::make('gernr')
|
||||
->label('GERNR'),
|
||||
ExportColumn::make('model_type')
|
||||
->label('MODEL TYPE'),
|
||||
ExportColumn::make('winded_status')
|
||||
->label('WINDED STATUS'),
|
||||
ExportColumn::make('winded_qr')
|
||||
->label('WINDED QR'),
|
||||
ExportColumn::make('winded_code')
|
||||
->label('WINDED CODE'),
|
||||
ExportColumn::make('winded_serial_number')
|
||||
->label('WINDED SERIAL NUMBER'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT')
|
||||
->enabledByDefault(true),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY')
|
||||
->enabledByDefault(true),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your winded serial validation error 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;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\WireMasterPacking;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class WireMasterPackingExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = WireMasterPacking::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('customerPo.customer_po')
|
||||
->label('CUSTOMER PO NUMBER'),
|
||||
ExportColumn::make('wire_packing_number')
|
||||
->label('WIRE PACKING NUMBER'),
|
||||
ExportColumn::make('process_order')
|
||||
->label('PROCESS ORDER'),
|
||||
ExportColumn::make('batch_number')
|
||||
->label('BATCH NUMBER'),
|
||||
ExportColumn::make('weight')
|
||||
->label('WEIGHT'),
|
||||
ExportColumn::make('wire_packing_status')
|
||||
->label('WIRE PACKING STATUS'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('scanned_at')
|
||||
->label('SCANNED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('scanned_by')
|
||||
->label('SCANNED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your wire master packing export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ class WorkGroupMasterExporter extends Exporter
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
@@ -22,32 +21,32 @@ class WorkGroupMasterExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('name')
|
||||
->label('GROUP WORK CENTER'),
|
||||
->label('NAME'),
|
||||
ExportColumn::make('description')
|
||||
->label('DESCRIPTION'),
|
||||
->label('DESCRIPTION'),
|
||||
ExportColumn::make('operation_number')
|
||||
->label('OPERATION NUMBER'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
->label('OPERATION NUMBER'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your work group master export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your work group master 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;
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\Plant;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
|
||||
class AlertMailRuleImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = AlertMailRule::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('module')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Module')
|
||||
->example('ProductionQuantities/InvoiceValidation/QualityValidation/InvoiceDataReport/InvoiceTransit')
|
||||
->label('Module')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('rule_name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Rule Name')
|
||||
->example('ProductionMail/InvoiceMail/QualityMail/InvoiceDataMail/InvoiceTransitMail')
|
||||
->label('Rule Name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('email')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Email')
|
||||
->example('admin@cripumps.com,ranjith.bala@cripumps.com')
|
||||
->label('Email')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('schedule_type')
|
||||
->exampleHeader('Schedule Type')
|
||||
->example('Daily/Live/Hourly')
|
||||
->label('Schedule Type'),
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000 or All Plants')
|
||||
->label('Plant Code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('cc_emails')
|
||||
->exampleHeader('CC Email')
|
||||
->example('admin@cripumps.com,ranjith.bala@cripumps.com')
|
||||
->label('CC Email')
|
||||
->rules(['nullable', 'string']),
|
||||
//->rules(['cc_emails']),
|
||||
// ImportColumn::make('invoiceMaster')
|
||||
// ->relationship(),
|
||||
ImportColumn::make('receiving_plant_name')
|
||||
->exampleHeader('Receiving Plant Name')
|
||||
->example('BANGALORE')
|
||||
->label('Receiving Plant Name')
|
||||
->requiredMapping(),
|
||||
ImportColumn::make('transporter_name')
|
||||
->exampleHeader('Transporter Name')
|
||||
->example('SAFEXPRESS PRIVATE LIMITED')
|
||||
->label('Transporter Name')
|
||||
->requiredMapping(),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?AlertMailRule
|
||||
{
|
||||
$warnMsg = [];
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
if (strtolower($this->data['plant']) == 'all plants') {
|
||||
$this->data['plant'] = 0;
|
||||
} else {
|
||||
$plant = Plant::where('code', $this->data['plant'])->first();
|
||||
if (!$plant) {
|
||||
$warnMsg[] = "Plant code '{$this->data['plant']}' not found.";
|
||||
$this->data['plant'] = null;
|
||||
} else {
|
||||
$this->data['plant'] = $plant->id;
|
||||
}
|
||||
}
|
||||
|
||||
$receivingPlantName = $this->data['receiving_plant_name'] ?? null;
|
||||
$transporterName = $this->data['transporter_name'] ?? null;
|
||||
|
||||
if (!$receivingPlantName || !$transporterName)
|
||||
{
|
||||
$warnMsg [] = 'Both Receiving Plant Name and Transporter Name are required.';
|
||||
}
|
||||
|
||||
$invoiceMaster = \App\Models\InvoiceMaster::where('receiving_plant_name', $receivingPlantName)
|
||||
->where('transport_name', $transporterName)
|
||||
->first();
|
||||
|
||||
if (!$invoiceMaster) {
|
||||
$warnMsg [] = "Invoice Master not found for Receiving Plant '{$receivingPlantName}' and Transporter '{$transporterName}'.";
|
||||
}
|
||||
|
||||
$this->data['invoice_master_id'] = $invoiceMaster->id;
|
||||
|
||||
unset($this->data['receiving_plant_name'], $this->data['transporter_name']);
|
||||
|
||||
if(! empty($warnMsg)){
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return AlertMailRule::Create([
|
||||
'module' => $this->data['module'],
|
||||
'rule_name' => $this->data['rule_name'],
|
||||
'email' => $this->data['email'],
|
||||
'schedule_type' => $this->data['schedule_type'],
|
||||
'plant' => $this->data['plant'],
|
||||
'cc_emails' => $this->data['cc_emails'] ?? null,
|
||||
'invoice_master_id' => $invoiceMaster->id,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
|
||||
//return new AlertMailRule();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your alert mail rule 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;
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\AsrsItemValidation;
|
||||
use App\Models\Plant;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
|
||||
class AsrsItemValidationImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = AsrsItemValidation::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('item_code')
|
||||
->exampleHeader('ITEM CODE')
|
||||
->example('ITEM001')
|
||||
->label('ITEM CODE')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item_description')
|
||||
->exampleHeader('ITEM DESCRIPTION')
|
||||
->example('Item Description')
|
||||
->label('ITEM DESCRIPTION'),
|
||||
ImportColumn::make('uom')
|
||||
->exampleHeader('UOM')
|
||||
->example('EA')
|
||||
->label('UOM'),
|
||||
ImportColumn::make('material_type')
|
||||
->exampleHeader('MATERIAL TYPE')
|
||||
->example('Material Type')
|
||||
->label('MATERIAL TYPE'),
|
||||
ImportColumn::make('material_group')
|
||||
->exampleHeader('MATERIAL GROUP')
|
||||
->example('Material Group')
|
||||
->label('MATERIAL GROUP'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?AsrsItemValidation
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = trim($this->data['plant']) ?? '';
|
||||
$iCode = trim($this->data['item_code']) ?? '';
|
||||
$itemDes = trim($this->data['item_description']) ?? '';
|
||||
$uom = trim($this->data['uom']) ?? '';
|
||||
$materialType = trim($this->data['material_type']) ?? '';
|
||||
$materialGroup = trim($this->data['material_group']) ?? '';
|
||||
$createdBy = Filament::auth()->user()?->name ?? '';
|
||||
$updatedBy = $createdBy;
|
||||
|
||||
$plantId = null;
|
||||
|
||||
if ($plantCod == null || $plantCod == '' || ! $plantCod) {
|
||||
$warnMsg[] = "Plant code can't be empty!";
|
||||
} elseif (! is_numeric($plantCod)) {
|
||||
$warnMsg[] = "Plant code '{$plantCod}' should contain only numeric values!";
|
||||
} elseif (Str::length($plantCod) < 4 || Str::length($plantCod) > 7) {
|
||||
$warnMsg[] = "Plant code '{$plantCod}' must be between 4 and 7 digits only!";
|
||||
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCod)) {
|
||||
$warnMsg[] = "Invalid plant code '{$plantCod}' found!";
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found!';
|
||||
} else {
|
||||
$plantId = $plant->id;
|
||||
}
|
||||
}
|
||||
if (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||
$warnMsg[] = 'Invalid item code found';
|
||||
}
|
||||
if (Str::length($itemDes) < 5) {
|
||||
$warnMsg[] = 'Invalid description found';
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return AsrsItemValidation::updateOrCreate([
|
||||
'item_code' => $iCode,
|
||||
'plant_id' => $plant->id,
|
||||
],
|
||||
[
|
||||
'item_description' => $itemDes,
|
||||
'uom' => trim($this->data['uom']),
|
||||
'material_type' => $materialType,
|
||||
'material_group' => $materialGroup,
|
||||
'created_by' => $createdBy,
|
||||
'updated_by' => $updatedBy,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your asrs item validation 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;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Notification;
|
||||
use Str;
|
||||
|
||||
class BlockImporter extends Importer
|
||||
@@ -19,16 +20,16 @@ class BlockImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('BLOCK NAME')
|
||||
->exampleHeader('Block Name')
|
||||
->example('Block A')
|
||||
->label('BLOCK NAME')
|
||||
->label('Block Name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('PLANT CODE')
|
||||
->example('1000')
|
||||
->label('PLANT CODE')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
];
|
||||
}
|
||||
@@ -36,28 +37,21 @@ class BlockImporter extends Importer
|
||||
public function resolveRecord(): ?Block
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = $this->data['plant'];
|
||||
$plant = null;
|
||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found';
|
||||
// $warnMsg[] = "Plant '" . $plantCod . "' not found";
|
||||
}
|
||||
$plant = Plant::where('name', $this->data['plant'])->first();
|
||||
if (!$plant) {
|
||||
$warnMsg[] = "Plant not found";
|
||||
// $warnMsg[] = "Plant '" . $this->data['plant'] . "' not found";
|
||||
}
|
||||
if (Str::length($this->data['name']) < 0) {
|
||||
$warnMsg[] = 'Block name not found';
|
||||
$warnMsg[] = "Block name not found";
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return Block::updateOrCreate([
|
||||
'name' => $this->data['name'],
|
||||
'plant_id' => $plant->id,
|
||||
'plant_id' => $plant->id
|
||||
]);
|
||||
// return Block::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
@@ -69,10 +63,10 @@ class BlockImporter extends Importer
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your block import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your block 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.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\CharacteristicApproverMaster;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
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 CharacteristicApproverMasterImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = CharacteristicApproverMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->examples(['1000', '1000'])
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Work Center')
|
||||
->examples(['RMGLAS02', 'RMGLAS02'])
|
||||
->label('Work Center')
|
||||
->relationship(resolveUsing: 'work_center')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('approver_type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Type')
|
||||
->examples(['Characteristic', 'Quality'])
|
||||
->label('Approver Type'),
|
||||
ImportColumn::make('machine_name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Machine Name')
|
||||
->examples(['15002635', '17002635'])
|
||||
->label('Machine Name'),
|
||||
ImportColumn::make('characteristic_field')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Master Characteristic Field')
|
||||
->examples(['NIL', 'MV SERIES'])
|
||||
->label('Master Characteristic Field'),
|
||||
ImportColumn::make('name1')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Name 1')
|
||||
->examples(['Test 1', 'Test 4'])
|
||||
->label('Approver Name 1'),
|
||||
ImportColumn::make('mail1')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail 1')
|
||||
->examples(['test1@cripumps.com', 'test4@cripumps.com'])
|
||||
->label('Mail 1'),
|
||||
ImportColumn::make('duration1')
|
||||
->numeric()
|
||||
->requiredMapping()
|
||||
->exampleHeader('Duration 1')
|
||||
->examples(['0.05', '0.30'])
|
||||
->label('Duration 1'),
|
||||
ImportColumn::make('name2')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Name 2')
|
||||
->examples(['Test 2', 'Test 5'])
|
||||
->label('Approver Name 2'),
|
||||
ImportColumn::make('mail2')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail 2')
|
||||
->examples(['test2@cripumps.com', 'test5@cripumps.com'])
|
||||
->label('Mail 2'),
|
||||
ImportColumn::make('duration2')
|
||||
->numeric()
|
||||
->requiredMapping()
|
||||
->exampleHeader('Duration 2')
|
||||
->examples(['0.05', '0.30'])
|
||||
->label('Duration 2'),
|
||||
ImportColumn::make('name3')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Name 3')
|
||||
->examples(['Test 3', 'Test 6'])
|
||||
->label('Approver Name 3'),
|
||||
ImportColumn::make('mail3')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail 3')
|
||||
->examples(['test3@cripumps.com', 'test6@cripumps.com'])
|
||||
->label('Mail 3'),
|
||||
ImportColumn::make('duration3')
|
||||
->numeric()
|
||||
->requiredMapping()
|
||||
->exampleHeader('Duration 3')
|
||||
->examples(['0.05', '0.30'])
|
||||
->label('Duration 3'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?CharacteristicApproverMaster
|
||||
{
|
||||
// return CharacteristicApproverMaster::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
$warnMsg = [];
|
||||
$plantCod = trim($this->data['plant']) ?? null;
|
||||
$workCenter = trim($this->data['machine']) ?? null;
|
||||
$apprTyp = trim($this->data['approver_type']) ?? null;
|
||||
$machineNam = trim($this->data['machine_name']) ?? null;
|
||||
$mastCharFld = trim($this->data['characteristic_field']) ?? null; // zmm_pumpseries
|
||||
$apprNam1 = trim($this->data['name1']) ?? null;
|
||||
$apprMail1 = trim($this->data['mail1']) ?? null;
|
||||
$apprDur1 = trim($this->data['duration1']) ?? 0.01;
|
||||
$apprNam2 = trim($this->data['name2']) ?? null;
|
||||
$apprMail2 = trim($this->data['mail2']) ?? null;
|
||||
$apprDur2 = trim($this->data['duration2']) ?? 0.01;
|
||||
$apprNam3 = trim($this->data['name3']) ?? null;
|
||||
$apprMail3 = trim($this->data['mail3']) ?? null;
|
||||
$apprDur3 = trim($this->data['duration3']) ?? 0.01;
|
||||
$createdBy = Filament::auth()->user()->name;
|
||||
$updatedBy = $createdBy;
|
||||
|
||||
$plantId = null;
|
||||
$machineId = null;
|
||||
|
||||
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 ($workCenter == null || $workCenter == '') {
|
||||
$warnMsg[] = "Work center can't be empty!";
|
||||
}
|
||||
if ($apprTyp == '' || $apprTyp == null || ($apprTyp != 'Characteristic' && $apprTyp != 'Quality')) {
|
||||
$warnMsg[] = "Approver type must be either 'Characteristic' or 'Quality'!";
|
||||
}
|
||||
if ($machineNam == null || $machineNam == '') {
|
||||
$warnMsg[] = "Machine name can't be empty!";
|
||||
}
|
||||
if ($mastCharFld == null || $mastCharFld == '') {
|
||||
$mastCharFld = 'NIL';
|
||||
}
|
||||
if ($apprNam1 == null || $apprNam1 == '') {
|
||||
$warnMsg[] = "Approver name 1 can't be empty!";
|
||||
}
|
||||
if ($apprMail1 == null || $apprMail1 == '') {
|
||||
$warnMsg[] = "Approver email 1 can't be empty!";
|
||||
}
|
||||
if (! is_numeric($apprDur1)) {
|
||||
$warnMsg[] = 'Duration 1 must be a numeric value (HH.MM)!';
|
||||
}
|
||||
if ($apprDur2 != null && $apprDur2 != '' && ! is_numeric($apprDur2)) {
|
||||
$warnMsg[] = 'Duration 2 must be a numeric value (HH.MM)!';
|
||||
}
|
||||
if ($apprDur3 != null && $apprDur3 != '' && ! is_numeric($apprDur3)) {
|
||||
$warnMsg[] = 'Duration 3 must be a numeric value (HH.MM)!';
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant code not found!';
|
||||
} else {
|
||||
$plantId = $plant->id;
|
||||
|
||||
$machine = Machine::where('work_center', $workCenter)->first();
|
||||
if (! $machine) {
|
||||
$warnMsg[] = 'Work center not found!';
|
||||
} else {
|
||||
$machine = Machine::where('work_center', $workCenter)->where('plant_id', $plantId)->first();
|
||||
|
||||
if (! $machine) {
|
||||
$warnMsg[] = 'Work center not found for the given plant!';
|
||||
} else {
|
||||
$machineId = $machine->id;
|
||||
}
|
||||
}
|
||||
|
||||
$getCreatedBy = CharacteristicApproverMaster::where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
->where('approver_type', $apprTyp)
|
||||
->where('machine_name', $machineNam)
|
||||
->where('characteristic_field', $mastCharFld)
|
||||
->first()?->created_by;
|
||||
|
||||
if ($getCreatedBy) {
|
||||
$createdBy = $getCreatedBy;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
CharacteristicApproverMaster::updateOrCreate(
|
||||
[
|
||||
'plant_id' => $plantId,
|
||||
'machine_id' => $machineId,
|
||||
'approver_type' => $apprTyp,
|
||||
'machine_name' => $machineNam,
|
||||
'characteristic_field' => $mastCharFld,
|
||||
],
|
||||
[
|
||||
'name1' => $apprNam1,
|
||||
'mail1' => $apprMail1,
|
||||
'duration1' => $apprDur1,
|
||||
'name2' => $apprNam2,
|
||||
'mail2' => $apprMail2,
|
||||
'duration2' => $apprDur2,
|
||||
'name3' => $apprNam3,
|
||||
'mail3' => $apprMail3,
|
||||
'duration3' => $apprDur3,
|
||||
'created_by' => $createdBy,
|
||||
'updated_by' => $updatedBy,
|
||||
]);
|
||||
|
||||
return null;
|
||||
|
||||
// return new CharacteristicApproverMaster;
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your characteristic approver master 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;
|
||||
}
|
||||
}
|
||||
@@ -1,372 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\CharacteristicValue;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProcessOrder;
|
||||
use App\Models\ProductCharacteristicsMaster;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
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 CharacteristicValueImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = CharacteristicValue::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('line')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Line Name')
|
||||
->example('4 inch pump line')
|
||||
->label('Line Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Item Code')
|
||||
->example('123456')
|
||||
->label('Item Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Work Center')
|
||||
->example('RMGS09745')
|
||||
->label('Work Center')
|
||||
->relationship(resolveUsing: 'work_center')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('process_order')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Process Order')
|
||||
->example('23455256352')
|
||||
->label('Process Order'),
|
||||
ImportColumn::make('coil_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Coil Number')
|
||||
->example('0')
|
||||
->label('Coil Number'),
|
||||
ImportColumn::make('status')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Status')
|
||||
->example('Ok')
|
||||
->label('Status'),
|
||||
ImportColumn::make('observed_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Observed Value')
|
||||
->example('RAW01234')
|
||||
->label('Observed Value'),
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Created By')
|
||||
->example('RAW01234')
|
||||
->label('Created By'),
|
||||
ImportColumn::make('created_at')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Created DateTime')
|
||||
->example('01-01-2025 08:00:00')
|
||||
->label('Created DateTime')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_at')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Updated DateTime')
|
||||
->example('01-01-2025 08:00:00')
|
||||
->label('Updated DateTime')
|
||||
->rules(['required']),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?CharacteristicValue
|
||||
{
|
||||
// return CharacteristicValue::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
$warnMsg = [];
|
||||
$plantId = null;
|
||||
$itemId = null;
|
||||
$lineId = null;
|
||||
$machineId = null;
|
||||
// $itemAgainstPlant = null;
|
||||
|
||||
$plantCode = $this->data['plant'];
|
||||
$processOrder = trim($this->data['process_order'] ?? '');
|
||||
$iCode = trim($this->data['item']);
|
||||
$workCenter = trim($this->data['machine']);
|
||||
$lineName = trim($this->data['line']);
|
||||
$coilNo = trim($this->data['coil_number']);
|
||||
$obserVal = trim($this->data['observed_value']);
|
||||
$status = trim($this->data['status']);
|
||||
$createdBy = trim($this->data['created_by']);
|
||||
|
||||
if ($plantCode == null || $plantCode == '') {
|
||||
$warnMsg[] = 'Plant code cannot be empty';
|
||||
} elseif ($iCode == null || $iCode == '') {// process_order
|
||||
$warnMsg[] = 'Item code cannot be empty';
|
||||
} elseif ($processOrder == null || $processOrder == '') {//
|
||||
$warnMsg[] = 'Process Order cannot be empty';
|
||||
} elseif ($workCenter == null || $workCenter == '') {
|
||||
$warnMsg[] = 'Work center cannot be empty';
|
||||
} elseif ($lineName == null || $lineName == '') {
|
||||
$warnMsg[] = 'Line name cannot be empty';
|
||||
} elseif ($coilNo == null || $coilNo == '') {
|
||||
$warnMsg[] = 'Coil number cannot be empty';
|
||||
} elseif ($obserVal == null || $obserVal == '') {
|
||||
$warnMsg[] = 'Observed value cannot be empty';
|
||||
} elseif ($status == null || $status == '') {
|
||||
$warnMsg[] = 'Status cannot be empty';
|
||||
}
|
||||
|
||||
if (Str::length($plantCode) > 0 && (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode))) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found';
|
||||
} else {
|
||||
$plantId = $plant->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (Str::length($iCode) > 0 && (Str::length($iCode) < 6 || ! ctype_alnum($iCode))) {
|
||||
$warnMsg[] = 'Invalid item code found';
|
||||
} else {
|
||||
$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', $lineName)->first();
|
||||
if (! $lineExists) {
|
||||
$warnMsg[] = 'Line name not found';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$lineAgainstPlant = Line::where('name', $lineName)->where('plant_id', $plantId)->first();
|
||||
if (! $lineAgainstPlant) {
|
||||
$warnMsg[] = 'Line name not found for the given plant';
|
||||
} else {
|
||||
$lineId = $lineAgainstPlant->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$workCenterExist = Machine::where('work_center', $workCenter)->first();
|
||||
if (! $workCenterExist) {
|
||||
$warnMsg[] = 'Work Center not found';
|
||||
}
|
||||
|
||||
// $workCenterAgainstPlant = Machine::where('work_center', $workCenter)
|
||||
// ->where('plant_id', $plantId)
|
||||
// ->first();
|
||||
|
||||
// if (!$workCenterAgainstPlant) {
|
||||
// $warnMsg[] = 'Work center not found for the given plant';
|
||||
// } else {
|
||||
// $MachineId = $workCenterAgainstPlant->id;
|
||||
// }
|
||||
|
||||
if ($plantId != null && $lineId != null) {
|
||||
$machineAgaPlantLine = Machine::where('plant_id', $plantId)
|
||||
->where('line_id', $lineId)
|
||||
->where('work_center', $workCenter)
|
||||
->first();
|
||||
|
||||
if (! $machineAgaPlantLine) {
|
||||
$warnMsg[] = 'Work center not found for the given plant and line';
|
||||
} else {
|
||||
$machineId = $machineAgaPlantLine->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (Str::length($coilNo) > 0 && ! is_numeric($coilNo)) {
|
||||
$warnMsg[] = 'Coil number should contain only numeric values!';
|
||||
}
|
||||
|
||||
if (Str::length($obserVal) > 0 && ! is_numeric($obserVal)) {
|
||||
$warnMsg[] = 'Observed value should contain only numeric values!';
|
||||
}
|
||||
|
||||
if (Str::length($status) > 0 && ! in_array($status, ['Ok', 'NotOk'], true)) {
|
||||
$warnMsg[] = "Status must be either 'Ok' or 'NotOk'!";
|
||||
}
|
||||
// else {
|
||||
// if (Str::length($status) <= 0 || ! is_numeric($status) || ! preg_match('/^\d+(\.\d+)?$/', $status)
|
||||
// ) {
|
||||
// $status = 'NotOk';
|
||||
// } else {
|
||||
// $specVal = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('item_id', $itemId)->where('line_id', $lineId)->where('machine_id', $machineId)->first();
|
||||
// if (! $specVal) {
|
||||
// $status = 'NotOk';
|
||||
// }
|
||||
|
||||
// $lowLimit = $specVal?->lower ?? 0;
|
||||
// $uppLimit = $specVal?->upper ?? 0;
|
||||
|
||||
// if (Str::length($lowLimit) <= 0 || ! is_numeric($lowLimit) || ! preg_match('/^\d+(\.\d+)?$/', $lowLimit)
|
||||
// ) {
|
||||
// $status = 'NotOk';
|
||||
// } elseif (Str::length($uppLimit) <= 0 || ! is_numeric($uppLimit) || ! preg_match('/^\d+(\.\d+)?$/', $uppLimit)
|
||||
// ) {
|
||||
// $status = 'NotOk';
|
||||
// }
|
||||
|
||||
// if (($lowLimit == 0 && $uppLimit == 0) || ($uppLimit == 0)) {
|
||||
// $status = 'NotOk';
|
||||
// }
|
||||
|
||||
// if ($lowLimit > $obserVal || $uppLimit < $obserVal) {
|
||||
// $status = 'NotOk';
|
||||
// }
|
||||
// $status = 'Ok';
|
||||
// }
|
||||
// }
|
||||
|
||||
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
||||
$warnMsg[] = 'Created By cannot be empty';
|
||||
}
|
||||
|
||||
if ($plantId) {
|
||||
$user = User::where('name', $createdBy)->first();
|
||||
|
||||
$userPlant = User::where('name', $createdBy)->where('plant_id', $plantId)->first();
|
||||
|
||||
if (! $user) {
|
||||
$warnMsg[] = 'Created By user name not found!';
|
||||
} elseif (! $userPlant && ! $user->hasRole('Super Admin')) {
|
||||
$warnMsg[] = "Created By user '{$createdBy}' not found for Plant '{$plantCode}'!";
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Process Quality Manager', 'Process Manager', 'Process Supervisor', 'Process Employee'])) {
|
||||
$warnMsg[] = 'Created By user does not have rights!';
|
||||
}
|
||||
}
|
||||
|
||||
if ($plantId && $processOrder) {
|
||||
$existing = CharacteristicValue::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
$warnMsg[] = "Coil number '{$coilNo}' already exists for Plant '{$plantCode}' and Process Order '{$processOrder}'.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($plant && $itemCode && $processOrder != '' && $processOrder != null) {
|
||||
|
||||
$existingOrder = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->first();
|
||||
|
||||
if ($existingOrder && $existingOrder->item_id !== ($itemId ?? null)) {
|
||||
$warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code';
|
||||
}
|
||||
}
|
||||
|
||||
$updatedBy = Filament::auth()->user()->name; // ?? 'Admin'
|
||||
if (! $updatedBy) {
|
||||
$warnMsg[] = 'Invalid updated by user name found';
|
||||
}
|
||||
|
||||
$fromDate = $this->data['created_at'];
|
||||
$toDate = $this->data['updated_at'];
|
||||
|
||||
$formats = ['d-m-Y H:i', 'd-m-Y H:i:s']; // '07-05-2025 08:00' or '07-05-2025 08:00:00'
|
||||
|
||||
$fdateTime = null;
|
||||
$tdateTime = null;
|
||||
// Try parsing with multiple formats
|
||||
foreach ($formats as $format) {
|
||||
try {
|
||||
$fdateTime = Carbon::createFromFormat($format, $fromDate);
|
||||
break;
|
||||
} catch (\Exception $e) {
|
||||
// $warnMsg[] = "Date format mismatch with format: $format";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($formats as $format) {
|
||||
try {
|
||||
$tdateTime = Carbon::createFromFormat($format, $toDate);
|
||||
break;
|
||||
} catch (\Exception $e) {
|
||||
// $warnMsg[] = "Date format mismatch with format: $format";
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($fdateTime)) {
|
||||
$warnMsg[] = "Invalid 'Created DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
|
||||
}
|
||||
if (! isset($tdateTime)) {
|
||||
$warnMsg[] = "Invalid 'Updated DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
|
||||
}
|
||||
|
||||
if (isset($fdateTime) && isset($tdateTime)) {
|
||||
if ($fdateTime->greaterThan($tdateTime)) {
|
||||
$warnMsg[] = "'Created DataTime' is greater than 'Updated DateTime'.";
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return CharacteristicValue::updateOrCreate([
|
||||
'plant_id' => $plantId,
|
||||
'process_order' => $processOrder,
|
||||
'coil_number' => $coilNo,
|
||||
],
|
||||
[
|
||||
'item_id' => $itemId,
|
||||
'line_id' => $lineId,
|
||||
'machine_id' => $machineId,
|
||||
'status' => $status,
|
||||
'observed_value' => $obserVal,
|
||||
'created_by' => $createdBy,
|
||||
'updated_by' => $updatedBy,
|
||||
'created_at' => $fdateTime->format('Y-m-d H:i:s'),
|
||||
'updated_at' => $tdateTime->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
|
||||
// return null;
|
||||
|
||||
// return new CharacteristicValue;
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your characteristic value 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;
|
||||
}
|
||||
}
|
||||
@@ -20,10 +20,10 @@ class CheckPointNameImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('name')
|
||||
->requiredMapping()
|
||||
@@ -43,33 +43,27 @@ class CheckPointNameImporter extends Importer
|
||||
public function resolveRecord(): ?CheckPointName
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = $this->data['plant'];
|
||||
$plant = null;
|
||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found'; // '" . $plantCod . "'
|
||||
}
|
||||
$plant = Plant::where('name', $this->data['plant'])->first();
|
||||
if (!$plant) {
|
||||
$warnMsg[] = "Plant not found"; // '" . $this->data['plant'] . "'
|
||||
}
|
||||
if (Str::length($this->data['name']) < 3) { // || !ctype_alnum($this->data['name'])
|
||||
$warnMsg[] = 'Invalid check point name found';
|
||||
$warnMsg[] = "Invalid check point name found";
|
||||
}
|
||||
$createdBy = $this->data['created_by'];
|
||||
if (Str::length($createdBy) < 3) { // || !ctype_alnum($createdBy)
|
||||
$warnMsg[] = 'Invalid created by name found';
|
||||
$warnMsg[] = "Invalid created by name found";
|
||||
}
|
||||
if (! empty($warnMsg)) {
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return CheckPointName::updateOrCreate([
|
||||
'name' => $this->data['name'],
|
||||
'plant_id' => $plant->id,
|
||||
],
|
||||
[
|
||||
'created_by' => $this->data['created_by'],
|
||||
'plant_id' => $plant->id
|
||||
],
|
||||
[
|
||||
'created_by' => $this->data['created_by']
|
||||
]
|
||||
);
|
||||
// // return CheckPointName::firstOrNew([
|
||||
@@ -82,10 +76,10 @@ class CheckPointNameImporter extends Importer
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your check point name import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your check point name 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.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -21,10 +21,10 @@ class CheckPointTimeImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('checkPointNames1')
|
||||
->requiredMapping()
|
||||
@@ -73,51 +73,50 @@ class CheckPointTimeImporter extends Importer
|
||||
public function resolveRecord(): ?CheckPointTime
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = $this->data['plant'];
|
||||
$plant = null;
|
||||
$plant = Plant::where('name', $this->data['plant'])->first();
|
||||
$checkPointNames1 = null;
|
||||
$checkPointNames2 = null;
|
||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found'; // '" . $plantCod . "'
|
||||
} else {
|
||||
$checkPointNames1 = CheckPointName::where('name', $this->data['checkPointNames1'])->first();
|
||||
if (! $checkPointNames1) {
|
||||
$warnMsg[] = 'Check point 1 not found';
|
||||
} else {
|
||||
$checkPointNames2 = CheckPointName::where('name', $this->data['checkPointNames2'])->first();
|
||||
if (! $checkPointNames2) {
|
||||
$warnMsg[] = 'Check point 2 not found';
|
||||
} else {
|
||||
if ($checkPointNames1->id === $checkPointNames2->id) {
|
||||
$warnMsg[] = "Check point 1 and 2 can't be the same";
|
||||
}
|
||||
if (!$plant) {
|
||||
$warnMsg[] = "Plant not found"; // '" . $this->data['plant'] . "'
|
||||
}
|
||||
else
|
||||
{
|
||||
$checkPointNames1 = CheckPointName::where('name', $this->data['checkPointNames1'])->first();
|
||||
if (!$checkPointNames1) {
|
||||
$warnMsg[] = "Check point 1 not found";
|
||||
}
|
||||
else
|
||||
{
|
||||
$checkPointNames2 = CheckPointName::where('name', $this->data['checkPointNames2'])->first();
|
||||
if (!$checkPointNames2) {
|
||||
$warnMsg[] = "Check point 2 not found";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($checkPointNames1->id === $checkPointNames2->id) {
|
||||
$warnMsg[] = "Check point 1 and 2 can't be the same";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Str::length($this->data['sequence_number']) < 1 || ! is_numeric($this->data['sequence_number']) || $this->data['sequence_number'] <= 0) {
|
||||
$warnMsg[] = 'Invalid sequence number found';
|
||||
if (Str::length($this->data['sequence_number']) < 1 || !is_numeric($this->data['sequence_number']) || $this->data['sequence_number'] <= 0) {
|
||||
$warnMsg[] = "Invalid sequence number found";
|
||||
}
|
||||
|
||||
if (Str::length($this->data['time_lapse']) < 1 || ! is_numeric($this->data['time_lapse']) || $this->data['time_lapse'] <= 0) {
|
||||
$warnMsg[] = 'Invalid time lapse found';
|
||||
if (Str::length($this->data['time_lapse']) < 1 || !is_numeric($this->data['time_lapse']) || $this->data['time_lapse'] <= 0) {
|
||||
$warnMsg[] = "Invalid time lapse found";
|
||||
}
|
||||
|
||||
if (Str::length($this->data['time_lapse_cushioning']) < 1 || ! is_numeric($this->data['time_lapse_cushioning']) || $this->data['time_lapse_cushioning'] <= 0) {
|
||||
$warnMsg[] = 'Invalid time lapse cushioning found';
|
||||
if (Str::length($this->data['time_lapse_cushioning']) < 1 || !is_numeric($this->data['time_lapse_cushioning']) || $this->data['time_lapse_cushioning'] <= 0) {
|
||||
$warnMsg[] = "Invalid time lapse cushioning found";
|
||||
}
|
||||
|
||||
$createdBy = $this->data['created_by'];
|
||||
if (Str::length($createdBy) < 3) { // || !ctype_alnum($createdBy)
|
||||
$warnMsg[] = 'Invalid created by name found';
|
||||
$warnMsg[] = "Invalid created by name found";
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
@@ -125,12 +124,12 @@ class CheckPointTimeImporter extends Importer
|
||||
'plant_id' => $plant->id,
|
||||
'check_point1_id' => $checkPointNames1->id,
|
||||
'check_point2_id' => $checkPointNames2->id,
|
||||
'sequence_number' => $this->data['sequence_number'],
|
||||
'sequence_number' => $this->data['sequence_number']
|
||||
],
|
||||
[
|
||||
'time_lapse' => $this->data['time_lapse'],
|
||||
'time_lapse_cushioning' => $this->data['time_lapse_cushioning'],
|
||||
'created_by' => $this->data['created_by'],
|
||||
[
|
||||
'time_lapse' => $this->data['time_lapse'],
|
||||
'time_lapse_cushioning' => $this->data['time_lapse_cushioning'],
|
||||
'created_by' => $this->data['created_by']
|
||||
]
|
||||
);
|
||||
// // return CheckPointTime::firstOrNew([
|
||||
@@ -143,10 +142,10 @@ class CheckPointTimeImporter extends Importer
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your check point time import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your check point time 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.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -1,773 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\ClassCharacteristic;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class ClassCharacteristicImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = ClassCharacteristic::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('aufnr')
|
||||
->label('AUFNR')
|
||||
->exampleHeader('AUFNR')
|
||||
->example('1234567'),
|
||||
ImportColumn::make('class')
|
||||
->label('CLASS')
|
||||
->exampleHeader('CLASS')
|
||||
->example('ZLASER'),
|
||||
ImportColumn::make('arbid')
|
||||
->label('ARBID')
|
||||
->exampleHeader('ARBID')
|
||||
->example('LASER'),
|
||||
ImportColumn::make('gamng')
|
||||
->label('GAMNG')
|
||||
->exampleHeader('GAMNG')
|
||||
->example('1.000'),
|
||||
ImportColumn::make('lmnga')
|
||||
->label('LMNGA')
|
||||
->exampleHeader('LMNGA')
|
||||
->example('1'),
|
||||
ImportColumn::make('gernr')
|
||||
->label('GERNR')
|
||||
->exampleHeader('GERNR')
|
||||
->example('12345678901234'),
|
||||
ImportColumn::make('zz1_cn_bill_ord')
|
||||
->label('ZZ1 CN BILL ORD')
|
||||
->exampleHeader('ZZ1 CN BILL ORD')
|
||||
->example('INDIA'),
|
||||
ImportColumn::make('zmm_amps')
|
||||
->label('ZMM AMPS')
|
||||
->exampleHeader('ZMM AMPS')
|
||||
->example('11A'),
|
||||
ImportColumn::make('zmm_brand')
|
||||
->label('ZMM BRAND')
|
||||
->exampleHeader('ZMM BRAND')
|
||||
->example('CRI'),
|
||||
ImportColumn::make('zmm_degreeofprotection')
|
||||
->label('ZMM DEGREEOFPROTECTION')
|
||||
->exampleHeader('ZMM DEGREEOFPROTECTION')
|
||||
->example('IP55'),
|
||||
ImportColumn::make('zmm_delivery')
|
||||
->label('ZMM DELIVERY')
|
||||
->exampleHeader('ZMM DELIVERY')
|
||||
->example('65MM'),
|
||||
ImportColumn::make('zmm_dir_rot')
|
||||
->label('ZMM DIR ROT')
|
||||
->exampleHeader('ZMM DIR ROT')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_discharge')
|
||||
->label('ZMM DISCHARGE')
|
||||
->exampleHeader('ZMM DISCHARGE')
|
||||
->example('17m³/h'),
|
||||
ImportColumn::make('zmm_discharge_max')
|
||||
->label('ZMM DISCHARGE MAX')
|
||||
->exampleHeader('ZMM DISCHARGE MAX')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_discharge_min')
|
||||
->label('ZMM DISCHARGE MIN')
|
||||
->exampleHeader('ZMM DISCHARGE MIN')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_duty')
|
||||
->label('ZMM DUTY')
|
||||
->exampleHeader('ZMM DUTY')
|
||||
->example('DUTY S1'),
|
||||
ImportColumn::make('zmm_eff_motor')
|
||||
->label('ZMM EFF MOTOR')
|
||||
->exampleHeader('ZMM EFF MOTOR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_eff_pump')
|
||||
->label('ZMM EFF PUMP')
|
||||
->exampleHeader('ZMM EFF PUMP')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_frequency')
|
||||
->label('ZMM FREQUENCY')
|
||||
->exampleHeader('ZMM FREQUENCY')
|
||||
->example('50Hz'),
|
||||
ImportColumn::make('zmm_head')
|
||||
->label('ZMM HEAD')
|
||||
->exampleHeader('ZMM HEAD')
|
||||
->example('77M'),
|
||||
ImportColumn::make('zmm_heading')
|
||||
->label('ZMM HEADING')
|
||||
->exampleHeader('ZMM HEADING')
|
||||
->example('PRESSURE BOOSTER SYSTEM'),
|
||||
ImportColumn::make('zmm_head_max')
|
||||
->label('ZMM HEAD MAX')
|
||||
->exampleHeader('ZMM HEAD MAX')
|
||||
->example('96m'),
|
||||
ImportColumn::make('zmm_head_minimum')
|
||||
->label('ZMM HEAD MINIMUM')
|
||||
->exampleHeader('ZMM HEAD MINIMUM')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_idx_eff_mtr')
|
||||
->label('ZMM IDX EFF MTR')
|
||||
->exampleHeader('ZMM IDX EFF MTR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_idx_eff_pump')
|
||||
->label('ZMM IDX EFF PUMP')
|
||||
->exampleHeader('ZMM IDX EFF PUMP')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_kvacode')
|
||||
->label('ZMM KVACODE')
|
||||
->exampleHeader('ZMM KVACODE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_maxambtemp')
|
||||
->label('ZMM MAXAMBTEMP')
|
||||
->exampleHeader('ZMM MAXAMBTEMP')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_mincoolingflow')
|
||||
->label('ZMM MINCOOLINGFLOW')
|
||||
->exampleHeader('ZMM MINCOOLINGFLOW')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_motorseries')
|
||||
->label('ZMM MOTORSERIES')
|
||||
->exampleHeader('ZMM MOTORSERIES')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_motor_model')
|
||||
->label('ZMM MOTOR MODEL')
|
||||
->exampleHeader('ZMM MOTOR MODEL')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_outlet')
|
||||
->label('ZMM OUTLET')
|
||||
->exampleHeader('ZMM OUTLET')
|
||||
->example('IE2'),
|
||||
ImportColumn::make('zmm_phase')
|
||||
->label('ZMM PHASE')
|
||||
->exampleHeader('ZMM PHASE')
|
||||
->example('3Ph'),
|
||||
ImportColumn::make('zmm_pressure')
|
||||
->label('ZMM PRESSURE')
|
||||
->exampleHeader('ZMM PRESSURE')
|
||||
->example('16bar'),
|
||||
ImportColumn::make('zmm_pumpflowtype')
|
||||
->label('ZMM PUMPFLOWTYPE')
|
||||
->exampleHeader('ZMM PUMPFLOWTYPE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pumpseries')
|
||||
->label('ZMM PUMPSERIES')
|
||||
->exampleHeader('ZMM PUMPSERIES')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pump_model')
|
||||
->label('ZMM PUMP MODEL')
|
||||
->exampleHeader('ZMM PUMP MODEL')
|
||||
->example('MVHS-15/07TR'),
|
||||
ImportColumn::make('zmm_ratedpower')
|
||||
->label('ZMM RATEDPOWER')
|
||||
->exampleHeader('ZMM RATEDPOWER')
|
||||
->example('5.5kW/7.5HP'),
|
||||
ImportColumn::make('zmm_region')
|
||||
->label('ZMM REGION')
|
||||
->exampleHeader('ZMM REGION')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_servicefactor')
|
||||
->label('ZMM SERVICEFACTOR')
|
||||
->exampleHeader('ZMM SERVICEFACTOR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_servicefactormaximumamps')
|
||||
->label('ZMM SERVICEFACTORMAXIMUMAMPS')
|
||||
->exampleHeader('ZMM SERVICEFACTORMAXIMUMAMPS')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_speed')
|
||||
->label('ZMM SPEED')
|
||||
->exampleHeader('ZMM SPEED')
|
||||
->example('2900rpm'),
|
||||
ImportColumn::make('zmm_suction')
|
||||
->label('ZMM SUCTION')
|
||||
->exampleHeader('ZMM SUCTION')
|
||||
->example('65mm'),
|
||||
ImportColumn::make('zmm_suctionxdelivery')
|
||||
->label('ZMM SUCTIONXDELIVERY')
|
||||
->exampleHeader('ZMM SUCTIONXDELIVERY')
|
||||
->example('50 x 50mm'),
|
||||
ImportColumn::make('zmm_supplysource')
|
||||
->label('ZMM SUPPLYSOURCE')
|
||||
->exampleHeader('ZMM SUPPLYSOURCE')
|
||||
->example('AC SUPPLY'),
|
||||
ImportColumn::make('zmm_temperature')
|
||||
->label('ZMM TEMPERATURE')
|
||||
->exampleHeader('ZMM TEMPERATURE')
|
||||
->example('90°C'),
|
||||
ImportColumn::make('zmm_thrustload')
|
||||
->label('ZMM THRUSTLOAD')
|
||||
->exampleHeader('ZMM THRUSTLOAD')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_volts')
|
||||
->label('ZMM VOLTS')
|
||||
->exampleHeader('ZMM VOLTS')
|
||||
->example('415V'),
|
||||
ImportColumn::make('zmm_wire')
|
||||
->label('ZMM WIRE')
|
||||
->exampleHeader('ZMM WIRE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_package')
|
||||
->label('ZMM PACKAGE')
|
||||
->exampleHeader('ZMM PACKAGE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pvarrayrating')
|
||||
->label('ZMM PVARRAYRATING')
|
||||
->exampleHeader('ZMM PVARRAYRATING')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isi')
|
||||
->label('ZMM ISI')
|
||||
->exampleHeader('ZMM ISI')
|
||||
->example('Y'),
|
||||
ImportColumn::make('zmm_isimotor')
|
||||
->label('ZMM ISIMOTOR')
|
||||
->exampleHeader('ZMM ISIMOTOR')
|
||||
->example('IS:12615'),
|
||||
ImportColumn::make('zmm_isipump')
|
||||
->label('ZMM ISIPUMP')
|
||||
->exampleHeader('ZMM ISIPUMP')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isipumpset')
|
||||
->label('ZMM ISIPUMPSET')
|
||||
->exampleHeader('ZMM ISIPUMPSET')
|
||||
->example('IS:12615'),
|
||||
ImportColumn::make('zmm_pumpset_model')
|
||||
->label('ZMM PUMPSET MODEL')
|
||||
->exampleHeader('ZMM PUMPSET MODEL')
|
||||
->example('MVHS-15/07TR'),
|
||||
ImportColumn::make('zmm_stages')
|
||||
->label('ZMM STAGES')
|
||||
->exampleHeader('ZMM STAGES')
|
||||
->example('7'),
|
||||
ImportColumn::make('zmm_headrange')
|
||||
->label('ZMM HEADRANGE')
|
||||
->exampleHeader('ZMM HEADRANGE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_overall_efficiency')
|
||||
->label('ZMM OVERALL EFFICIENCY')
|
||||
->exampleHeader('ZMM OVERALL EFFICIENCY')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_connection')
|
||||
->label('ZMM CONNECTION')
|
||||
->exampleHeader('ZMM CONNECTION')
|
||||
->example('STAR/DELTA'),
|
||||
ImportColumn::make('zmm_min_bore_size')
|
||||
->label('ZMM MIN BORE SIZE')
|
||||
->exampleHeader('ZMM MIN BORE SIZE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isireference')
|
||||
->label('ZMM ISIREFERENCE')
|
||||
->exampleHeader('ZMM ISIREFERENCE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_category')
|
||||
->label('ZMM CATEGORY')
|
||||
->exampleHeader('ZMM CATEGORY')
|
||||
->example('B'),
|
||||
ImportColumn::make('zmm_submergence')
|
||||
->label('ZMM SUBMERGENCE')
|
||||
->exampleHeader('ZMM SUBMERGENCE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_capacitorstart')
|
||||
->label('ZMM CAPACITORSTART')
|
||||
->exampleHeader('ZMM CAPACITORSTART')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_capacitorrun')
|
||||
->label('ZMM CAPACITORRUN')
|
||||
->exampleHeader('ZMM CAPACITORRUN')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_inch')
|
||||
->label('ZMM INCH')
|
||||
->exampleHeader('ZMM INCH')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_motor_type')
|
||||
->label('ZMM MOTOR TYPE')
|
||||
->exampleHeader('ZMM MOTOR TYPE')
|
||||
->example('TEFC'),
|
||||
ImportColumn::make('zmm_dismantle_direction')
|
||||
->label('ZMM DISMANTLE DIRECTION')
|
||||
->exampleHeader('ZMM DISMANTLE DIRECTION')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_eff_ovrall')
|
||||
->label('ZMM EFF OVERALL')
|
||||
->exampleHeader('ZMM EFF OVERALL')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_bodymoc')
|
||||
->label('ZMM BODYMOC')
|
||||
->exampleHeader('ZMM BODYMOC')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_rotormoc')
|
||||
->label('ZMM ROTORMOC')
|
||||
->exampleHeader('ZMM ROTORMOC')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_dlwl')
|
||||
->label('ZMM DLWL')
|
||||
->exampleHeader('ZMM DLWL')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_inputpower')
|
||||
->label('ZMM INPUTPOWER')
|
||||
->exampleHeader('ZMM INPUTPOWER')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_imp_od')
|
||||
->label('ZMM IMP OD')
|
||||
->exampleHeader('ZMM IMP OD')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_ambtemp')
|
||||
->label('ZMM AMBTEMP')
|
||||
->exampleHeader('ZMM AMBTEMP')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_de')
|
||||
->label('ZMM DE')
|
||||
->exampleHeader('ZMM DE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_dischargerange')
|
||||
->label('ZMM DISCHARGERANGE')
|
||||
->exampleHeader('ZMM DISCHARGERANGE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_efficiency_class')
|
||||
->label('ZMM EFFICIENCY CLASS')
|
||||
->exampleHeader('ZMM EFFICIENCY CLASS')
|
||||
->example('IE2'),
|
||||
ImportColumn::make('zmm_framesize')
|
||||
->label('ZMM FRAMESIZE')
|
||||
->exampleHeader('ZMM FRAMESIZE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_impellerdiameter')
|
||||
->label('ZMM IMPELLERDIAMETER')
|
||||
->exampleHeader('ZMM IMPELLERDIAMETER')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_insulationclass')
|
||||
->label('ZMM INSULATIONCLASS')
|
||||
->exampleHeader('ZMM INSULATIONCLASS')
|
||||
->example('F'),
|
||||
ImportColumn::make('zmm_maxflow')
|
||||
->label('ZMM MAXFLOW')
|
||||
->exampleHeader('ZMM MAXFLOW')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_minhead')
|
||||
->label('ZMM MINHEAD')
|
||||
->exampleHeader('ZMM MINHEAD')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_mtrlofconst')
|
||||
->label('ZMM MTRLOFCONST')
|
||||
->exampleHeader('ZMM MTRLOFCONST')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_nde')
|
||||
->label('ZMM NDE')
|
||||
->exampleHeader('ZMM NDE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_powerfactor')
|
||||
->label('ZMM POWERFACTOR')
|
||||
->exampleHeader('ZMM POWERFACTOR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_tagno')
|
||||
->label('ZMM TAGNO')
|
||||
->exampleHeader('ZMM TAGNO')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_year')
|
||||
->label('ZMM YEAR')
|
||||
->exampleHeader('ZMM YEAR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_laser_name')
|
||||
->label('ZMM LASER NAME')
|
||||
->exampleHeader('ZMM LASER NAME')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_logo_cp')
|
||||
->label('ZMM LOGO CP')
|
||||
->exampleHeader('ZMM LOGO CP')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_logo_ce')
|
||||
->label('ZMM LOGO CE')
|
||||
->exampleHeader('ZMM LOGO CE')
|
||||
->example('NO'),
|
||||
ImportColumn::make('zmm_logo_nsf')
|
||||
->label('ZMM LOGO NSF')
|
||||
->exampleHeader('ZMM LOGO NSF')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_logo_eac')
|
||||
->label('ZMM LOGO EAC')
|
||||
->exampleHeader('ZMM LOGO EAC')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_beenote')
|
||||
->label('ZMM BEENOTE')
|
||||
->exampleHeader('ZMM BEENOTE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_beenumber')
|
||||
->label('ZMM BEENUMBER')
|
||||
->exampleHeader('ZMM BEENUMBER')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_beestar')
|
||||
->label('ZMM BEESTAR')
|
||||
->exampleHeader('ZMM BEESTAR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_codeclass')
|
||||
->label('ZMM CODECLASS')
|
||||
->exampleHeader('ZMM CODECLASS')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_colour')
|
||||
->label('ZMM COLOUR')
|
||||
->exampleHeader('ZMM COLOUR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grade')
|
||||
->label('ZMM GRADE')
|
||||
->exampleHeader('ZMM GRADE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grwt_pset')
|
||||
->label('ZMM GRWT PSET')
|
||||
->exampleHeader('ZMM GRWT PSET')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grwt_cable')
|
||||
->label('ZMM GRWT CABLE')
|
||||
->exampleHeader('ZMM GRWT CABLE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grwt_motor')
|
||||
->label('ZMM GRWT MOTOR')
|
||||
->exampleHeader('ZMM GRWT MOTOR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grwt_pf')
|
||||
->label('ZMM GRWT PF')
|
||||
->exampleHeader('ZMM GRWT PF')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_grwt_pump')
|
||||
->label('ZMM GRWT PUMP')
|
||||
->exampleHeader('ZMM GRWT PUMP')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isivalve')
|
||||
->label('ZMM ISIVALVE')
|
||||
->exampleHeader('ZMM ISIVALVE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_isi_wc')
|
||||
->label('ZMM ISI WC')
|
||||
->exampleHeader('ZMM ISI WC')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_labelperiod')
|
||||
->label('ZMM LABELPERIOD')
|
||||
->exampleHeader('ZMM LABELPERIOD')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_length')
|
||||
->label('ZMM LENGTH')
|
||||
->exampleHeader('ZMM LENGTH')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_license_cml_no')
|
||||
->label('ZMM LICENSE CML NO')
|
||||
->exampleHeader('ZMM LICENSE CML NO')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_mfgmonyr')
|
||||
->label('ZMM MFGMONYR')
|
||||
->exampleHeader('ZMM MFGMONYR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_modelyear')
|
||||
->label('ZMM MODELYEAR')
|
||||
->exampleHeader('ZMM MODELYEAR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_motoridentification')
|
||||
->label('ZMM MOTORIDENTIFICATION')
|
||||
->exampleHeader('ZMM MOTORIDENTIFICATION')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_newt_pset')
|
||||
->label('ZMM NEWT PSET')
|
||||
->exampleHeader('ZMM NEWT PSET')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_newt_cable')
|
||||
->label('ZMM NEWT CABLE')
|
||||
->exampleHeader('ZMM NEWT CABLE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_newt_motor')
|
||||
->label('ZMM NEWT MOTOR')
|
||||
->exampleHeader('ZMM NEWT MOTOR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_newt_pf')
|
||||
->label('ZMM NEWT PF')
|
||||
->exampleHeader('ZMM NEWT PF')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_newt_pump')
|
||||
->label('ZMM NEWT PUMP')
|
||||
->exampleHeader('ZMM NEWT PUMP')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_packtype')
|
||||
->label('ZMM PACKTYPE')
|
||||
->exampleHeader('ZMM PACKTYPE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_panel')
|
||||
->label('ZMM PANEL')
|
||||
->exampleHeader('ZMM PANEL')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_performance_factor')
|
||||
->label('ZMM PERFORMANCE FACTOR')
|
||||
->exampleHeader('ZMM PERFORMANCE FACTOR')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_pumpidentification')
|
||||
->label('ZMM PUMPIDENTIFICATION')
|
||||
->exampleHeader('ZMM PUMPIDENTIFICATION')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_psettype')
|
||||
->label('ZMM PSETTYPE')
|
||||
->exampleHeader('ZMM PSETTYPE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_size')
|
||||
->label('ZMM SIZE')
|
||||
->exampleHeader('ZMM SIZE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_eff_ttl')
|
||||
->label('ZMM EFF TTL')
|
||||
->exampleHeader('ZMM EFF TTL')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_type')
|
||||
->label('ZMM TYPE')
|
||||
->exampleHeader('ZMM TYPE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_usp')
|
||||
->label('ZMM USP')
|
||||
->exampleHeader('ZMM USP')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_operating_range')
|
||||
->label('ZMM OPERATING RANGE')
|
||||
->exampleHeader('ZMM OPERATING RANGE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_intake_air')
|
||||
->label('ZMM USP')
|
||||
->exampleHeader('ZMM USP')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_oxygen_transfer_rate')
|
||||
->label('ZMM OXYGEN TRANSFER RATE')
|
||||
->exampleHeader('ZMM OXYGEN TRANSFER RATE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_air_inlet_pipesize')
|
||||
->label('ZMM AIR INLET PIPESIZE')
|
||||
->exampleHeader('ZMM AIR INLET PIPESIZE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_sump_depth')
|
||||
->label('ZMM SUMP DEPTH')
|
||||
->exampleHeader('ZMM SUMP DEPTH')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_poles')
|
||||
->label('ZMM POLES')
|
||||
->exampleHeader('ZMM POLES')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_motor_heading')
|
||||
->label('ZMM MOTOR HEADING')
|
||||
->exampleHeader('ZMM MOTOR HEADING')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_motor_speed')
|
||||
->label('ZMM MOTOR SPEED')
|
||||
->exampleHeader('ZMM MOTOR SPEED')
|
||||
->example(''),
|
||||
ImportColumn::make('zqmm_qty')
|
||||
->label('ZQMM QTY')
|
||||
->exampleHeader('ZQMM QTY')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE')
|
||||
->exampleHeader('ZMM OPERATING TEMPERATURE')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_axial_force')
|
||||
->label('ZMM AXIAL FORCE')
|
||||
->exampleHeader('ZMM AXIAL FORCE')
|
||||
->example(''),
|
||||
ImportColumn::make('is_stopped')
|
||||
->label('IS STOPPED')
|
||||
->exampleHeader('IS STOPPED')
|
||||
->example('0'),
|
||||
ImportColumn::make('stopped_datetime')
|
||||
->label('STOPPED DATETIME')
|
||||
->exampleHeader('STOPPED DATETIME')
|
||||
->example('01-01-2026 00:08:00'),
|
||||
ImportColumn::make('stopped_by')
|
||||
->label('STOPPED BY')
|
||||
->exampleHeader('STOPPED BY')
|
||||
->example(''),
|
||||
ImportColumn::make('mark_status')
|
||||
->label('MARKED STATUS')
|
||||
->exampleHeader('MARKED STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('marked_physical_count')
|
||||
->label('MARKED PHYSICAL COUNT')
|
||||
->exampleHeader('MARKED PHYSICAL COUNT')
|
||||
->example('0'),
|
||||
ImportColumn::make('marked_expected_time')
|
||||
->label('MARKED EXPECTED TIME')
|
||||
->exampleHeader('MARKED EXPECTED TIME')
|
||||
->example('0'),
|
||||
ImportColumn::make('marked_datetime')
|
||||
->label('MARKED DATETIME')
|
||||
->exampleHeader('MARKED DATETIME')
|
||||
->example('01-01-2026 00:08:00'),
|
||||
ImportColumn::make('marked_by')
|
||||
->label('MARKED BY')
|
||||
->exampleHeader('MARKED BY')
|
||||
->example('TEST001'),
|
||||
ImportColumn::make('man_marked_status')
|
||||
->label('MANUAL MARKED PHYSICAL COUNT')
|
||||
->exampleHeader('MANUAL MARKED STATUS')
|
||||
->example('0'),
|
||||
ImportColumn::make('man_marked_datetime')
|
||||
->label('MANUAL MARKED DATETIME')
|
||||
->exampleHeader('MANUAL MARKED DATETIME')
|
||||
->example(''),
|
||||
ImportColumn::make('man_marked_by')
|
||||
->label('MANUAL MARKED BY')
|
||||
->exampleHeader('MANUAL MARKED BY')
|
||||
->example(''),
|
||||
ImportColumn::make('motor_marked_status')
|
||||
->label('MOTOR MARKED STATUS')
|
||||
->exampleHeader('MOTOR MARKED STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('motor_marked_physical_count')
|
||||
->label('MOTOR MARKED PHYSICAL COUNT')
|
||||
->exampleHeader('MOTOR MARKED PHYSICAL COUNT')
|
||||
->example('0'),
|
||||
ImportColumn::make('motor_expected_time')
|
||||
->label('MOTOR EXPECTED TIME')
|
||||
->exampleHeader('MOTOR EXPECTED TIME')
|
||||
->example('0'),
|
||||
ImportColumn::make('motor_marked_datetime')
|
||||
->label('MOTOR MARKED DATETIME')
|
||||
->exampleHeader('MOTOR MARKED DATETIME')
|
||||
->example('01-01-2026 00:08:00'),
|
||||
ImportColumn::make('motor_marked_by')
|
||||
->label('MOTOR MARKED BY')
|
||||
->exampleHeader('MOTOR MARKED BY')
|
||||
->example(''),
|
||||
ImportColumn::make('pump_marked_status')
|
||||
->label('PUMP MARKED STATUS')
|
||||
->exampleHeader('PUMP MARKED STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('pump_marked_physical_count')
|
||||
->label('PUMP MARKED PHYSICAL COUNT')
|
||||
->exampleHeader('PUMP MARKED PHYSICAL COUNT')
|
||||
->example('0'),
|
||||
ImportColumn::make('pump_expected_time')
|
||||
->label('PUMP EXPECTED TIME')
|
||||
->exampleHeader('PUMP EXPECTED TIME')
|
||||
->example('0'),
|
||||
ImportColumn::make('pump_marked_datetime')
|
||||
->label('PUMP MARKED DATETIME')
|
||||
->exampleHeader('PUMP MARKED DATETIME')
|
||||
->example('01-01-2026 00:08:00'),
|
||||
ImportColumn::make('pump_marked_by')
|
||||
->label('PUMP MARKED BY')
|
||||
->exampleHeader('PUMP MARKED BY')
|
||||
->example(''),
|
||||
ImportColumn::make('name_plate_marked_status')
|
||||
->label('NAME PLATE MARKED STATUS')
|
||||
->exampleHeader('NAME PLATE MARKED STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('name_plate_expected_time')
|
||||
->label('NAME PLATE EXPECTED TIME')
|
||||
->exampleHeader('NAME PLATE EXPECTED TIME')
|
||||
->example('0'),
|
||||
ImportColumn::make('name_plate_marked_datetime')
|
||||
->label('NAME PLATE MARKED DATETIME')
|
||||
->exampleHeader('NAME PLATE MARKED DATETIME')
|
||||
->example('01-01-2026 00:08:00'),
|
||||
ImportColumn::make('name_plate_marked_by')
|
||||
->label('NAME PLATE MARKED BY')
|
||||
->exampleHeader('NAME PLATE MARKED BY')
|
||||
->example(''),
|
||||
ImportColumn::make('motor_pump_pumpset_status')
|
||||
->label('MOTOR PUMP PUMPSET STATUS')
|
||||
->exampleHeader('MOTOR PUMP PUMPSET STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('winded_serial_number')
|
||||
->label('WINDED SERIAL NUMBER')
|
||||
->exampleHeader('WINDED SERIAL NUMBER')
|
||||
->example(''),
|
||||
ImportColumn::make('winded_rework_status')
|
||||
->label('WINDED REWORK STATUS')
|
||||
->exampleHeader('WINDED REWORK STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('motor_machine_name')
|
||||
->label('MOTOR MACHINE NAME')
|
||||
->exampleHeader('MOTOR MACHINE NAME')
|
||||
->example(''),
|
||||
ImportColumn::make('pump_machine_name')
|
||||
->label('PUMP MACHINE NAME')
|
||||
->exampleHeader('PUMP MACHINE NAME')
|
||||
->example(''),
|
||||
ImportColumn::make('name_plate_machine_name')
|
||||
->label('NAME PLATE MACHINE NAME')
|
||||
->exampleHeader('NAME PLATE MACHINE NAME')
|
||||
->example(''),
|
||||
// ImportColumn::make('pumpset_machine_name')
|
||||
// ->label('PUMPSET MACHINE NAME')
|
||||
// ->exampleHeader('PUMPSET MACHINE NAME')
|
||||
// ->example(''),
|
||||
ImportColumn::make('part_validation_1')
|
||||
->label('PART VALIDATION 1')
|
||||
->exampleHeader('PART VALIDATION 1')
|
||||
->example(''),
|
||||
ImportColumn::make('part_validation_2')
|
||||
->label('PART VALIDATION 2')
|
||||
->exampleHeader('PART VALIDATION 2')
|
||||
->example(''),
|
||||
ImportColumn::make('samlight_logged_name')
|
||||
->label('SAMLGHT LOGGED NAME')
|
||||
->exampleHeader('SAMLGHT LOGGED NAME')
|
||||
->example(''),
|
||||
ImportColumn::make('pending_released_status')
|
||||
->label('PENDING RELEASED STATUS')
|
||||
->exampleHeader('PENDING RELEASED STATUS')
|
||||
->example(''),
|
||||
ImportColumn::make('has_work_flow_id')
|
||||
->label('HAS WORK FLOW ID')
|
||||
->exampleHeader('HAS WORK FLOW ID')
|
||||
->example('0'),
|
||||
ImportColumn::make('created_at')
|
||||
->label('CREATED AT')
|
||||
->exampleHeader('CREATED AT')
|
||||
->example('01-01-2026 00:08:00'),
|
||||
ImportColumn::make('created_by')
|
||||
->label('CREATED BY')
|
||||
->exampleHeader('CREATED BY')
|
||||
->example('TEST001'),
|
||||
ImportColumn::make('updated_at')
|
||||
->label('UPDATED AT')
|
||||
->exampleHeader('UPDATED AT')
|
||||
->example('01-01-2026 00:08:00'),
|
||||
ImportColumn::make('updated_by')
|
||||
->label('UPDATED BY')
|
||||
->exampleHeader('UPDATED BY')
|
||||
->example('TEST001'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?ClassCharacteristic
|
||||
{
|
||||
// return ClassCharacteristic::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new ClassCharacteristic;
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your class 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;
|
||||
}
|
||||
}
|
||||
@@ -62,15 +62,15 @@ class ConfigurationImporter extends Importer
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new Configuration;
|
||||
return new Configuration();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your configuration import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your configuration 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.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\CustomerPoMaster;
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
|
||||
class CustomerPoMasterImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = CustomerPoMaster::class;
|
||||
|
||||
protected array $importedPos = [];
|
||||
|
||||
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('item')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Item Code')
|
||||
->example('630214')
|
||||
->label('Item Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('customer_po')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Customer PO')
|
||||
->example('1JA0029512')
|
||||
->label('Customer PO')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('customer_name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Customer Name')
|
||||
->example('KANKARIA MACHINERY STORE')
|
||||
->label('Customer Name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('quantity')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Quantity')
|
||||
->example('5')
|
||||
->label('Quantity')
|
||||
->rules(['required']),
|
||||
// ImportColumn::make('created_by')
|
||||
// ->requiredMapping()
|
||||
// ->exampleHeader('Created By')
|
||||
// ->example('Admin')
|
||||
// ->label('Created By')
|
||||
// ->rules(['required']),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?CustomerPoMaster
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = $this->data['plant'];
|
||||
$plant = null;
|
||||
$item = null;
|
||||
$customerPo = trim($this->data['customer_po']);
|
||||
$customerName = trim($this->data['customer_name']);
|
||||
|
||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found';
|
||||
} else {
|
||||
$item = Item::where('code', $this->data['item'])->where('plant_id', $plant->id)->first();
|
||||
}
|
||||
if (! $item) {
|
||||
$warnMsg[] = 'Item not found';
|
||||
}
|
||||
}
|
||||
|
||||
if (Str::length($this->data['customer_po']) < 9) {
|
||||
$warnMsg[] = 'Invalid Customer PO number found';
|
||||
}
|
||||
|
||||
if (empty($this->data['customer_po'])) {
|
||||
$warnMsg[] = 'Customer PO cannot be empty.';
|
||||
}
|
||||
|
||||
if (isset($this->importedPos[$customerPo])) {
|
||||
|
||||
if (strtolower(trim($this->importedPos[$customerPo])) != strtolower($customerName)){
|
||||
$warnMsg[] = "Customer PO '{$customerPo}' has multiple customer names in the import file.";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->importedPos[$customerPo] = $customerName;
|
||||
}
|
||||
|
||||
$existingPo = CustomerPoMaster::where('plant_id', $plant->id)->where('customer_po', $this->data['customer_po'])->first();
|
||||
|
||||
if ($existingPo && trim(strtolower($existingPo->customer_name)) != trim(strtolower($this->data['customer_name'])))
|
||||
{
|
||||
$warnMsg[] = "Customer PO '{$this->data['customer_po']}' is already mapped to customer '{$existingPo->customer_name}'.";
|
||||
}
|
||||
|
||||
$existingPoItem = CustomerPoMaster::where('plant_id', $plant->id)->where('item_id', $item->id)->where('customer_po', $this->data['customer_po'])->where('customer_name', $this->data['customer_name'])->first();
|
||||
|
||||
if ($existingPoItem)
|
||||
{
|
||||
$warnMsg[] = "Customer PO '{$this->data['customer_po']}' is already exist with item code '{$this->data['item']}' and customer name '{$this->data['customer_name']}'.";
|
||||
}
|
||||
|
||||
// $user = User::where('name', $this->data['created_by'])->first();
|
||||
// if (! $user) {
|
||||
// $warnMsg[] = 'User not found';
|
||||
// }
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
//else { // if (empty($warnMsg))
|
||||
// $grMaster = GrMaster::where('plant_id', $plant->id)
|
||||
// ->where('serial_number', $this->data['serial_number'])
|
||||
// ->latest()
|
||||
// ->first();
|
||||
|
||||
// if ($grMaster) {
|
||||
// throw new RowImportFailedException('Serial number already exist!');
|
||||
// }
|
||||
// }
|
||||
|
||||
CustomerPoMaster::updateOrCreate([
|
||||
'plant_id' => $plant->id,
|
||||
'item_id' => $item->id,
|
||||
'customer_po' => $this->data['customer_po'],
|
||||
'customer_name' => $this->data['customer_name'],
|
||||
'quantity' => $this->data['quantity'] ?? null,
|
||||
'created_by' => $operatorName,
|
||||
]);
|
||||
|
||||
return null;
|
||||
|
||||
// return new CustomerPoMaster();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your customer po master 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;
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\DealerVisitPlan;
|
||||
use App\Models\EmployeeMaster;
|
||||
use App\Models\Plant;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DealerVisitPlanImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = DealerVisitPlan::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Dealer Name')
|
||||
->example('Suresh')
|
||||
->label('Dealer Name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('company')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Dealer Company')
|
||||
->example('Suresh Traders')
|
||||
->label('Dealer Company')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('visit_plan_date')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Visit Plan Date')
|
||||
->example('2026-07-20')
|
||||
->label('Visit Plan Date'),
|
||||
ImportColumn::make('organizer')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Organizer')
|
||||
->example('Ramesh')
|
||||
->label('Organizer'),
|
||||
ImportColumn::make('employee_master_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Receipient Employee Code')
|
||||
->example('RAS001234')
|
||||
->label('Receipient Employee Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('number_of_person')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Number Of Person')
|
||||
->example('10')
|
||||
->label('Number Of Person'),
|
||||
ImportColumn::make('purpose_of_visit')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Purpose Of Visit')
|
||||
->example('Meeting')
|
||||
->label('Purpose Of Visit'),
|
||||
ImportColumn::make('status')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Status')
|
||||
->example('Planned/Completed')
|
||||
->label('Status'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?DealerVisitPlan
|
||||
{
|
||||
$warnMsg = [];
|
||||
|
||||
$user = null;
|
||||
$dealerName = trim($this->data['name']);
|
||||
$dealerCompany = trim($this->data['company']);
|
||||
$visitPlanDt = trim($this->data['visit_plan_date']);
|
||||
$organizer = trim($this->data['organizer']);
|
||||
$employeeCode = trim($this->data['employee_master_id']);
|
||||
$noOfPerson = trim($this->data['number_of_person']);
|
||||
$purposeOfVisit = trim($this->data['purpose_of_visit']);
|
||||
$status = trim($this->data['status']);
|
||||
$user = Filament::auth()->user()->name;
|
||||
|
||||
if (Str::length($employeeCode) < 5) {
|
||||
$warnMsg[] = 'Invalid receipient employee number found!';
|
||||
}
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
$employeeId = EmployeeMaster::where('code', $employeeCode)->first();
|
||||
|
||||
$eId = $employeeId->id;
|
||||
|
||||
DealerVisitPlan::updateOrCreate(
|
||||
[
|
||||
'name' => $dealerName,
|
||||
'company' => $dealerCompany,
|
||||
'visit_plan_date' => Carbon::createFromFormat('d-m-Y', $visitPlanDt)->format('Y-m-d'),
|
||||
'organizer' => $organizer,
|
||||
'employee_master_id' => $eId,
|
||||
'number_of_person' => $noOfPerson,
|
||||
'purpose_of_visit' => $purposeOfVisit,
|
||||
'status' => $status,
|
||||
'created_by' => $user,
|
||||
'updated_by' => $user,
|
||||
]
|
||||
);
|
||||
|
||||
return null;
|
||||
|
||||
// return new DealerVisitPlan();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your dealer visit plan 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;
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,10 @@ class DeviceMasterImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('name')
|
||||
->requiredMapping()
|
||||
@@ -53,15 +53,15 @@ class DeviceMasterImporter extends Importer
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new DeviceMaster;
|
||||
return new DeviceMaster();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your device master import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your device master 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.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -16,10 +16,10 @@ class EbReadingImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('lcd_segment_check')
|
||||
->label('LCD Segment Check')
|
||||
@@ -227,15 +227,15 @@ class EbReadingImporter extends Importer
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new EbReading;
|
||||
return new EbReading();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your eb reading import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your eb reading 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.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\EmployeeMaster;
|
||||
use App\Models\Plant;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class EmployeeMasterImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = EmployeeMaster::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('name')
|
||||
->exampleHeader('EMPLOYEE NAME')
|
||||
->example('John Doe')
|
||||
->label('EMPLOYEE NAME'),
|
||||
ImportColumn::make('code')
|
||||
->exampleHeader('EMPLOYEE ID')
|
||||
->example('EMP001')
|
||||
->label('EMPLOYEE ID'),
|
||||
ImportColumn::make('department')
|
||||
->exampleHeader('DEPARTMENT')
|
||||
->example('HR')
|
||||
->label('DEPARTMENT'),
|
||||
// ImportColumn::make('designation')
|
||||
// ->exampleHeader('DESIGNATION')
|
||||
// ->example('Manager')
|
||||
// ->label('DESIGNATION'),
|
||||
ImportColumn::make('email')
|
||||
->exampleHeader('EMAIL')
|
||||
->example('john.doe@example.com')
|
||||
->label('EMAIL'),
|
||||
ImportColumn::make('mobile_number')
|
||||
->exampleHeader('MOBILE NUMBER')
|
||||
->example('1234567890')
|
||||
->label('MOBILE NUMBER'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?EmployeeMaster
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = trim($this->data['plant']) ?? '';
|
||||
$employeeName = trim($this->data['name']) ?? '';
|
||||
$employeeCode = trim($this->data['code']) ?? '';
|
||||
$employeeDepartment = trim($this->data['department']) ?? '';
|
||||
// $employeeDesignation = trim($this->data['designation']) ?? '';
|
||||
$employeeEmail = trim($this->data['email']) ?? '';
|
||||
$employeeMobile = trim($this->data['mobile_number']) ?? '';
|
||||
$createdBy = Filament::auth()->user()?->name ?? '';
|
||||
$updatedBy = $createdBy;
|
||||
|
||||
$plantId = null;
|
||||
|
||||
if ($plantCod == null || $plantCod == '' || ! $plantCod) {
|
||||
$warnMsg[] = "Plant code can't be empty!";
|
||||
} elseif (! is_numeric($plantCod)) {
|
||||
$warnMsg[] = "Plant code '{$plantCod}' should contain only numeric values!";
|
||||
} elseif (Str::length($plantCod) < 4 || Str::length($plantCod) > 7) {
|
||||
$warnMsg[] = "Plant code '{$plantCod}' must be between 4 and 7 digits only!";
|
||||
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCod)) {
|
||||
$warnMsg[] = "Invalid plant code '{$plantCod}' found!";
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found!';
|
||||
} else {
|
||||
$plantId = $plant->id;
|
||||
}
|
||||
}
|
||||
|
||||
if ($employeeCode == null || $employeeCode == '' || ! $employeeCode) {
|
||||
$warnMsg[] = "Employee ID can't be empty!";
|
||||
} elseif (Str::length($employeeCode) < 3 || Str::length($employeeCode) > 20) {
|
||||
$warnMsg[] = "Employee ID '{$employeeCode}' must be between 3 and 20 characters only!";
|
||||
}
|
||||
if ($employeeEmail != null && $employeeEmail != '' && ! filter_var($employeeEmail, FILTER_VALIDATE_EMAIL)) {
|
||||
$warnMsg[] = "Invalid email address '{$employeeEmail}' found!";
|
||||
}
|
||||
if ($employeeMobile != null && $employeeMobile != '' && ! is_numeric($employeeMobile)) {
|
||||
$warnMsg[] = "Mobile number '{$employeeMobile}' should contain only numeric values!";
|
||||
} elseif (Str::length($employeeMobile) < 10 || Str::length($employeeMobile) > 10) {
|
||||
$warnMsg[] = "Mobile number '{$employeeMobile}' must be exactly 10 digits!";
|
||||
}
|
||||
else
|
||||
{
|
||||
$existingMobile = EmployeeMaster::where('mobile_number', $employeeMobile)
|
||||
->where('code', '!=', $employeeCode)
|
||||
->first();
|
||||
|
||||
if ($existingMobile) {
|
||||
$warnMsg[] = "Mobile number '{$employeeMobile}' is already assigned to another employee!";
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
else
|
||||
{
|
||||
EmployeeMaster::updateOrCreate(
|
||||
[
|
||||
'plant_id' => $plantId ?? null,
|
||||
'code' => $employeeCode ?? null,
|
||||
],
|
||||
[
|
||||
'name' => $employeeName ?? null,
|
||||
'email' => $employeeEmail ?? null,
|
||||
'mobile_number' => $employeeMobile ?? null,
|
||||
'department' => $employeeDepartment ?? null,
|
||||
// 'designation' => $employeeDesignation ?? null,
|
||||
'created_by' => $createdBy ?? null,
|
||||
'updated_by' => $updatedBy ?? null,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your employee master 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;
|
||||
}
|
||||
}
|
||||
@@ -16,17 +16,17 @@ class EquipmentMasterImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Machine Name')
|
||||
->example('1006378')
|
||||
->label('Machine Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('name')
|
||||
->label('Name')
|
||||
@@ -93,15 +93,15 @@ class EquipmentMasterImporter extends Importer
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new EquipmentMaster;
|
||||
return new EquipmentMaster();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your equipment master import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your equipment master 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.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\GrMaster;
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use App\Models\Plant;
|
||||
use App\Models\Item;
|
||||
use Str;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use App\Models\User;
|
||||
|
||||
class GrMasterImporter extends Importer
|
||||
{
|
||||
@@ -21,17 +21,17 @@ class GrMasterImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Item Code')
|
||||
->example('630214')
|
||||
->label('Item Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->relationship(resolveUsing:'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('serial_number')
|
||||
->requiredMapping()
|
||||
@@ -51,7 +51,7 @@ class GrMasterImporter extends Importer
|
||||
->example('Admin')
|
||||
->label('Created By')
|
||||
->rules(['required']),
|
||||
// ImportColumn::make('updated_by'),
|
||||
//ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -63,47 +63,44 @@ class GrMasterImporter extends Importer
|
||||
// ]);
|
||||
|
||||
$warnMsg = [];
|
||||
$plantCod = $this->data['plant'];
|
||||
$plant = null;
|
||||
$item = null;
|
||||
|
||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found';
|
||||
} else {
|
||||
$item = Item::where('code', $this->data['item'])->where('plant_id', $plant->id)->first();
|
||||
}
|
||||
if (! $item) {
|
||||
$warnMsg[] = 'Item not found';
|
||||
}
|
||||
$plant = Plant::where('name', $this->data['plant'])->first();
|
||||
|
||||
if (!$plant) {
|
||||
$warnMsg[] = "Plant not found";
|
||||
}
|
||||
|
||||
if (Str::length($this->data['serial_number']) < 9 || ! ctype_alnum($this->data['serial_number'])) {
|
||||
$warnMsg[] = 'Invalid serial number found';
|
||||
$item = null;
|
||||
if ($plant) {
|
||||
$item = Item::where('code', $this->data['item'])->where('plant_id', $plant->id)->first();
|
||||
}
|
||||
if (!$item) {
|
||||
$warnMsg[] = "Item not found";
|
||||
}
|
||||
if (Str::length($this->data['serial_number']) < 9 || !ctype_alnum($this->data['serial_number'])) {
|
||||
$warnMsg[] = "Invalid serial number found";
|
||||
}
|
||||
|
||||
if (empty($this->data['gr_number'])) {
|
||||
$warnMsg[] = 'GR Number cannot be empty.';
|
||||
$warnMsg[] = "GR Number cannot be empty.";
|
||||
}
|
||||
|
||||
$user = User::where('name', $this->data['created_by'])->first();
|
||||
if (! $user) {
|
||||
$warnMsg[] = 'User not found';
|
||||
if (!$user) {
|
||||
$warnMsg[] = "User not found";
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
} else { // if (empty($warnMsg))
|
||||
}
|
||||
else { //if (empty($warnMsg))
|
||||
$grMaster = GrMaster::where('plant_id', $plant->id)
|
||||
->where('serial_number', $this->data['serial_number'])
|
||||
->latest()
|
||||
->first();
|
||||
->where('serial_number', $this->data['serial_number'])
|
||||
->latest()
|
||||
->first();
|
||||
|
||||
if ($grMaster) {
|
||||
throw new RowImportFailedException('Serial number already exist!');
|
||||
throw new RowImportFailedException("Serial number already exist!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,15 +113,15 @@ class GrMasterImporter extends Importer
|
||||
]);
|
||||
|
||||
return null;
|
||||
// return new GrMaster();
|
||||
//return new GrMaster();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your gr master import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your gr master 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.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -20,10 +20,10 @@ class GuardNameImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('name')
|
||||
->requiredMapping()
|
||||
@@ -54,38 +54,32 @@ class GuardNameImporter extends Importer
|
||||
public function resolveRecord(): ?GuardName
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = $this->data['plant'];
|
||||
$plant = null;
|
||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found'; // '" . $plantCod . "'
|
||||
}
|
||||
$plant = Plant::where('name', $this->data['plant'])->first();
|
||||
if (!$plant) {
|
||||
$warnMsg[] = "Plant not found"; // '" . $this->data['plant'] . "'
|
||||
}
|
||||
if (Str::length($this->data['name']) < 3) { // || !ctype_alnum($this->data['name'])
|
||||
$warnMsg[] = 'Invalid guard name found';
|
||||
$warnMsg[] = "Invalid guard name found";
|
||||
}
|
||||
if (Str::length($this->data['identification1']) < 5) {
|
||||
$warnMsg[] = 'Invalid identification-1 found';
|
||||
$warnMsg[] = "Invalid identification-1 found";
|
||||
}
|
||||
$createdBy = $this->data['created_by'];
|
||||
if (Str::length($createdBy) < 3) { // || !ctype_alnum($createdBy)
|
||||
$warnMsg[] = 'Invalid created by name found';
|
||||
$warnMsg[] = "Invalid created by name found";
|
||||
}
|
||||
if (! empty($warnMsg)) {
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return GuardName::updateOrCreate([
|
||||
'name' => $this->data['name'],
|
||||
'plant_id' => $plant->id,
|
||||
'plant_id' => $plant->id
|
||||
],
|
||||
[
|
||||
'identification1' => $this->data['identification1'],
|
||||
'identification2' => $this->data['identification2'],
|
||||
'created_by' => $this->data['created_by'],
|
||||
[
|
||||
'identification1' => $this->data['identification1'],
|
||||
'identification2' => $this->data['identification2'],
|
||||
'created_by' => $this->data['created_by']
|
||||
]
|
||||
);
|
||||
|
||||
@@ -93,15 +87,15 @@ class GuardNameImporter extends Importer
|
||||
// // // Update existing records, matching them by `$this->data['column_name']`
|
||||
// // 'email' => $this->data['email'],
|
||||
// // ]);
|
||||
// return new GuardName();
|
||||
//return new GuardName();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your guard name import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your guard name 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.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -23,10 +23,10 @@ class GuardPatrolEntryImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('guardNames')
|
||||
->requiredMapping()
|
||||
@@ -68,60 +68,61 @@ class GuardPatrolEntryImporter extends Importer
|
||||
public function resolveRecord(): ?GuardPatrolEntry
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = $this->data['plant'];
|
||||
$plant = null;
|
||||
$plant = Plant::where('name', $this->data['plant'])->first();
|
||||
$guardNames = null;
|
||||
$checkPointNames = null;
|
||||
$patrolDateTime = null; // $fdateTime = null;
|
||||
$patrolDateTime = null; //$fdateTime = null;
|
||||
if (!$plant) {
|
||||
$warnMsg[] = "Plant not found"; // '" . $this->data['plant'] . "'
|
||||
}
|
||||
else
|
||||
{
|
||||
$guardNames = GuardName::where('plant_id', $plant->id)->where('name', $this->data['guardNames'])->first();
|
||||
if (!$guardNames) {
|
||||
$warnMsg[] = "Guard name not found";
|
||||
}
|
||||
else
|
||||
{
|
||||
$checkPointNames = CheckPointName::where('plant_id', $plant->id)->where('name', $this->data['checkPointNames'])->first();
|
||||
if (!$checkPointNames) {
|
||||
$warnMsg[] = "Check point name not found";
|
||||
}
|
||||
else
|
||||
{
|
||||
$patrolTime = $this->data['patrol_time'];//$fromDate = $this->data['from_datetime'];
|
||||
$formats = ['d-m-Y H:i', 'd-m-Y H:i:s']; //'07-05-2025 08:00' or '07-05-2025 08:00:00'
|
||||
|
||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found'; // '" . $plantCod . "'
|
||||
} else {
|
||||
$guardNames = GuardName::where('plant_id', $plant->id)->where('name', $this->data['guardNames'])->first();
|
||||
if (! $guardNames) {
|
||||
$warnMsg[] = 'Guard name not found';
|
||||
} else {
|
||||
$checkPointNames = CheckPointName::where('plant_id', $plant->id)->where('name', $this->data['checkPointNames'])->first();
|
||||
if (! $checkPointNames) {
|
||||
$warnMsg[] = 'Check point name not found';
|
||||
} else {
|
||||
$patrolTime = $this->data['patrol_time']; // $fromDate = $this->data['from_datetime'];
|
||||
$formats = ['d-m-Y H:i', 'd-m-Y H:i:s']; // '07-05-2025 08:00' or '07-05-2025 08:00:00'
|
||||
|
||||
foreach ($formats as $format) {
|
||||
try {
|
||||
$patrolDateTime = Carbon::createFromFormat($format, $patrolTime);
|
||||
break;
|
||||
} catch (\Exception $e) {
|
||||
// Optionally collect warning messages
|
||||
// $warnMsg[] = "Date format mismatch with format: $format";
|
||||
}
|
||||
foreach ($formats as $format) {
|
||||
try {
|
||||
$patrolDateTime = Carbon::createFromFormat($format, $patrolTime);
|
||||
break;
|
||||
} catch (\Exception $e) {
|
||||
// Optionally collect warning messages
|
||||
// $warnMsg[] = "Date format mismatch with format: $format";
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($patrolDateTime)) {
|
||||
// throw new \Exception('Invalid date time format');
|
||||
$warnMsg[] = "Invalid 'Patrol DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
|
||||
} else {
|
||||
$guardEntryFound = GuardPatrolEntry::where('plant_id', $plant->id)->where('guard_name_id', $guardNames->id)->where('check_point_name_id', $checkPointNames->id)->where('patrol_time', $patrolDateTime->format('Y-m-d H:i:s'))->first();
|
||||
if ($guardEntryFound) {
|
||||
$warnMsg[] = 'Duplicate guard patrol entry found';
|
||||
}
|
||||
if (!isset($patrolDateTime)) {
|
||||
// throw new \Exception('Invalid date time format');
|
||||
$warnMsg[] = "Invalid 'Patrol DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
|
||||
}
|
||||
else
|
||||
{
|
||||
$guardEntryFound = GuardPatrolEntry::where('plant_id', $plant->id)->where('guard_name_id', $guardNames->id)->where('check_point_name_id', $checkPointNames->id)->where('patrol_time', $patrolDateTime->format('Y-m-d H:i:s'))->first();
|
||||
if ($guardEntryFound) {
|
||||
$warnMsg[] = "Duplicate guard patrol entry found";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$createdBy = Filament::auth()->user()->name; // ?? 'Admin'
|
||||
if (! $createdBy) {
|
||||
$warnMsg[] = 'Invalid created by name found';
|
||||
$createdBy = Filament::auth()->user()->name;// ?? 'Admin'
|
||||
if (!$createdBy) {
|
||||
$warnMsg[] = "Invalid created by name found";
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
@@ -129,15 +130,14 @@ class GuardPatrolEntryImporter extends Importer
|
||||
'plant_id' => $plant->id,
|
||||
'guard_name_id' => $guardNames->id,
|
||||
'check_point_name_id' => $checkPointNames->id,
|
||||
'patrol_time' => $patrolDateTime->format('Y-m-d H:i:s'),
|
||||
'patrol_time' => $patrolDateTime->format('Y-m-d H:i:s')
|
||||
],
|
||||
[
|
||||
'reader_code' => null,
|
||||
'created_by' => $createdBy,
|
||||
'updated_by' => $createdBy,
|
||||
[
|
||||
'reader_code' => null,
|
||||
'created_by' => $createdBy,
|
||||
'updated_by' => $createdBy
|
||||
]
|
||||
);
|
||||
|
||||
return null;
|
||||
// // return GuardPatrolEntry::firstOrNew([
|
||||
// // // Update existing records, matching them by `$this->data['column_name']`
|
||||
@@ -149,10 +149,10 @@ class GuardPatrolEntryImporter extends Importer
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your guard patrol entry import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your guard patrol entry 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.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\ImportTransit;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ImportTransitImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = ImportTransit::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('cri_rfq_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('CRI RFQ Number')
|
||||
->example('RFQ-IMP-C.R.I-2025-A')
|
||||
->label('CRI RFQ Number')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('mail_received_date')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail Received Date')
|
||||
->example('2024-01-01')
|
||||
->label('Mail Received Date'),
|
||||
ImportColumn::make('pricol_ref_number')
|
||||
->exampleHeader('Pricol Ref Number')
|
||||
->example('ENQ-1649')
|
||||
->label('Pricol Ref Number'),
|
||||
ImportColumn::make('requester')
|
||||
->exampleHeader('Requester')
|
||||
->example('Mr.Sathish.K')
|
||||
->label('Requester'),
|
||||
ImportColumn::make('shipper')
|
||||
->exampleHeader('Shipper')
|
||||
->example('Zhejiang shenneng technology co.,ltd')
|
||||
->label('Shipper'),
|
||||
ImportColumn::make('shipper_location')
|
||||
->exampleHeader('Shipper Location')
|
||||
->example('China')
|
||||
->label('Shipper Location'),
|
||||
ImportColumn::make('shipper_invoice')
|
||||
->exampleHeader('Shipper Invoice')
|
||||
->example('SNINDIA250618')
|
||||
->label('Shipper Invoice'),
|
||||
ImportColumn::make('shipper_invoice_date')
|
||||
->exampleHeader('Shipper Invoice Date')
|
||||
->example('2024-01-02')
|
||||
->label('Shipper Invoice Date'),
|
||||
ImportColumn::make('inv_value')
|
||||
->exampleHeader('Inv Value')
|
||||
->example('10000')
|
||||
->label('Inv Value'),
|
||||
ImportColumn::make('freight_charge')
|
||||
->exampleHeader('Freight Charge')
|
||||
->example('500')
|
||||
->label('Freight Charge'),
|
||||
ImportColumn::make('customs_agent_name')
|
||||
->exampleHeader('Customs Agent Name')
|
||||
->example('Pricol Logistics')
|
||||
->label('Customs Agent Name'),
|
||||
ImportColumn::make('eta_date')
|
||||
->exampleHeader('ETA Date')
|
||||
->example('2024-01-10')
|
||||
->label('ETA Date'),
|
||||
ImportColumn::make('status')
|
||||
->exampleHeader('Status')
|
||||
->example('Receipted')
|
||||
->label('Status'),
|
||||
ImportColumn::make('insurance_status')
|
||||
->exampleHeader('Insurance Status')
|
||||
->example('Yes')
|
||||
->label('Insurance Status'),
|
||||
ImportColumn::make('delivery_location')
|
||||
->exampleHeader('Delivery Location')
|
||||
->example('Arasur Hub')
|
||||
->label('Delivery Location'),
|
||||
ImportColumn::make('etd_date')
|
||||
->exampleHeader('ETD Date')
|
||||
->example('2024-01-05')
|
||||
->label('ETD Date'),
|
||||
ImportColumn::make('mode')
|
||||
->exampleHeader('Mode')
|
||||
->example('LCL')
|
||||
->label('Mode'),
|
||||
ImportColumn::make('inco_terms')
|
||||
->exampleHeader('Inco Terms')
|
||||
->example('FOB')
|
||||
->label('Inco Terms'),
|
||||
ImportColumn::make('port_of_loading')
|
||||
->exampleHeader('Port of Loading')
|
||||
->example('NINGBO')
|
||||
->label('Port of Loading'),
|
||||
ImportColumn::make('port_of_discharge')
|
||||
->exampleHeader('Port of Discharge')
|
||||
->example('CHENNAI')
|
||||
->label('Port of Discharge'),
|
||||
ImportColumn::make('delivery_city')
|
||||
->exampleHeader('Delivery City')
|
||||
->example('COIMBATORE')
|
||||
->label('Delivery City'),
|
||||
ImportColumn::make('packages')
|
||||
->exampleHeader('Packages')
|
||||
->example('450')
|
||||
->label('Packages'),
|
||||
ImportColumn::make('type_of_package')
|
||||
->exampleHeader('Type of Package')
|
||||
->example('PKG')
|
||||
->label('Type of Package'),
|
||||
ImportColumn::make('gross_weight')
|
||||
->exampleHeader('Gross Weight')
|
||||
->example('5000')
|
||||
->label('Gross Weight'),
|
||||
ImportColumn::make('volume')
|
||||
->exampleHeader('Volume')
|
||||
->example('50')
|
||||
->label('Volume'),
|
||||
ImportColumn::make('bill_number')
|
||||
->exampleHeader('Bill Number')
|
||||
->example('BL12345')
|
||||
->label('Bill Number'),
|
||||
ImportColumn::make('bill_received_date')
|
||||
->exampleHeader('Bill Received Date')
|
||||
->example('2024-01-15')
|
||||
->label('Bill Received Date'),
|
||||
ImportColumn::make('vessel_number')
|
||||
->exampleHeader('Vessel Number')
|
||||
->example('XIN WEN ZHOU')
|
||||
->label('Vessel Number'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?ImportTransit
|
||||
{
|
||||
$warnMsg = [];
|
||||
$criRfqNumber = trim($this->data['cri_rfq_number']) ?? '';
|
||||
$mailRecDate = trim($this->data['mail_received_date']) ?? '';
|
||||
$pricolRefNumber = trim($this->data['pricol_ref_number']) ?? '';
|
||||
$requester = trim($this->data['requester']) ?? '';
|
||||
$shipper = trim($this->data['shipper']) ?? '';
|
||||
$shipperLocation = trim($this->data['shipper_location']) ?? '';
|
||||
$shipperInvoice = trim($this->data['shipper_invoice']) ?? '';
|
||||
$shipperInvoiceDt = trim($this->data['shipper_invoice_date']) ?? '';
|
||||
$invValue = trim($this->data['inv_value']) ?? '';
|
||||
$freightCharge = trim($this->data['freight_charge']) ?? '';
|
||||
$customsAgentname = trim($this->data['customs_agent_name']) ?? '';
|
||||
$etaDate = trim($this->data['eta_date']) ?? '';
|
||||
$status = trim($this->data['status']) ?? '';
|
||||
$deliveryLocation = trim($this->data['delivery_location']) ?? '';
|
||||
$etdDate = trim($this->data['etd_date']) ?? '';
|
||||
$mode = trim($this->data['mode']) ?? '';
|
||||
$incoTerms = trim($this->data['inco_terms']) ?? '';
|
||||
$portOfLoading = trim($this->data['port_of_loading']) ?? '';
|
||||
$portOfDischarge = trim($this->data['port_of_discharge']) ?? '';
|
||||
$deliveryCity = trim($this->data['delivery_city']) ?? '';
|
||||
$packages = trim($this->data['packages']) ?? '';
|
||||
$typeOfPackage = trim($this->data['type_of_package']) ?? '';
|
||||
$grossWeight = trim($this->data['gross_weight']) ?? '';
|
||||
$volume = trim($this->data['volume']) ?? '';
|
||||
$billNo = trim($this->data['bill_number']) ?? '';
|
||||
$billReceivedDate = trim($this->data['bill_received_date']) ?? '';
|
||||
$vesselNumber = trim($this->data['vessel_number']) ?? '';
|
||||
|
||||
$createdBy = Filament::auth()->user()?->name ?? '';
|
||||
$updatedBy = $createdBy;
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return ImportTransit::updateOrCreate([
|
||||
'cri_rfq_number' => $criRfqNumber,
|
||||
'shipper_invoice' => $shipperInvoice,
|
||||
],
|
||||
[
|
||||
'mail_received_date' => $this->formatDate($mailRecDate),
|
||||
'shipper_invoice_date' => $this->formatDate($shipperInvoiceDt),
|
||||
'eta_date' => $this->formatDate($etaDate),
|
||||
'etd_date' => $this->formatDate($etdDate),
|
||||
'bill_received_date' => $this->formatDate($billReceivedDate),
|
||||
'pricol_ref_number' => $pricolRefNumber,
|
||||
'requester' => $requester,
|
||||
'shipper' => $shipper,
|
||||
'shipper_location' => $shipperLocation,
|
||||
'inv_value' => $invValue,
|
||||
'freight_charge' => $freightCharge,
|
||||
'custom_agent_name' => $customsAgentname,
|
||||
'status' => $status,
|
||||
'delivery_location' => $deliveryLocation,
|
||||
'mode' => $mode,
|
||||
'inco_terms' => $incoTerms,
|
||||
'port_of_loading' => $portOfLoading,
|
||||
'port_of_discharge' => $portOfDischarge,
|
||||
'delivery_city' => $deliveryCity,
|
||||
'packages' => $packages,
|
||||
'type_of_package' => $typeOfPackage,
|
||||
'gross_weight' => $grossWeight,
|
||||
'volume' => $volume,
|
||||
'bill_number' => $billNo,
|
||||
'vessel_number' => $vesselNumber,
|
||||
// 'created_at' => $createdAt ?? null,
|
||||
// 'updated_at' => $updatedAt ?? null,
|
||||
'created_by' => $createdBy ?? null,
|
||||
'updated_by' => $updatedBy ?? null,
|
||||
]
|
||||
);
|
||||
// return new ImportTransit();
|
||||
}
|
||||
|
||||
private function formatDate($date): ?string
|
||||
{
|
||||
if (blank($date)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!preg_match('/\d/', $date)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$date = trim($date);
|
||||
|
||||
// Excel numeric date (e.g. 46000)
|
||||
if (is_numeric($date)) {
|
||||
return Carbon::instance(
|
||||
\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject((float)$date)
|
||||
)->format('Y-m-d');
|
||||
}
|
||||
|
||||
// Try common formats explicitly
|
||||
$formats = ['d-m-Y', 'd/m/Y', 'Y-m-d', 'm/d/Y', 'd.m.Y'];
|
||||
|
||||
foreach ($formats as $format) {
|
||||
try {
|
||||
return Carbon::createFromFormat($format, $date)->format('Y-m-d');
|
||||
} catch (\Exception $e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your import transit 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;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user