Removed image path logic in quality validation resource page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m41s
Laravel Larastan / larastan (pull_request) Failing after 3m12s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m41s
Laravel Larastan / larastan (pull_request) Failing after 3m12s
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Filament\Exports\QualityValidationExporter;
|
|||||||
use App\Filament\Imports\QualityValidationImporter;
|
use App\Filament\Imports\QualityValidationImporter;
|
||||||
use App\Filament\Resources\QualityValidationResource\Pages;
|
use App\Filament\Resources\QualityValidationResource\Pages;
|
||||||
use App\Filament\Resources\QualityValidationResource\RelationManagers;
|
use App\Filament\Resources\QualityValidationResource\RelationManagers;
|
||||||
|
// use App\Jobs\SendInvalidQualityMailJob;
|
||||||
use App\Mail\InvalidQualityMail;
|
use App\Mail\InvalidQualityMail;
|
||||||
use App\Models\AlertMailRule;
|
use App\Models\AlertMailRule;
|
||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
@@ -13,6 +14,8 @@ use App\Models\Line;
|
|||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\QualityValidation;
|
use App\Models\QualityValidation;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
|
// use App\Models\User;
|
||||||
|
// use App\Notifications\StatusUpdated;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
@@ -45,6 +48,7 @@ class QualityValidationResource extends Resource
|
|||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Display';
|
protected static ?string $navigationGroup = 'Display';
|
||||||
|
|
||||||
public $isSubmitted = false;
|
public $isSubmitted = false;
|
||||||
public $data = [];
|
public $data = [];
|
||||||
|
|
||||||
@@ -706,7 +710,6 @@ class QualityValidationResource extends Resource
|
|||||||
$fileName = "{$value}.png";
|
$fileName = "{$value}.png";
|
||||||
|
|
||||||
$imageUrl = route('part.validation.image', [
|
$imageUrl = route('part.validation.image', [
|
||||||
'plant' => $plantCode1,
|
|
||||||
'filename' => $fileName
|
'filename' => $fileName
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -1731,6 +1734,17 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
$set('tube_sticker_motor_error', null);
|
$set('tube_sticker_motor_error', null);
|
||||||
|
|
||||||
|
// $mPorder = $get('production_order');
|
||||||
|
|
||||||
|
// $mPlantId = $get('plant_id');
|
||||||
|
//$plant = Plant::find($mPlantId);
|
||||||
|
// $plantCodePart4 = $plant?->code;
|
||||||
|
|
||||||
|
// $mlineId = $get('line_id');
|
||||||
|
|
||||||
|
// $mLine = Line::find($mlineId);
|
||||||
|
// $mLinePart = $mLine?->name;
|
||||||
|
|
||||||
if (empty($state)) {
|
if (empty($state)) {
|
||||||
$set('tube_sticker_motor_error', null);
|
$set('tube_sticker_motor_error', null);
|
||||||
return;
|
return;
|
||||||
@@ -1832,6 +1846,24 @@ class QualityValidationResource extends Resource
|
|||||||
if (!$isMatch)
|
if (!$isMatch)
|
||||||
{
|
{
|
||||||
$set('tube_sticker_motor_error', 'Serial number does not match.');
|
$set('tube_sticker_motor_error', 'Serial number does not match.');
|
||||||
|
|
||||||
|
// $mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
|
||||||
|
|
||||||
|
// $mPlantName = $mailData['plant_name'];
|
||||||
|
// $emails = $mailData['emails'];
|
||||||
|
// $mUserName = Filament::auth()->user()->name;
|
||||||
|
|
||||||
|
// if (!empty($emails))
|
||||||
|
// {
|
||||||
|
// //Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||||
|
// Mail::to($emails)->send(
|
||||||
|
// new InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidTubeStickerMotor')
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// \Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
||||||
|
// }
|
||||||
$set('tube_sticker_motor_qr', null);
|
$set('tube_sticker_motor_qr', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1856,10 +1888,32 @@ class QualityValidationResource extends Resource
|
|||||||
->default('')
|
->default('')
|
||||||
->required()
|
->required()
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state, $livewire) {
|
||||||
|
|
||||||
$set('tube_sticker_pump_error', null);
|
$set('tube_sticker_pump_error', null);
|
||||||
|
|
||||||
|
// $mPorder = $get('production_order');
|
||||||
|
|
||||||
|
// $mPlantId = $get('plant_id');
|
||||||
|
// $plant = Plant::find($mPlantId);
|
||||||
|
// $mPlantName = $plant?->name;
|
||||||
|
|
||||||
|
// $mlineId = $get('line_id');
|
||||||
|
|
||||||
|
// $mLine = Line::find($mlineId);
|
||||||
|
// $mLinePart = $mLine?->name;
|
||||||
|
|
||||||
|
// $mPorder = $get('production_order');
|
||||||
|
// $mPlantId = $get('plant_id');
|
||||||
|
// $mlineId = $get('line_id');
|
||||||
|
// $mUserName = Filament::auth()->user()?->name ?? 'Unknown';
|
||||||
|
|
||||||
|
// $mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
|
||||||
|
|
||||||
|
// $mPlantName = $mailData['plant_name'];
|
||||||
|
// $emails = $mailData['emails'];
|
||||||
|
//$mUserName = Filament::auth()->user()->name;
|
||||||
|
|
||||||
if (empty($state)) {
|
if (empty($state)) {
|
||||||
$set('tube_sticker_pump_error', null);
|
$set('tube_sticker_pump_error', null);
|
||||||
return;
|
return;
|
||||||
@@ -1962,6 +2016,62 @@ class QualityValidationResource extends Resource
|
|||||||
{
|
{
|
||||||
$set('tube_sticker_pump_error', 'Serial number does not match.');
|
$set('tube_sticker_pump_error', 'Serial number does not match.');
|
||||||
$set('tube_sticker_pump_qr', null);
|
$set('tube_sticker_pump_qr', null);
|
||||||
|
// $user = User::where('name', $mUserName)->first();
|
||||||
|
|
||||||
|
// if ($user) {
|
||||||
|
// $user->notify(new StatusUpdated($state));
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// $currentUser = Filament::auth()->user();
|
||||||
|
|
||||||
|
// if ($currentUser) {
|
||||||
|
// $currentUser->notify(new StatusUpdated($state)); // standard Laravel DB notification
|
||||||
|
|
||||||
|
// // refresh Filament bell
|
||||||
|
// $livewire->dispatch('refreshFilamentNotifications');
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Status Updated')
|
||||||
|
// ->body("Serial number scanned: $state")
|
||||||
|
// ->danger()
|
||||||
|
// ->sendToDatabase($currentUser);
|
||||||
|
|
||||||
|
//$user->notify(new StatusUpdated($state));
|
||||||
|
|
||||||
|
//Notification::send($user, new StatusUpdated($state));
|
||||||
|
|
||||||
|
|
||||||
|
//dd($user);
|
||||||
|
// $user->notify(new StatusUpdated($state));
|
||||||
|
// Inside a Filament page or resource
|
||||||
|
//$this->notify('success', "Serial number scanned: $state");
|
||||||
|
|
||||||
|
// dispatch(new SendInvalidQualityMailJob(
|
||||||
|
// $state, $mPorder, $mPlantId, $mlineId, $mUserName, 'InvalidTubeStickerPump'
|
||||||
|
// ))->afterResponse();
|
||||||
|
|
||||||
|
|
||||||
|
// $mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
|
||||||
|
|
||||||
|
// $mPlantName = $mailData['plant_name'];
|
||||||
|
// $emails = $mailData['emails'];
|
||||||
|
// $mUserName = Filament::auth()->user()->name;
|
||||||
|
|
||||||
|
// if (!empty($emails))
|
||||||
|
// {
|
||||||
|
// //Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||||
|
// Mail::to($emails)->queue(
|
||||||
|
// new InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidTubeStickerPumpset')
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// \Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
||||||
|
// }
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1989,6 +2099,17 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
$set('tube_sticker_pumpset_error', null);
|
$set('tube_sticker_pumpset_error', null);
|
||||||
|
|
||||||
|
$mPorder = $get('production_order');
|
||||||
|
|
||||||
|
$mPlantId = $get('plant_id');
|
||||||
|
//$plant = Plant::find($mPlantId);
|
||||||
|
// $plantCodePart4 = $plant?->code;
|
||||||
|
|
||||||
|
$mlineId = $get('line_id');
|
||||||
|
|
||||||
|
$mLine = Line::find($mlineId);
|
||||||
|
$mLinePart = $mLine?->name;
|
||||||
|
|
||||||
if (empty($state)) {
|
if (empty($state)) {
|
||||||
$set('tube_sticker_pumpset_error', null);
|
$set('tube_sticker_pumpset_error', null);
|
||||||
return;
|
return;
|
||||||
@@ -2092,6 +2213,23 @@ class QualityValidationResource extends Resource
|
|||||||
if (!$isMatch)
|
if (!$isMatch)
|
||||||
{
|
{
|
||||||
$set('tube_sticker_pumpset_error', 'Serial number does not match.');
|
$set('tube_sticker_pumpset_error', 'Serial number does not match.');
|
||||||
|
// $mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
|
||||||
|
|
||||||
|
// $mPlantName = $mailData['plant_name'];
|
||||||
|
// $emails = $mailData['emails'];
|
||||||
|
// $mUserName = Filament::auth()->user()->name;
|
||||||
|
|
||||||
|
// if (!empty($emails))
|
||||||
|
// {
|
||||||
|
// //Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||||
|
// Mail::to($emails)->send(
|
||||||
|
// new InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidTubeStickerPumpset')
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// \Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
||||||
|
// }
|
||||||
$set('tube_sticker_pumpset_qr', null);
|
$set('tube_sticker_pumpset_qr', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2305,7 +2443,7 @@ class QualityValidationResource extends Resource
|
|||||||
$set('part_validation1', null);
|
$set('part_validation1', null);
|
||||||
|
|
||||||
$fileName = $expectedValue . ".png"; // or .jpg based on your file
|
$fileName = $expectedValue . ".png"; // or .jpg based on your file
|
||||||
$fullPath = storage_path("app/private/uploads/PartValidation/{$plantCodePart1}/{$fileName}");
|
$fullPath = storage_path("app/private/uploads/PartValidation/{$fileName}");
|
||||||
|
|
||||||
// dd($fullPath);
|
// dd($fullPath);
|
||||||
|
|
||||||
@@ -2316,7 +2454,7 @@ class QualityValidationResource extends Resource
|
|||||||
// ]);
|
// ]);
|
||||||
if (file_exists($fullPath)) {
|
if (file_exists($fullPath)) {
|
||||||
$imageUrl = route('part.validation.image', [
|
$imageUrl = route('part.validation.image', [
|
||||||
'plant' => $plantCodePart1,
|
// 'plant' => $plantCodePart1,
|
||||||
'filename' => $fileName
|
'filename' => $fileName
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
@@ -2607,7 +2745,7 @@ class QualityValidationResource extends Resource
|
|||||||
'filename' => $fileName
|
'filename' => $fileName
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$set('part_validation2_error_image', $imageUrl);
|
$set('part_validation4_error_image', $imageUrl);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2771,34 +2909,6 @@ class QualityValidationResource extends Resource
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public function getMail(){
|
|
||||||
// //$plantId = $this->form->getState()['plant_id'];
|
|
||||||
// $plantId = $this->data['plant_id'] ?? null;
|
|
||||||
// //$this->plantId = $plantId;
|
|
||||||
// dd($plantId);
|
|
||||||
// $mInvoiceType = 'Serial';
|
|
||||||
// $mPlantName = Plant::where('id', $plantId)->value('name');
|
|
||||||
// $emails = AlertMailRule::where('plant', $plantId)
|
|
||||||
// //->where('plant', $plantName)
|
|
||||||
// ->where('module', 'InvoiceValidation')
|
|
||||||
// ->where('rule_name', 'InvoiceMail')
|
|
||||||
// ->where(function ($query) {
|
|
||||||
// $query->whereNull('schedule_type')
|
|
||||||
// ->orWhere('schedule_type', '');
|
|
||||||
// })
|
|
||||||
// ->pluck('email')
|
|
||||||
// ->toArray();
|
|
||||||
|
|
||||||
// return [
|
|
||||||
// 'plant_id' => $plantId,
|
|
||||||
// 'plant_name' => $mPlantName,
|
|
||||||
// 'invoice_type' => $mInvoiceType,
|
|
||||||
// 'emails' => $emails,
|
|
||||||
// ];
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
|
|||||||
Reference in New Issue
Block a user