12 Commits

Author SHA1 Message Date
dhanabalan
6f93f2bd92 Updated alignments and validation logics
Some checks are pending
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Waiting to run
2026-05-13 17:41:22 +05:30
dhanabalan
d19b8120e2 Commented testing purpose code
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 17:16:56 +05:30
dhanabalan
8fb42203c3 Removed unwanted comment line
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 17:16:07 +05:30
dhanabalan
bb2f5082b1 Updated alignment on resource page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 17:15:21 +05:30
dhanabalan
3215cd39ad Added space between query
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 17:13:19 +05:30
dhanabalan
7755d15741 Updated filter logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 17:12:25 +05:30
dhanabalan
4586fc0d60 Removed unwanted space
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 17:10:39 +05:30
dhanabalan
65fc5202a4 Import example data updated
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 17:09:57 +05:30
dhanabalan
770f0c9af3 Import logic updated on Production Characteristic Importer
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 17:08:53 +05:30
dhanabalan
47a0cf31d2 Removed unwanted space
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 17:07:39 +05:30
dhanabalan
e5f23303d9 removed unwanted quotes in characteristics controller
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 15:15:01 +05:30
dhanabalan
b9e164725e Updated has_work_flow_id column value in TempClassCharacteristic table while request approval get api
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-05-13 10:01:00 +05:30
20 changed files with 370 additions and 131 deletions

View File

@@ -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);

View File

@@ -59,7 +59,6 @@ class ProcessOrderExporter extends Exporter
ExportColumn::make('deleted_at')
->enabledByDefault(false)
->label('DELETED AT'),
];
}

View File

@@ -110,7 +110,7 @@ class InvoiceValidationImporter extends Importer
ImportColumn::make('operator_id')
->requiredMapping()
->exampleHeader('OPERATOR ID')
->example('USER1')
->example('USER00001')
->label('OPERATOR ID')
->rules(['required']),
ImportColumn::make('created_at')
@@ -122,19 +122,19 @@ class InvoiceValidationImporter extends Importer
ImportColumn::make('created_by')
->requiredMapping()
->exampleHeader('CREATED BY')
->example('USER1')
->example('USER00001')
->label('CREATED BY')
->rules(['required']),
ImportColumn::make('updated_at')
->requiredMapping()
->exampleHeader('UPDATED AT')
->example('USER1')
->example('')
->label('UPDATED AT')
->rules(['required']),
ImportColumn::make('updated_by')
->requiredMapping()
->exampleHeader('UPDATED BY')
->example('')
->example('USER00001')
->label('UPDATED BY')
->rules(['required']),
];

View File

