Agregado "requiere notas" a productos con 'PTC'

This commit is contained in:
Rodrigo 2024-09-19 20:58:44 -03:00
parent 82f5862063
commit 177ba193de
4 changed files with 36 additions and 4 deletions

View File

@ -25,7 +25,8 @@ class ProductoResource extends JsonResource
'imagen' => optional($this->poster)->url(),
'descripcion' => $this->descripcion,
'apto_veganxs' => $this->apto_veganxs,
'apto_celiacxs' => $this->apto_celiacxs
'apto_celiacxs' => $this->apto_celiacxs,
'requiere_notas' => $this->requiere_notas,
];
}
}

View File

@ -15,7 +15,6 @@ class NotasProducto extends Migration
{
Schema::table('producto_subpedido', function (Blueprint $table) {
$table->string('notas');
$table->boolean('requiere-notas');
});
}
@ -28,7 +27,6 @@ class NotasProducto extends Migration
{
Schema::table('producto_subpedido', function (Blueprint $table) {
$table->dropColumn('notas');
$table->dropColumn('requiere-notas');
});
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ProductoRequiereNotas extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('productos', function (Blueprint $table) {
$table->boolean('requiere_notas')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('productos', function (Blueprint $table) {
$table->dropColumn('requiere_notas');
});
}
}

View File

@ -61,7 +61,8 @@ class CanastaSeeder extends Seeder
'nombre' => trim(str_replace('*', ' ',$registro['Producto'])),
'precio' => $registro['Precio'],
'proveedor_id' => $this->obtenerProveedor($registro['Producto']),
'bono' => $registro[$this::FILA_HEADER] == "B"
'bono' => $registro[$this::FILA_HEADER] == "B",
'requiere_notas'=> $registro[$this::FILA_HEADER] =="PTC",
];
}