Updated validation logic against machin name on resource and import 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-20 16:16:04 +05:30
parent 253d319587
commit 4c7bed8c63
2 changed files with 19 additions and 18 deletions

View File

@@ -410,13 +410,13 @@ class ProcessOrderResource extends Resource
$orderQty = (float) $get('order_quantity');
$updatedQty = (float) $value;
$allowedVariance = $orderQty * 0.10;
$allowedVariance = $orderQty * 0.10;
$maxAllowed = $orderQty + $allowedVariance;
$minAllowed = $orderQty - $allowedVariance;
if ($updatedQty > $maxAllowed || $updatedQty < $minAllowed) {
$fail("Quantity can vary by ±10% of the order quantity.");
$fail('Quantity can vary by ±10% of the order quantity.');
}
$otherReceivedQty = ProcessOrder::where('plant_id', $plantId)
@@ -631,6 +631,7 @@ class ProcessOrderResource extends Resource
Forms\Components\TextInput::make('machine_name')
->label('Machine Name')
->reactive()
->maxLength(18)
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$set('updated_by', Filament::auth()->user()?->name);