Merge pull request 'ranjith-dev' (#668) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #668
This commit was merged in pull request #668.
This commit is contained in:
2026-05-29 11:05:50 +00:00
4 changed files with 48 additions and 21 deletions

View File

@@ -17,6 +17,8 @@ class CustomerPoMasterImporter extends Importer
{
protected static ?string $model = CustomerPoMaster::class;
protected array $importedPos = [];
public static function getColumns(): array
{
return [
@@ -67,6 +69,8 @@ class CustomerPoMasterImporter extends Importer
$plantCod = $this->data['plant'];
$plant = null;
$item = null;
$customerPo = trim($this->data['customer_po']);
$customerName = trim($this->data['customer_name']);
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found';
@@ -90,6 +94,23 @@ class CustomerPoMasterImporter extends Importer
$warnMsg[] = 'Customer PO cannot be empty.';
}
if (isset($this->importedPos[$customerPo])) {
if (strtolower(trim($this->importedPos[$customerPo])) != strtolower($customerName)){
$warnMsg[] = "Customer PO '{$customerPo}' has multiple customer names in the import file.";
}
}
else {
$this->importedPos[$customerPo] = $customerName;
}
$existingPo = CustomerPoMaster::where('plant_id', $plant->id)->where('customer_po', $this->data['customer_po'])->first();
if ($existingPo && trim(strtolower($existingPo->customer_name)) != trim(strtolower($this->data['customer_name'])))
{
$warnMsg[] = "Customer PO '{$this->data['customer_po']}' is already mapped to customer '{$existingPo->customer_name}'.";
}
// $user = User::where('name', $this->data['created_by'])->first();
// if (! $user) {
// $warnMsg[] = 'User not found';

View File

@@ -43,6 +43,7 @@ class MachineResource extends Resource
Forms\Components\Select::make('plant_id')
->label('Plant Name')
->relationship('plant', 'name')
->searchable()
->required()
->columnSpan(1)
->reactive()
@@ -75,6 +76,7 @@ class MachineResource extends Resource
Forms\Components\Select::make('line_id')
->label('Line Name')
->relationship('line', 'name')
->searchable()
->required()
->columnSpan(1)
->reactive()
@@ -115,6 +117,7 @@ class MachineResource extends Resource
Forms\Components\Select::make('work_group_master_id')
->label('Group Work Center')
->relationship('workGroupMaster', 'name')
->searchable()
->required()
->columnSpan(1)
->reactive()
@@ -142,6 +145,7 @@ class MachineResource extends Resource
$lineId = $get('line_id');
if (! $lineId) {
$set('mGroupWorkError', 'Please select a line first.');
$set('work_group_master_id', null);
return;
} else {

View File

@@ -40,6 +40,7 @@ class WorkGroupMasterResource extends Resource
Forms\Components\Select::make('plant_id')
->label('Plant Name')
->relationship('plant', 'name')
->searchable()
->reactive()
->columnSpan(1)
->required()
@@ -55,22 +56,20 @@ class WorkGroupMasterResource extends Resource
->afterStateUpdated(function ($state, $set, callable $get) {
$plantId = $get('plant_id');
if (! $plantId) {
$set('pqPlantError', 'Please select a plant first.');
$set('name', null);
$set('description', null);
$set('operation_number', null);
return;
}
$set('validationError', null);
$set('pqPlantError', null);
$set('wgmPlantError', null);
$set('name', null);
$set('description', null);
$set('operation_number', null);
if (! $plantId) {
$set('wgmPlantError', 'Please select a plant first.');
return;
}
})
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
->extraAttributes(fn ($get) => [
'class' => $get('wgmPlantError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('wgmPlantError') ? $get('wgmPlantError') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('name')
->label('Group Work Center')

View File

@@ -12,10 +12,10 @@
$headerRows = [
'PRODUCT' => $product,
'MONTH/YEAR' => $monthYear,
'MFG. MONTH & YEAR' => $monthYear,
'CUSTOMER PO' => $customerCode,
'CUSTOMER NAME' => $customerName,
'NO OF MASTER BOX' => $masterBox,
'MASTER BOX NO.' => $masterBox,
];
$titleHeight = 10;
@@ -55,6 +55,9 @@
if ($numItems == 1) {
$itemRowHeight -= 0.5;
}
if ($numItems == 2) {
$itemRowHeight += 0.4;
}
if ($itemRowHeight < 3) {
$itemFontSize = '5.5px';
@@ -290,7 +293,7 @@
style="height: <?php echo $logoHeight; ?>mm;
max-width: <?php echo $logoMaxWidth; ?>mm;
width: auto;">
C.R.I POLY WRAPPED WINDING WIRE
C.R.I. POLY WRAPPED WINDING WIRE
<div class="vertical-line right"></div>
{{-- <img src="<?php echo public_path('images/isi_8783.png'); ?>"
class="logo"
@@ -320,8 +323,8 @@
<tr class="items-header-row">
<td class="col-1 center">MATERIAL CODE</td>
<td class="col-2 center">DESCRIPTION</td>
<td class="col-3 center">QTY</td>
<td class="col-4 center">NO OF BOX</td>
<td class="col-3 center">QTY in kg</td>
<td class="col-4 center">NO. OF BOXES</td>
</tr>
<!-- Item Rows - ONLY THESE ADJUST DYNAMICALLY -->
@@ -342,13 +345,13 @@
<!-- Gross Weight - FIXED 5mm -->
<tr class="gross-weight-row">
<td colspan="2" class="label center">GROSS WEIGHT</td>
<td colspan="2" class="label center">GROSS WEIGHT(kg)</td>
<td colspan="2" class="center"><?php echo number_format($grossWeight, 3); ?></td>
</tr>
<!-- Net Weight - FIXED 5mm -->
<tr class="net-weight-row">
<td colspan="2" class="label center">NET WEIGHT</td>
<td colspan="2" class="label center">NET WEIGHT(kg)</td>
<td colspan="2" class="center"><?php echo number_format($netWeight, 3); ?></td>
</tr>
@@ -368,8 +371,8 @@
C.R.I. PUMPS PRIVATE LIMITED<br>
(Unit of {{ $plantName }})<br>
{{ $plantAddress }}<br>
India Regd.Office : 7/46-1, Keeranatham Road, Saravanampatti, Coimbatore-641 036<br>
For Feedback/Complaint: C.R.I Customer care cell Toll-Free: 1800 121 1243
India Regd.Office : 7/46-1, Keeranatham Road, Saravanampatti, Coimbatore- 641 035<br>
For Feedback/Complaint: C.R.I. Customer care cell Toll-Free: 1800 121 1243
{{-- <img src="{{ $qrBase64 }}"
style="position: absolute; bottom: 2.8mm; right: 2mm; width: 8mm; height: 6.8mm;"> --}}
</td>