ip
This commit is contained in:
@@ -29,6 +29,12 @@ class EditConfeccion extends EditRecord
|
||||
->maxValue(fn () => $this->getRecord()->faltantes ?? 0)
|
||||
->helperText(fn () => 'Máximo: ' . ($this->getRecord()->faltantes ?? 0))
|
||||
->default(fn () => $this->getRecord()->faltantes ?? 0),
|
||||
|
||||
Forms\Components\TextInput::make('prendas_defectuosas')
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->maxValue(fn ($get) => (int) ($get('cantidad') ?? 0))
|
||||
->helperText('Opcional. Se restará del total recibido.'),
|
||||
Forms\Components\Textarea::make('notas'),
|
||||
])
|
||||
->action(function (array $data): void {
|
||||
|
||||
+7
@@ -29,6 +29,13 @@ class RecepcionesRelationManager extends RelationManager
|
||||
->minValue(1)
|
||||
->maxValue(fn () => $this->getOwnerRecord()?->faltantes ?? 0)
|
||||
->helperText(fn () => 'Máximo: ' . ($this->getOwnerRecord()?->faltantes ?? 0)),
|
||||
|
||||
TextInput::make('prendas_defectuosas')
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->maxValue(fn ($get) => (int) ($get('cantidad') ?? 0))
|
||||
->helperText('Opcional. Se restará del total recibido.'),
|
||||
|
||||
Textarea::make('notas'),
|
||||
]);
|
||||
}
|
||||
|
||||
+7
@@ -29,6 +29,13 @@ class RecepcionesRelationManager extends RelationManager
|
||||
->minValue(1)
|
||||
->maxValue(fn () => $this->getOwnerRecord()?->faltantes ?? 0)
|
||||
->helperText(fn () => 'Máximo: ' . ($this->getOwnerRecord()?->faltantes ?? 0)),
|
||||
|
||||
TextInput::make('prendas_defectuosas')
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->maxValue(fn ($get) => (int) ($get('cantidad') ?? 0))
|
||||
->helperText('Opcional. Se restará del total recibido.'),
|
||||
|
||||
Textarea::make('notas'),
|
||||
]);
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?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::table('recepciones', function (Blueprint $table) {
|
||||
$table->integer('prendas_defectuosas')->default(0)->after('cantidad');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('recepciones', function (Blueprint $table) {
|
||||
$table->dropColumn('prendas_defectuosas');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -56,6 +56,24 @@ class RecepcionFlowTest extends TestCase
|
||||
->count();
|
||||
|
||||
$this->assertEquals(2, $count);
|
||||
|
||||
// Crear recepción con defectos y comprobar traslado creado
|
||||
Recepcion::create([
|
||||
'referencia_type' => Confeccion::class,
|
||||
'referencia_id' => $conf->id,
|
||||
'cantidad' => 50,
|
||||
'prendas_defectuosas' => 5,
|
||||
'fecha_recepcion' => now(),
|
||||
]);
|
||||
|
||||
$ultimoTraslado = TrasladoPrenda::where('referencia_type', Confeccion::class)
|
||||
->where('referencia_id', $conf->id)
|
||||
->latest('id')
|
||||
->first();
|
||||
|
||||
$this->assertNotNull($ultimoTraslado);
|
||||
$this->assertEquals(45, $ultimoTraslado->cantidad_recibida);
|
||||
$this->assertEquals(5, $ultimoTraslado->prendas_defectuosas);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
||||
Reference in New Issue
Block a user