Changed the navigation group from 'Administración' to 'Gestión' across multiple Filament resources for consistency. In TelaResource, improved the file upload field with image editor options and aspect ratios, and added an image column to the table for better visualization of fabric images.
139 lines
3.9 KiB
PHP
139 lines
3.9 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\TintoreriaResource\Pages;
|
|
use App\Filament\Resources\TintoreriaResource\RelationManagers;
|
|
use App\Models\Tintoreria;
|
|
use Filament\Forms;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
use Filament\Forms\Components\{
|
|
Select,
|
|
TextInput,
|
|
DatePicker,
|
|
Textarea,
|
|
Section
|
|
};
|
|
use Filament\Tables\Columns\{
|
|
TextColumn,
|
|
BadgeColumn
|
|
};
|
|
|
|
class TintoreriaResource extends Resource
|
|
{
|
|
protected static ?string $model = Tintoreria::class;
|
|
|
|
protected static ?string $navigationGroup = 'Gestión';
|
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form->schema([
|
|
Section::make('Proceso de Tintorería')
|
|
->schema([
|
|
Select::make('proveedor_id')
|
|
->label('Tintorería')
|
|
->relationship(
|
|
'proveedor',
|
|
'nombre',
|
|
fn($query) => $query->where('categoria', 'tintoreria')
|
|
)
|
|
->searchable()
|
|
->preload()
|
|
|
|
->required(),
|
|
|
|
Select::make('orden_produccion_id')
|
|
->label('Orden de Producción')
|
|
->relationship('ordenProduccion', 'numero_orden')
|
|
->searchable()
|
|
->preload()
|
|
|
|
->required(),
|
|
|
|
TextInput::make('tipo_proceso')
|
|
->label('Tipo de proceso')
|
|
->required(),
|
|
|
|
DatePicker::make('fecha_envio')
|
|
->required(),
|
|
|
|
TextInput::make('cantidad_enviada')
|
|
->numeric()
|
|
->required(),
|
|
|
|
DatePicker::make('fecha_recepcion'),
|
|
|
|
TextInput::make('cantidad_recibida')
|
|
->numeric(),
|
|
|
|
TextInput::make('perdidas')
|
|
->disabled()
|
|
->dehydrated(false),
|
|
|
|
Textarea::make('observaciones')
|
|
->columnSpanFull(),
|
|
])
|
|
->columns(2),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('ordenProduccion.numero_orden')
|
|
->label('OP')
|
|
->searchable(),
|
|
|
|
TextColumn::make('proveedor.nombre')
|
|
->label('Tintorería')
|
|
->searchable(),
|
|
|
|
TextColumn::make('tipo_proceso'),
|
|
|
|
TextColumn::make('cantidad_enviada'),
|
|
|
|
TextColumn::make('cantidad_recibida'),
|
|
|
|
TextColumn::make('perdidas')
|
|
->label('Pérdidas'),
|
|
|
|
TextColumn::make('fecha_recepcion')
|
|
->date(),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->actions([
|
|
Tables\Actions\EditAction::make(),
|
|
])
|
|
->bulkActions([
|
|
Tables\Actions\BulkActionGroup::make([
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListTintorerias::route('/'),
|
|
'create' => Pages\CreateTintoreria::route('/create'),
|
|
'edit' => Pages\EditTintoreria::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|