Updated alignments and added orderby query while load plant
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

This commit is contained in:
dhanabalan
2026-02-10 12:45:54 +05:30
parent 6c9408663b
commit aaa9c17e66
36 changed files with 1592 additions and 1574 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Filament\Resources;
use App\Filament\Exports\StickerPrintingExporter;
use App\Filament\Imports\StickerPrintingImporter;
use App\Filament\Resources\StickerPrintingResource\Pages;
use App\Models\Plant;
use App\Models\StickerPrinting;
@@ -11,14 +13,11 @@ use Filament\Forms\Components\Section;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use App\Filament\Exports\StickerPrintingExporter;
use App\Filament\Imports\StickerPrintingImporter;
use Filament\Forms\Components\Actions\Action;
class StickerPrintingResource extends Resource
{
@@ -40,13 +39,14 @@ class StickerPrintingResource extends Resource
->relationship('plant', 'name')
->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();
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->required()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$plantId = $get('plant_id');
if (!$plantId) {
if (! $plantId) {
$set('reference_number', null);
$set('serial_number', null);
$set('ivPlantError', 'Please select a plant first.');
@@ -64,7 +64,7 @@ class StickerPrintingResource extends Resource
Forms\Components\TextInput::make('reference_number')
->label('Reference Number')
->reactive()
->readOnly(fn (callable $get) => !empty($get('serial_number')))
->readOnly(fn (callable $get) => ! empty($get('serial_number')))
->extraAttributes([
'id' => 'invoice_number_input',
'x-data' => '{ value: "" }',
@@ -82,9 +82,9 @@ class StickerPrintingResource extends Resource
'x-data' => '{ value: "" }',
'x-model' => 'value',
'wire:keydown.enter.prevent' => 'processSno(value)',
//'x-on:keydown.enter.prevent' => '$wire.processInvoice(value)',
// 'x-on:keydown.enter.prevent' => '$wire.processInvoice(value)',
]),
//->required(),
// ->required(),
Forms\Components\View::make('forms.components.print-button'),
Forms\Components\Hidden::make('created_by')