This commit is contained in:
Lizandro Guarnizo
2026-02-05 08:13:34 -05:00
parent 715f3e3a81
commit 452603b882
3 changed files with 36 additions and 2 deletions
@@ -69,7 +69,9 @@ class OrdenProduccionResource extends Resource
TextInput::make('cantidad_total')
->numeric()
->required()
->minValue(1),
->minValue(1)
->step(0.01)
->dehydrateStateUsing(fn ($state) => str_replace(',', '.', $state)),
Select::make('tela_id')
->label('Tela asociada')
@@ -110,7 +112,9 @@ class OrdenProduccionResource extends Resource
->numeric()
->required()
->minValue(0)
->step(0.01)
->reactive()
->dehydrateStateUsing(fn ($state) => str_replace(',', '.', $state))
->helperText(fn ($get) => $get('tela_id') ? 'Saldo disponible: ' . (\App\Models\Tela::find($get('tela_id'))->metros_disponibles ?? 0) . ' m' : 'Selecciona una tela')
->default(0),
@@ -14,7 +14,7 @@ return new class extends Migration
$table->string('numero_orden')->unique();
$table->string('prenda_modelo');
$table->string('referencia');
$table->integer('cantidad_total');
$table->decimal('cantidad_total', 10, 2);
$table->foreignId('tela_id')
->nullable()
@@ -0,0 +1,30 @@
<?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('orden_produccions', function (Blueprint $table) {
$table->decimal('cantidad_total', 10, 2)->change();
$table->decimal('metros_requeridos', 10, 2)->default(0)->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('orden_produccions', function (Blueprint $table) {
$table->integer('cantidad_total')->change();
$table->integer('metros_requeridos')->default(0)->change();
});
}
};