update
This commit is contained in:
@@ -0,0 +1,139 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ConfeccionResource\Pages;
|
||||||
|
use App\Filament\Resources\ConfeccionResource\RelationManagers;
|
||||||
|
use App\Models\Confeccion;
|
||||||
|
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,
|
||||||
|
Section
|
||||||
|
};
|
||||||
|
use Filament\Tables\Columns\{
|
||||||
|
TextColumn,
|
||||||
|
BadgeColumn
|
||||||
|
};
|
||||||
|
|
||||||
|
class ConfeccionResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = Confeccion::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Administración';
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form->schema([
|
||||||
|
Section::make('Datos de Confección')
|
||||||
|
->schema([
|
||||||
|
Select::make('proveedor_id')
|
||||||
|
->label('Tallerista')
|
||||||
|
->relationship(
|
||||||
|
'proveedor',
|
||||||
|
'nombre',
|
||||||
|
fn($query) => $query->where('categoria', 'talleres')
|
||||||
|
)
|
||||||
|
->searchable()
|
||||||
|
->preload()
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Select::make('orden_produccion_id')
|
||||||
|
->label('Orden de Producción')
|
||||||
|
->relationship('ordenProduccion', 'numero_orden')
|
||||||
|
->searchable()
|
||||||
|
->preload()
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
DatePicker::make('fecha_envio')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
TextInput::make('cantidad_enviada')
|
||||||
|
->numeric()
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
DatePicker::make('fecha_recepcion'),
|
||||||
|
|
||||||
|
TextInput::make('cantidad_recibida')
|
||||||
|
->numeric(),
|
||||||
|
|
||||||
|
TextInput::make('prendas_defectuosas')
|
||||||
|
->numeric()
|
||||||
|
->default(0),
|
||||||
|
|
||||||
|
TextInput::make('valor_por_prenda')
|
||||||
|
->numeric()
|
||||||
|
->prefix('$')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
TextInput::make('total_pagar')
|
||||||
|
->prefix('$'),
|
||||||
|
])
|
||||||
|
->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('Tallerista')
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
|
TextColumn::make('cantidad_enviada'),
|
||||||
|
|
||||||
|
TextColumn::make('cantidad_recibida'),
|
||||||
|
|
||||||
|
BadgeColumn::make('estado')
|
||||||
|
->colors([
|
||||||
|
'warning' => 'pendiente',
|
||||||
|
'info' => 'parcial',
|
||||||
|
'success' => 'completo',
|
||||||
|
])
|
||||||
|
->formatStateUsing(fn($state) => ucfirst($state)),
|
||||||
|
|
||||||
|
TextColumn::make('total_pagar')
|
||||||
|
->money('COP'),
|
||||||
|
])
|
||||||
|
->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\ListConfeccions::route('/'),
|
||||||
|
'create' => Pages\CreateConfeccion::route('/create'),
|
||||||
|
'edit' => Pages\EditConfeccion::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\ConfeccionResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ConfeccionResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateConfeccion extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = ConfeccionResource::class;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\ConfeccionResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ConfeccionResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditConfeccion extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = ConfeccionResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\ConfeccionResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ConfeccionResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListConfeccions extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = ConfeccionResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InventarioPrendaResource\Pages;
|
||||||
|
use App\Filament\Resources\InventarioPrendaResource\RelationManagers;
|
||||||
|
use App\Models\InventarioPrenda;
|
||||||
|
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,
|
||||||
|
Section
|
||||||
|
};
|
||||||
|
use Filament\Tables\Columns\{
|
||||||
|
TextColumn,
|
||||||
|
BadgeColumn
|
||||||
|
};
|
||||||
|
|
||||||
|
class InventarioPrendaResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = InventarioPrenda::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Administración';
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form->schema([
|
||||||
|
Section::make('Ingreso a Inventario')
|
||||||
|
->schema([
|
||||||
|
Select::make('orden_produccion_id')
|
||||||
|
->label('Orden de Producción')
|
||||||
|
->relationship('ordenProduccion', 'numero_orden')
|
||||||
|
->searchable()
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
TextInput::make('cantidad_terminada')
|
||||||
|
->numeric()
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
TextInput::make('cantidad_disponible')
|
||||||
|
->disabled()
|
||||||
|
->dehydrated(false),
|
||||||
|
|
||||||
|
DatePicker::make('fecha_ingreso')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Select::make('estado')
|
||||||
|
->options([
|
||||||
|
'en_bodega' => 'En bodega',
|
||||||
|
'lista_despacho' => 'Lista para despacho',
|
||||||
|
])
|
||||||
|
->required(),
|
||||||
|
])
|
||||||
|
->columns(2),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('ordenProduccion.numero_orden')
|
||||||
|
->label('OP')
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
|
TextColumn::make('cantidad_terminada'),
|
||||||
|
|
||||||
|
TextColumn::make('cantidad_disponible'),
|
||||||
|
|
||||||
|
TextColumn::make('fecha_ingreso')
|
||||||
|
->date(),
|
||||||
|
|
||||||
|
BadgeColumn::make('estado')
|
||||||
|
->formatStateUsing(fn ($state) => match ($state) {
|
||||||
|
'en_bodega' => 'En bodega',
|
||||||
|
'lista_despacho' => 'Lista para despacho',
|
||||||
|
})
|
||||||
|
->colors([
|
||||||
|
'secondary' => 'en_bodega',
|
||||||
|
'success' => 'lista_despacho',
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
->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\ListInventarioPrendas::route('/'),
|
||||||
|
'create' => Pages\CreateInventarioPrenda::route('/create'),
|
||||||
|
'edit' => Pages\EditInventarioPrenda::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InventarioPrendaResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InventarioPrendaResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateInventarioPrenda extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = InventarioPrendaResource::class;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InventarioPrendaResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InventarioPrendaResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditInventarioPrenda extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = InventarioPrendaResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\InventarioPrendaResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\InventarioPrendaResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListInventarioPrendas extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = InventarioPrendaResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\OrdenProduccionResource\Pages;
|
||||||
|
use App\Filament\Resources\OrdenProduccionResource\RelationManagers;
|
||||||
|
use App\Models\OrdenProduccion;
|
||||||
|
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\{
|
||||||
|
TextInput,
|
||||||
|
Select,
|
||||||
|
DatePicker,
|
||||||
|
Section
|
||||||
|
};
|
||||||
|
use Filament\Tables\Columns\{
|
||||||
|
TextColumn,
|
||||||
|
BadgeColumn
|
||||||
|
};
|
||||||
|
|
||||||
|
class OrdenProduccionResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = OrdenProduccion::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Administración';
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Section::make('Datos de la Orden')
|
||||||
|
->schema([
|
||||||
|
TextInput::make('prenda_modelo')
|
||||||
|
->label('Prenda / Modelo')
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('referencia')
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
|
||||||
|
TextInput::make('cantidad_total')
|
||||||
|
->numeric()
|
||||||
|
->required()
|
||||||
|
->minValue(1),
|
||||||
|
|
||||||
|
Select::make('tela_id')
|
||||||
|
->label('Tela asociada')
|
||||||
|
->relationship('tela', 'codigo')
|
||||||
|
->searchable()
|
||||||
|
->preload()
|
||||||
|
->nullable(),
|
||||||
|
|
||||||
|
DatePicker::make('fecha_inicio')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
DatePicker::make('fecha_entrega_estimada')
|
||||||
|
->required(),
|
||||||
|
])
|
||||||
|
->columns(2),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('numero_orden')
|
||||||
|
->label('OP')
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
TextColumn::make('prenda_modelo')
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
|
TextColumn::make('referencia')
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
|
TextColumn::make('cantidad_total')
|
||||||
|
->label('Cantidad'),
|
||||||
|
|
||||||
|
TextColumn::make('tela.codigo')
|
||||||
|
->label('Tela')
|
||||||
|
->toggleable(),
|
||||||
|
|
||||||
|
BadgeColumn::make('estado')
|
||||||
|
->colors([
|
||||||
|
'warning' => 'en_corte',
|
||||||
|
'info' => 'en_confeccion',
|
||||||
|
'primary' => 'en_tintoreria',
|
||||||
|
'secondary' => 'en_acabados',
|
||||||
|
'success' => 'finalizada',
|
||||||
|
])
|
||||||
|
->formatStateUsing(fn($state) => match ($state) {
|
||||||
|
'en_corte' => 'En corte',
|
||||||
|
'en_confeccion' => 'En confección',
|
||||||
|
'en_tintoreria' => 'En tintorería',
|
||||||
|
'en_acabados' => 'En acabados',
|
||||||
|
'finalizada' => 'Finalizada',
|
||||||
|
}),
|
||||||
|
|
||||||
|
TextColumn::make('fecha_entrega_estimada')
|
||||||
|
->date(),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
//
|
||||||
|
])
|
||||||
|
->actions([
|
||||||
|
Tables\Actions\EditAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Tables\Actions\BulkActionGroup::make([
|
||||||
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
|
// Tables\Actions\Action::make('avanzar')
|
||||||
|
// ->label('Avanzar estado')
|
||||||
|
// ->icon('heroicon-o-arrow-right')
|
||||||
|
// ->requiresConfirmation()
|
||||||
|
// ->visible(fn($record) => $record->estado !== 'finalizada')
|
||||||
|
// ->action(fn($record) => $record->avanzarEstado()),
|
||||||
|
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListOrdenProduccions::route('/'),
|
||||||
|
'create' => Pages\CreateOrdenProduccion::route('/create'),
|
||||||
|
'edit' => Pages\EditOrdenProduccion::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\OrdenProduccionResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\OrdenProduccionResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateOrdenProduccion extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = OrdenProduccionResource::class;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\OrdenProduccionResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\OrdenProduccionResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditOrdenProduccion extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = OrdenProduccionResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\OrdenProduccionResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\OrdenProduccionResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListOrdenProduccions extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = OrdenProduccionResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ProcesoAcabadoResource\Pages;
|
||||||
|
use App\Filament\Resources\ProcesoAcabadoResource\RelationManagers;
|
||||||
|
use App\Models\ProcesoAcabado;
|
||||||
|
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 ProcesoAcabadoResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = ProcesoAcabado::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Administración';
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form->schema([
|
||||||
|
Section::make('Proceso de Acabado')
|
||||||
|
->schema([
|
||||||
|
Select::make('orden_produccion_id')
|
||||||
|
->label('Orden de Producción')
|
||||||
|
->relationship('ordenProduccion', 'numero_orden')
|
||||||
|
->searchable()
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
TextInput::make('tipo_proceso')
|
||||||
|
->label('Tipo de proceso')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Select::make('proveedor_id')
|
||||||
|
->label('Proveedor (opcional)')
|
||||||
|
->relationship('proveedor', 'nombre')
|
||||||
|
->searchable()
|
||||||
|
->nullable(),
|
||||||
|
|
||||||
|
TextInput::make('responsable_interno')
|
||||||
|
->label('Responsable interno')
|
||||||
|
->nullable(),
|
||||||
|
|
||||||
|
TextInput::make('cantidad_enviada')
|
||||||
|
->numeric()
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
TextInput::make('cantidad_recibida')
|
||||||
|
->numeric(),
|
||||||
|
|
||||||
|
DatePicker::make('fecha_envio')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
DatePicker::make('fecha_recepcion'),
|
||||||
|
|
||||||
|
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('tipo_proceso'),
|
||||||
|
|
||||||
|
TextColumn::make('proveedor.nombre')
|
||||||
|
->label('Proveedor')
|
||||||
|
->toggleable(),
|
||||||
|
|
||||||
|
TextColumn::make('responsable_interno')
|
||||||
|
->toggleable(),
|
||||||
|
|
||||||
|
TextColumn::make('cantidad_enviada'),
|
||||||
|
|
||||||
|
TextColumn::make('cantidad_recibida'),
|
||||||
|
|
||||||
|
BadgeColumn::make('fecha_recepcion')
|
||||||
|
->label('Estado')
|
||||||
|
->formatStateUsing(fn($state) => $state ? 'Completado' : 'Pendiente')
|
||||||
|
->colors([
|
||||||
|
'warning' => null,
|
||||||
|
'success' => fn($state) => $state !== null,
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
->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\ListProcesoAcabados::route('/'),
|
||||||
|
'create' => Pages\CreateProcesoAcabado::route('/create'),
|
||||||
|
'edit' => Pages\EditProcesoAcabado::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\ProcesoAcabadoResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ProcesoAcabadoResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateProcesoAcabado extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = ProcesoAcabadoResource::class;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\ProcesoAcabadoResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ProcesoAcabadoResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditProcesoAcabado extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = ProcesoAcabadoResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\ProcesoAcabadoResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ProcesoAcabadoResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListProcesoAcabados extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = ProcesoAcabadoResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,17 +6,17 @@ use App\Filament\Resources\ProveedorResource\Pages;
|
|||||||
use App\Filament\Resources\ProveedorResource\RelationManagers;
|
use App\Filament\Resources\ProveedorResource\RelationManagers;
|
||||||
use App\Models\Proveedor;
|
use App\Models\Proveedor;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class ProveedorResource extends Resource
|
class ProveedorResource extends Resource
|
||||||
{
|
{
|
||||||
protected static ?string $model = Proveedor::class;
|
protected static ?string $model = Proveedor::class;
|
||||||
protected static ?string $navigationGroup = 'Administración'; //
|
|
||||||
|
protected static ?string $navigationGroup = 'Administración'; //
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-users';
|
protected static ?string $navigationIcon = 'heroicon-o-users';
|
||||||
|
|
||||||
public static function canViewAny(): bool
|
public static function canViewAny(): bool
|
||||||
@@ -31,15 +31,22 @@ class ProveedorResource extends Resource
|
|||||||
Forms\Components\TextInput::make('nombre')
|
Forms\Components\TextInput::make('nombre')
|
||||||
->required()
|
->required()
|
||||||
->maxLength(255),
|
->maxLength(255),
|
||||||
Forms\Components\TextInput::make('contacto')
|
Forms\Components\TextInput::make('nit')
|
||||||
|
|
||||||
->maxLength(255),
|
->maxLength(255),
|
||||||
|
Select::make('categoria')
|
||||||
|
->label('Categoría')
|
||||||
|
->options([
|
||||||
|
'tintoreria' => 'Tintorería',
|
||||||
|
'talleres' => 'Talleres',
|
||||||
|
'telas' => 'Telas',
|
||||||
|
'otros' => 'Otros',
|
||||||
|
])
|
||||||
|
->required(),
|
||||||
Forms\Components\TextInput::make('telefono')
|
Forms\Components\TextInput::make('telefono')
|
||||||
->tel()
|
->tel()
|
||||||
->maxLength(20),
|
->maxLength(20)->required(),
|
||||||
Forms\Components\TextInput::make('correo')
|
Forms\Components\Textarea::make('direccion'),
|
||||||
->maxLength(255),
|
|
||||||
Forms\Components\Textarea::make('direccion')
|
|
||||||
->columnSpanFull(),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,28 +55,40 @@ class ProveedorResource extends Resource
|
|||||||
return $table
|
return $table
|
||||||
->columns([
|
->columns([
|
||||||
Tables\Columns\TextColumn::make('nombre')
|
Tables\Columns\TextColumn::make('nombre')
|
||||||
|
->label('Nombre')
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('nit')
|
||||||
|
->label('NIT')
|
||||||
->searchable(),
|
->searchable(),
|
||||||
Tables\Columns\TextColumn::make('contacto')
|
|
||||||
->searchable(),
|
Tables\Columns\BadgeColumn::make('categoria')
|
||||||
|
->label('Categoría')
|
||||||
|
->colors([
|
||||||
|
'primary' => 'tintoreria',
|
||||||
|
'success' => 'talleres',
|
||||||
|
'warning' => 'telas',
|
||||||
|
'gray' => 'otros',
|
||||||
|
])
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
Tables\Columns\TextColumn::make('telefono')
|
Tables\Columns\TextColumn::make('telefono')
|
||||||
|
->label('Teléfono')
|
||||||
->searchable(),
|
->searchable(),
|
||||||
Tables\Columns\TextColumn::make('correo')
|
|
||||||
->searchable(),
|
Tables\Columns\TextColumn::make('direccion')
|
||||||
|
->label('Dirección')
|
||||||
|
->limit(30)
|
||||||
|
->toggleable(),
|
||||||
|
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->dateTime()
|
->label('Creado')
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
Tables\Columns\TextColumn::make('updated_at')
|
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->sortable()
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
])
|
])
|
||||||
->paginated(true)
|
|
||||||
//->paginationPageOptions([50])
|
|
||||||
->defaultSort('created_at', 'desc')
|
->defaultSort('created_at', 'desc')
|
||||||
->filters([
|
|
||||||
//
|
|
||||||
])
|
|
||||||
->actions([
|
->actions([
|
||||||
Tables\Actions\EditAction::make(),
|
Tables\Actions\EditAction::make(),
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -0,0 +1,148 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\TelaResource\Pages;
|
||||||
|
use App\Filament\Resources\TelaResource\RelationManagers;
|
||||||
|
use App\Models\Tela;
|
||||||
|
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;
|
||||||
|
use Filament\Forms\Components\FileUpload;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Components\DatePicker;
|
||||||
|
use Filament\Forms\Components\Textarea;
|
||||||
|
use Filament\Forms\Components\ColorPicker;
|
||||||
|
use Filament\Forms\Set; // Importa la clase Set
|
||||||
|
|
||||||
|
class TelaResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = Tela::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Administración';
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form->schema([
|
||||||
|
|
||||||
|
TextInput::make('codigo')->required()->unique(ignoreRecord: true),
|
||||||
|
|
||||||
|
Select::make('tipo')
|
||||||
|
->options([
|
||||||
|
'algodon' => 'Algodón',
|
||||||
|
'poliester' => 'Poliéster',
|
||||||
|
'denim' => 'Denim',
|
||||||
|
])
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
FileUpload::make('foto')->image()->directory('telas')->disk('public')->nullable()->visibility('public')->maxSize(1024)->helperText('Selecciona una imagen de la tela')->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])->downloadable()->openable(),
|
||||||
|
|
||||||
|
ColorPicker::make('color')->default('#000000'),
|
||||||
|
|
||||||
|
Select::make('proveedor_id')->relationship('proveedor', 'nombre')->searchable()->preload()->required(),
|
||||||
|
|
||||||
|
TextInput::make('metros_comprados')->numeric()->required()->live(onBlur: true)->afterStateUpdated(function ($state, Forms\Set $set, $get) {
|
||||||
|
$valor_total = $get('valor_total');
|
||||||
|
$metros_comprados = $state;
|
||||||
|
|
||||||
|
if ($valor_total && $metros_comprados) {
|
||||||
|
$costo_por_metro = $valor_total / $metros_comprados;
|
||||||
|
$set('costo_por_metro', $costo_por_metro);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
TextInput::make('valor_total')->numeric()->required()->prefix('$')->live(onBlur: true)
|
||||||
|
->afterStateUpdated(function ($state, Forms\Set $set, $get) {
|
||||||
|
$metros_comprados = $get('metros_comprados');
|
||||||
|
$valor_total = $state;
|
||||||
|
|
||||||
|
if ($metros_comprados && $valor_total) {
|
||||||
|
$costo_por_metro = $valor_total / $metros_comprados;
|
||||||
|
$set('costo_por_metro', $costo_por_metro);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
TextInput::make('costo_por_metro')->numeric()->prefix('$')->readOnly()->dehydrated()->default(0),
|
||||||
|
|
||||||
|
TextInput::make('metros_disponibles')->numeric()
|
||||||
|
->default(function ($get) {
|
||||||
|
return $get('metros_comprados');
|
||||||
|
}),
|
||||||
|
|
||||||
|
DatePicker::make('fecha_compra')->required(),
|
||||||
|
|
||||||
|
Textarea::make('observaciones')->columnSpanFull(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
Tables\Columns\TextColumn::make('codigo')
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('tipo')
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('color')
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('proveedor.nombre')
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('metros_comprados')
|
||||||
|
->numeric(),
|
||||||
|
Tables\Columns\TextColumn::make('metros_disponibles')
|
||||||
|
->numeric(),
|
||||||
|
Tables\Columns\TextColumn::make('valor_total')
|
||||||
|
->money('USD')
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('costo_por_metro')
|
||||||
|
->money('USD')
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('fecha_compra')
|
||||||
|
->date()
|
||||||
|
->sortable(),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
Tables\Filters\SelectFilter::make('tipo')
|
||||||
|
->options([
|
||||||
|
'algodon' => 'Algodón',
|
||||||
|
'poliester' => 'Poliéster',
|
||||||
|
'denim' => 'Denim',
|
||||||
|
]),
|
||||||
|
Tables\Filters\SelectFilter::make('proveedor_id')
|
||||||
|
->relationship('proveedor', 'nombre')
|
||||||
|
->searchable()
|
||||||
|
->preload(),
|
||||||
|
])
|
||||||
|
->actions([
|
||||||
|
Tables\Actions\EditAction::make(),
|
||||||
|
Tables\Actions\DeleteAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Tables\Actions\BulkActionGroup::make([
|
||||||
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListTelas::route('/'),
|
||||||
|
'create' => Pages\CreateTela::route('/create'),
|
||||||
|
'edit' => Pages\EditTela::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\TelaResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\TelaResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateTela extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = TelaResource::class;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\TelaResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\TelaResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditTela extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = TelaResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\TelaResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\TelaResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListTelas extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = TelaResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\TintoreriaProcesoResource\Pages;
|
||||||
|
use App\Filament\Resources\TintoreriaProcesoResource\RelationManagers;
|
||||||
|
use App\Models\TintoreriaProceso;
|
||||||
|
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 TintoreriaProcesoResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = TintoreriaProceso::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Administració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()
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Select::make('orden_produccion_id')
|
||||||
|
->label('Orden de Producción')
|
||||||
|
->relationship('ordenProduccion', 'numero_orden')
|
||||||
|
->searchable()
|
||||||
|
->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\ListTintoreriaProcesos::route('/'),
|
||||||
|
'create' => Pages\CreateTintoreriaProceso::route('/create'),
|
||||||
|
'edit' => Pages\EditTintoreriaProceso::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\TintoreriaProcesoResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\TintoreriaProcesoResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateTintoreriaProceso extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = TintoreriaProcesoResource::class;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\TintoreriaProcesoResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\TintoreriaProcesoResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditTintoreriaProceso extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = TintoreriaProcesoResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\TintoreriaProcesoResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\TintoreriaProcesoResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListTintoreriaProcesos extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = TintoreriaProcesoResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Confeccion extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'proveedor_id',
|
||||||
|
'orden_produccion_id',
|
||||||
|
'fecha_envio',
|
||||||
|
'cantidad_enviada',
|
||||||
|
'fecha_recepcion',
|
||||||
|
'cantidad_recibida',
|
||||||
|
'prendas_defectuosas',
|
||||||
|
'valor_por_prenda',
|
||||||
|
'total_pagar',
|
||||||
|
'estado',
|
||||||
|
];
|
||||||
|
|
||||||
|
/* Relaciones */
|
||||||
|
public function proveedor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Proveedor::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ordenProduccion()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(OrdenProduccion::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lógica de negocio */
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::saving(function ($confeccion) {
|
||||||
|
// Total a pagar
|
||||||
|
if ($confeccion->cantidad_recibida !== null) {
|
||||||
|
$confeccion->total_pagar =
|
||||||
|
$confeccion->cantidad_recibida * $confeccion->valor_por_prenda;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Estado automático
|
||||||
|
if (!$confeccion->cantidad_recibida) {
|
||||||
|
$confeccion->estado = 'pendiente';
|
||||||
|
} elseif ($confeccion->cantidad_recibida < $confeccion->cantidad_enviada) {
|
||||||
|
$confeccion->estado = 'parcial';
|
||||||
|
} else {
|
||||||
|
$confeccion->estado = 'completo';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Cuando se completa la confección → avanzar OP
|
||||||
|
static::updated(function ($confeccion) {
|
||||||
|
if ($confeccion->estado === 'completo') {
|
||||||
|
$confeccion->ordenProduccion?->avanzarEstado();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class InventarioPrenda extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'orden_produccion_id',
|
||||||
|
'cantidad_terminada',
|
||||||
|
'cantidad_disponible',
|
||||||
|
'fecha_ingreso',
|
||||||
|
'estado',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function ordenProduccion()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(OrdenProduccion::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::creating(function ($inventario) {
|
||||||
|
// Al ingresar al inventario, todo está disponible
|
||||||
|
$inventario->cantidad_disponible = $inventario->cantidad_terminada;
|
||||||
|
|
||||||
|
// Estado automático inicial
|
||||||
|
$inventario->estado = 'en_bodega';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class OrdenProduccion extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'numero_orden',
|
||||||
|
'prenda_modelo',
|
||||||
|
'referencia',
|
||||||
|
'cantidad_total',
|
||||||
|
'tela_id',
|
||||||
|
'fecha_inicio',
|
||||||
|
'fecha_entrega_estimada',
|
||||||
|
'estado',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function tela()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Tela::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function avanzarEstado(): void
|
||||||
|
{
|
||||||
|
$flujo = [
|
||||||
|
'en_corte',
|
||||||
|
'en_confeccion',
|
||||||
|
'en_tintoreria',
|
||||||
|
'en_acabados',
|
||||||
|
'finalizada',
|
||||||
|
];
|
||||||
|
|
||||||
|
$actual = array_search($this->estado, $flujo, true);
|
||||||
|
|
||||||
|
if ($actual !== false && isset($flujo[$actual + 1])) {
|
||||||
|
$this->update([
|
||||||
|
'estado' => $flujo[$actual + 1],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::creating(function ($orden) {
|
||||||
|
if (!$orden->numero_orden) {
|
||||||
|
$ultimoId = self::max('id') + 1;
|
||||||
|
|
||||||
|
$orden->numero_orden = 'OP-' . str_pad($ultimoId, 6, '0', STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ProcesoAcabado extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'orden_produccion_id',
|
||||||
|
'tipo_proceso',
|
||||||
|
'proveedor_id',
|
||||||
|
'responsable_interno',
|
||||||
|
'cantidad_enviada',
|
||||||
|
'cantidad_recibida',
|
||||||
|
'fecha_envio',
|
||||||
|
'fecha_recepcion',
|
||||||
|
'observaciones',
|
||||||
|
];
|
||||||
|
|
||||||
|
/* Relaciones */
|
||||||
|
public function ordenProduccion()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(OrdenProduccion::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function proveedor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Proveedor::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lógica de negocio */
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
// Cuando se recibe el proceso
|
||||||
|
static::updated(function ($acabado) {
|
||||||
|
if (
|
||||||
|
$acabado->fecha_recepcion &&
|
||||||
|
$acabado->cantidad_recibida !== null
|
||||||
|
) {
|
||||||
|
// Validar si ya no quedan procesos pendientes
|
||||||
|
$pendientes = self::where('orden_produccion_id', $acabado->orden_produccion_id)
|
||||||
|
->whereNull('fecha_recepcion')
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if (!$pendientes) {
|
||||||
|
$acabado->ordenProduccion?->update([
|
||||||
|
'estado' => 'finalizada',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,24 +9,14 @@ class Proveedor extends Model
|
|||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that are mass assignable.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'nombre',
|
'nombre',
|
||||||
'contacto',
|
'nit',
|
||||||
|
'categoria',
|
||||||
'telefono',
|
'telefono',
|
||||||
'correo',
|
|
||||||
'direccion',
|
'direccion',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that should be cast to native types.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'id' => 'integer',
|
'id' => 'integer',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Tela extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'codigo',
|
||||||
|
'tipo',
|
||||||
|
'foto',
|
||||||
|
'color',
|
||||||
|
'proveedor_id',
|
||||||
|
'metros_comprados',
|
||||||
|
'metros_disponibles',
|
||||||
|
'fecha_compra',
|
||||||
|
'valor_total',
|
||||||
|
'costo_por_metro',
|
||||||
|
'observaciones',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'foto' => 'string',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function proveedor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Proveedor::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class TintoreriaProceso extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'proveedor_id',
|
||||||
|
'orden_produccion_id',
|
||||||
|
'tipo_proceso',
|
||||||
|
'fecha_envio',
|
||||||
|
'cantidad_enviada',
|
||||||
|
'fecha_recepcion',
|
||||||
|
'cantidad_recibida',
|
||||||
|
'perdidas',
|
||||||
|
'observaciones',
|
||||||
|
];
|
||||||
|
|
||||||
|
/* Relaciones */
|
||||||
|
public function proveedor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Proveedor::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ordenProduccion()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(OrdenProduccion::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lógica de negocio */
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::saving(function ($tintoreria) {
|
||||||
|
if ($tintoreria->cantidad_recibida !== null) {
|
||||||
|
$tintoreria->perdidas =
|
||||||
|
$tintoreria->cantidad_enviada - $tintoreria->cantidad_recibida;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Cuando vuelve de tintorería → avanzar OP
|
||||||
|
static::updated(function ($tintoreria) {
|
||||||
|
if (
|
||||||
|
$tintoreria->fecha_recepcion &&
|
||||||
|
$tintoreria->cantidad_recibida !== null
|
||||||
|
) {
|
||||||
|
$tintoreria->ordenProduccion?->avanzarEstado();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('proveedors', function (Blueprint $table) {
|
||||||
|
// Agregar nuevos campos
|
||||||
|
$table->string('nit')->nullable()->after('nombre');
|
||||||
|
$table->string('categoria')->after('nit');
|
||||||
|
|
||||||
|
// Eliminar campos que no se usarán
|
||||||
|
$table->dropColumn(['contacto', 'correo']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('proveedors', function (Blueprint $table) {
|
||||||
|
// Restaurar columnas eliminadas
|
||||||
|
$table->string('contacto')->nullable();
|
||||||
|
$table->string('correo')->unique()->nullable();
|
||||||
|
|
||||||
|
// Eliminar columnas nuevas
|
||||||
|
$table->dropColumn(['nit', 'categoria']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('telas', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->string('codigo');
|
||||||
|
$table->string('tipo');
|
||||||
|
|
||||||
|
$table->string('foto')->nullable();
|
||||||
|
$table->string('color')->nullable();
|
||||||
|
|
||||||
|
$table->foreignId('proveedor_id')->constrained('proveedors')->cascadeOnDelete();
|
||||||
|
|
||||||
|
$table->string('metros_comprados');
|
||||||
|
$table->string('metros_disponibles');
|
||||||
|
|
||||||
|
$table->date('fecha_compra');
|
||||||
|
|
||||||
|
$table->string('valor_total');
|
||||||
|
$table->string('costo_por_metro');
|
||||||
|
|
||||||
|
$table->text('observaciones')->nullable();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('telas');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('orden_produccions', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->string('numero_orden')->unique();
|
||||||
|
$table->string('prenda_modelo');
|
||||||
|
$table->string('referencia');
|
||||||
|
$table->integer('cantidad_total');
|
||||||
|
|
||||||
|
$table->foreignId('tela_id')
|
||||||
|
->nullable()
|
||||||
|
->constrained('telas')
|
||||||
|
->nullOnDelete();
|
||||||
|
|
||||||
|
$table->date('fecha_inicio');
|
||||||
|
$table->date('fecha_entrega_estimada');
|
||||||
|
|
||||||
|
$table->enum('estado', [
|
||||||
|
'en_corte',
|
||||||
|
'en_confeccion',
|
||||||
|
'en_tintoreria',
|
||||||
|
'en_acabados',
|
||||||
|
'finalizada'
|
||||||
|
])->default('en_corte');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('orden_produccions');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('confeccions', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
// Relaciones
|
||||||
|
$table->foreignId('proveedor_id')
|
||||||
|
->constrained('proveedors')
|
||||||
|
->cascadeOnDelete();
|
||||||
|
|
||||||
|
$table->foreignId('orden_produccion_id')
|
||||||
|
->constrained('orden_produccions')
|
||||||
|
->cascadeOnDelete();
|
||||||
|
|
||||||
|
// Envío
|
||||||
|
$table->date('fecha_envio');
|
||||||
|
$table->integer('cantidad_enviada');
|
||||||
|
|
||||||
|
// Recepción
|
||||||
|
$table->date('fecha_recepcion')->nullable();
|
||||||
|
$table->integer('cantidad_recibida')->nullable();
|
||||||
|
$table->integer('prendas_defectuosas')->default(0);
|
||||||
|
|
||||||
|
// Costos
|
||||||
|
$table->decimal('valor_por_prenda', 12, 2);
|
||||||
|
$table->decimal('total_pagar', 14, 2)->default(0);
|
||||||
|
|
||||||
|
// Estado
|
||||||
|
$table->enum('estado', ['pendiente', 'parcial', 'completo'])
|
||||||
|
->default('pendiente');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('confeccions');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('tintoreria_procesos', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
// Relaciones
|
||||||
|
$table->foreignId('proveedor_id')
|
||||||
|
->constrained('proveedors')
|
||||||
|
->cascadeOnDelete();
|
||||||
|
|
||||||
|
$table->foreignId('orden_produccion_id')
|
||||||
|
->constrained('orden_produccions')
|
||||||
|
->cascadeOnDelete();
|
||||||
|
|
||||||
|
// Proceso
|
||||||
|
$table->string('tipo_proceso');
|
||||||
|
|
||||||
|
// Envío
|
||||||
|
$table->date('fecha_envio');
|
||||||
|
$table->integer('cantidad_enviada');
|
||||||
|
|
||||||
|
// Recepción
|
||||||
|
$table->date('fecha_recepcion')->nullable();
|
||||||
|
$table->integer('cantidad_recibida')->nullable();
|
||||||
|
|
||||||
|
// Control
|
||||||
|
$table->integer('perdidas')->default(0);
|
||||||
|
|
||||||
|
$table->text('observaciones')->nullable();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('tintoreria_procesos');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('proceso_acabados', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->foreignId('orden_produccion_id')
|
||||||
|
->constrained('orden_produccions')
|
||||||
|
->cascadeOnDelete();
|
||||||
|
|
||||||
|
// Proceso
|
||||||
|
$table->string('tipo_proceso');
|
||||||
|
|
||||||
|
// Responsable (opcional proveedor)
|
||||||
|
$table->foreignId('proveedor_id')
|
||||||
|
->nullable()
|
||||||
|
->constrained('proveedors')
|
||||||
|
->nullOnDelete();
|
||||||
|
|
||||||
|
$table->string('responsable_interno')->nullable();
|
||||||
|
|
||||||
|
// Cantidades
|
||||||
|
$table->integer('cantidad_enviada');
|
||||||
|
$table->integer('cantidad_recibida')->nullable();
|
||||||
|
|
||||||
|
// Fechas
|
||||||
|
$table->date('fecha_envio');
|
||||||
|
$table->date('fecha_recepcion')->nullable();
|
||||||
|
|
||||||
|
$table->text('observaciones')->nullable();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('proceso_acabados');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('inventario_prendas', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->foreignId('orden_produccion_id')
|
||||||
|
->constrained('orden_produccions')
|
||||||
|
->cascadeOnDelete();
|
||||||
|
|
||||||
|
// Cantidades
|
||||||
|
$table->integer('cantidad_terminada');
|
||||||
|
$table->integer('cantidad_disponible');
|
||||||
|
|
||||||
|
// Control
|
||||||
|
$table->date('fecha_ingreso');
|
||||||
|
|
||||||
|
$table->enum('estado', [
|
||||||
|
'lista_despacho',
|
||||||
|
'en_bodega'
|
||||||
|
])->default('en_bodega');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('inventario_prendas');
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user