@@ -102,7 +102,6 @@ class ProductCharacteristicsMasterImporter extends Importer
public function resolveRecord(): ?ProductCharacteristicsMaster
{
$warnMsg = [];
$plantCod = trim($this->data['plant']) ?? null;
$itemCod = trim($this->data['item']) ?? null;

View File

@@ -2,10 +2,17 @@
namespace App\Filament\Imports;
use App\Models\Item;
use App\Models\Line;
use App\Models\Machine;
use App\Models\Plant;
use App\Models\ProductionCharacteristic;
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
use Filament\Facades\Filament;
use Str;
class ProductionCharacteristicImporter extends Importer
{
@@ -16,40 +23,170 @@ class ProductionCharacteristicImporter extends Importer
return [
ImportColumn::make('plant')
->requiredMapping()
->relationship()
->exampleHeader('PLANT CODE')
->example('1200')
->label('PLANT CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('line')
->requiredMapping()
->relationship()
->rules(['required']),
->exampleHeader('LINE NAME')
->example('Poly Wrapped Wire SFG')
->label('LINE NAME')
->relationship(resolveUsing: 'name'),
ImportColumn::make('item')
->requiredMapping()
->relationship()
->exampleHeader('ITEM CODE')
->example('123456')
->label('ITEM CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('machine')
ImportColumn::make('machine_name')
->requiredMapping()
->relationship()
->exampleHeader('MACHINE NAME')
->example('RMI001234')
->label('MACHINE NAME')
// ->relationship(resolveUsing: 'work_center')
->rules(['required']),
ImportColumn::make('production_order'),
ImportColumn::make('serial_number'),
ImportColumn::make('characteristic_name'),
ImportColumn::make('observed_value'),
ImportColumn::make('status'),
ImportColumn::make('inspection_status'),
ImportColumn::make('remark'),
ImportColumn::make('created_by'),
ImportColumn::make('updated_by'),
ImportColumn::make('production_order')
->requiredMapping()
->exampleHeader('PRODUCTION ORDER')
->example('1880231')
->label('PRODUCTION ORDER')
->rules(['required']),
ImportColumn::make('serial_number')
->requiredMapping()
->exampleHeader('SERIAL NUMBER')
->example('20001202121')
->label('SERIAL NUMBER')
->rules(['required']),
ImportColumn::make('characteristic_name')
->requiredMapping()
->exampleHeader('CHARACTERISTIC NAME')
->example('Voltage')
->label('CHARACTERISTIC NAME'),
ImportColumn::make('observed_value')
->exampleHeader('OBSERVED VALUE')
->example('0')
->label('OBSERVED VALUE'),
ImportColumn::make('status')
->exampleHeader('STATUS')
->example('Ok')
->label('STATUS'),
ImportColumn::make('remark')
->exampleHeader('REMARK')
->example('Issue')
->label('REMARK'),
];
}
public function resolveRecord(): ?ProductionCharacteristic
{
// return ProductionCharacteristic::firstOrNew([
// // Update existing records, matching them by `$this->data['column_name']`
// 'email' => $this->data['email'],
// ]);
return new ProductionCharacteristic();
$warnMsg = [];
$plant = null;
$plantCod = trim($this->data['plant']) ?? '';
$plantId = null;
$iCode = trim($this->data['item']) ?? '';
$itemId = null;
$lineNam = trim($this->data['line']) ?? '';
$lineId = null;
$machineName = trim($this->data['machine_name'] ?? '');
$pOrder = trim($this->data['production_order'] ?? '');
$sNo = trim($this->data['serial_number'] ?? '');
$charName = trim($this->data['characteristic_name'] ?? '');
$obsValue = trim($this->data['observed_value'] ?? '');
$status = trim($this->data['status'] ?? '');
$remark = trim($this->data['remark'] ?? '');
if ($plantCod == null || $plantCod == '') {
$warnMsg[] = "Plant code can't be empty!";
} elseif (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found';
}
if ($iCode == null || $iCode == '') {
$warnMsg[] = "Item code can't be empty!";
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
$warnMsg[] = 'Invalid item code found!';
}
if ($machineName != null && $machineName != '' && Str::length($machineName) > 18) {
$warnMsg[] = 'Invalid machine name found!';
}
$plant = Plant::where('code', $plantCod)->first();
if (! $plant) {
$warnMsg[] = 'Plant not found!';
} else {
$plantId = $plant->id;
}
$itemCode = Item::where('code', $iCode)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found!';
} else {
if ($plantId) {
$itemCode = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found for the given plant!';
} else {
$itemId = $itemCode->id;
}
}
}
$lineExists = Line::where('name', $lineNam)->first();
if (! $lineExists) {
$warnMsg[] = 'Line name not found!';
} else {
if ($plantId) {
$lineAgainstPlant = Line::where('name', $lineNam)->where('plant_id', $plantId)->first();
if (! $lineAgainstPlant) {
$warnMsg[] = 'Line name not found for the given plant!';
} else {
$lineId = $lineAgainstPlant->id;
}
}
}
$machineExists = Machine::where('work_center', $machineName)->first();
if (! $machineExists) {
$warnMsg[] = 'Machine not found!';
} else {
if ($plantId) {
$machineAgainstPlant = Machine::where('work_center', $machineName)->where('plant_id', $plantId)->first();
if (! $machineAgainstPlant) {
$warnMsg[] = 'Machine not found for the given plant!';
} else {
$machineId = $machineAgainstPlant->id;
}
}
}
if (! empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
ProductionCharacteristic::Create(
[
'plant_id' => $plantId,
'line_id' => $lineId,
'item_id' => $itemId,
'machine_id' => $machineId,
'production_order' => $pOrder,
'serial_number' => $sNo,
'characteristic_name' => $charName,
'observed_value' => $obsValue,
'status' => $status,
'remark' => $remark,
'created_at' => now(),
'updated_at' => now(),
'created_by' => Filament::auth()->user()->name,
'updated_by' => Filament::auth()->user()->name,
]
);
return null;
// return new ProductionCharacteristic();
}
public static function getCompletedNotificationBody(Import $import): string

View File

@@ -291,7 +291,6 @@ class ProductionQuantityPage extends Page implements HasForms
$machineId = $get('machine_id');
$this->mNam = $machineId;
})
->extraAttributes(fn ($get) => [
// 'class' => $get('pqLineError') ? 'border-red-500' : '',

View File

@@ -22,6 +22,7 @@ use Filament\Notifications\Notification;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
// use PhpOffice\PhpSpreadsheet\IOFactory;
class ImportTransitResource extends Resource
{
@@ -446,6 +447,20 @@ class ImportTransitResource extends Resource
}
// $spreadsheet = IOFactory::load($fullPath);
// foreach ($spreadsheet->getAllSheets() as $sheet) {
// $state = $sheet->getSheetState();
// if ($state == \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN ||
// $state == \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VERYHIDDEN) {
// Notification::make()
// ->title('Import Failed')
// ->body("Hidden sheet found: \"{$sheet->getTitle()}\". Please remove all hidden sheets and try again.")
// ->danger()
// ->send();
// return;
// }
// }
try
{

View File

@@ -339,8 +339,9 @@ class ProductionCharacteristicResource extends Resource
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Item', null);
$set('Line', null);
$set('Item', null);
$set('Machine', null);
}),
Select::make('Line')
->label('Search by Line Name')
@@ -361,7 +362,7 @@ class ProductionCharacteristicResource extends Resource
})->pluck('name', 'id');
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('process_order', null);
$set('Machine', null);
}),
Select::make('Item')
->label('Search by Item Code')

