Updated alignments and validation logics
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
This commit is contained in:
@@ -34,6 +34,8 @@ class SendInvoiceReport extends Command
|
|||||||
// $scheduleType = $this->argument('scheduleType');
|
// $scheduleType = $this->argument('scheduleType');
|
||||||
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
||||||
|
|
||||||
|
// $mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||||
|
|
||||||
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||||
|
|
||||||
// $startDate = now()->setTime(8, 0, 0);
|
// $startDate = now()->setTime(8, 0, 0);
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ class ProcessOrderExporter extends Exporter
|
|||||||
ExportColumn::make('deleted_at')
|
ExportColumn::make('deleted_at')
|
||||||
->enabledByDefault(false)
|
->enabledByDefault(false)
|
||||||
->label('DELETED AT'),
|
->label('DELETED AT'),
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ class CreateProductionOrder extends CreateRecord
|
|||||||
} else {
|
} else {
|
||||||
return redirect()->route('production-orders.printpanel', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
return redirect()->route('production-orders.printpanel', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFormActions(): array
|
protected function getFormActions(): array
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class PalletPrintController extends Controller
|
|||||||
|
|
||||||
$index = $completedPallets->search($pallet);
|
$index = $completedPallets->search($pallet);
|
||||||
|
|
||||||
$currentPalletNo = ($index != false) ? $index + 1 : 0;
|
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
||||||
|
|
||||||
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
||||||
|
|
||||||
|
|||||||
@@ -4,28 +4,42 @@ namespace App\Mail;
|
|||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
// use App\Exports\ProductionExport;
|
||||||
|
// use Illuminate\Mail\Mailables\Attachment;
|
||||||
|
// use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
class ProductionMail extends Mailable
|
class ProductionMail extends Mailable
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
public $tableData;
|
public $tableData;
|
||||||
|
|
||||||
public $scheduleType;
|
public $scheduleType;
|
||||||
|
// public $excelData;
|
||||||
|
// public $dates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct($scheduleType,$tableData = [])
|
public function __construct($scheduleType, $tableData = [])
|
||||||
{
|
{
|
||||||
$this->scheduleType = $scheduleType;
|
$this->scheduleType = $scheduleType;
|
||||||
$this->tableData = $tableData ?? [];
|
$this->tableData = $tableData ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function __construct($scheduleType,$tableData = [],$excelData = [],$dates = [])
|
||||||
|
// {
|
||||||
|
// $this->scheduleType = $scheduleType;
|
||||||
|
// $this->tableData = $tableData;
|
||||||
|
// $this->excelData = $excelData;
|
||||||
|
// $this->dates = $dates;
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the message envelope.
|
* Get the message envelope.
|
||||||
*/
|
*/
|
||||||
@@ -52,13 +66,14 @@ class ProductionMail extends Mailable
|
|||||||
// ],
|
// ],
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public function content(): Content
|
public function content(): Content
|
||||||
{
|
{
|
||||||
$greeting = "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,";
|
$greeting = "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,";
|
||||||
|
|
||||||
if ($this->scheduleType == 'Daily') {
|
if ($this->scheduleType == 'Daily') {
|
||||||
$fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i') . ':000';
|
$fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i').':000';
|
||||||
$toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i') . ':999';
|
$toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i').':999';
|
||||||
$reportPeriod = "The following report presents results from: $fromDate to $toDate.";
|
$reportPeriod = "The following report presents results from: $fromDate to $toDate.";
|
||||||
$greeting .= $reportPeriod;
|
$greeting .= $reportPeriod;
|
||||||
}
|
}
|
||||||
@@ -74,22 +89,21 @@ class ProductionMail extends Mailable
|
|||||||
if ($this->scheduleType == 'Live') {
|
if ($this->scheduleType == 'Live') {
|
||||||
$now = now();
|
$now = now();
|
||||||
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
|
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
|
||||||
$toMinute = $now->format('d/m/Y H:i:s');
|
$toMinute = $now->format('d/m/Y H:i:s');
|
||||||
$greeting .= "The following report presents results from: $fromMinute to $toMinute.";
|
$greeting .= "The following report presents results from: $fromMinute to $toMinute.";
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Content(
|
return new Content(
|
||||||
view: 'mail.production_report',
|
view: 'mail.production_report',
|
||||||
with: [
|
with: [
|
||||||
'company' => "CRI Digital Manufacturing Solutions",
|
'company' => 'CRI Digital Manufacturing Solutions',
|
||||||
'greeting' => $greeting,
|
'greeting' => $greeting,
|
||||||
'tableData' => $this->tableData,
|
'tableData' => $this->tableData,
|
||||||
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the attachments for the message.
|
* Get the attachments for the message.
|
||||||
*
|
*
|
||||||
@@ -98,5 +112,19 @@ class ProductionMail extends Mailable
|
|||||||
public function attachments(): array
|
public function attachments(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
|
// return [
|
||||||
|
// Attachment::fromData(
|
||||||
|
// fn () => Excel::raw(
|
||||||
|
// new ProductionExport(
|
||||||
|
// $this->excelData,
|
||||||
|
// $this->dates
|
||||||
|
// ),
|
||||||
|
// \Maatwebsite\Excel\Excel::XLSX
|
||||||
|
// ),
|
||||||
|
// 'production_plan_data.xlsx'
|
||||||
|
// )->withMime(
|
||||||
|
// 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
|
// ),
|
||||||
|
// ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,7 +210,20 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view import temp class characteristic']);
|
Permission::updateOrCreate(['name' => 'view import temp class characteristic']);
|
||||||
Permission::updateOrCreate(['name' => 'view export temp class characteristic']);
|
Permission::updateOrCreate(['name' => 'view export temp class characteristic']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import production temp']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export production temp']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import production orders']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export production orders']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import transit']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export import transit']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view reprint production order']);
|
||||||
|
Permission::updateOrCreate(['name' => 'create osp production sticker reprint page']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view print production order button']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view save production order button']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view print panel production order button']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -948,84 +948,80 @@ function cameraCapture() {
|
|||||||
|
|
||||||
|
|
||||||
async verifyPhoto() {
|
async verifyPhoto() {
|
||||||
if (!this.capturedPhoto) {
|
if (!this.capturedPhoto) {
|
||||||
alert("Please capture a photo first!");
|
alert("Please capture a photo first!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isWorkerReady) {
|
if (!this.isWorkerReady) {
|
||||||
alert("OCR worker not ready yet!");
|
alert("OCR worker not ready yet!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = this.capturedPhoto;
|
img.src = this.capturedPhoto;
|
||||||
|
|
||||||
img.onload = async () => {
|
img.onload = async () => {
|
||||||
|
|
||||||
// Reuse the same temp canvas (no memory leak)
|
// Reuse the same temp canvas (no memory leak)
|
||||||
this.tempCanvas.width = img.width;
|
this.tempCanvas.width = img.width;
|
||||||
this.tempCanvas.height = img.height;
|
this.tempCanvas.height = img.height;
|
||||||
this.tempCtx.drawImage(img, 0, 0);
|
this.tempCtx.drawImage(img, 0, 0);
|
||||||
|
|
||||||
// Worker OCR — much faster
|
// Worker OCR — much faster
|
||||||
const result = await this.ocrWorker.recognize(this.tempCanvas);
|
const result = await this.ocrWorker.recognize(this.tempCanvas);
|
||||||
|
|
||||||
const detectedText = result.data.text.trim();
|
const detectedText = result.data.text.trim();
|
||||||
console.log("Detected Text:", detectedText);
|
console.log("Detected Text:", detectedText);
|
||||||
|
|
||||||
// -------------------------------------------------------
|
const serialWithLabelRegex = /Serial\s*No[:\-]?\s*([A-Za-z0-9]+)/i;
|
||||||
// SERIAL EXTRACTION LOGIC — SAME AS YOUR ORIGINAL
|
const match = detectedText.match(serialWithLabelRegex);
|
||||||
// -------------------------------------------------------
|
|
||||||
const serialWithLabelRegex = /Serial\s*No[:\-]?\s*([A-Za-z0-9]+)/i;
|
|
||||||
const match = detectedText.match(serialWithLabelRegex);
|
|
||||||
|
|
||||||
if (match && match[1]) {
|
if (match && match[1]) {
|
||||||
// "Serial No: XXXXX"
|
this.serialNumbers = [match[1].trim()];
|
||||||
this.serialNumbers = [match[1].trim()];
|
console.log("Serial with Label:", this.serialNumbers[0]);
|
||||||
console.log("Serial with Label:", this.serialNumbers[0]);
|
}
|
||||||
} else {
|
else
|
||||||
// Extract first 4 alphanumeric sequences of 4+ chars
|
{
|
||||||
const generalNums = detectedText.match(/[A-Za-z0-9]{4,}/g) || [];
|
const generalNums = detectedText.match(/[A-Za-z0-9]{4,}/g) || [];
|
||||||
this.serialNumbers = generalNums.slice(0, 4);
|
this.serialNumbers = generalNums.slice(0, 4);
|
||||||
|
|
||||||
if (this.serialNumbers.length === 0) {
|
if (this.serialNumbers.length == 0) {
|
||||||
alert("No serial numbers detected!");
|
alert("No serial numbers detected!");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Serial Numbers List:", this.serialNumbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Serial Numbers List:", this.serialNumbers);
|
// Save into hidden input (your original logic)
|
||||||
|
this.$refs.hiddenInputSerials.value = JSON.stringify(this.serialNumbers);
|
||||||
|
|
||||||
|
alert("Serial numbers:\n" + this.$refs.hiddenInputSerials.value);
|
||||||
|
|
||||||
|
fetch('/save-serials-to-session', {
|
||||||
|
method: 'POST',
|
||||||
|
credentials: 'same-origin',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
serial_numbers: this.serialNumbers,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
console.log("Session Updated:", data);
|
||||||
|
alert("✅ Serial numbers saved to session!");
|
||||||
|
});
|
||||||
|
};
|
||||||
|
} catch (err) {
|
||||||
|
console.error("OCR verify error:", err);
|
||||||
|
alert("OCR verify failed:\n" + (err.message || err));
|
||||||
}
|
}
|
||||||
|
},
|
||||||
// Save into hidden input (your original logic)
|
|
||||||
this.$refs.hiddenInputSerials.value = JSON.stringify(this.serialNumbers);
|
|
||||||
|
|
||||||
alert("Serial numbers:\n" + this.$refs.hiddenInputSerials.value);
|
|
||||||
|
|
||||||
fetch('/save-serials-to-session', {
|
|
||||||
method: 'POST',
|
|
||||||
credentials: 'same-origin',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
serial_numbers: this.serialNumbers,
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
console.log("Session Updated:", data);
|
|
||||||
alert("✅ Serial numbers saved to session!");
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error("OCR verify error:", err);
|
|
||||||
alert("OCR verify failed:\n" + (err.message || err));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
startDetection() {
|
startDetection() {
|
||||||
if (this.textDetectionInterval) {
|
if (this.textDetectionInterval) {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
if (!scanInput) return;
|
if (!scanInput) return;
|
||||||
|
|
||||||
scanInput.addEventListener('keydown', function (event) {
|
scanInput.addEventListener('keydown', function (event) {
|
||||||
if (event.key === 'Enter') {
|
if (event.key == 'Enter') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
const value = scanInput.value.trim();
|
const value = scanInput.value.trim();
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
<div class="bg-white max-h-[80vh] overflow-hidden p-6 rounded-lg shadow-lg pointer-events-auto"
|
<div class="bg-white max-h-[80vh] overflow-hidden p-6 rounded-lg shadow-lg pointer-events-auto"
|
||||||
style="width:30vw !important; max-width:none !important;">
|
style="width:30vw !important; max-width:none !important;">
|
||||||
|
|
||||||
@if($records && $records->count())
|
{{-- @if($records && $records->count()) --}}
|
||||||
|
@if(!empty($records) && count($records))
|
||||||
<div style="max-height:250px; overflow-y:auto; border:1px solid #ccc;">
|
<div style="max-height:250px; overflow-y:auto; border:1px solid #ccc;">
|
||||||
|
|
||||||
{{-- <table class="min-w-full border"> --}}
|
{{-- <table class="min-w-full border"> --}}
|
||||||
|
|||||||
@@ -106,7 +106,6 @@
|
|||||||
-
|
-
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{{-- <td>{{ $row['lr_bl_aw_date'] }}</td> --}}
|
{{-- <td>{{ $row['lr_bl_aw_date'] }}</td> --}}
|
||||||
<td>{{ $row['transit_days'] }}</td>
|
<td>{{ $row['transit_days'] }}</td>
|
||||||
<td>{{ $row['status'] }}</td>
|
<td>{{ $row['status'] }}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user