1 Commits

Author SHA1 Message Date
c338cf776a Update dependency alperenersoy/filament-export to v5
Some checks failed
renovate/artifacts Artifact file update failure
Gemini PR Review / Gemini PR Review (pull_request) Failing after 23s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Larastan / larastan (pull_request) Failing after 3m22s
Laravel Pint / pint (pull_request) Failing after 3m18s
2026-10-18 00:01:23 +00:00
42 changed files with 211 additions and 2548 deletions

View File

@@ -56,10 +56,10 @@ class SendDailyTaskReport extends Command
})
->values();
// if ($pdfFiles->isEmpty()) {
// $this->info('No PDF files found.');
// return self::SUCCESS;
// }
if ($pdfFiles->isEmpty()) {
$this->info('No PDF files found.');
return self::SUCCESS;
}
$parser = new Parser();
$attachments = [];
@@ -100,37 +100,6 @@ class SendDailyTaskReport extends Command
$this->info('Attached: ' . basename($file));
}
// Expected employees
$expectedEmployees = [
'Dhanabalan Saravanan',
'Ranjith',
'Srimathi Ramamoorthy',
];
$uploadedEmployees = array_map(
fn ($row) => strtolower(trim($row['name'])),
$rows
);
foreach ($expectedEmployees as $employeeName) {
if (! in_array(
strtolower(trim($employeeName)),
$uploadedEmployees,
true
)) {
$rows[] = [
'sno' => $sno++,
'name' => $employeeName,
'project-name' => 'Not uploaded',
'task' => 'PDF not received',
'status' => 'Missing',
'completed' => '-',
];
$this->warn("PDF not uploaded by: {$employeeName}");
}
}
$toEmails = [];
$ccEmails = [];

View File

@@ -30,7 +30,7 @@ class ProductionCharacteristicExporter extends Exporter
ExportColumn::make('machine.work_center')
->label('WORK CENTER'),
ExportColumn::make('production_order')
->label('PRODUCTION ORDER / DOC NO'),
->label('PRODUCTION ORDER'),
ExportColumn::make('serial_number')
->label('SERIAL NUMBER'),
ExportColumn::make('characteristic_name')

View File

@@ -128,8 +128,6 @@ class TestingPanelReadingExporter extends Exporter
->label('TEST SEQUENCE FLAG'),
ExportColumn::make('test_started_at')
->label('TEST STARTED AT'),
ExportColumn::make('test_finished_at')
->label('TEST FINISHED AT'),
ExportColumn::make('rework_count')
->label('REWORK COUNT'),
ExportColumn::make('rework_winded')

View File

@@ -262,11 +262,6 @@ class TestingPanelReadingImporter extends Importer
->label('TEST STARTED AT')
->exampleHeader('TEST STARTED AT')
->example('01-01-2026 00:08:00'),
ImportColumn::make('test_finished_at')
->requiredMapping()
->label('TEST FINISHED AT')
->exampleHeader('TEST FINISHED AT')
->example('01-01-2026 00:08:00'),
ImportColumn::make('rework_count')
->requiredMapping()
->label('REWORK COUNT')

View File

