Added category column for items masters
This commit is contained in:
@@ -24,6 +24,8 @@ class ItemExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('category')
|
||||
->label('CATEGORY'),
|
||||
ExportColumn::make('code')
|
||||
->label('CODE'),
|
||||
ExportColumn::make('description')
|
||||
|
||||
@@ -17,6 +17,11 @@ class ItemImporter extends Importer
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('category')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Category')
|
||||
->example('Submersible Motor')
|
||||
->label('Category'),
|
||||
ImportColumn::make('code')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Item Code')
|
||||
@@ -78,6 +83,7 @@ class ItemImporter extends Importer
|
||||
'plant_id' => $plant->id
|
||||
],
|
||||
[
|
||||
'category' => $this->data['category'],
|
||||
'description' => $this->data['description'],
|
||||
'hourly_quantity' => $this->data['hourly_quantity'],
|
||||
'uom' => $this->data['uom']
|
||||
|
||||
@@ -66,6 +66,10 @@ class ItemResource extends Resource
|
||||
])
|
||||
->hint(fn ($get) => $get('iPlantError') ? $get('iPlantError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\TextInput::make('category')
|
||||
->label('Category')
|
||||
->placeholder('Scan the Category'),
|
||||
|
||||
Forms\Components\TextInput::make('code')
|
||||
->required()
|
||||
->placeholder('Scan the valid code')
|
||||
@@ -146,7 +150,7 @@ class ItemResource extends Resource
|
||||
->placeholder('Scan the valid description')
|
||||
->required()
|
||||
->minLength(5)
|
||||
->columnSpan(['default' => 1, 'sm' => 2]),
|
||||
->columnSpan(['default' => 1, 'sm' => 1]),
|
||||
// ->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
@@ -178,6 +182,11 @@ class ItemResource extends Resource
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('category')
|
||||
->label('Category')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('description')
|
||||
->label('Description')
|
||||
->alignCenter()
|
||||
|
||||
@@ -12,6 +12,7 @@ class Item extends Model
|
||||
|
||||
protected $fillable = [
|
||||
"plant_id",
|
||||
'category',
|
||||
'code',
|
||||
'description',
|
||||
'hourly_quantity',
|
||||
|
||||
Reference in New Issue
Block a user