Refactored alignments on resource page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled

This commit is contained in:
dhanabalan
2026-03-11 19:36:48 +05:30
parent 658db00ac8
commit e20892cc83

View File

@@ -2,25 +2,22 @@
namespace App\Filament\Pages;
use App\Models\CustomerPoMaster;
use App\Models\InvoiceValidation;
use App\Models\Item;
use App\Models\NotInStock;
use App\Models\Plant;
use App\Models\StickerMaster;
use App\Models\StockDataMaster;
use App\Models\WireMasterPacking;
use Carbon\Carbon;
use Filament\Actions\Action;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Facades\Filament;
use Filament\Pages\Page;
use Filament\Forms\Form;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Form;
use Filament\Notifications\Notification;
use Filament\Actions\Action;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Pages\Page;
use Illuminate\Support\Facades\Auth;
class CycleCount extends Page
@@ -28,21 +25,33 @@ class CycleCount extends Page
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static string $view = 'filament.pages.cycle-count';
protected static ?string $navigationGroup = 'Cycle Count Software';
use InteractsWithForms;
use InteractsWithActions;
use InteractsWithForms;
public $serialNumber;
public $location, $bin;
public $location;
public $bin;
public $snoCount = 0;
public $state = [];
public $plantId, $itemCode, $batch, $docNo, $quantity, $sNo;
public $plantId;
public $itemCode;
public $batch;
public $docNo;
public $quantity;
public $sNo;
public array $filters = [];
@@ -66,6 +75,7 @@ class CycleCount extends Page
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->required(),
@@ -95,7 +105,7 @@ class CycleCount extends Page
// ->reactive()
// ->readOnly(),
])
->columns(4)
->columns(4),
]);
}
@@ -123,8 +133,7 @@ class CycleCount extends Page
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
if (!preg_match($pattern1, $value) && !preg_match($pattern2, $value) && !preg_match($pattern3, $value))
{
if (! preg_match($pattern1, $value) && ! preg_match($pattern2, $value) && ! preg_match($pattern3, $value)) {
Notification::make()
->danger()
->title('Invalid QR Format')
@@ -142,8 +151,7 @@ class CycleCount extends Page
return;
}
if(preg_match($pattern1, $value))
{
if (preg_match($pattern1, $value)) {
$value = rtrim($value, '#');
$parts = explode('#', $value);
@@ -152,10 +160,9 @@ class CycleCount extends Page
$this->docNo = $parts[2] ?? null;
$this->quantity = $parts[3] ?? null;
if (strlen($this->itemCode) < 6)
{
if (strlen($this->itemCode) < 6) {
Notification::make()
->title("Unknown Item Code")
->title('Unknown Item Code')
->body("Item Code should contain minimum 6 digits '$this->itemCode'")
->danger()
->send();
@@ -165,11 +172,11 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
elseif(!ctype_alnum($this->itemCode)){
} elseif (! ctype_alnum($this->itemCode)) {
Notification::make()
->title("Unknown Item Code")
->title('Unknown Item Code')
->body("Item Code should contain alpha-numeric values '$this->itemCode'")
->danger()
->duration(5000)
@@ -180,13 +187,13 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
elseif($this->batch != '' || $this->batch != null){
} elseif ($this->batch != '' || $this->batch != null) {
if (strlen($this->batch) < 5) {
Notification::make()
->title("Unknown Batch")
->title('Unknown Batch')
->body("Batch should contain minimum 5 digits '$this->batch'")
->danger()
->duration(5000)
@@ -197,13 +204,13 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
}
elseif(strlen($this->docNo) < 5){
} elseif (strlen($this->docNo) < 5) {
Notification::make()
->title("Unknown Doc No")
->title('Unknown Doc No')
->body("Doc No should contain minimum 5 digits '$this->docNo'")
->danger()
->duration(5000)
@@ -214,11 +221,11 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
elseif (!ctype_digit($this->quantity)) {
} elseif (! ctype_digit($this->quantity)) {
Notification::make()
->title("Unknown Quantity")
->title('Unknown Quantity')
->body("Quantity must be an integer value '$this->quantity'")
->danger()
->duration(5000)
@@ -229,6 +236,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -236,7 +244,7 @@ class CycleCount extends Page
if (! $item) {
Notification::make()
->title("Item Code Not Found")
->title('Item Code Not Found')
->body("Item code not found '$this->itemCode'")
->danger()
->duration(5000)
@@ -247,6 +255,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -258,7 +267,7 @@ class CycleCount extends Page
if (! $itemCodeAgaPlant) {
Notification::make()
->title("Item Code Not Found")
->title('Item Code Not Found')
->body("Item code '$this->itemCode' not found against plant code '$plantCode'")
->danger()
->duration(5000)
@@ -269,6 +278,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -277,7 +287,7 @@ class CycleCount extends Page
if (! $stickerExists) {
Notification::make()
->title("Unknown Sticker Master")
->title('Unknown Sticker Master')
->body("Item code not found in sticker master '{$this->itemCode}'")
->danger()
->duration(5000)
@@ -300,7 +310,7 @@ class CycleCount extends Page
if (! $stickerExists) {
Notification::make()
->title("Unknown Sticker Master")
->title('Unknown Sticker Master')
->body("Item code not found in sticker master '{$this->itemCode}' in plant '{$plantCode}'")
->danger()
->duration(5000)
@@ -361,8 +371,8 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
])
'quantity' => $this->quantity,
]),
])
->send();
@@ -372,6 +382,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -418,8 +429,8 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
])
'quantity' => $this->quantity,
]),
])
->send();
@@ -477,7 +488,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -530,7 +541,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -583,7 +594,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -629,7 +640,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -640,6 +651,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -667,12 +679,10 @@ class CycleCount extends Page
'bin' => $bin,
'batch' => $this->batch,
'scanned_quantity' => $newScannedQty,
'scanned_status' => $status
'scanned_status' => $status,
]);
$this->dispatch('refreshSfgData', location: $location, plantId: $plantId, itemCode: $this->itemCode, docNo: $this->docNo);
}
else
{
} else {
Notification::make()
->title('Unknown : Data Found')
->body("No matching record found for the given Location, Item Code, Batch, and Document Number under Plant Code '$plantCode' in stock data master.")
@@ -688,7 +698,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -705,9 +715,7 @@ class CycleCount extends Page
return;
}
}
else if(preg_match($pattern2, $value))
{
} elseif (preg_match($pattern2, $value)) {
$value = rtrim($value, '|');
$parts = explode('|', $value);
@@ -720,10 +728,9 @@ class CycleCount extends Page
$this->sNo = $parts[2];
}
if (strlen($this->itemCode) < 6)
{
if (strlen($this->itemCode) < 6) {
Notification::make()
->title("Unknown Item Code")
->title('Unknown Item Code')
->body("Item Code should contain minimum 6 digits '$this->itemCode'")
->danger()
->send();
@@ -734,11 +741,11 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
elseif(!ctype_alnum($this->itemCode)){
} elseif (! ctype_alnum($this->itemCode)) {
Notification::make()
->title("Unknown Item Code")
->title('Unknown Item Code')
->body("Item Code should contain alpha-numeric values '$this->itemCode'")
->danger()
->duration(5000)
@@ -749,20 +756,20 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
elseif(strlen($this->batch) < 5){
} elseif (strlen($this->batch) < 5) {
Notification::make()
->title("Unknown Batch")
->title('Unknown Batch')
->body("Batch should contain minimum 5 digits '$this->batch'")
->danger()
->duration(5000)
->send();
return;
}
elseif(strlen($this->sNo) < 9){
} elseif (strlen($this->sNo) < 9) {
Notification::make()
->title("Unknown Serial Number")
->title('Unknown Serial Number')
->body("Serial Number should contain minimum 9 digits '$this->sNo'")
->danger()
->duration(5000)
@@ -773,11 +780,11 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
elseif(!ctype_alnum($this->sNo)){
} elseif (! ctype_alnum($this->sNo)) {
Notification::make()
->title("Unknown Serial Number")
->title('Unknown Serial Number')
->body("Serial Number should contain alpha-numeric values '$this->sNo'")
->danger()
->duration(5000)
@@ -788,6 +795,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -795,7 +803,7 @@ class CycleCount extends Page
if (! $item) {
Notification::make()
->title("Item Code Not Found")
->title('Item Code Not Found')
->body("Item code not found '$this->itemCode'")
->danger()
->duration(5000)
@@ -806,6 +814,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -817,7 +826,7 @@ class CycleCount extends Page
if (! $itemCodeAgaPlant) {
Notification::make()
->title("Item Code Not Found")
->title('Item Code Not Found')
->body("Item code '$this->itemCode' not found against plant code '$plantCode'")
->danger()
->duration(5000)
@@ -828,6 +837,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -836,7 +846,7 @@ class CycleCount extends Page
if (! $stickerExists) {
Notification::make()
->title("Unknown Sticker Master")
->title('Unknown Sticker Master')
->body("Item code not found in sticker master '{$this->itemCode}'")
->danger()
->duration(5000)
@@ -858,7 +868,7 @@ class CycleCount extends Page
if (! $stickerExists) {
Notification::make()
->title("Unknown Sticker Master")
->title('Unknown Sticker Master')
->body("Item code not found in sticker master '{$this->itemCode}' in plant '{$plantCode}'")
->danger()
->duration(5000)
@@ -869,6 +879,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -917,7 +928,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -976,7 +987,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -1049,7 +1060,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -1105,7 +1116,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -1159,7 +1170,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -1213,7 +1224,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -1269,7 +1280,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -1326,7 +1337,6 @@ class CycleCount extends Page
// }
// }
$serial = StockDataMaster::where('plant_id', $plantId)
->where('serial_number', $this->sNo)
->where('location', $location)
@@ -1349,8 +1359,7 @@ class CycleCount extends Page
]);
return;
}
elseif ((int) $serial->quantity > 1) {
} elseif ((int) $serial->quantity > 1) {
Notification::make()
->warning()
->title('Invalid Quantity')
@@ -1388,7 +1397,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -1399,6 +1408,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -1409,7 +1419,7 @@ class CycleCount extends Page
'scanned_status' => 'Scanned',
'scanned_quantity' => '1',
'updated_at' => now(),
'updated_by' => $operatorName
'updated_by' => $operatorName,
]);
$this->form->fill([
@@ -1421,9 +1431,7 @@ class CycleCount extends Page
$this->dispatch('refreshSfgNonData', location: $location, plantId: $plantId, serialNumber: $this->sNo, itemCode: $this->itemCode);
}
}
else
{
} else {
$serNo = $value;
if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/', $serNo, $matches)) {
@@ -1502,6 +1510,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -1524,6 +1533,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -1572,7 +1582,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -1631,7 +1641,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -1704,6 +1714,7 @@ class CycleCount extends Page
'bin' => $bin,
'qr_code' => null,
]);
return;
}
@@ -1783,7 +1794,7 @@ class CycleCount extends Page
'stickerMasterId' => $stickerMasterId,
'batch' => $this->batch,
'docNo' => $this->docNo,
'quantity' => $this->quantity
'quantity' => $this->quantity,
]),
])
->send();
@@ -1839,8 +1850,7 @@ class CycleCount extends Page
$hasMotorQr = $record->stickerMasterRelation->pack_slip_motor ?? null;
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
$hasPumpSetQr = $record->stickerMasterRelation->pack_slip_pumpset ?? null;
}
else {
} else {
if (! $hasPumpSetQr && ! $hasPumpQr) {
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
}
@@ -2044,8 +2054,7 @@ class CycleCount extends Page
]);
return;
}
elseif ($isMarkPs) {
} elseif ($isMarkPs) {
if (! $hasPumpSetQr) {
Notification::make()
->title('Unknown: Pump Set QR')
@@ -2155,6 +2164,7 @@ class CycleCount extends Page
->title('Sticker Master Not Found')
->danger()
->send();
return;
}
$existingRecord = NotInStock::where('serial_number', $this->serialNumber)
@@ -2174,6 +2184,7 @@ class CycleCount extends Page
->body("Serial number '{$this->serialNumber}' already exists with Item Code '{$existingItemCode}'.")
->danger()
->send();
return;
}
}
@@ -2192,6 +2203,7 @@ class CycleCount extends Page
->body("Item Code '$itemCode' with Serial number '$this->serialNumber' already exist in not in stock table!")
->danger()
->send();
return;
}
@@ -2215,5 +2227,4 @@ class CycleCount extends Page
{
return Auth::check() && Auth::user()->can('view cycle count page');
}
}