View File

@@ -203,7 +203,6 @@ class ProductionOrderResource extends Resource
->label('Production Order')
->readOnly()
->visible(fn ($get) => $get('quantity') > 0),
// ->visible(fn ($get) => $get('show_extra_fields')),
Forms\Components\TextInput::make('from_serial_number')
->label('From Serial Number')
->readOnly()

View File

@@ -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

View File

@@ -94,7 +94,7 @@ class QualityValidationResource extends Resource
Forms\Components\Hidden::make('plant')
->default(fn () => session('last_selected_plant_id'))
->afterStateHydrated(function ($state, $set) {
if (!$state && request()->has('plant_id')) {
if (! $state && request()->has('plant_id')) {
$set('plant_id', request()->get('plant_id'));
}
}),
@@ -136,7 +136,7 @@ class QualityValidationResource extends Resource
Forms\Components\Hidden::make('line')
->default(fn () => session('last_selected_line'))
->afterStateHydrated(function ($state, $set) {
if (!$state && request()->has('line_id')) {
if (! $state && request()->has('line_id')) {
$set('line_id', request()->get('line_id'));
}
}),
@@ -178,7 +178,7 @@ class QualityValidationResource extends Resource
Forms\Components\Hidden::make('production')
->default(fn () => session('last_selected_production'))
->afterStateHydrated(function ($state, $set) {
if (!$state && request()->has('production_order')) {
if (! $state && request()->has('production_order')) {
$set('production_order', request()->get('production_order'));
}
}),
@@ -2423,7 +2423,6 @@ class QualityValidationResource extends Resource
$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(
@@ -2519,7 +2518,6 @@ class QualityValidationResource extends Resource
$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(
@@ -2711,7 +2709,6 @@ class QualityValidationResource extends Resource
$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(
@@ -2864,16 +2861,6 @@ class QualityValidationResource extends Resource
'showChecklist' => $livewire->showChecklist,
]),
// Forms\Components\View::make('components.production-checklist-wrapper')
// ->statePath('checklist')
// ->key('checklist-view')
// ->viewData(fn ($livewire) => [
// 'existingRecords' => is_array($livewire->existingRecords)
// ? $livewire->existingRecords
// : $livewire->existingRecords->toArray(),
// 'showChecklist' => $livewire->showChecklist,
// ]),
]);
}
@@ -3066,7 +3053,6 @@ class QualityValidationResource extends Resource
])
->filters([
Tables\Filters\TrashedFilter::make(),
Filter::make('advanced_filters')
->label('Advanced Filters')

View File

@@ -630,7 +630,7 @@ class TestingPanelReadingResource extends Resource
->options(function () {
// return Plant::pluck('name', 'id');
$userHas = Filament::auth()->user()->plant_id;
if ($userHas && strlen($userHas) > 0) {
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
} else {

View File

@@ -3780,7 +3780,7 @@ class CharacteristicsController extends Controller
if (! $cField) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Master characteristic field value '{$charField}'' not found in approver master!",
'status_description' => "Master characteristic field value '{$charField}' not found in approver master!",
], 404);
}
@@ -3856,6 +3856,21 @@ class CharacteristicsController extends Controller
$query->where('approver_type', 'Characteristic');
})->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
$requestQual = RequestCharacteristic::where('aufnr', $jobNo)->where('item_id', $itemId)->where('model_type', $modelType)
->whereHas('approver', function ($query) {
$query->where('approver_type', 'Quality');
})->where('machine_id', $machineId)->where('plant_id', $plantId)->orderBy('id')->get();
foreach ($requestQual as $row) {
$workFlowStatus = ($row->approver_status1 == 'Approved' || $row->approver_status2 == 'Approved' || $row->approver_status3 == 'Approved') ? '0' : '1';
TempClassCharacteristic::where('aufnr', $jobNo)->where('model_type', $modelType)->where('machine_id', $machineId)->where('plant_id', $plantId)
->update([
'has_work_flow_id' => $workFlowStatus,
'updated_by' => $userName,
]);
}
$tempClassChars = TempClassCharacteristic::where('aufnr', $jobNo)->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
if (! $requestChars->isEmpty()) {
@@ -3966,6 +3981,21 @@ class CharacteristicsController extends Controller
$query->where('approver_type', 'Characteristic');
})->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
$requestQual = RequestCharacteristic::where('aufnr', $jobNo)->where('item_id', $itemId)->where('model_type', $modelType)
->whereHas('approver', function ($query) {
$query->where('approver_type', 'Quality');
})->where('machine_id', $machineId)->where('plant_id', $plantId)->orderBy('id')->get();
foreach ($requestQual as $row) {
$workFlowStatus = ($row->approver_status1 == 'Approved' || $row->approver_status2 == 'Approved' || $row->approver_status3 == 'Approved') ? '0' : '1';
TempClassCharacteristic::where('aufnr', $jobNo)->where('model_type', $modelType)->where('machine_id', $machineId)->where('plant_id', $plantId)
->update([
'has_work_flow_id' => $workFlowStatus,
'updated_by' => $userName,
]);
}
if (! $requestChars->isEmpty()) {
$hasCharPending = false;
@@ -4980,6 +5010,21 @@ class CharacteristicsController extends Controller
$query->where('approver_type', 'Characteristic');
})->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
$requestQual = RequestCharacteristic::where('aufnr', $jobNo)->where('item_id', $itemId)->where('model_type', $modelType)
->whereHas('approver', function ($query) {
$query->where('approver_type', 'Quality');
})->where('machine_id', $machineId)->where('plant_id', $plantId)->orderBy('id')->get();
foreach ($requestQual as $row) {
$workFlowStatus = ($row->approver_status1 == 'Approved' || $row->approver_status2 == 'Approved' || $row->approver_status3 == 'Approved') ? '0' : '1';
TempClassCharacteristic::where('aufnr', $jobNo)->where('model_type', $modelType)->where('machine_id', $machineId)->where('plant_id', $plantId)
->update([
'has_work_flow_id' => $workFlowStatus,
'updated_by' => $userName,
]);
}
$tempClassChars = TempClassCharacteristic::where('aufnr', $jobNo)->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
if (! $requestChars->isEmpty()) {
@@ -5084,6 +5129,21 @@ class CharacteristicsController extends Controller
$query->where('approver_type', 'Characteristic');
})->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
$requestQual = RequestCharacteristic::where('aufnr', $jobNo)->where('item_id', $itemId)->where('model_type', $modelType)
->whereHas('approver', function ($query) {
$query->where('approver_type', 'Quality');
})->where('machine_id', $machineId)->where('plant_id', $plantId)->orderBy('id')->get();
foreach ($requestQual as $row) {
$workFlowStatus = ($row->approver_status1 == 'Approved' || $row->approver_status2 == 'Approved' || $row->approver_status3 == 'Approved') ? '0' : '1';
TempClassCharacteristic::where('aufnr', $jobNo)->where('model_type', $modelType)->where('machine_id', $machineId)->where('plant_id', $plantId)
->update([
'has_work_flow_id' => $workFlowStatus,
'updated_by' => $userName,
]);
}
if (! $requestChars->isEmpty()) {
$hasCharPending = false;
@@ -5168,6 +5228,12 @@ class CharacteristicsController extends Controller
} else {
$workFlowStatus = ($row->approver_status1 == 'Approved' || $row->approver_status2 == 'Approved' || $row->approver_status3 == 'Approved') ? '0' : '1';
// / TempClassCharacteristic::where('aufnr', $jobNo)->where('model_type', $modelType)->where('machine_id', $machineId)->where('plant_id', $plantId)
// / ->update([
// / 'has_work_flow_id' => $workFlowStatus,
// / 'updated_by' => $userName,
// / ]);
if ($workFlowStatus == '1') {
$workFlowStatus = ($row->approver_status1 == 'Rejected' || $row->approver_status2 == 'Rejected' || $row->approver_status3 == 'Rejected') ? '2' : '1';
}

View File

@@ -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;

View File

@@ -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'
// ),
// ];
}
}

View File

@@ -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']);
}
}

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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"> --}}

View File

@@ -106,7 +106,6 @@
-
@endif
</td>
{{-- <td>{{ $row['lr_bl_aw_date'] }}</td> --}}
<td>{{ $row['transit_days'] }}</td>
<td>{{ $row['status'] }}</td>