Merge pull request 'corrected logic in sticker printing page' (#55) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Reviewed-on: #55
This commit was merged in pull request #55.
This commit is contained in:
@@ -9,6 +9,7 @@ use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
|||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use App\Models\StickerPrinting;
|
use App\Models\StickerPrinting;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
|
use Str;
|
||||||
|
|
||||||
|
|
||||||
class CreateStickerPrinting extends CreateRecord
|
class CreateStickerPrinting extends CreateRecord
|
||||||
@@ -94,6 +95,11 @@ class CreateStickerPrinting extends CreateRecord
|
|||||||
->body("Serial number should conatin minimum 9 digits '$serial'.")
|
->body("Serial number should conatin minimum 9 digits '$serial'.")
|
||||||
->warning()
|
->warning()
|
||||||
->send();
|
->send();
|
||||||
|
$this->form->fill([
|
||||||
|
'plant_id' => $plant,
|
||||||
|
'reference_number' => $ref,
|
||||||
|
'serial_number' => '',
|
||||||
|
]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(!ctype_alnum($serial)) {
|
else if(!ctype_alnum($serial)) {
|
||||||
@@ -102,6 +108,11 @@ class CreateStickerPrinting extends CreateRecord
|
|||||||
->body("Serial number should be alphanumeric '$serial'.")
|
->body("Serial number should be alphanumeric '$serial'.")
|
||||||
->warning()
|
->warning()
|
||||||
->send();
|
->send();
|
||||||
|
$this->form->fill([
|
||||||
|
'plant_id' => $plant,
|
||||||
|
'reference_number' => $ref,
|
||||||
|
'serial_number' => '',
|
||||||
|
]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$extractedSerialNumber = $matches['serial_number'];
|
$extractedSerialNumber = $matches['serial_number'];
|
||||||
@@ -124,8 +135,8 @@ class CreateStickerPrinting extends CreateRecord
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($plant == null || trim($plant) == '' || $ref == null || trim($ref) == '' || $sNumber == null || trim($sNumber) == '')
|
||||||
if(empty($this->plantId) || empty($ref) || empty($this->serial_number)) {
|
{
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown: Incomplete Data!')
|
->title('Unknown: Incomplete Data!')
|
||||||
->body("Please ensure Plant, Reference Number, and Serial Number are provided.")
|
->body("Please ensure Plant, Reference Number, and Serial Number are provided.")
|
||||||
@@ -158,16 +169,16 @@ class CreateStickerPrinting extends CreateRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
StickerPrinting::create([
|
StickerPrinting::create([
|
||||||
'plant_id' => $this->plantId,
|
'plant_id' => $plant,
|
||||||
'reference_number' => $ref,
|
'reference_number' => $ref,
|
||||||
'serial_number' => $this->serial_number,
|
'serial_number' => $sNumber,
|
||||||
'created_by' => Filament::auth()->user()->name,
|
'created_by' => Filament::auth()->user()->name,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->dispatch('addStickerToList', $this->plantId, $ref, $this->serial_number);
|
$this->dispatch('addStickerToList', $plant, $ref, $sNumber);
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id' => $this->plantId,
|
'plant_id' => $plant,
|
||||||
'reference_number' => $ref,
|
'reference_number' => $ref,
|
||||||
'serial_number' => '',
|
'serial_number' => '',
|
||||||
]);
|
]);
|
||||||
@@ -223,6 +234,7 @@ class CreateStickerPrinting extends CreateRecord
|
|||||||
// Send data to Pdf view
|
// Send data to Pdf view
|
||||||
$pdf = PDF::loadView('pdf.qrcode', [
|
$pdf = PDF::loadView('pdf.qrcode', [
|
||||||
'qrCode' => $qrCode,
|
'qrCode' => $qrCode,
|
||||||
|
'referenceNumber' => $refNumber,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return response()->streamDownload(function () use ($pdf) {
|
return response()->streamDownload(function () use ($pdf) {
|
||||||
|
|||||||
Reference in New Issue
Block a user