Updated alignments and validation logics
Some checks are pending
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Waiting to run
Some checks are pending
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Waiting to run
This commit is contained in:
@@ -34,6 +34,8 @@ class SendInvoiceReport extends Command
|
||||
// $scheduleType = $this->argument('scheduleType');
|
||||
$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');
|
||||
|
||||
// $startDate = now()->setTime(8, 0, 0);
|
||||
|
||||
@@ -59,7 +59,6 @@ class ProcessOrderExporter extends Exporter
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +245,6 @@ class CreateProductionOrder extends CreateRecord
|
||||
} else {
|
||||
return redirect()->route('production-orders.printpanel', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function getFormActions(): array
|
||||
|
||||
@@ -107,7 +107,7 @@ class PalletPrintController extends Controller
|
||||
|
||||
$index = $completedPallets->search($pallet);
|
||||
|
||||
$currentPalletNo = ($index != false) ? $index + 1 : 0;
|
||||
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
||||
|
||||
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
||||
|
||||
|
||||
@@ -4,28 +4,42 @@ namespace App\Mail;
|
||||
|
||||
use DateTime;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
// use App\Exports\ProductionExport;
|
||||
// use Illuminate\Mail\Mailables\Attachment;
|
||||
// use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class ProductionMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $tableData;
|
||||
|
||||
public $scheduleType;
|
||||
// public $excelData;
|
||||
// public $dates;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($scheduleType,$tableData = [])
|
||||
public function __construct($scheduleType, $tableData = [])
|
||||
{
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
$this->scheduleType = $scheduleType;
|
||||
$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.
|
||||
*/
|
||||
@@ -52,13 +66,14 @@ class ProductionMail extends Mailable
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
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,";
|
||||
|
||||
if ($this->scheduleType == 'Daily') {
|
||||
$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';
|
||||
$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';
|
||||
$reportPeriod = "The following report presents results from: $fromDate to $toDate.";
|
||||
$greeting .= $reportPeriod;
|
||||
}
|
||||
@@ -74,22 +89,21 @@ class ProductionMail extends Mailable
|
||||
if ($this->scheduleType == 'Live') {
|
||||
$now = now();
|
||||
$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.";
|
||||
}
|
||||
|
||||
return new Content(
|
||||
view: 'mail.production_report',
|
||||
with: [
|
||||
'company' => "CRI Digital Manufacturing Solutions",
|
||||
'company' => 'CRI Digital Manufacturing Solutions',
|
||||
'greeting' => $greeting,
|
||||
'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.
|
||||
*
|
||||
@@ -98,5 +112,19 @@ class ProductionMail extends Mailable
|
||||
public function attachments(): array
|
||||
{
|
||||
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 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() {
|
||||
if (!this.capturedPhoto) {
|
||||
alert("Please capture a photo first!");
|
||||
return;
|
||||
}
|
||||
if (!this.capturedPhoto) {
|
||||
alert("Please capture a photo first!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isWorkerReady) {
|
||||
alert("OCR worker not ready yet!");
|
||||
return;
|
||||
}
|
||||
if (!this.isWorkerReady) {
|
||||
alert("OCR worker not ready yet!");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const img = new Image();
|
||||
img.src = this.capturedPhoto;
|
||||
try {
|
||||
const img = new Image();
|
||||
img.src = this.capturedPhoto;
|
||||
|
||||
img.onload = async () => {
|
||||
img.onload = async () => {
|
||||
|
||||
// Reuse the same temp canvas (no memory leak)
|
||||
this.tempCanvas.width = img.width;
|
||||
this.tempCanvas.height = img.height;
|
||||
this.tempCtx.drawImage(img, 0, 0);
|
||||
// Reuse the same temp canvas (no memory leak)
|
||||
this.tempCanvas.width = img.width;
|
||||
this.tempCanvas.height = img.height;
|
||||
this.tempCtx.drawImage(img, 0, 0);
|
||||
|
||||
// Worker OCR — much faster
|
||||
const result = await this.ocrWorker.recognize(this.tempCanvas);
|
||||
// Worker OCR — much faster
|
||||
const result = await this.ocrWorker.recognize(this.tempCanvas);
|
||||
|
||||
const detectedText = result.data.text.trim();
|
||||
console.log("Detected Text:", detectedText);
|
||||
const detectedText = result.data.text.trim();
|
||||
console.log("Detected Text:", detectedText);
|
||||
|
||||
// -------------------------------------------------------
|
||||
// SERIAL EXTRACTION LOGIC — SAME AS YOUR ORIGINAL
|
||||
// -------------------------------------------------------
|
||||
const serialWithLabelRegex = /Serial\s*No[:\-]?\s*([A-Za-z0-9]+)/i;
|
||||
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]) {
|
||||
// "Serial No: XXXXX"
|
||||
this.serialNumbers = [match[1].trim()];
|
||||
console.log("Serial with Label:", this.serialNumbers[0]);
|
||||
} else {
|
||||
// Extract first 4 alphanumeric sequences of 4+ chars
|
||||
const generalNums = detectedText.match(/[A-Za-z0-9]{4,}/g) || [];
|
||||
this.serialNumbers = generalNums.slice(0, 4);
|
||||
if (match && match[1]) {
|
||||
this.serialNumbers = [match[1].trim()];
|
||||
console.log("Serial with Label:", this.serialNumbers[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
const generalNums = detectedText.match(/[A-Za-z0-9]{4,}/g) || [];
|
||||
this.serialNumbers = generalNums.slice(0, 4);
|
||||
|
||||
if (this.serialNumbers.length === 0) {
|
||||
alert("No serial numbers detected!");
|
||||
return;
|
||||
if (this.serialNumbers.length == 0) {
|
||||
alert("No serial numbers detected!");
|
||||
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() {
|
||||
if (this.textDetectionInterval) {
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
if (!scanInput) return;
|
||||
|
||||
scanInput.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Enter') {
|
||||
if (event.key == 'Enter') {
|
||||
event.preventDefault();
|
||||
|
||||
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"
|
||||
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;">
|
||||
|
||||
{{-- <table class="min-w-full border"> --}}
|
||||
|
||||
@@ -106,7 +106,6 @@
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
|
||||
{{-- <td>{{ $row['lr_bl_aw_date'] }}</td> --}}
|
||||
<td>{{ $row['transit_days'] }}</td>
|
||||
<td>{{ $row['status'] }}</td>
|
||||
|
||||
Reference in New Issue
Block a user