Compare commits
12 Commits
9edbaf3d43
...
renovate/t
| Author | SHA1 | Date | |
|---|---|---|---|
| f82ff3191d | |||
| 79e3427cdb | |||
|
|
cdd746d5da | ||
| 81a5fa16c4 | |||
|
|
385103323a | ||
| 6520c3ca87 | |||
|
|
6ead4bce3d | ||
|
|
5917ae4717 | ||
| 2e167c75b0 | |||
|
|
dbdb11b9cf | ||
| aca5d6c957 | |||
|
|
764a14990b |
@@ -5,6 +5,7 @@ namespace App\Filament\Resources;
|
|||||||
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
|
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
|
||||||
use App\Filament\Exports\InvoiceValidationExporter;
|
use App\Filament\Exports\InvoiceValidationExporter;
|
||||||
use App\Filament\Resources\InvoiceValidationResource\Pages;
|
use App\Filament\Resources\InvoiceValidationResource\Pages;
|
||||||
|
use App\Mail\InvoiceNotification;
|
||||||
use App\Models\InvoiceValidation;
|
use App\Models\InvoiceValidation;
|
||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
@@ -29,7 +30,6 @@ use Filament\Tables;
|
|||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
use Filament\Forms\Components\View;
|
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Tables\Actions\Action;
|
use Filament\Tables\Actions\Action;
|
||||||
use Filament\Tables\Actions\ExportAction;
|
use Filament\Tables\Actions\ExportAction;
|
||||||
@@ -38,6 +38,10 @@ use Illuminate\Support\Facades\Storage;
|
|||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
use Livewire\Livewire;
|
use Livewire\Livewire;
|
||||||
use Str;
|
use Str;
|
||||||
|
use Illuminate\Support\Facades\Session;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Filament\Forms\Components\View;
|
||||||
|
|
||||||
|
|
||||||
class InvoiceValidationResource extends Resource
|
class InvoiceValidationResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -49,6 +53,8 @@ class InvoiceValidationResource extends Resource
|
|||||||
|
|
||||||
public $invoiceNumber;
|
public $invoiceNumber;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
@@ -119,6 +125,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
$invNo = $get('invoice_number');
|
$invNo = $get('invoice_number');
|
||||||
$set('serial_number', null);
|
$set('serial_number', null);
|
||||||
$set('update_invoice', null);
|
$set('update_invoice', null);
|
||||||
|
//Session::put('invoice_number', $state);
|
||||||
|
session(['invoice_number' => $state]);
|
||||||
|
|
||||||
// if (!$invNo) { return; } else { }
|
// if (!$invNo) { return; } else { }
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -126,17 +135,32 @@ class InvoiceValidationResource extends Resource
|
|||||||
->label('Serial Number')
|
->label('Serial Number')
|
||||||
->reactive()
|
->reactive()
|
||||||
->readOnly(fn (callable $get) => empty($get('invoice_number')))
|
->readOnly(fn (callable $get) => empty($get('invoice_number')))
|
||||||
//->disabled(fn (Get $get) => empty($get('invoice_number')))
|
->disabled(fn (Get $get) => empty($get('invoice_number')))
|
||||||
->extraAttributes([
|
->extraAttributes([
|
||||||
'id' => 'serial_number_input',
|
'id' => 'serial_number_input',
|
||||||
'x-data' => '{ value: "" }',
|
'x-data' => '{ value: "" }',
|
||||||
'x-model' => 'value',
|
'x-model' => 'value',
|
||||||
'wire:keydown.enter.prevent' => 'processSerialNumber(value)', // Using wire:keydown
|
'wire:keydown.enter.prevent' => 'processSerial(value)', // Using wire:keydown
|
||||||
])
|
])
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
// ->dehydrated(false) // Do not trigger Livewire syncing
|
||||||
|
// ->extraAttributes([
|
||||||
|
// 'id' => 'serial_number_input',
|
||||||
|
// 'x-on:keydown.enter.prevent' => "
|
||||||
|
// let serial = \$event.target.value;
|
||||||
|
// if (serial.trim() != '') {
|
||||||
|
// \$wire.dispatch('process-scan', serial);
|
||||||
|
// \$event.target.value = '';
|
||||||
|
// }
|
||||||
|
// ",
|
||||||
|
// ])
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get, callable $livewire) {
|
||||||
$set('update_invoice', 0);
|
$set('update_invoice', 0);
|
||||||
// $this->dispatch('focus-serial-number');
|
// $this->dispatch('focus-serial-number');
|
||||||
// if (!$invNo) { return; } else { }
|
// if (!$invNo) { return; } else { }
|
||||||
|
// if ($state) {
|
||||||
|
// $livewire('process-scan', $state);
|
||||||
|
// $set('serial_number', null);
|
||||||
|
// }
|
||||||
})
|
})
|
||||||
->columnSpan(1),
|
->columnSpan(1),
|
||||||
Forms\Components\TextInput::make('total_quantity')
|
Forms\Components\TextInput::make('total_quantity')
|
||||||
@@ -1256,6 +1280,24 @@ class InvoiceValidationResource extends Resource
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public static function render(): View
|
||||||
|
// {
|
||||||
|
// if (session()->has('invoice_number')) {
|
||||||
|
// $invoiceNumber = session('invoice_number');
|
||||||
|
|
||||||
|
// // Debug: show the invoice number
|
||||||
|
// dd($invoiceNumber); // This will stop execution and show the value
|
||||||
|
|
||||||
|
// // Trigger email
|
||||||
|
// \Mail::to('jothikumar.padmanaban@cripumps.com')
|
||||||
|
// ->send(new InvoiceNotification($invoiceNumber));
|
||||||
|
|
||||||
|
// // Clear session so it doesn't resend on next refresh
|
||||||
|
// //session()->forget('invoice_number');
|
||||||
|
// }
|
||||||
|
// // return view('filament.resources.invoice-validation-resource.pages.list-invoice-validation');
|
||||||
|
// }
|
||||||
|
|
||||||
public static function getEloquentQuery(): Builder
|
public static function getEloquentQuery(): Builder
|
||||||
{
|
{
|
||||||
return parent::getEloquentQuery()
|
return parent::getEloquentQuery()
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ use Illuminate\Support\Facades\Mail;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
use Str;
|
use Str;
|
||||||
|
use Livewire\Attributes\On;
|
||||||
|
|
||||||
class CreateInvoiceValidation extends CreateRecord
|
class CreateInvoiceValidation extends CreateRecord
|
||||||
{
|
{
|
||||||
@@ -2260,7 +2261,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processSerialNumber($serNo)
|
public function processSerial($serNo)
|
||||||
{
|
{
|
||||||
$serNo = trim($serNo);
|
$serNo = trim($serNo);
|
||||||
$mSerNo = $serNo;
|
$mSerNo = $serNo;
|
||||||
@@ -2370,18 +2371,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
// .Mail
|
// .Mail
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2404,19 +2405,19 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
// .Mail
|
// .Mail
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2439,19 +2440,19 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
// .Mail
|
// .Mail
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2481,18 +2482,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
// .Mail
|
// .Mail
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2513,18 +2514,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2555,18 +2556,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
// .Mail
|
// .Mail
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2588,18 +2589,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
// .Mail
|
// .Mail
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2630,18 +2631,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
// .Mail
|
// .Mail
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2668,18 +2669,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotFound')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotFound')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2705,18 +2706,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotFoundDB')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotFoundDB')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2741,18 +2742,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotValidMaterialType')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotValidMaterialType')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2783,18 +2784,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotInvoice')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotInvoice')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -2824,18 +2825,18 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
|
|
||||||
$mailData = $this->getMail();
|
// $mailData = $this->getMail();
|
||||||
$mPlantName = $mailData['plant_name'];
|
// $mPlantName = $mailData['plant_name'];
|
||||||
$emails = $mailData['emails'];
|
// $emails = $mailData['emails'];
|
||||||
$mInvoiceType = 'Material';
|
// $mInvoiceType = 'Material';
|
||||||
|
|
||||||
if (! empty($emails)) {
|
// if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
// Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'Item')
|
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'Item')
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -3764,6 +3765,12 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #[On('process-scan')]
|
||||||
|
// public function processSerial($serial)
|
||||||
|
// {
|
||||||
|
// $this->processSer($serial); // Your duplicate check + mail logic
|
||||||
|
// }
|
||||||
|
|
||||||
public function getHeading(): string
|
public function getHeading(): string
|
||||||
{
|
{
|
||||||
return 'Scan Invoice Validation';
|
return 'Scan Invoice Validation';
|
||||||
|
|||||||
@@ -5,21 +5,19 @@ namespace App\Filament\Resources;
|
|||||||
use App\Filament\Exports\WorkGroupMasterExporter;
|
use App\Filament\Exports\WorkGroupMasterExporter;
|
||||||
use App\Filament\Imports\WorkGroupMasterImporter;
|
use App\Filament\Imports\WorkGroupMasterImporter;
|
||||||
use App\Filament\Resources\WorkGroupMasterResource\Pages;
|
use App\Filament\Resources\WorkGroupMasterResource\Pages;
|
||||||
use App\Filament\Resources\WorkGroupMasterResource\RelationManagers;
|
|
||||||
use App\Models\Line;
|
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\WorkGroupMaster;
|
use App\Models\WorkGroupMaster;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Components\Section;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Actions\ExportAction;
|
||||||
|
use Filament\Tables\Actions\ImportAction;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
use Filament\Forms\Components\Section;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Filament\Tables\Actions\ImportAction;
|
|
||||||
use Filament\Tables\Actions\ExportAction;
|
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class WorkGroupMasterResource extends Resource
|
class WorkGroupMasterResource extends Resource
|
||||||
@@ -37,68 +35,70 @@ class WorkGroupMasterResource extends Resource
|
|||||||
return $form
|
return $form
|
||||||
->schema([
|
->schema([
|
||||||
Section::make('')
|
Section::make('')
|
||||||
->schema([
|
->schema([
|
||||||
Forms\Components\Select::make('plant_id')
|
Forms\Components\Select::make('plant_id')
|
||||||
->label('Plant')
|
->label('Plant')
|
||||||
->relationship('plant', 'name')
|
->relationship('plant', 'name')
|
||||||
->reactive()
|
->reactive()
|
||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
->required()
|
->required()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
|
||||||
})
|
|
||||||
->afterStateUpdated(function ($state, $set, callable $get) {
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
|
|
||||||
if (!$plantId) {
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
$set('pqPlantError', 'Please select a plant first.');
|
})
|
||||||
$set('name', null);
|
->afterStateUpdated(function ($state, $set, callable $get) {
|
||||||
$set('description', null);
|
$plantId = $get('plant_id');
|
||||||
$set('operation_number', null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$set('validationError', null);
|
if (! $plantId) {
|
||||||
$set('pqPlantError', null);
|
$set('pqPlantError', 'Please select a plant first.');
|
||||||
$set('name', null);
|
$set('name', null);
|
||||||
$set('description', null);
|
$set('description', null);
|
||||||
$set('operation_number', null);
|
$set('operation_number', null);
|
||||||
})
|
|
||||||
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
|
return;
|
||||||
->hintColor('danger'),
|
}
|
||||||
Forms\Components\TextInput::make('name')
|
|
||||||
->label('Name')
|
$set('validationError', null);
|
||||||
->required()
|
$set('pqPlantError', null);
|
||||||
->minLength(6)
|
$set('name', null);
|
||||||
->columnSpan(1)
|
$set('description', null);
|
||||||
->reactive()
|
$set('operation_number', null);
|
||||||
->rule(function (callable $get) {
|
})
|
||||||
return Rule::unique('work_group_masters', 'name')
|
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
|
||||||
->where('plant_id', $get('plant_id'))
|
->hintColor('danger'),
|
||||||
->ignore($get('id'));
|
Forms\Components\TextInput::make('name')
|
||||||
}),
|
->label('Name')
|
||||||
Forms\Components\TextInput::make('operation_number')
|
->required()
|
||||||
->label('Operation Number')
|
->minLength(6)
|
||||||
->numeric()
|
->columnSpan(1)
|
||||||
->columnSpan(1)
|
->reactive()
|
||||||
->reactive()
|
->rule(function (callable $get) {
|
||||||
->required()
|
return Rule::unique('work_group_masters', 'name')
|
||||||
->rule(function (callable $get) {
|
->where('plant_id', $get('plant_id'))
|
||||||
return Rule::unique('work_group_masters', 'operation_number')
|
->ignore($get('id'));
|
||||||
->where('plant_id', $get('plant_id'))
|
}),
|
||||||
->ignore($get('id'));
|
Forms\Components\TextInput::make('operation_number')
|
||||||
}),
|
->label('Operation Number')
|
||||||
Forms\Components\TextInput::make('description')
|
->numeric()
|
||||||
->label('Description')
|
->columnSpan(1)
|
||||||
->required()
|
->reactive()
|
||||||
->minLength(5)
|
->required(),
|
||||||
->reactive()
|
// ->rule(function (callable $get) {
|
||||||
->columnSpan(['default' => 1, 'sm' => 3]),
|
// return Rule::unique('work_group_masters', 'operation_number')
|
||||||
Forms\Components\Hidden::make('created_by')
|
// ->where('plant_id', $get('plant_id'))
|
||||||
->default(Filament::auth()->user()?->name),
|
// ->ignore($get('id'));
|
||||||
])
|
// }),
|
||||||
->columns(['default' => 1, 'sm' => 3]),
|
Forms\Components\TextInput::make('description')
|
||||||
|
->label('Description')
|
||||||
|
->required()
|
||||||
|
->minLength(5)
|
||||||
|
->reactive()
|
||||||
|
->columnSpan(['default' => 1, 'sm' => 3]),
|
||||||
|
Forms\Components\Hidden::make('created_by')
|
||||||
|
->default(Filament::auth()->user()?->name),
|
||||||
|
])
|
||||||
|
->columns(['default' => 1, 'sm' => 3]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +112,7 @@ class WorkGroupMasterResource extends Resource
|
|||||||
$paginator = $livewire->getTableRecords();
|
$paginator = $livewire->getTableRecords();
|
||||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||||
|
|
||||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||||
}),
|
}),
|
||||||
Tables\Columns\TextColumn::make('plant.name')
|
Tables\Columns\TextColumn::make('plant.name')
|
||||||
@@ -177,14 +178,14 @@ class WorkGroupMasterResource extends Resource
|
|||||||
->label('Import Work Group Masters')
|
->label('Import Work Group Masters')
|
||||||
->color('warning')
|
->color('warning')
|
||||||
->importer(WorkGroupMasterImporter::class)
|
->importer(WorkGroupMasterImporter::class)
|
||||||
->visible(function() {
|
->visible(function () {
|
||||||
return Filament::auth()->user()->can('view import work group master');
|
return Filament::auth()->user()->can('view import work group master');
|
||||||
}),
|
}),
|
||||||
ExportAction::make()
|
ExportAction::make()
|
||||||
->label('Export Work Group Masters')
|
->label('Export Work Group Masters')
|
||||||
->color('warning')
|
->color('warning')
|
||||||
->exporter(WorkGroupMasterExporter::class)
|
->exporter(WorkGroupMasterExporter::class)
|
||||||
->visible(function() {
|
->visible(function () {
|
||||||
return Filament::auth()->user()->can('view export work group master');
|
return Filament::auth()->user()->can('view export work group master');
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -110,8 +110,14 @@ class InvalidSerialMail extends Mailable
|
|||||||
case 'DuplicateCapacitorQR':
|
case 'DuplicateCapacitorQR':
|
||||||
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||||
break;
|
break;
|
||||||
|
case 'CompletedSerialInvoice':
|
||||||
|
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||||
|
break;
|
||||||
|
case 'CSerialInvoice':
|
||||||
|
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||||
|
break;
|
||||||
case 'ComSerInv':
|
case 'ComSerInv':
|
||||||
$this->subjectLine = "Completed Serial Invoice ({$this->mplantName})";
|
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,6 +153,26 @@ class InvalidSerialMail extends Mailable
|
|||||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||||
";
|
";
|
||||||
break;
|
break;
|
||||||
|
case 'CompletedSerialInvoice':
|
||||||
|
$this->greeting = "
|
||||||
|
Dear Sir/Madam,<br><br>
|
||||||
|
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
|
||||||
|
<b>Plant:</b> {$this->mplantName}<br>
|
||||||
|
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||||
|
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||||
|
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||||
|
";
|
||||||
|
break;
|
||||||
|
case 'CSerialInvoice':
|
||||||
|
$this->greeting = "
|
||||||
|
Dear Sir/Madam,<br><br>
|
||||||
|
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
|
||||||
|
<b>Plant:</b> {$this->mplantName}<br>
|
||||||
|
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||||
|
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||||
|
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||||
|
";
|
||||||
|
break;
|
||||||
case 'ComSerInv':
|
case 'ComSerInv':
|
||||||
$this->greeting = "
|
$this->greeting = "
|
||||||
Dear Sir/Madam,<br><br>
|
Dear Sir/Madam,<br><br>
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$sql = <<<'SQL'
|
||||||
|
ALTER TABLE process_orders
|
||||||
|
ALTER COLUMN order_quantity TYPE NUMERIC
|
||||||
|
USING order_quantity::NUMERIC;
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
// Schema::table('process_orders', function (Blueprint $table) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('work_group_masters', function (Blueprint $table) {
|
||||||
|
$table->dropUnique('work_group_masters_plant_id_operation_number_key');
|
||||||
|
});
|
||||||
|
|
||||||
|
// $sql = <<<'SQL'
|
||||||
|
// ALTER TABLE work_group_masters
|
||||||
|
// DROP INDEX work_group_masters_plant_id_operation_number_key;
|
||||||
|
// SQL;
|
||||||
|
|
||||||
|
// DB::statement($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('work_group_masters', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"concurrently": "^9.0.1",
|
"concurrently": "^9.0.1",
|
||||||
"laravel-vite-plugin": "^1.2.0",
|
"laravel-vite-plugin": "^1.2.0",
|
||||||
"postcss": "^8.4.47",
|
"postcss": "^8.4.47",
|
||||||
"tailwindcss": "^3.4.13",
|
"tailwindcss": "^4.0.0",
|
||||||
"vite": "^6.0.11"
|
"vite": "^6.0.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user