@@ -25,8 +25,6 @@ use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Illuminate\Support\Facades\Log;
use Livewire\Attributes\On;
use Filament\Forms\Set;
class BulkStickerPrinting extends Page implements HasForms
{
@@ -38,19 +36,12 @@ class BulkStickerPrinting extends Page implements HasForms
public array $filters = [];
public array $serialNumbers = [''];
public $serNo;
public $ref_number;
//public $workCenter;
public function mount(): void
{
$this->form->fill();
}
public function form(Form $form): Form
{
return $form
@@ -94,6 +85,7 @@ class BulkStickerPrinting extends Page implements HasForms
TextInput::make('production_order')
->label('Production Order')
->reactive()
->required()
->afterStateUpdated(function ($state, callable $set, $get) {
for ($i = 1; $i <= 8; $i++) {
@@ -179,10 +171,10 @@ class BulkStickerPrinting extends Page implements HasForms
->where('item_id', $item->id)
->get();
if ($stickerMappings->isEmpty()) {
if (! $stickerMappings) {
Notification::make()
->title('Sticker mapping not found')
->body("No sticker mapping found for item '$itemCode' and plant '$plantName'.")
->body("No sticker mapping found for this plant and class characteristic.")
->danger()
->send();
@@ -243,19 +235,7 @@ class BulkStickerPrinting extends Page implements HasForms
}
$set('sticker_options', $stickerOptions);
$serialNumbers = ClassCharacteristic::query()
->where('plant_id', $plantId)
->where('aufnr', $state)
->pluck('gernr')
->filter()
->values()
->all();
$this->dispatch('load-serial-numbers',serialNumbers: $serialNumbers);
}),
Select::make('sticker_id')
->label('Sticker ID')
->options(fn (callable $get) => $get('sticker_options') ?? [])
@@ -285,189 +265,10 @@ class BulkStickerPrinting extends Page implements HasForms
->default([]),
TextInput::make('from_serial_number')
->label('From Serial Number')
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
if (blank($state)) {
return;
}
$plantId = $get('plant_id');
$machineId = $get('machine_id');
$record = ClassCharacteristic::where('plant_id', $plantId)->where('machine_id', $machineId)->where('gernr', $state)->first();
if (! $record) {
$plantName = Plant::find($plantId)?->name;
$machineName = Machine::find($machineId)?->work_center;
Notification::make()
->title('Serial Number Not Found')
->body("Serial number '{$state}' was not found against work center '$machineName' and plant '$plantName'.")
->danger()
->send();
return;
}
$plantName = Plant::where('id', $plantId)->value('name');
$workCenter = Machine::where('id', $machineId)->value('work_center');
if (empty($machineId)) {
Notification::make()
->title('Work Center not selected')
->body('Please select a Work Center first.')
->warning()
->send();
return;
}
$productionOrder = ClassCharacteristic::where('plant_id', $plantId)->where('machine_id', $machineId)->where('gernr', $state)->first();
if (! $productionOrder) {
Notification::make()
->title('Production Order not found')
->body("Production Order '{$state}' was not found against machine '$workCenter', Serial Number '$state' and plant '$plantName'.")
->danger()
->send();
return;
}
$plantId = $productionOrder->plant_id;
$itemId = $productionOrder->item_id;
$item = Item::find($itemId);
if (! $item) {
Notification::make()
->title('Item not found')
->body("Item code '{$itemId}' was not found in item master.")
->danger()
->send();
return;
}
$itemCode = $item->code;
$item = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
if (! $item) {
Notification::make()
->title('Item not found')
->body("Item '{$itemCode}' was not found for the selected plant.")
->danger()
->send();
return;
}
$itemCharacteristic = ClassCharacteristic::where('plant_id', $plantId)->where('item_id', $item->id)->first();
if (! $itemCharacteristic) {
Notification::make()
->title('Class characteristic not found')
->body("No class characteristic found for item '{$itemCode}'.")
->danger()
->send();
return;
}
// $itemCharacteristicId = $itemCharacteristic->id;
$stickerMappings = StickerMappingMaster::where('plant_id', $plantId)
->where('item_id', $item->id)
->get();
if (! $stickerMappings) {
Notification::make()
->title('Sticker mapping not found')
->body("No sticker mapping found for this plant and class characteristic.")
->danger()
->send();
return;
}
$stickerOptions = [];
foreach ($stickerMappings as $stickerMapping) {
for ($i = 1; $i <= 8; $i++) {
$machineColumn = "sticker{$i}_machine_id";
$stickerMachineId = $stickerMapping->$machineColumn;
if ((string) $stickerMachineId != (string) $machineId) {
continue;
}
$structureColumn = "sticker_structure{$i}_id";
$stickerStructureId = $stickerMapping->$structureColumn;
if (empty($stickerStructureId)) {
continue;
}
$detail = StickerStructureDetail::find($stickerStructureId);
if ($detail && $detail->sticker_id) {
$stickerOptions[$detail->sticker_id] =
$detail->sticker_id;
}
$set("sticker_structure{$i}_id", $stickerStructureId);
}
}
$set('sticker_options', $stickerOptions);
$set('production_order', $record->aufnr);
}),
->reactive(),
TextInput::make('to_serial_number')
->label('To Serial Number')
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
if (blank($state)) {
return;
}
$productionOrder = $get('production_order');
$plantId = $get('plant_id');
$machineId = $get('machine_id');
$toSerialRecord = ClassCharacteristic::where('plant_id', $plantId)->where('machine_id', $machineId)->where('gernr', $state)->first();
if (! $toSerialRecord) {
Notification::make()
->title('Serial Number Not Found')
->body("To Serial Number '{$state}' was not found.")
->danger()
->send();
$set('to_serial_number', null);
return;
}
if ((string) $toSerialRecord->aufnr != (string) $productionOrder) {
Notification::make()
->title('Production Order Mismatch')
->body("To Serial Number '{$state}' does not belong to Production Order '{$productionOrder}'.")
->danger()
->send();
$set('to_serial_number', null);
return;
}
}),
->reactive(),
])
->columns(6),
]);
@@ -997,7 +798,6 @@ class BulkStickerPrinting extends Page implements HasForms
}
}
public function generateStickerId()
{
$state = $this->form->getState();
@@ -1175,7 +975,7 @@ class BulkStickerPrinting extends Page implements HasForms
//.New Logic
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->get();
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->get();
if ($stickerMappingMasterItems->isEmpty()) {
Notification::make()
@@ -1277,69 +1077,54 @@ class BulkStickerPrinting extends Page implements HasForms
$matchedMachineId = null;
// for ($i = 1; $i <= 8; $i++) {
// $structureColumn = "sticker_structure{$i}_id";
// if (
// (string) $stickerMappingMasterItem->{$structureColumn}
// == (string) $structure->id
// ) {
// $machineColumn = "sticker{$i}_machine_id";
// $matchedMachineId = $stickerMappingMasterItem->{$machineColumn};
// break;
// }
// }
// if ($matchedMachineId == null || (string) $matchedMachineId != (string) $machineId)
// {
// Notification::make()
// ->danger()
// ->title('Machine Mapping Mismatch')
// ->body("Selected machine '{$machineId}' does not match the machine mapped to the selected sticker.")
// ->send();
// return;
// }
//..New
for ($i = 1; $i <= 8; $i++) {
$structureColumn = "sticker_structure{$i}_id";
$machineColumn = "sticker{$i}_machine_id";
$mappedStructureId = $stickerMappingMasterItem->{$structureColumn} ?? null;
if (
$mappedStructureId !== null &&
(string) $mappedStructureId === (string) $structure->id
(string) $stickerMappingMasterItem->{$structureColumn}
== (string) $structure->id
) {
$matchedMachineId = $stickerMappingMasterItem->{$machineColumn} ?? null;
$machineColumn = "sticker{$i}_machine_id";
$matchedMachineId = $stickerMappingMasterItem->{$machineColumn};
break;
}
}
$selectedMachineId = trim((string) $machineId);
$mappedMachineId = trim((string) $matchedMachineId);
if ($mappedMachineId === '' || $mappedMachineId !== $selectedMachineId) {
if (
$matchedMachineId == null ||
(string) $matchedMachineId != (string) $machineId
) {
Notification::make()
->danger()
->title('Machine Mapping Mismatch')
->body("Selected machine '{$selectedMachineId}' does not match the mapped machine '{$mappedMachineId}'.")
->body("Selected machine '{$machineId}' does not match the machine mapped to the selected sticker.")
->send();
return;
}
// if ((string) $matchedMachineId != (string) $machineId) {
if ((string) $matchedMachineId != (string) $machineId) {
Notification::make()
->danger()
->title('Machine Not Found')
->body("Machine '{$machineId}' is not mapped for Item Code '{$itemCode}' against sticker '$stickerId' in sticker mapping master.")
->send();
return;
}
// $matchedMachineId = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->where('sticker_structure1_id', $structure->id)->where('sticker1_machine_id', $machineId)->first();
// if (!$matchedMachineId) {
// Notification::make()
// ->danger()
// ->title('Machine Not Found')
// ->body("Machine '{$machineId}' is not mapped for Item Code '{$itemCode}' against sticker '$stickerId' in sticker mapping master.")
// ->body("Machine '{$machineId}' is not mapped for Item Code '{$itemCode}' in sticker mapping master.")
// ->send();
// return;
@@ -1451,378 +1236,6 @@ class BulkStickerPrinting extends Page implements HasForms
}
#[On('generate-sticker-id')]
public function generateStickerId2(string $serialNumbers)
{
$state = $this->form->getState();
$plantId = trim($state['plant_id'] ?? '');
$machineId = trim($state['machine_id'] ?? '');
$stickerId = $state['sticker_id'] ?? null;
$pOrder = $state['production_order'] ?? null;
$fromSno = trim($state['from_serial_number'] ?? '');
$toSno = trim($state['to_serial_number'] ?? '');
$serialNumbersArray = array_filter(array_map('trim', explode(',', $serialNumbers)));
if (count($serialNumbersArray) > 50) {
Notification::make()
->title('Too Many Serial Numbers')
->body('You can enter a maximum of 50 serial numbers.')
->danger()
->send();
return;
}
$plantName = Plant::where('id', $plantId)->value('name');
if (!$stickerId) {
Notification::make()
->danger()
->title('Sticker ID Not Selected')
->body('Please Choose a Sticker ID.')
->send();
return;
}
$pOrderExist = ClassCharacteristic::where('plant_id',$plantId)->where('aufnr', $pOrder)->first();
if(!$pOrderExist){
Notification::make()
->danger()
->title('Unknown Production Order')
->body("Production Order '$pOrder' not found.")
->send();
return;
}
if($pOrderExist){
$existingSerialNumbers = ClassCharacteristic::where('plant_id', $plantId)
->where('aufnr', $pOrder)
->whereIn('gernr', $serialNumbersArray)
->pluck('gernr')
->map(fn ($value) => trim((string) $value))
->unique()
->toArray();
$invalidSerialNumbers = array_values(
array_diff($serialNumbersArray, $existingSerialNumbers)
);
if (!empty($invalidSerialNumbers)) {
Notification::make()
->danger()
->title('Unknown Serial Numbers')
->body(
"The following serial numbers do not belong to Production Order '$pOrder' "
. "for plant '$plantName': "
. implode(', ', $invalidSerialNumbers)
)
->send();
return;
}
}
$existingStickers = StickerOrder::where('plant_id', $plantId)
->where('production_order', $pOrder)
->where('sticker_id', $stickerId)
->where('print_status', 'Printed')
->whereIn('serial_number', $serialNumbersArray)
->pluck('serial_number')
->unique()
->values()
->toArray();
if (!empty($existingStickers)) {
Notification::make()
->danger()
->title('Duplicate Sticker')
->body("The following serial numbers already exist in generated stickers for ". "Sticker '$stickerId', Production Order '$pOrder', and plant '$plantName': ". implode(', ', $existingStickers))
->send();
return;
}
$structure = StickerStructureDetail::where('sticker_id',$stickerId)->first();
if (!$structure) {
Notification::make()
->danger()
->title('Sticker Structure Not Found')
->body("No sticker structure found for sticker ID '{$stickerId}'.")
->send();
return;
}
//.New Logic
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->get();
if ($stickerMappingMasterItems->isEmpty()) {
Notification::make()
->danger()
->title('Sticker Mapping Not Found')
->body("No sticker mapping found for plant ID '{$plantId}'.")
->send();
return;
}
$structureIds = $stickerMappingMasterItems
->flatMap(function ($mapping) {
$ids = [];
for ($i = 1; $i <= 8; $i++) {
$column = "sticker_structure{$i}_id";
if (!empty($mapping->{$column})) {
$ids[] = $mapping->{$column};
}
}
return $ids;
})
->unique()
->values();
$detailsById = StickerStructureDetail::whereIn('id', $structureIds)
->get()
->keyBy('id');
$structure = null;
$stickerMappingMasterItem = null;
foreach ($stickerMappingMasterItems as $mapping) {
for ($i = 1; $i <= 8; $i++) {
$column = "sticker_structure{$i}_id";
$structureId = $mapping->{$column};
if (empty($structureId)) {
continue;
}
$detail = $detailsById->get($structureId);
if (!$detail) {
continue;
}
if ((string) $detail->sticker_id === (string) $stickerId) {
$structure = $detail;
$stickerMappingMasterItem = $mapping;
break 2;
}
}
}
if (!$structure) {
Notification::make()
->danger()
->title('Sticker Mapping Not Found')
->body("No mapping found for sticker ID '{$stickerId}' and plant ID '{$plantId}'.")
->send();
return;
}
// $checkItem = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->where('sticker_structure1_id', $structure->id)->first();
$itemCode = Item::where('id', $pOrderExist->item_id)->value('code');
$plantCode = Plant::where('id', $plantId)->value('code');
// if (!$checkItem) {
// Notification::make()
// ->danger()
// ->title('Item Not Found')
// ->body("Item code '$itemCode' not found in sticker mapping master for selected sticker ID '{$stickerId}'.")
// ->send();
// return;
// }
$itemCharacteristic1 = ClassCharacteristic::where('plant_id', $plantId)->where('aufnr', $pOrder)->where('item_id', $pOrderExist->item_id)->first();
if (!$itemCharacteristic1) {
Notification::make()
->danger()
->title('Item Not Found')
->body("Item code '{$itemCode}' was not found against job number '$pOrder' in class characteristic.")
->send();
return;
}
$matchedMachineId = null;
for ($i = 1; $i <= 8; $i++) {
$structureColumn = "sticker_structure{$i}_id";
$machineColumn = "sticker{$i}_machine_id";
$mappedStructureId = $stickerMappingMasterItem->{$structureColumn} ?? null;
if (
$mappedStructureId !== null &&
(string) $mappedStructureId === (string) $structure->id
) {
$matchedMachineId = $stickerMappingMasterItem->{$machineColumn} ?? null;
break;
}
}
$selectedMachineId = trim((string) $machineId);
$mappedMachineId = trim((string) $matchedMachineId);
if ($mappedMachineId === '' || $mappedMachineId !== $selectedMachineId) {
Notification::make()
->danger()
->title('Machine Mapping Mismatch')
->body("Selected machine '{$selectedMachineId}' does not match the mapped machine '{$mappedMachineId}'.")
->send();
return;
}
$itemCharacteristic = ClassCharacteristic::where('plant_id', $plantId)
->where('item_id', $pOrderExist->item_id)
->where('machine_id', $machineId)
->where('aufnr', $pOrder)
->first();
if(!$itemCharacteristic){
Notification::make()
->danger()
->title('Record Not Found')
->body("Record not found in class characteristic against job '$pOrder', item '$itemCode' and plant '$plantCode'.")
->send();
return;
}
$elements = StickerDetail::where('sticker_structure_detail_id',$structure->id)->get();
if ($elements->isEmpty()) {
Notification::make()
->danger()
->title('Sticker Details Not Found')
->body('No sticker details configured for the selected sticker.')
->send();
return;
}
$stickerService = new StickerPdfService();
$template = $stickerService->generateTemplate(
$structure->sticker_id,
$elements,
$itemCharacteristic,
$itemCode,
$plantId,
$machineId
);
$pdfContent = $stickerService->generateMultipleBulkFromTemplate(
$template,
$serialNumbersArray,
$itemCode,
);
$fileName = 'bulk_sticker_'. '_'. uniqid(). '.pdf';
$tempPdfPath = storage_path('app/' . $fileName);
file_put_contents(
$tempPdfPath,
$pdfContent
);
$pdfUrl = route(
'sticker.preview',
[
'path' => $fileName,
]
);
$this->dispatch('open-sticker-pdf',urls: [$pdfUrl]);
$totalStickers = count($serialNumbersArray);
$item = Item::where('id', $pOrderExist->item_id)->where('plant_id', $plantId)->first();
foreach ($serialNumbersArray as $serialNumber) {
$serialNumber = trim($serialNumber);
$exists = StickerOrder::where('plant_id', $plantId)
->where('production_order', $pOrder)
->where('sticker_id', $stickerId)
->where('serial_number', $serialNumber)
->first();
if (!$exists) {
StickerOrder::create([
'plant_id' => $plantId,
'item_id' => $item->id,
'production_order' => $pOrder,
'serial_number' => $serialNumber,
'sticker_id' => $stickerId,
'print_status' => 'Printed',
]);
}
}
Notification::make()
->success()
->title('Sticker Generated')
->body("{$totalStickers} sticker(s) generated successfully.")
->seconds(3)
->send();
return;
}
#[On('production-order-updated')]
public function updateProductionOrder(string $productionOrder): void
{
$this->filters['production_order'] = $productionOrder;
}
#[On('sticker-options')]
public function stickerStructure(array $stickerOptions): void
{
$this->filters['sticker_options'] = $stickerOptions;
}
#[On('production-order-clear')]
public function updateProductionOrderClear(): void
{
$this->filters['production_order'] = null;
}
#[On('sticker-options-clear')]
public function stickerStructureClear(): void
{
$this->filters['sticker_options'] = null;
}
public static function canAccess(): bool
{
return Auth::check() && Auth::user()->can('view sticker bulk print page');

View File

@@ -17,7 +17,6 @@ use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Facades\Filament;
use Illuminate\Support\Facades\Auth;
use App\Models\InvoiceValidation;
class PanelBoxInspectionStock extends Page
{
@@ -289,11 +288,11 @@ class PanelBoxInspectionStock extends Page
{
$parts = explode('/', $itemId);
if (!preg_match('/^\d+\/\d+\/\d{4}\/\d+$/', $itemId) || preg_match('/[a-zA-Z]/', $itemId)) {
if (count($parts) < 3) {
Notification::make()
->title('Invalid QR Format')
->body("Expected format: plantcode/itemcode/yearmm/serialnumber : Format Received : $itemId")
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
->danger()
->send();
$this->form->fill([
@@ -311,10 +310,10 @@ class PanelBoxInspectionStock extends Page
$itemCode = $panelBoxCode;
$serialNumber = $panelBoxSerialNo;
if (strlen($serialNumber) > 15) {
if (strlen($serialNumber) > 30) {
Notification::make()
->title('Invalid Serial Number')
->body("Serial number cannot be greater than 15 characters. Current length: " . strlen($panelBoxSerialNo))
->body("Serial number cannot be greater than 30 characters. Current length: " . strlen($panelBoxSerialNo))
->danger()
->send();
@@ -359,11 +358,10 @@ class PanelBoxInspectionStock extends Page
return;
}
}
else
{
else {
Notification::make()
->title('Invalid QR Format')
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
->danger()
->send();
$this->form->fill([
@@ -446,63 +444,22 @@ class PanelBoxInspectionStock extends Page
}
}
$panelExistsInvoice = InvoiceValidation::where('plant_id', $plantId)
->where('panel_box_serial_number', $serialNumber)
->where('panel_box_supplier', $supplier)
->first();
$serialExists = PanelBoxValidation::where('plant_id', $plantId)->where('serial_number', $serialNumber)->where('panel_box_supplier', $supplier)->first();
if ($panelExistsInvoice) {
if ($serialExists) {
Notification::make()
->title('Duplicate Panel Box Serial Number')
->body("Duplicate panel already exists.<br>Panel Box Code: $itemCode, Serial Number: $serialNumber, Supplier Number: $supplier against invoice Number: $panelExistsInvoice->invoice_number")
->title('Duplicate Serial Number')
->body("Serial number already exists '$serialNumber' with supplier number '$supplier'.")
->danger()
->seconds(4)
->send();
$this->form->fill([
'plant_id' => $plantId,
'line_id' => $lineId,
'item_id' => null,
]);
return;
}
$serialExists = PanelBoxValidation::where('plant_id', $plantId)->where('serial_number', $serialNumber)->where('panel_box_supplier', $supplier)->first();
if ($serialExists) {
if($serialExists->inspection_lot_number != '' && $serialExists->production_order != ''){
Notification::make()
->title('Already Scanned In Testing')
->body("Serial number already scanned '$serialNumber' with supplier number '$supplier'.<br>Please scan this serial number in Invoice Validation.")
->success()
->send();
$this->dispatch('play-error-sound');
$this->form->fill([
'plant_id' => $plantId,
'line_id' => $lineId,
'item_id' => null,
]);
return;
}
else{
Notification::make()
->title('Already Scanned In Stock')
->body("Serial number already scanned '$serialNumber' with supplier number '$supplier'.<br>Please scan this serial number in Invoice Validation.")
->success()
->send();
$this->dispatch('play-error-sound');
$this->form->fill([
'plant_id' => $plantId,
'line_id' => $lineId,
'item_id' => null,
]);
return;
}
}
$item = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
if (! $item) {

View File

@@ -277,14 +277,15 @@ class StickerOrderReprint extends Page implements HasForms
$plantId = $get('plant_id');
$machineId = $get('machine_id');
$record = ClassCharacteristic::where('plant_id', $plantId)->where('machine_id', $machineId)->where('gernr', $state)->first();
$record = ClassCharacteristic::where('plant_id', $plantId)
->where('machine_id', $machineId)
->where('gernr', $state)
->first();
if (! $record) {
$plantName = Plant::find($plantId)?->name;
$machineName = Machine::find($machineId)?->work_center;
Notification::make()
->title('Serial Number Not Found')
->body("Serial number '{$state}' was not found against work center '$machineName' and plant '$plantName'.")
->body("Serial number '{$state}' was not found.")
->danger()
->send();
@@ -1090,7 +1091,7 @@ class StickerOrderReprint extends Page implements HasForms
return;
}
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->get();
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->get();
if ($stickerMappingMasterItems->isEmpty()) {
Notification::make()
@@ -1208,27 +1209,35 @@ class StickerOrderReprint extends Page implements HasForms
for ($i = 1; $i <= 8; $i++) {
$structureColumn = "sticker_structure{$i}_id";
$machineColumn = "sticker{$i}_machine_id";
$mappedStructureId = $stickerMappingMasterItem->{$structureColumn} ?? null;
if (
$mappedStructureId !== null &&
(string) $mappedStructureId === (string) $structure->id
(string) $stickerMappingMasterItem->{$structureColumn}
== (string) $structure->id
) {
$matchedMachineId = $stickerMappingMasterItem->{$machineColumn} ?? null;
$machineColumn = "sticker{$i}_machine_id";
$matchedMachineId = $stickerMappingMasterItem->{$machineColumn};
break;
}
}
$selectedMachineId = trim((string) $machineId);
$mappedMachineId = trim((string) $matchedMachineId);
if ($mappedMachineId === '' || $mappedMachineId !== $selectedMachineId) {
if ($matchedMachineId == null || (string) $matchedMachineId != (string) $machineId)
{
Notification::make()
->danger()
->title('Machine Mapping Mismatch')
->body("Selected machine '{$selectedMachineId}' does not match the mapped machine '{$mappedMachineId}'.")
->body("Selected machine '{$machineId}' does not match the machine mapped to the selected sticker.")
->send();
return;
}
if ((string) $matchedMachineId != (string) $machineId) {
Notification::make()
->danger()
->title('Machine Not Found')
->body("Machine '{$machineId}' is not mapped for Item Code '{$itemCode}' against sticker '$stickerId' in sticker mapping master.")
->send();
return;

View File

@@ -59,47 +59,31 @@ class UploadDailyReport extends Page implements HasForms
$path = 'task_updates/' . $filename;
$expectedEmployees = [
'Dhanabalan Saravanan',
'Ranjith',
'Srimathi Ramamoorthy',
];
// $duplicateExists = Storage::disk('local')->exists($path);
$filename = pathinfo(basename($currentFile), PATHINFO_FILENAME);
// if ($duplicateExists) {
// // Remove the just-uploaded file since it's a duplicate
// // Storage::disk('local')->delete($currentFile);
$isValid = collect($expectedEmployees)->contains(
fn ($name) => strcasecmp(trim($filename), $name) == 0
);
// Notification::make()
// ->title('File already exists')
// ->body("A file named \"{$filename}\" is already uploaded.")
// ->danger()
// ->send();
if (! $isValid) {
// $this->form->fill(['report_pdf' => null]);
// return;
// }
// else{
Notification::make()
->title('Invalid PDF filename')
->body(
'Please upload a PDF with one of these names: '
. implode(', ', array_map(
fn ($name) => $name . '.pdf',
$expectedEmployees
))
)
->danger()
->send();
->title('PDF uploaded successfully')
->success()
->send();
$this->form->fill(['report_pdf' => null]);
return;
}
else{
Notification::make()
->title('PDF uploaded successfully')
->success()
->send();
$this->form->fill(['report_pdf' => null]);
}
// }
}
public function removeTaskPdf(){
$fileName = $this->filters['file_name'] ?? null;
@@ -145,55 +129,6 @@ class UploadDailyReport extends Page implements HasForms
}
}
public function downloadTaskPdf(){
$fileName = $this->filters['file_name'] ?? null;
if (!$fileName) {
Notification::make()
->title('File Name Required')
->body('Please enter a file name before removing the PDF.')
->danger()
->send();
return;
}
$filePath = "task_updates/{$fileName}.pdf";
if (!Storage::disk('local')->exists($filePath)) {
Notification::make()
->title('PDF Not Found')
->body('The selected PDF does not exist.')
->danger()
->send();
$this->form->fill(['file_name' => null]);
return;
}
if (Storage::disk('local')->exists($filePath)) {
if($filePath){
$fullPath = Storage::disk('local')->path($filePath);
Notification::make()
->title('PDF Downloaded Successfully')
->body('The PDF was downloaded successfully.')
->success()
->send();
return response()->download($fullPath, "{$fileName}.pdf");
}
else{
Notification::make()
->title('PDF downloaded Failed')
->body('Unable to download the PDF. Please try again...')
->success()
->send();
return;
}
}
}
public static function canAccess(): bool
{
return Auth::check() && Auth::user()->can('view upload daily report page');

View File

@@ -1270,15 +1270,6 @@ class InvoiceValidationResource extends Resource
TextInput::make('serial_number')
->label('Serial Number')
->placeholder(placeholder: 'Enter Serial Number'),
TextInput::make('panel_box_serial_number')
->label('Panel Box Serial Number')
->placeholder(placeholder: 'Enter Panel Box Serial Number'),
TextInput::make('panel_box_supplier')
->label('Panel Box Supplier')
->placeholder(placeholder: 'Enter Panel Box Supplier'),
TextInput::make('panel_box_code')
->label('Panel Box Code')
->placeholder(placeholder: 'Enter Panel Box Code'),
Select::make('sticker_master_id')
->label('Search by Item Code')
->nullable()
@@ -1287,16 +1278,15 @@ class InvoiceValidationResource extends Resource
->options(function (callable $get) {
$pId = $get('Plant');
if (! $pId) {
return [];
} else {
return Item::whereHas('stickerMasters', function ($query) use ($pId) {
if ($pId) {
$query->where('plant_id', $pId);
}
$query->whereHas('invoiceValidations');
})->pluck('code', 'id');
}
// if (empty($pId)) {
// return [];
// }
return Item::whereHas('stickerMasters', function ($query) use ($pId) {
if ($pId) {
$query->where('plant_id', $pId);
}
$query->whereHas('invoiceValidations');
})->pluck('code', 'id');
}),
Select::make('scanned_status')
->label('Scanned Status')
@@ -1333,7 +1323,7 @@ class InvoiceValidationResource extends Resource
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['invoice_type']) || (empty($data['Plant']) && empty($data['invoice_number']) && empty($data['serial_number']) && empty($data['panel_box_serial_number']) && empty($data['panel_box_supplier']) && empty($data['panel_box_code']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['operator_id']) && empty($data['scanned_status']) && empty($data['sticker_master_id']))) {
if (empty($data['invoice_type']) || (empty($data['Plant']) && empty($data['invoice_number']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['operator_id']) && empty($data['scanned_status']) && empty($data['sticker_master_id']))) {
if (empty($data['invoice_type'])) {
Notification::make()
->title('Please, choose invoice type to filter.')
@@ -1391,18 +1381,6 @@ class InvoiceValidationResource extends Resource
$query->where('serial_number', 'like', '%'.$data['serial_number'].'%');
}
if (! empty($data['panel_box_serial_number'])) {
$query->where('panel_box_serial_number', 'like', '%'.$data['panel_box_serial_number'].'%');
}
if (! empty($data['panel_box_supplier'])) {
$query->where('panel_box_supplier', 'like', '%'.$data['panel_box_supplier'].'%');
}
if (! empty($data['panel_box_code'])) {
$query->where('panel_box_code', 'like', '%'.$data['panel_box_code'].'%');
}
if (! empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
@@ -1415,9 +1393,8 @@ class InvoiceValidationResource extends Resource
$query->where('operator_id', $data['operator_id']);
}
if (! empty($data['sticker_master_id']) && ! empty($data['Plant'])) {
if (! empty($data['sticker_master_id'])) {
$stickerMasterIds = StickerMaster::where('item_id', $data['sticker_master_id'])
->where('plant_id', $data['Plant'])
->pluck('id')
->toArray();
@@ -1447,19 +1424,7 @@ class InvoiceValidationResource extends Resource
$indicators[] = 'Serial Number: '.$data['serial_number'];
}
if (! empty($data['panel_box_serial_number'])) {
$indicators[] = 'Panel Box Serial Number: '.$data['panel_box_serial_number'];
}
if (! empty($data['panel_box_supplier'])) {
$indicators[] = 'Panel Box Supplier: '.$data['panel_box_supplier'];
}
if (! empty($data['panel_box_code'])) {
$indicators[] = 'Panel Box Code: '.$data['panel_box_code'];
}
if (! empty($data['sticker_master_id']) && ! empty($data['Plant'])) {
if (! empty($data['sticker_master_id'])) {
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
$indicators[] = 'Item Code: '.$itemCode;
}

View File

@@ -338,15 +338,12 @@ class ItemResource extends Resource
->reactive(),
TextInput::make('description')
->label('Search by Description')
->reactive()
->placeholder(placeholder: 'Enter Description'),
TextInput::make('category')
->label('Search by Category')
->reactive()
->placeholder(placeholder: 'Enter Category'),
TextInput::make('uom')
->label('Search by UOM')
->reactive()
->placeholder(placeholder: 'Enter UOM'),
DateTimePicker::make(name: 'created_from')
->label('Created From')
@@ -390,15 +387,27 @@ class ItemResource extends Resource
}
if (! empty($data['description'])) {
$query->where('description', 'like', '%'.$data['description'].'%');
$query->where('description', '%'.$data['description'].'%');
}
if (! empty($data['uom'])) {
$query->where('uom', 'like', '%'.$data['uom'].'%');
if ($data['uom'] == 'empty') {
$query->where(function ($q) {
$q->where('uom', '')->orWhereNull('uom');
});
} else {
$query->where('uom', 'like', '%'.$data['uom'].'%');
}
}
if (! empty($data['category'])) {
$query->where('category', 'like', '%'.$data['category'].'%');
if ($data['category'] == 'empty') {
$query->where(function ($q) {
$q->where('category', '')->orWhereNull('category');
});
} else {
$query->where('category', '%'.$data['category'].'%');
}
}
if (! empty($data['created_from'])) {

View File

@@ -21,8 +21,6 @@ use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Forms\Set;
use Filament\Notifications\Notification;
class LeakTestReadingResource extends Resource
{
@@ -78,84 +76,39 @@ class LeakTestReadingResource extends Resource
->hintColor('danger'),
Forms\Components\TextInput::make('item_code')
->required()
->label('Scan QR Code')
->placeholder('Scan the valid QR Code')
->label('Item Code')
->placeholder('Scan the valid item code')
->autofocus(true)
// ->alphaNum()
// ->minLength(6)
->alphaNum()
->minLength(6)
->reactive()
->disabled(fn (Get $get) => ! empty($get('id')) && ! Filament::auth()->user()->hasRole('Super Admin'))
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
// $code = $get('item_code');
// $set('lsrCodeError', null);
// if (! $code) {
// $set('lsrCodeError', 'Scan the valid item code.');
->afterStateUpdated(function ($state, callable $set, callable $get) {
$code = $get('item_code');
$set('lsrCodeError', null);
if (! $code) {
$set('lsrCodeError', 'Scan the valid item code.');
// return;
// } else {
// if (strlen($code) < 6) {
// $set('lsrCodeError', 'Item code must be at least 6 digits.');
return;
} else {
if (strlen($code) < 6) {
$set('lsrCodeError', 'Item code must be at least 6 digits.');
// return;
// } elseif (! ctype_alnum($code)) {
// $set('item_code', null);
// $set('lsrCodeError', 'Item code must contain only alpha-numeric characters!');
// return;
// } elseif (! preg_match('/^[a-zA-Z1-9][a-zA-Z0-9]{5,}$/', $code)) {
// $set('item_code', null);
// $set('lsrCodeError', "Item code should not begin with '0' or letter!");
// return;
// }
// $set('lsrCodeError', null);
// }
// })
->afterStateUpdated(function ($state, Set $set, Get $get, $livewire) {
if (blank($state)) {
return;
} elseif (! ctype_alnum($code)) {
$set('item_code', null);
$set('serial_number', null);
$set('lsrCodeError', 'Item code must contain only alpha-numeric characters!');
return;
} elseif (! preg_match('/^[a-zA-Z1-9][a-zA-Z0-9]{5,}$/', $code)) {
$set('item_code', null);
$set('lsrCodeError', "Item code should not begin with '0' or letter!");
return;
}
$parts = explode('|', trim($state));
if (! preg_match('/^[^|]+\|[^|]+\|?$/', trim($state))) {
Notification::make()
->title('Invalid QR Format')
->body("Expected format: ItemCode|SerialNumber<br>Received Format '$state'")
->danger()
->send();
$set('item_code', null);
return;
}
else{
$iCode = $parts[0];
if (strlen($parts[0]) > 6) {
Notification::make()
->title('Invalid Item Code')
->body("Item code '$iCode' should contain minimum 6 digits!")
->danger()
->send();
$set('item_code', null);
return;
}
elseif(!preg_match('/^[a-zA-Z0-9]+$/', $iCode)){
Notification::make()
->title('Invalid Item Code')
->body("Item code '$iCode' should contain alpha numeric values!")
->danger()
->send();
$set('item_code', null);
return;
}
$set('item_code', trim($parts[0]));
$set('serial_number', isset($parts[1]) ? trim($parts[1]) : null);
// $set('test_status', 'P');
$livewire->dispatch('submit-leak-test-form');
}
})
$set('lsrCodeError', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('lsrCodeError') ? 'border-red-500' : '',
])
@@ -205,14 +158,13 @@ class LeakTestReadingResource extends Resource
->label('Test Status')
->searchable()
->reactive()
->default('P')
// ->disabled(fn (Get $get) => ! empty($get('id')))
->options(function (callable $set, callable $get) {
$plantId = $get('plant_id');
// $itemCode = $get('item_code');
// $serialNumber = $get('serial_number');
$itemCode = $get('item_code');
$serialNumber = $get('serial_number');
if (! $plantId) { //|| ! $itemCode || ! $serialNumber
if (! $plantId || ! $itemCode || ! $serialNumber) {
$set('test_status', null);
return [];

View File

@@ -4,55 +4,9 @@ namespace App\Filament\Resources\LeakTestReadingResource\Pages;
use App\Filament\Resources\LeakTestReadingResource;
use Filament\Actions;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\CreateRecord;
use Livewire\Attributes\On;
class CreateLeakTestReading extends CreateRecord
{
protected static string $resource = LeakTestReadingResource::class;
public function processQR($value){
$qrCode = $value;
$parts = explode('|', $qrCode);
$plantId = $this->form->getState()['plant_id'];
if (! preg_match('/^[^|]+(?:\|[^|]+)?$/', $value)) {
Notification::make()
->title('Invalid QR Format')
->body('Expected format: ItemCode|SerialNumber')
->danger()
->send();
return;
}
$itemCode = $parts[0] ?? null;
$serialNumber = $parts[1] ?? null;
$this->form->fill([
'plant_id' => $plantId,
'item_code' => $itemCode,
'serial_number' => $serialNumber,
'test_status' => 'PASS'
]);
}
#[On('submit-leak-test-form')]
public function submitLeakTestForm(): void
{
$this->create();
}
protected function getRedirectUrl(): string
{
//return $this->getResource()::getUrl('create'); // Stay on Create Page after savin
return $this->getResource()::getUrl('create', [
'plant_id' => $this->data['plant_id'] ?? null,
]);
}
}

View File

@@ -19,7 +19,6 @@ use App\Models\Item;
use App\Models\Line;
use App\Models\Plant;
use App\Models\StickerMaster;
use App\Models\InvoiceValidation;
use App\Models\PanelGrMaster;
use Filament\Notifications\Notification;
use Filament\Forms\Components\DateTimePicker;
@@ -211,7 +210,8 @@ class PanelBoxValidationResource extends Resource
'class' => $get('inspecOrdError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('inspecOrdError') ? $get('inspecOrdError') : null)
->hintColor('danger'),
->hintColor('danger')
->required(),
Forms\Components\Hidden::make('inspection')
->default(fn () => session('last_selected_inspection'))
->afterStateHydrated(function ($state, $set) {
@@ -562,11 +562,11 @@ class PanelBoxValidationResource extends Resource
{
$parts = explode('/', $state);
if (!preg_match('/^\d+\/\d+\/\d{4}\/\d+$/', $state) || preg_match('/[a-zA-Z]/', $state)) {
if (count($parts) < 3) {
Notification::make()
->title('Invalid QR Format')
->body("Expected format: plantcode/itemcode/yearmm/serialnumber Format Received : $state")
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
->danger()
->send();
$set('item_id', null);
@@ -581,10 +581,10 @@ class PanelBoxValidationResource extends Resource
$itemCode = $panelBoxCode;
$serialNumber = $panelBoxSerialNo;
if (strlen($serialNumber) > 15) {
if (strlen($serialNumber) > 30) {
Notification::make()
->title('Invalid Serial Number')
->body("Serial number cannot be greater than 15 characters. Current length: " . strlen($panelBoxSerialNo))
->body("Serial number cannot be greater than 30 characters. Current length: " . strlen($panelBoxSerialNo))
->danger()
->send();
@@ -633,25 +633,6 @@ class PanelBoxValidationResource extends Resource
return;
}
$panelExistsInvoice = InvoiceValidation::where('plant_id', $plantId)
->where('panel_box_serial_number', $serialNumber)
->where('panel_box_supplier', $supplier)
->first();
if ($panelExistsInvoice) {
Notification::make()
->title('Duplicate Panel Box Serial Number')
->body("Duplicate panel already exists.<br>Panel Box Code: $itemCode, Serial Number: $serialNumber, Supplier Number: $supplier against invoice Number: $panelExistsInvoice->invoice_number")
->danger()
->seconds(4)
->send();
$set('item_id', null);
$set('serial_exists', false);
return;
}
$existInMaster = PanelGrMaster::where('document_number', $pOrder)->where('inspection_lot_number', $inspecLotNo)->where('item_id', $iId->id)->where('plant_id', $plantId)->first();
if(!$existInMaster){
@@ -844,7 +825,7 @@ class PanelBoxValidationResource extends Resource
}
}
$serialExists = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->where('panel_box_supplier', $supplier)->where('status', '!=', '')->whereNotNull('status')->where('status', 'NotOk')->first();
$serialExists = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->where('panel_box_supplier', $supplier)->first();
if ($serialExists) {
$set('serial_exists', true);
@@ -852,20 +833,6 @@ class PanelBoxValidationResource extends Resource
$set('serial_exists', false);
}
$serialExistsPanel = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->where('panel_box_supplier', $supplier)->where('status', '!=', '')->whereNotNull('status')->where('status', 'Ok')->first();
if($serialExistsPanel){
Notification::make()
->title('Panel Box Already Validated')
->body("Serial number '$serialNumber' for supplier '$supplier' has already been tested and marked as 'OK'")
->success()
->send();
$set('item_id', null);
$set('serial_exists', false);
$set('validationError', null);
return;
}
// if ($serialExists && ! $get('id')) {
// $set('validationError', 'Serial number already exists in panel box validation.');
// $set('sticker_master_id', null);

View File

@@ -18,8 +18,6 @@ class EditPanelGrMaster extends EditRecord
{
$record = $this->record;
$scannedQuantity = 0;
$sticker = StickerMaster::where('plant_id', $record->plant_id)->where('item_id', $record->item_id)->first();
if($sticker)

View File

@@ -185,13 +185,15 @@ class PlantResource extends Resource
->hint(fn ($get) => $get('pAddressError') ? $get('pAddressError') : null)
->hintColor('danger'),
Forms\Components\Textarea::make('reg_address')
->label('Regd Address')
->required()
->label('Reg Address')
->placeholder('Scan the valid Regd address')
->unique(ignoreRecord: true)
->columnSpanFull()
->reactive()
->minLength(5)
->afterStateUpdated(function ($state, callable $set, callable $get) {
$nameId = $get('reg_address');
$nameId = $get('address');
// Ensure `linestop_id` is not cleared
if (! $nameId) {
$set('pRegAddressError', 'Scan the valid reg address.');
@@ -206,50 +208,6 @@ class PlantResource extends Resource
])
->hint(fn ($get) => $get('pRegAddressError') ? $get('pRegAddressError') : null)
->hintColor('danger'),
Forms\Components\Textarea::make('feed_address')
->label('Feed Address')
->placeholder('Scan the valid Feed address')
->columnSpanFull()
->reactive()
->minLength(5)
->afterStateUpdated(function ($state, callable $set, callable $get) {
$nameId = $get('feed_address');
// Ensure `linestop_id` is not cleared
if (! $nameId) {
$set('pFeedAddressError', 'Scan the valid feed back address.');
return;
} else {
$set('pFeedAddressError', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('pFeedAddressError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('pFeedAddressError') ? $get('pRegAddressError') : null)
->hintColor('danger'),
Forms\Components\Textarea::make('tollfree')
->label('Tollfree')
->placeholder('Scan the valid Tollfree')
->columnSpanFull()
->reactive()
->minLength(5)
->afterStateUpdated(function ($state, callable $set, callable $get) {
$nameId = $get('tollfree');
// Ensure `linestop_id` is not cleared
if (! $nameId) {
$set('pTollfreeError', 'Scan the valid tollfree.');
return;
} else {
$set('pTollfreeError', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('pTollfreeError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('pTollfreeError') ? $get('pTollfreeError') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('id')
->hidden()
->readOnly(),
@@ -304,16 +262,6 @@ class PlantResource extends Resource
->alignCenter()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('feed_address')
->label('FeedBack')
->alignCenter()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('tollfree')
->label('Tollfree')
->alignCenter()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('company.name')
->label('Company')
->alignCenter()

View File

@@ -116,11 +116,6 @@ class StickerDetailResource extends Resource
->prepend('Serial Number', 'serial_number')
->prepend('Plant Name', 'plant_name')
->prepend('Plant Address', 'plant_address')
->prepend('Regd Address', 'regd_address')
->prepend('Regd Unit', 'regd_unit')
->prepend('Feed Address', 'feed_address')
->prepend('Tollfree', 'tollfree')
->prepend('Company Name', 'company_name')
->prepend('Current Date', 'current_date')
->prepend('Tested By', 'tested_by')
->prepend('Verified By', 'verified_by')

View File

@@ -89,26 +89,7 @@ class StickerMappingMasterResource extends Resource
})
->searchable()
->required()
->rules([
function (callable $get, $record) {
return function (string $attribute, $value, $fail) use ($get, $record) {
$plantId = $get('plant_id');
$query = StickerMappingMaster::where('plant_id', $plantId)
->where('item_id', $value);
// Ignore the current record when editing
if ($record) {
$query->where('id', '!=', $record->id);
}
if ($query->exists()) {
$fail('Item Code already exist to the selected plant.');
}
};
},
]),
->required(),
])
->columns(2),

View File

@@ -652,16 +652,6 @@ class TestingPanelReadingResource extends Resource
->reactive()
// ->live()
// ->format('d-m-Y H:i:s')
->readOnly(fn (Get $get) => $get('id')) // checkhere...............................
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\DateTimePicker::make('test_finished_at')
->label('FR Finished At')
->reactive()
// ->live()
// ->format('d-m-Y H:i:s')
->readOnly(fn (Get $get) => $get('id'))
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
@@ -949,11 +939,6 @@ class TestingPanelReadingResource extends Resource
->alignCenter()
->sortable()
->dateTime(),
Tables\Columns\TextColumn::make('test_finished_at')
->label('FR Finished At')
->alignCenter()
->sortable()
->dateTime(),
Tables\Columns\TextColumn::make('rework_count')
->label('Rework Count')
->alignCenter(),
@@ -1247,16 +1232,6 @@ class TestingPanelReadingResource extends Resource
->placeholder('Select To DateTime')
->reactive()
->native(false),
DateTimePicker::make('test_finished_from')
->label('FR Finished From')
->placeholder('Select From DateTime')
->reactive()
->native(false),
DateTimePicker::make('test_finished_to')
->label('FR Finished To')
->placeholder('Select To DateTime')
->reactive()
->native(false),
Select::make('tested_by')
->label('Tested By')
->nullable()
@@ -1308,7 +1283,7 @@ class TestingPanelReadingResource extends Resource
// dd($data);
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['Line']) && empty($data['item_code']) && empty($data['subassembly_code']) && empty($data['machine_name']) && empty($data['item_description']) && empty($data['serial_number']) && empty($data['winded_serial_number']) && empty($data['output']) && empty($data['connection']) && empty($data['remark']) && empty($data['batch_number']) && empty($data['result']) && empty($data['test_sequence_flag']) && empty($data['test_started_from']) && empty($data['test_started_to']) && empty($data['test_finished_from']) && empty($data['test_finished_to']) && empty($data['tested_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {
if (empty($data['Plant']) && empty($data['Line']) && empty($data['item_code']) && empty($data['subassembly_code']) && empty($data['machine_name']) && empty($data['item_description']) && empty($data['serial_number']) && empty($data['winded_serial_number']) && empty($data['output']) && empty($data['connection']) && empty($data['remark']) && empty($data['batch_number']) && empty($data['result']) && empty($data['test_sequence_flag']) && empty($data['test_started_from']) && empty($data['test_started_to']) && empty($data['tested_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {
return $query->whereRaw('1 = 0');
}
@@ -1417,14 +1392,6 @@ class TestingPanelReadingResource extends Resource
$query->where('test_started_at', '<=', $data['test_started_to']);
}
if (! empty($data['test_finished_from'])) {
$query->where('test_finished_at', '>=', $data['test_finished_from']);
}
if (! empty($data['test_finished_to'])) {
$query->where('test_finished_at', '<=', $data['test_finished_to']);
}
if (! empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
@@ -1519,14 +1486,6 @@ class TestingPanelReadingResource extends Resource
$indicators[] = 'Test Started To: '.$data['test_started_to'];
}
if (! empty($data['test_finished_from'])) {
$indicators[] = 'Test Finished From: '.$data['test_finished_from'];
}
if (! empty($data['test_finished_to'])) {
$indicators[] = 'Test Finished To: '.$data['test_finished_to'];
}
if (! empty($data['serial_number'])) {
$indicators[] = 'Serial Number: '.$data['serial_number'];
}

View File

@@ -116,7 +116,7 @@ class VisitorEntryResource extends Resource
}
}),
Forms\Components\Select::make('dealer')
->label('Dealer Visit / Special Guest')
->label('Dealer Visit')
->options(
DealerVisitPlan::where('status', 'Planned')
->whereDate('visit_plan_date', today())
@@ -350,28 +350,6 @@ class VisitorEntryResource extends Resource
])
->reactive()
->placeholder('Select Mode of Travel'),
Forms\Components\Select::make('tool_gadget')
->label('Tools & Gadgets')
->reactive()
->options([
'Laptop' => 'Laptop',
'Tablets' => 'Tablets',
'Mobiles' => 'Mobiles',
'Others' => 'Others',
])
->dehydrateStateUsing(function ($state, callable $get) {
return $state == 'Others'
? $get('other_tool')
: $state;
}),
Forms\Components\TextInput::make('other_tool')
->label('Specify Tool Type')
->reactive()
->visible(fn (callable $get) => $get('tool_gadget') == 'Others')
->required(fn (callable $get) => $get('tool_gadget') == 'Others')
->dehydrated(false),
Forms\Components\TextInput::make('serial_number')
->label('Serial Number'),
Forms\Components\DateTimePicker::make('in_time')
->label('In Time')
->required()
@@ -390,10 +368,10 @@ class VisitorEntryResource extends Resource
->columnSpanFull(),
Forms\Components\Hidden::make('photo'),
Forms\Components\Hidden::make('created_by')
->label('Created By')
->label('created_by')
->default(Filament::auth()->user()?->name),
Forms\Components\Hidden::make('updated_by')
->label('Updated By')
->label('updated_by')
->default(Filament::auth()->user()?->name),
]);
}
@@ -488,16 +466,6 @@ class VisitorEntryResource extends Resource
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('tool_gadget')
->label('Tools & Gadgets')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('serial_number')
->label('Serial Number')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('in_time')
->label('In Time')
->searchable()

View File

@@ -13,8 +13,6 @@ class ItemOverview extends ChartWidget
{
protected static ?string $heading = 'Hourly Production';
public ?string $filter = 'today';
protected int|string|array $columnSpan = '12';
protected static ?string $maxHeight = '400px';
@@ -152,97 +150,22 @@ class ItemOverview extends ChartWidget
// $planQuantity
// );
$planData = [];
if ($activeFilter === 'today') {
$monthlyPlanQuantity = \DB::table('production_plans')
->where('plant_id', $selectedPlant)
->where('line_id', $selectedLine)
->whereYear('created_at', $startDate->year)
->whereMonth('created_at', $startDate->month)
->sum('plan_quantity');
$weeksCount = (int) ceil(now()->daysInMonth / 7);
$dailyPlan = $weeksCount > 0
? round($monthlyPlanQuantity / ($weeksCount * 7), 2)
: 0;
$hourlyPlan = round($dailyPlan / 22.5, 2);
$planData = array_fill(0, count($orderedData), $hourlyPlan);
}
if ($activeFilter === 'yesterday') {
$monthlyPlanQuantity = \DB::table('production_plans')
->where('plant_id', $selectedPlant)
->where('line_id', $selectedLine)
->whereYear('created_at', $startDate->year)
->whereMonth('created_at', $startDate->month)
->sum('plan_quantity');
// Calculate daily target directly
$weeksCount = (int) ceil($startDate->daysInMonth / 7);
$dailyPlan = $weeksCount > 0
? round($monthlyPlanQuantity / ($weeksCount * 7), 2)
: 0;
// Calculate hourly target
$hourlyPlan = round($dailyPlan / 22.5, 2);
// Same hourly plan value for every hour
$planData = array_fill(0, 24, $hourlyPlan);
}
elseif ($activeFilter === 'this_month') {
$monthlyPlanQuantity = \DB::table('production_plans')
->where('plant_id', $selectedPlant)
->where('line_id', $selectedLine)
->whereYear('created_at', $startDate->year)
->whereMonth('created_at', $startDate->month)
->sum('plan_quantity');
// Number of weeks in the current month
$weeksCount = count($orderedData);
// Split the total monthly plan equally across all weeks
$weeklyPlan = $weeksCount > 0
? round($monthlyPlanQuantity / $weeksCount, 2)
: 0;
if (in_array($activeFilter, ['today', 'yesterday'])) {
$planQuantity = round(array_sum($orderedData) / 22.5, 2);
$planData = array_fill(
0,
$weeksCount,
$weeklyPlan
count($orderedData),
$planQuantity
);
} else {
// This Week: each day's production / 22.5
// This Month: each week's production / 22.5
$planData = array_map(
fn ($quantity) => round($quantity / 22.5, 2),
$orderedData
);
}
elseif ($activeFilter === 'this_week') {
// Get the total plan quantity for the current month
$monthlyPlanQuantity = \DB::table('production_plans')
->where('plant_id', $selectedPlant)
->where('line_id', $selectedLine)
->whereYear('created_at', $startDate->year)
->whereMonth('created_at', $startDate->month)
->sum('plan_quantity');
// Number of calendar weeks in the current month
$weeksCount = (int) ceil($startDate->daysInMonth / 7);
// Monthly plan -> weekly plan -> daily plan
$weeklyPlan = $weeksCount > 0
? $monthlyPlanQuantity / $weeksCount
: 0;
$dailyPlan = round($weeklyPlan / 7, 2);
// Monday through Sunday
$planData = array_fill(0, 7, $dailyPlan);
}
return [
'datasets' => [

View File

@@ -5923,7 +5923,7 @@ class CharacteristicsController extends Controller
$modelHeading = $request->header('model-heading');
$requestType = $request->header('request-type');
Log::info("Request {$requestType} GET API >>", ['user-name' => $userName, 'characteristic-field' => $charField, 'plant-code' => $plantCode, 'work-center' => $workCenter, 'machine-name' => $machineName, 'aufnr' => $jobNo, 'gernr' => $serialNumber, 'item-code' => $itemCode, 'work-flow-id' => $workFlowId]);
Log::info("Request {$requestType} POST API >>", ['user-name' => $userName, 'characteristic-field' => $charField, 'plant-code' => $plantCode, 'work-center' => $workCenter, 'machine-name' => $machineName, 'aufnr' => $jobNo, 'gernr' => $serialNumber, 'item-code' => $itemCode, 'work-flow-id' => $workFlowId]);
if (! $userName || $userName == null || $userName == '') {
return response()->json([

View File

@@ -314,78 +314,6 @@ class PdfController extends Controller
}
public function getCoilDetails(Request $request){
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser.':'.$expectedPw;
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!',
], 404);
}
$plantCode = $request->header('plant-code');
$processOrder = $request->header('process-order');
if (! $plantCode) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant Code value can't be empty",
], 404);
} elseif (! $processOrder) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Process Order cannot be empty!',
], 404);
}
if (!str_contains($processOrder, '-')) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invalid Process Order",
], 404);
}
$plant = Plant::where('code', $plantCode)->first();
$plantId = $plant->id;
if (! $plant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant Code '{$plantCode}' not found!",
], 404);
}
$parts = explode('-', $processOrder);
$processOrder = $parts[0]; // 261010002154
$coilNo = $parts[1]; // 001
$processOrderExist = ProcessOrder::where('process_order', $processOrder)->where('plant_id', $plantId)->where('coil_number', $coilNo)->first();
if ($processOrderExist) {
$itemId = $processOrderExist->item_id;
$item = Item::where('id', $itemId)->first();
$itemCode = $item->code;
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Process order '$processOrder' with coil number '$coilNo' found against item '$itemCode'",
], 404);
}
else{
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Process order '$processOrder' with coil number '$coilNo' not found'",
], 404);
}
}
/**
* Store a newly created resource in storage.
*/

View File

@@ -327,7 +327,6 @@ class TestingPanelController extends Controller
'rework_winded' => $serial['rework_winded'] ?? 0,
'test_sequence_flag' => $serial['test_sequence_flag'] ?? '4',
'test_started_at' => $serial['test_started_at'] ?? null,
'test_finished_at' => $serial['test_finished_at'] ?? null,
'output_flag' => $serial['output_flag'] ?? 0,
'tested_by' => (($serial['tested_by'] == 'jothi') ? 'Admin' : $serial['tested_by']) ?? null,
'updated_by' => (($serial['updated_by'] == 'jothi') ? 'Admin' : $serial['updated_by']) ?? null,

View File

@@ -850,25 +850,6 @@ class InvoiceDataTable extends Component
if($categoryExist?->category == 'Panel Box'){
$panelExistsInvoice = InvoiceValidation::where('plant_id', $this->plantId)
->where('panel_box_serial_number', $serialNumber)
// ->where('panel_box_code', $itemCode)
->where('panel_box_supplier', $supplier)
->first();
if ($panelExistsInvoice) {
Notification::make()
->title('Duplicate Panel Box Serial Number')
->body("Duplicate panel already exists.<br>Panel Box Code: $itemCode, Item Code: {$this->currentItemCode}, Serial Number: $serialNumber, Supplier Number: $supplier against invoice Number: $panelExistsInvoice->invoice_number")
->danger()
->seconds(2)
->send();
$this->capacitorInput = '';
return;
}
$panelExist = PanelBoxValidation::where('plant_id', $this->plantId)->where('panel_box_serial_number', $serialNumber)->where('panel_box_code', $itemCode)->where('panel_box_supplier', $supplier)->first();
if(!$panelExist){
@@ -883,15 +864,20 @@ class InvoiceDataTable extends Component
return;
}
$panelExistNotOk = PanelBoxValidation::where('plant_id', $this->plantId)->where('panel_box_serial_number', $serialNumber)->where('panel_box_code', $itemCode)->where('panel_box_supplier', $supplier)->whereNotNull('status')->where('status', '!=', '')->where('status', 'NotOk')->first();
$panelExistsInvoice = InvoiceValidation::where('plant_id', $this->plantId)
->where('panel_box_serial_number', $serialNumber)
->where('panel_box_code', $itemCode)
->where('panel_box_supplier', $supplier)
->first();
if($panelExistNotOk){
if ($panelExistsInvoice) {
Notification::make()
->title('Panel Not Ok')
->body("Panel Quality Inspection NotOk.<br>Panel Box Code: $itemCode, Item Code: {$this->currentItemCode}, Serial Number: $serialNumber.</br>")
->title('Duplicate Panel')
->body("Duplicate panel already exists.<br>Panel Box Code: $itemCode, Item Code: {$this->currentItemCode}, Serial Number: $serialNumber.")
->danger()
->seconds(2)
->send();
$this->capacitorInput = '';
return;

View File

@@ -1,245 +0,0 @@
<?php
namespace App\Livewire;
use App\Models\ClassCharacteristic;
use App\Models\StickerStructureDetail;
use App\Models\Item;
use App\Models\StickerMappingMaster;
use Filament\Notifications\Notification;
use Livewire\Component;
use Livewire\Attributes\Reactive;
use Livewire\Attributes\On;
class RandomSerialNumberList extends Component
{
public bool $showMultipleSerials = false;
public array $serialNumbers = [''];
#[Reactive]
public $plantId = null;
#[Reactive]
public $machineId = null;
public function updatedShowMultipleSerials($value): void
{
$this->serialNumbers = collect($this->serialNumbers)
->filter(fn ($serial) => trim($serial) !== '')
->values()
->toArray();
// Clear all values whenever the checkbox changes
$this->serialNumbers = [''];
}
public function splitSerialNumbers(string $text): void
{
$serials = preg_split('/[\r\n\t ,;]+/', trim($text));
$this->serialNumbers = collect($serials)
->filter(fn ($serial) => $serial !== '')
->values()
->toArray();
if (empty($this->serialNumbers)) {
$this->serialNumbers = [''];
}
$plantId = $this->plantId;
$machineId = $this->machineId;
if (!$plantId) {
Notification::make()
->danger()
->title('Plant Not Selected')
->body('Please select a plant before pasting serial numbers.')
->send();
$this->dispatch('sticker-options-clear', stickerOptions: '');
$this->dispatch('production-order-clear', productionOrder: '');
return;
}
$serialNumbersArray = array_values(
array_filter(
array_map('trim', $this->serialNumbers),
fn ($serial) => $serial !== ''
)
);
if (count($serialNumbersArray) > 50) {
Notification::make()
->title('Too Many Serial Numbers')
->body('You can enter a maximum of 50 serial numbers.')
->danger()
->send();
$this->dispatch('sticker-options-clear', stickerOptions: '');
$this->dispatch('production-order-clear', productionOrder: '');
$this->serialNumbers = [''];
return;
}
$records = ClassCharacteristic::where('plant_id', $plantId)->whereIn('gernr', $serialNumbersArray)->get();
$foundSerialNumbers = $records->pluck('gernr')
->map(fn ($serial) => trim((string) $serial))
->unique()
->toArray();
$missingSerialNumbers = array_values(
array_diff($serialNumbersArray, $foundSerialNumbers)
);
if (!empty($missingSerialNumbers)) {
Notification::make()
->danger()
->title('Serial Numbers Not Found')
->body('The following serial numbers do not exist for the selected plant: '. implode(', ', $missingSerialNumbers))
->send();
return;
}
$productionOrder = $records->first()->aufnr;
$invalidSerialNumbers = $productionOrder
? $records->filter(
fn ($record) => $record->aufnr != $productionOrder
)->pluck('gernr')->unique()->values()->toArray()
: [];
if (!empty($invalidSerialNumbers)) {
Notification::make()
->danger()
->title('Invalid Serial Numbers')
->body('The following serial numbers belong to a different production order: '. implode(', ', $invalidSerialNumbers))
->send();
return;
}
$record = $records->first();
$itemId = $record->item_id;
$item = Item::find($itemId);
if (! $item) {
Notification::make()
->title('Item not found')
->body("Item code '{$itemId}' was not found in item master.")
->danger()
->send();
$this->dispatch('sticker-options-clear', stickerOptions: '');
$this->dispatch('production-order-clear', productionOrder: '');
return;
}
$itemCode = $item->code;
$item = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
if (! $item) {
Notification::make()
->title('Item not found')
->body("Item '{$itemCode}' was not found for the selected plant.")
->danger()
->send();
$this->dispatch('sticker-options-clear', stickerOptions: '');
$this->dispatch('production-order-clear', productionOrder: '');
return;
}
$itemCharacteristic = ClassCharacteristic::where('plant_id', $plantId)->where('item_id', $item->id)->first();
if (! $itemCharacteristic) {
Notification::make()
->title('Class characteristic not found')
->body("No class characteristic found for item '{$itemCode}'.")
->danger()
->send();
return;
}
// $itemCharacteristicId = $itemCharacteristic->id;
$stickerMappings = StickerMappingMaster::where('plant_id', $plantId)
->where('item_id', $item->id)
->get();
if (! $stickerMappings) {
Notification::make()
->title('Sticker mapping not found')
->body("No sticker mapping found for this plant and item '$itemCode'.")
->danger()
->send();
return;
}
$stickerOptions = [];
foreach ($stickerMappings as $stickerMapping) {
for ($i = 1; $i <= 8; $i++) {
$machineColumn = "sticker{$i}_machine_id";
$stickerMachineId = $stickerMapping->$machineColumn;
if ((string) $stickerMachineId != (string) $machineId) {
continue;
}
$structureColumn = "sticker_structure{$i}_id";
$stickerStructureId = $stickerMapping->$structureColumn;
if (empty($stickerStructureId)) {
continue;
}
$detail = StickerStructureDetail::find($stickerStructureId);
if ($detail && $detail->sticker_id) {
$stickerOptions[$detail->sticker_id] =
$detail->sticker_id;
}
$this->dispatch('sticker-structure-updated', stickerStructureId: $stickerStructureId);
}
}
$this->dispatch('sticker-options', stickerOptions: $stickerOptions);
$this->dispatch('production-order-updated', productionOrder: $productionOrder);
}
public function generate(): void
{
$serialNumbersString = implode(',', array_filter(
$this->serialNumbers,
fn ($serial) => trim($serial) !== ''
));
$this->dispatch('generate-sticker-id', serialNumbers: $serialNumbersString);
}
#[On('load-serial-numbers')]
public function loadSerialNumbers(array $serialNumbers = []): void
{
$this->serialNumbers = $serialNumbers ?: [''];
}
public function clear(){
$this->serialNumbers = [''];
$this->dispatch('sticker-options-clear', stickerOptions: '');
$this->dispatch('production-order-clear', productionOrder: '');
}
public function render()
{
return view('livewire.random-serial-number-list');
}
}

View File

@@ -18,8 +18,6 @@ class Plant extends Model
'address',
'warehouse_number',
'reg_address',
'feed_address',
'tollfree',
];
public function company(): BelongsTo

View File

@@ -59,7 +59,6 @@ class TestingPanelReading extends Model
'remark',
'test_sequence_flag',
'test_started_at',
'test_finished_at',
'rework_count',
'rework_winded',
'update_count',

View File

@@ -25,8 +25,6 @@ class VisitorEntry extends Model
'number_of_person',
'valid_upto',
'mode_of_travel',
'tool_gadget',
'serial_number',
];
public function employeeMaster(): BelongsTo

View File

@@ -9,8 +9,6 @@ use App\Models\StickerDetail;
use App\Models\StickerMappingMaster;
use App\Models\StickerStructureDetail;
use App\Models\StickerValidation;
use App\Models\Company;
use App\Models\Plant;
use App\Models\TestApprovalMapping;
use App\Models\ClassCharacteristic;
use Illuminate\Http\Response;
@@ -1059,7 +1057,6 @@ class StickerPdfService
$plantName = $itemCharacteristic?->plant?->name ?? '';
$plantAddress = $itemCharacteristic?->plant?->address ?? '';
$plantRegdAddress = $itemCharacteristic?->plant?->reg_address ?? '';
$dateOfTest = $itemCharacteristic?->created_at?->format('d.m.Y') ?? '';
// $currentDate = $itemCharacteristic?->created_at?->format('M-y') ?? '';
@@ -1157,158 +1154,6 @@ class StickerPdfService
? number_format((float) $itemCharacteristic->{$column} * 2, 2, '.', '')
: '';
}
if ($row->characteristics_type == 'regd_address') {
$column = 'zmm_brand';
$textValue = $itemCharacteristic?->{$column} != null
? $itemCharacteristic->{$column}
: '';
if($textValue == 'TORMAC'){
$cName = Company::where('name', 'TORMAC')->first();
$plantRegdAddress = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdAddress->reg_address;
}
else if($textValue == 'CRI'){
$cName = Company::where('name', 'CRI')->first();
$plantRegdAddress = Plant::where('company_id', $cName->id)->where('id', $plantId)->first();
$textValue = $plantRegdAddress->address;
}
else if($textValue == 'GENVIK'){
$cName = Company::where('name', 'GENVIK')->first();
$plantRegdAddress = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdAddress->reg_address;
}
else if($textValue == 'ZIRANTEC'){
$cName = Company::where('name', 'ZIRANTEC')->first();
$plantRegdAddress = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdAddress->reg_address;
}
}
if ($row->characteristics_type == 'feed_address') {
$column = 'zmm_brand';
$textValue = $itemCharacteristic?->{$column} != null
? $itemCharacteristic->{$column}
: '';
if($textValue == 'TORMAC'){
$cName = Company::where('name', 'TORMAC')->first();
$plantRegdAddress = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdAddress->feed_address;
}
else if($textValue == 'CRI'){
$cName = Company::where('name', 'CRI')->first();
$plantRegdAddress = Plant::where('company_id', $cName->id)->where('id', $plantId)->first();
$textValue = $plantRegdAddress->feed_address;
}
else if($textValue == 'GENVIK'){
$cName = Company::where('name', 'GENVIK')->first();
$plantRegdAddress = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdAddress->feed_address;
}
else if($textValue == 'ZIRANTEC'){
$cName = Company::where('name', 'ZIRANTEC')->first();
$plantRegdAddress = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdAddress->feed_address;
}
}
if ($row->characteristics_type == 'regd_unit') {
$column = 'zmm_brand';
$textValue = $itemCharacteristic?->{$column} != null
? $itemCharacteristic->{$column}
: '';
if($textValue == 'TORMAC'){
$cName = Company::where('name', 'TORMAC')->first();
$plantRegdUnit = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdUnit->name;
}
else if($textValue == 'CRI'){
$cName = Company::where('name', 'CRI')->first();
$plantRegdUnit = Plant::where('company_id', $cName->id)->where('id', $plantId)->first();
$textValue = $plantRegdUnit->name;
}
else if($textValue == 'GENVIK'){
$cName = Company::where('name', 'GENVIK')->first();
$plantRegdUnit = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdUnit->name;
}
else if($textValue == 'ZIRANTEC'){
$cName = Company::where('name', 'ZIRANTEC')->first();
$plantRegdUnit = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdUnit->name;
}
}
if ($row->characteristics_type == 'company_name') {
$column = 'zmm_brand';
$textValue = $itemCharacteristic?->{$column} != null
? $itemCharacteristic->{$column}
: '';
if($textValue == 'TORMAC'){
$cName = Company::where('name', 'TORMAC')->first();
$textValue = $cName->name;
}
else if($textValue == 'CRI'){
$cName = Company::where('name', 'CRI')->first();
$textValue = $cName->name;
}
else if($textValue == 'GENVIK'){
$cName = Company::where('name', 'GENVIK')->first();
$textValue = $cName->name;
}
else if($textValue == 'ZIRANTEC'){
$cName = Company::where('name', 'ZIRANTEC')->first();
$textValue = $cName->name;
}
}
if ($row->characteristics_type == 'tollfree') {
$column = 'zmm_brand';
$textValue = $itemCharacteristic?->{$column} != null
? $itemCharacteristic->{$column}
: '';
if($textValue == 'TORMAC'){
$cName = Company::where('name', 'TORMAC')->first();
$plantRegdUnit = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdUnit->tollfree;
}
else if($textValue == 'CRI'){
$cName = Company::where('name', 'CRI')->first();
$plantRegdUnit = Plant::where('company_id', $cName->id)->where('id', $plantId)->first();
$textValue = $plantRegdUnit->tollfree;
}
else if($textValue == 'GENVIK'){
$cName = Company::where('name', 'GENVIK')->first();
$plantRegdUnit = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdUnit->tollfree;
}
else if($textValue == 'ZIRANTEC'){
$cName = Company::where('name', 'ZIRANTEC')->first();
$plantRegdUnit = Plant::where('company_id', $cName->id)->first();
$textValue = $plantRegdUnit->tollfree;
}
}
if (str_contains($row->string_value ?? '', '₹')) {
@@ -1325,15 +1170,30 @@ class StickerPdfService
if (!empty($row->string_font)) {
$fontFile = storage_path('app/private/fonts/' . $row->string_font . '.ttf');
Log::info($fontFile, [
'font' => $row->string_font,
]);
if (file_exists($fontFile)) {
\Log::info('TCPDF FONT DEBUG', [
'K_PATH_FONTS' => defined('K_PATH_FONTS') ? K_PATH_FONTS : 'NOT DEFINED',
'fontFile' => $fontFile,
'php_sapi' => PHP_SAPI,
]);
$font = TCPDF_FONTS::addTTFfont(
$fontFile,
'TrueTypeUnicode',
'',
32
);
Log::info('FONT CONVERSION RESULT', [
'result' => $font,
]);
} else {
Log::warning('FONT FILE NOT FOUND', [
'font_file' => $fontFile,
]);
$font = 'helvetica';
}
} else {
@@ -1351,7 +1211,6 @@ class StickerPdfService
'font' => $font,
'size' => (int) ($row->string_size ?? 10),
'color' => $row->element_colour ?? '#000000',
'string_align' => strtolower($row->string_align ?? ''),
];
}
elseif ($row->design_element_type == 'QR') {
@@ -1608,7 +1467,7 @@ class StickerPdfService
// }
public function generateBulkFromTemplate(array $template,$fromSerial,$toSerial,string $itemCode, ?string $randomSerials = null)
public function generateBulkFromTemplate(array $template,$fromSerial,$toSerial,string $itemCode)
{
$stickerWidth = (float) $template['width'];
$stickerHeight = (float) $template['height'];
@@ -1705,42 +1564,11 @@ class StickerPdfService
$rgb[2]
);
// $pdf->Text(
// $element['x'],
// $element['y'] + $currentY,
// (string) $textValue
// );
$alignment = strtolower($element['string_align'] ?? '');
$pdf->SetFont($element['font'], '', $element['size']);
$x = (float) $element['x'];
$y = $element['y'] + $currentY;
// $textWidth = $pdf->GetStringWidth((string) $textValue);
if ($alignment == 'center') {
if($stickerId == 'Sewage PumpSet Test Certificate' || $stickerId == 'Submersible Mixer Test Certificate' || $stickerId == 'Pump Test Certificate' || $stickerId == 'Submersible Aerator Pump Test Certificate'){
$leftMargin = 10; // mm from left edge
$rightMargin = 24; // mm from right edge
$usableWidth = $stickerWidth - $leftMargin - $rightMargin;
$textWidth = $pdf->GetStringWidth((string) $textValue);
// start x = left margin + half of the leftover space
$x = $leftMargin + (($usableWidth - $textWidth) / 2);
// if text is wider than the usable area, don't go past the left margin
if ($textWidth > $usableWidth) {
$x = $leftMargin;
}
}
}
$pdf->Text($x, $y, (string) $textValue);
$pdf->Text(
$element['x'],
$element['y'] + $currentY,
(string) $textValue
);
}
elseif ($element['type'] == 'qr') {
@@ -2043,445 +1871,6 @@ class StickerPdfService
}
}
//..Multiple Serial Numbers
public function generateMultipleBulkFromTemplate(array $template, array $serialNumbersArray,string $itemCode, ?string $randomSerials = null)
{
$stickerWidth = (float) $template['width'];
$stickerHeight = (float) $template['height'];
$stickerId = $template['sticker_id'] ?? null;
// $gap = 5.0;
// $count = ($toSerial - $fromSerial) + 1;
// $totalHeight =
// ($stickerHeight * $count)
// +
// ($gap * ($count - 1));
$orientation = $stickerWidth > $stickerHeight ? 'L' : 'P';
// $pdf = new TCPDF(
// 'P',
// 'mm',
// [
// $stickerWidth,
// $stickerHeight
// ],
// true,
// 'UTF-8',
// false
// );
$pdf = new TCPDF($orientation, 'mm', [$stickerWidth, $stickerHeight], true, 'UTF-8', false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetMargins(
0,
0,
0,
0
);
$pdf->SetAutoPageBreak(false, 0);
// $pdf->AddPage();
$currentY = 0;
// Generate every serial
if ($stickerId != 'SelfPriming Monoblock Pump Dual') {
foreach ($serialNumbersArray as $serial) {
$serial = (string) $serial;
$pdf->AddPage();
$qrContent = $itemCode . '|' . $serial;
$serialString = (string) $serial;
$serialDate = '';
if (strlen($serialString) >= 4) {
$year = substr($serialString, 0, 2);
$month = substr($serialString, 2, 2);
if ((int) $month >= 1 && (int) $month <= 12) {
$serialDate = \Carbon\Carbon::createFromFormat(
'y-m',
$year . '-' . $month
)->format('M-y');
}
}
foreach ($template['elements'] as $element) {
if ($element['type'] == 'text') {
$textValue = $element['value'];
if ($textValue == '__SERIAL_NUMBER__') {
$textValue = (string) $serial;
}
if ($textValue == '__CURRENT_DATE__') {
$textValue = $serialDate;
}
$pdf->SetFont($element['font'],'',$element['size']);
$rgb = $this->hexToRgb($element['color']);
$pdf->SetTextColor(
$rgb[0],
$rgb[1],
$rgb[2]
);
// $pdf->Text(
// $element['x'],
// $element['y'] + $currentY,
// (string) $textValue
// );
$alignment = strtolower($element['string_align'] ?? '');
$pdf->SetFont($element['font'], '', $element['size']);
$x = (float) $element['x'];
$y = $element['y'] + $currentY;
// $textWidth = $pdf->GetStringWidth((string) $textValue);
if ($alignment == 'center') {
if($stickerId == 'Sewage PumpSet Test Certificate' || $stickerId == 'Submersible Mixer Test Certificate' || $stickerId == 'Pump Test Certificate' || $stickerId == 'Submersible Aerator Pump Test Certificate'){
$leftMargin = 10; // mm from left edge
$rightMargin = 24; // mm from right edge
$usableWidth = $stickerWidth - $leftMargin - $rightMargin;
$textWidth = $pdf->GetStringWidth((string) $textValue);
// start x = left margin + half of the leftover space
$x = $leftMargin + (($usableWidth - $textWidth) / 2);
// if text is wider than the usable area, don't go past the left margin
if ($textWidth > $usableWidth) {
$x = $leftMargin;
}
}
}
$pdf->Text($x, $y, (string) $textValue);
}
elseif ($element['type'] == 'qr') {
$qrValue = $element['value'];
if ($qrValue == '__DYNAMIC_QR__') {
$qrValue = $qrContent;
}
$pdf->write2DBarcode(
$qrValue,
'QRCODE,H',
$element['x'],
$element['y'] + $currentY,
$element['size'],
$element['size']
);
}
elseif ($element['type'] == 'image') {
if (!empty($element['path']) && file_exists($element['path']))
{
$pdf->Image(
$element['path'],
$element['x'],
$element['y'] + $currentY,
$element['width'],
$element['height']
);
}
}
elseif ($element['type'] == 'shape') {
$rgb = $this->hexToRgb(
$element['color']
);
$pdf->SetDrawColor(
$rgb[0],
$rgb[1],
$rgb[2]
);
$pdf->SetLineWidth(
$element['pen_size']
);
if ($element['name'] == 'Line') {
$pdf->Line(
$element['x1'],
$element['y1'] + $currentY,
$element['x2'],
$element['y2'] + $currentY
);
}
elseif ($element['name'] == 'Rectangle') {
$x = min($element['x1'],$element['x2']);
$y = min($element['y1'],$element['y2']);
$width = abs($element['x2'] - $element['x1']);
$height = abs($element['y2'] - $element['y1']);
$pdf->Rect(
$x,
$y + $currentY,
$width,
$height,
'D'
);
}
elseif ($element['name'] == 'CurvedRectangle')
{
$x = min($element['x1'],$element['x2']);
$y = min($element['y1'],$element['y2']);
$width = abs($element['x2'] - $element['x1']);
$height = abs($element['y2'] - $element['y1']);
$pdf->RoundedRect(
$x,
$y + $currentY,
$width,
$height,
$element['radius'],
'1111',
'D'
);
}
}
}
// $currentY += $stickerHeight + $gap;
}
return $pdf->Output('', 'S');
}
// if($stickerId == 'SelfPriming Monoblock Pump Dual'){
// foreach ($serialNumbersArray as $serial) {
// $serial = (string) $serial;
// $pdf->AddPage();
// $serialString = (string) $serial;
// $serialDate = '';
// $firstSerial = $serial;
// $secondSerial = $serial + 1;
// $serialString = (string) $firstSerial;
// $serialDate = '';
// if (strlen($serialString) >= 4) {
// $year = substr($serialString, 0, 2);
// $month = substr($serialString, 2, 2);
// if ((int) $month >= 1 && (int) $month <= 12) {
// $serialDate = \Carbon\Carbon::createFromFormat(
// 'y-m',
// $year . '-' . $month
// )->format('M-y');
// }
// }
// foreach ($template['elements'] as $element) {
// if ($element['type'] == 'text') {
// $textValue = $element['value'];
// if ($textValue == '__SERIAL_NUMBER__') {
// $textValue = (string) $firstSerial;
// }
// if ($textValue == 'TO__SERIAL_NUMBER__') {
// if ($secondSerial <= $toSerial) {
// $textValue = (string) $secondSerial;
// } else {
// $textValue = '';
// }
// }
// if ($textValue == '__CURRENT_DATE__') {
// $textValue = $serialDate;
// }
// $pdf->SetFont(
// $element['font'],
// '',
// $element['size']
// );
// $rgb = $this->hexToRgb($element['color']);
// $pdf->SetTextColor(
// $rgb[0],
// $rgb[1],
// $rgb[2]
// );
// $pdf->Text(
// $element['x'],
// $element['y'] + $currentY,
// (string) $textValue
// );
// }
// elseif ($element['type'] == 'qr') {
// $qrValue = $element['value'];
// if ($qrValue == '__DYNAMIC_QR__') {
// $qrValue = $itemCode . '|' . $firstSerial;
// }
// elseif ($qrValue == '__DYNAMIC_QR2__') {
// if ($secondSerial <= $toSerial) {
// $qrValue = $itemCode . '|' . $secondSerial;
// } else {
// $qrValue = '';
// }
// }
// if ($qrValue != '') {
// $pdf->write2DBarcode(
// $qrValue,
// 'QRCODE,H',
// $element['x'],
// $element['y'] + $currentY,
// $element['size'],
// $element['size']
// );
// }
// }
// elseif ($element['type'] == 'image') {
// if (
// !empty($element['path']) &&
// file_exists($element['path'])
// ) {
// $pdf->Image(
// $element['path'],
// $element['x'],
// $element['y'] + $currentY,
// $element['width'],
// $element['height']
// );
// }
// }
// elseif ($element['type'] == 'shape') {
// $rgb = $this->hexToRgb($element['color']);
// $pdf->SetDrawColor(
// $rgb[0],
// $rgb[1],
// $rgb[2]
// );
// $pdf->SetLineWidth(
// $element['pen_size']
// );
// if ($element['name'] == 'Line') {
// $pdf->Line(
// $element['x1'],
// $element['y1'] + $currentY,
// $element['x2'],
// $element['y2'] + $currentY
// );
// }
// elseif ($element['name'] == 'Rectangle') {
// $x = min(
// $element['x1'],
// $element['x2']
// );
// $y = min(
// $element['y1'],
// $element['y2']
// );
// $width = abs(
// $element['x2'] - $element['x1']
// );
// $height = abs(
// $element['y2'] - $element['y1']
// );
// $pdf->Rect(
// $x,
// $y + $currentY,
// $width,
// $height,
// 'D'
// );
// }
// elseif ($element['name'] == 'CurvedRectangle') {
// $x = min(
// $element['x1'],
// $element['x2']
// );
// $y = min(
// $element['y1'],
// $element['y2']
// );
// $width = abs(
// $element['x2'] - $element['x1']
// );
// $height = abs(
// $element['y2'] - $element['y1']
// );
// $pdf->RoundedRect(
// $x,
// $y + $currentY,
// $width,
// $height,
// $element['radius'],
// '1111',
// 'D'
// );
// }
// }
// }
// }
// return $pdf->Output('', 'S');
// }
}
public function generatePdfBySerial($item, $serNo, $plantId, $refNumber)
{
$recFound = ProductionQuantity::where('plant_id', $plantId)

View File

@@ -7,7 +7,7 @@
"license": "MIT",
"require": {
"php": "^8.2",
"alperenersoy/filament-export": "^3.0",
"alperenersoy/filament-export": "^5.0",
"althinect/filament-spatie-roles-permissions": "^2.3",
"diogogpinto/filament-auth-ui-enhancer": "^1.0",
"erag/laravel-pwa": "^1.9",

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql1 = <<<'SQL'
ALTER TABLE plants
ADD COLUMN feed_address TEXT DEFAULT NULL
SQL;
DB::statement($sql1);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('plants', function (Blueprint $table) {
//
});
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql1 = <<<'SQL'
ALTER TABLE plants
ADD COLUMN tollfree TEXT DEFAULT NULL
SQL;
DB::statement($sql1);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('plants', function (Blueprint $table) {
// //
// });
}
};

View File

@@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql1 = <<<'SQL'
ALTER TABLE testing_panel_readings
ADD COLUMN test_finished_at TIMESTAMP DEFAULT NULL
SQL;
DB::statement($sql1);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('testing_panel_readings', function (Blueprint $table) {
// //
// });
}
};

View File

@@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql1 = <<<'SQL'
ALTER TABLE visitor_entries
ADD COLUMN tool_gadget TEXT DEFAULT NULL
SQL;
DB::statement($sql1);
$sql2 = <<<'SQL'
ALTER TABLE visitor_entries
ADD COLUMN serial_number TEXT DEFAULT NULL
SQL;
DB::statement($sql2);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('visitor_entries', function (Blueprint $table) {
// //
// });
}
};

View File

@@ -18,25 +18,7 @@
>
Generate Sticker
</button>
</div>
{{-- <label class="flex items-center gap-2 mt-4">
<input
type="checkbox"
wire:model="showMultipleSerials"
class="rounded border-gray-300 text-primary-600 focus:ring-primary-500"
>
<span class="text-sm font-medium">Show Multiple Serial Numbers</span>
</label> --}}
{{-- <div class="bg-white shadow rounded-xl p-4 mt-6">
<livewire:random-serial-number-list />
</div> --}}
<div class="bg-white shadow rounded-xl p-4 mt-6">
<livewire:random-serial-number-list
:plant-id="$filters['plant_id'] ?? null"
:machine-id="$filters['machine_id'] ?? null"
/>
</div>
</div>
{{-- <script>
document.addEventListener('livewire:init', () => {

View File

@@ -6,21 +6,4 @@
</div>
</div>
<audio id="error-sound" src="{{ asset('sounds/scan_serial_tamil.mp3') }}" preload="auto"></audio>
<script>
document.addEventListener('livewire:init', () => {
Livewire.on('play-error-sound', () => {
const audio = document.getElementById('error-sound');
if (audio) {
audio.currentTime = 0;
audio.play().catch(error => {
console.log('Could not play error sound:', error);
});
}
});
});
</script>
</x-filament-panels::page>

View File

@@ -16,12 +16,5 @@
>
Remove Task PDF
</button>
<button
type="button"
wire:click="downloadTaskPdf"
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
>
Download Task PDF
</button>
</div>
</x-filament-panels::page>

View File

@@ -96,8 +96,7 @@
{{ $date }}
</th> --}}
<th colspan="2" class="text-center border-r-4 border-gray-400">
{{-- {{ $date }} --}}
{{ \Carbon\Carbon::parse($date)->format('d-m-Y') }}
{{ $date }}
</th>
@endforeach
</tr>

View File

@@ -1,76 +0,0 @@
<div class="w-fit rounded-xl bg-white p-4 shadow-sm ring-1 ring-gray-950/5">
<label class="flex items-center gap-2 mt-4">
<input
type="checkbox"
wire:model.live="showMultipleSerials"
class="rounded border-gray-300 text-primary-600"
>
<span class="text-sm font-medium">
Show Multiple Serial Numbers
</span>
</label>
<button
type="button"
wire:click="generate"
class="mt-2 rounded bg-primary-600 px-4 py-1 text-white"
>
Generate
</button>
<button
type="button"
wire:click="clear"
class="mt-2 rounded bg-primary-600 px-4 py-1 text-white"
>
Clear
</button>
@if ($showMultipleSerials)
<div class="mt-4 overflow-x-auto">
<div class="flex justify-end mb-2">
<span class="text-sm font-medium">
Total Count:
<span class="text-primary-600 font-bold">
{{ count(array_filter($serialNumbers, fn ($serial) => trim($serial) !== '')) }}
</span>
</span>
</div>
<table class="w-1/2 border-collapse border border-gray-300 text-sm">
<thead>
<tr class="bg-gray-100">
<th class="border px-3 py-2">S.No</th>
<th class="border px-3 py-2">Serial Number</th>
</tr>
</thead>
<tbody>
@foreach ($serialNumbers as $index => $serial)
<tr wire:key="serial-row-{{ $index }}">
<td class="border px-3 py-2 text-center">
{{ $index + 1 }}
</td>
<td class="border px-3 py-2">
<input
type="text"
{{-- wire:model="serialNumbers.{{ $index }}" --}}
wire:model.live="serialNumbers.{{ $index }}"
@if ($index === 0)
x-data
@paste.prevent="
const text = $event.clipboardData.getData('text');
$wire.splitSerialNumbers(text);
"
@endif
class="w-full rounded border-gray-300"
placeholder="Paste serial numbers here"
>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>

View File

@@ -162,7 +162,7 @@
if ((float) $planQuantity == 0 && (float) $actualQuantity == 0)
{
return null;
return '#4caf50';
}
$efficiency = (float) $value;
@@ -171,8 +171,7 @@
return '#ff4d4d'; // red
} elseif ($efficiency < 95) {
return '#ffd633'; // yellow
}
else {
} else {
return '#4caf50'; // green
}
};
@@ -219,15 +218,8 @@
{{-- <td style="text-align:center; border:1px solid #444; padding:8px;">
{{ $row['dayShiftEfficiency'] }}
</td> --}}
{{-- <td style="text-align:center; border:1px solid #444; padding:8px; background-color: {{ $dayEfficiencyColor }}; color: #fff; font-weight: bold;">
<td style="text-align:center; border:1px solid #444; padding:8px; background-color: {{ $dayEfficiencyColor }}; color: #fff; font-weight: bold;">
{{ $row['dayShiftEfficiency'] }}
</td> --}}
<td style="text-align: center; vertical-align: middle; border: 1px solid #444; padding: 8px; background-color: {{ $dayEfficiencyColor }}; color: #fff; font-weight: bold;">
<div style="text-align: center; width: 100%;">
{{ $row['dayShiftEfficiency'] }}
</div>
</td>
<td style="text-align:center; border:1px solid #444; padding:8px;">
@@ -242,14 +234,8 @@
{{ $row['nightShiftEfficiency'] }}
</td> --}}
{{-- <td style="text-align:center; border:1px solid #444; padding:8px; background-color: {{ $nightEfficiencyColor }}; color: #fff; font-weight: bold;">
<td style="text-align:center; border:1px solid #444; padding:8px; background-color: {{ $nightEfficiencyColor }}; color: #fff; font-weight: bold;">
{{ $row['nightShiftEfficiency'] }}
</td> --}}
<td style="text-align: center; vertical-align: middle; border: 1px solid #444; padding: 8px; background-color: {{ $nightEfficiencyColor }}; color: #fff; font-weight: bold;">
<div style="text-align: center; width: 100%;">
{{ $row['nightShiftEfficiency'] }}
</div>
</td>
<td style="text-align:center; border:1px solid #444; padding:8px;">
@@ -267,9 +253,7 @@
</td> --}}
<td style="text-align:center; border:1px solid #444; padding:8px; background-color: {{ $efficiencyColor }}; color: #fff; font-weight: bold;">
<div style="text-align: center;">
{{ $row['efficiency'] }}
</div>
{{ $row['efficiency'] }}
</td>
<td style="text-align:center; border:1px solid #444; padding:8px;">
{{ $row['nonPlannedQuantity'] }}

View File

@@ -101,22 +101,6 @@
{{ $visitor->created_at?->format('d-m-Y h:i A') }}
</td>
</tr>
<tr>
<td style="border:1px solid #d1d5db;font-weight:bold;">
Tools & Gadgets
</td>
<td style="border:1px solid #d1d5db;">
{{ $visitor->tool_gadget ?? 'N/A' }}
</td>
</tr>
<tr>
<td style="border:1px solid #d1d5db;font-weight:bold;">
Ref Number
</td>
<td style="border:1px solid #d1d5db;">
{{ $visitor->serial_number ?? 'N/A' }}
</td>
</tr>
</table>

View File

@@ -292,5 +292,3 @@ Route::get('item-code', [PlantController::class, 'getItemCode']);
// ..Coil Packing
Route::get('/download-coil-qr-pdf/{palletNo}', [PalletController::class, 'downloadCoilQrPdf'])->name('download-coil-qr-pdf');
Route::get('coil-details', [PdfController::class, 'getCoilDetails']);