Compare commits
No commits in common. "ba229880269a5626ad3d1b08d33ad7491fde0b95" and "73f02dfff013c7a6267d25cd3732303f6c7b1d3e" have entirely different histories.
ba22988026
...
73f02dfff0
18 changed files with 58 additions and 230 deletions
app
database
migrations
seeds
resources
js
views/pdfgen
routes
|
@ -233,36 +233,10 @@ class GrupoDeCompra extends Model
|
||||||
|
|
||||||
// Guardar en un archivo .csv
|
// Guardar en un archivo .csv
|
||||||
try {
|
try {
|
||||||
$writer = Writer::createFromPath(resource_path('csv/exports/total-pedidos.csv'), 'w');
|
$writer = Writer::createFromPath(resource_path('csv/exports/total-pedidos.csv'), 'w');
|
||||||
$writer->insertAll($planilla);
|
$writer->insertAll($planilla);
|
||||||
} catch (CannotInsertRecord $e) {
|
} catch (CannotInsertRecord $e) {
|
||||||
var_export($e->getRecords());
|
var_export($e->getRecords());
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function exportarProductosConNotasEnCSV() {
|
|
||||||
$gdcs = GrupoDeCompra::all();
|
|
||||||
foreach ($gdcs as $i => $gdc) {
|
|
||||||
$productos_en_pedido = DB::table('pedidos_aprobados')->where('grupo_de_compra_id', $gdc->id)->get()->keyBy('producto_id');
|
|
||||||
$pedidos = $gdc->pedidosAprobados();
|
|
||||||
foreach ($productos_en_pedido as $id => $producto_pedido) {
|
|
||||||
foreach ($pedidos as $pedido) {
|
|
||||||
$producto = $pedido->productos()->find($id);
|
|
||||||
if ($producto != null && $producto->requiere_notas) {
|
|
||||||
$planilla[$i+1][0] = $gdc->nombre;
|
|
||||||
$planilla[$i+1][1] = $producto->nombre;
|
|
||||||
$planilla[$i+1][2] = $producto->pivot->cantidad;
|
|
||||||
$planilla[$i+1][3] = $producto->pivot->notas;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Guardar en un archivo .csv
|
|
||||||
try {
|
|
||||||
$writer = Writer::createFromPath(resource_path('csv/exports/pedidos-notas.csv'), 'w');
|
|
||||||
$writer->insertAll($planilla);
|
|
||||||
} catch (CannotInsertRecord $e) {
|
|
||||||
var_export($e->getRecords());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@ class SubpedidoController extends Controller
|
||||||
|
|
||||||
$valid = request()->validate([
|
$valid = request()->validate([
|
||||||
'cantidad' => 'required|min:0',
|
'cantidad' => 'required|min:0',
|
||||||
'notas' => 'nullable',
|
|
||||||
'producto_id' => [
|
'producto_id' => [
|
||||||
'required',
|
'required',
|
||||||
Rule::in(Producto::all()->pluck('id')),
|
Rule::in(Producto::all()->pluck('id')),
|
||||||
|
@ -87,11 +86,7 @@ class SubpedidoController extends Controller
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$producto = Producto::find($valid['producto_id']);
|
$producto = Producto::find($valid['producto_id']);
|
||||||
$notas = $valid['notas'];
|
$subpedido->syncProducto($producto, $valid['cantidad']);
|
||||||
if ($notas == null) {
|
|
||||||
$notas = "";
|
|
||||||
}
|
|
||||||
$subpedido->syncProducto($producto, $valid['cantidad'], $notas);
|
|
||||||
return new SubpedidoResource($subpedido);
|
return new SubpedidoResource($subpedido);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,6 @@ class ComprasController
|
||||||
return response()->download($file);
|
return response()->download($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function descargarNotas() {
|
|
||||||
GrupoDeCompra::exportarProductosConNotasEnCSV();
|
|
||||||
$file = resource_path('csv/exports/pedidos-notas.csv');
|
|
||||||
return response()->download($file);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function show()
|
public function show()
|
||||||
{
|
{
|
||||||
return view('auth/compras_login');
|
return view('auth/compras_login');
|
||||||
|
|
|
@ -25,8 +25,7 @@ class ProductoResource extends JsonResource
|
||||||
'imagen' => optional($this->poster)->url(),
|
'imagen' => optional($this->poster)->url(),
|
||||||
'descripcion' => $this->descripcion,
|
'descripcion' => $this->descripcion,
|
||||||
'apto_veganxs' => $this->apto_veganxs,
|
'apto_veganxs' => $this->apto_veganxs,
|
||||||
'apto_celiacxs' => $this->apto_celiacxs,
|
'apto_celiacxs' => $this->apto_celiacxs
|
||||||
'requiere_notas' => $this->requiere_notas,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Producto extends Model
|
||||||
|
|
||||||
public function subpedidos()
|
public function subpedidos()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany('App\Subpedido','productos_subpedidos')->withPivot(["cantidad", "notas"]);
|
return $this->belongsToMany('App\Subpedido','productos_subpedidos')->withPivot(["cantidad"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function proveedor()
|
public function proveedor()
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Subpedido extends Model
|
||||||
|
|
||||||
public function productos()
|
public function productos()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany('App\Producto')->withPivot(["cantidad","total", "notas"]);
|
return $this->belongsToMany('App\Producto')->withPivot(["cantidad","total"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Bonos del MPS, Sororo, etc. NO devuelve bonos de transporte
|
//Bonos del MPS, Sororo, etc. NO devuelve bonos de transporte
|
||||||
|
@ -84,14 +84,13 @@ class Subpedido extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
//Actualiza el pedido, agregando o quitando del subpedido según sea necesario. Debe ser llamado desde el controlador de subpedidos, luego de validar que los parámetros $producto y $cantidad son correctos. También calcula el subtotal por producto.
|
//Actualiza el pedido, agregando o quitando del subpedido según sea necesario. Debe ser llamado desde el controlador de subpedidos, luego de validar que los parámetros $producto y $cantidad son correctos. También calcula el subtotal por producto.
|
||||||
public function syncProducto(Producto $producto, Int $cantidad, string $notas) {
|
public function syncProducto(Producto $producto, Int $cantidad) {
|
||||||
if ($cantidad){
|
if ($cantidad){
|
||||||
//si la cantidad es 1 o más se agrega el producto o actualiza la cantidad
|
//si la cantidad es 1 o más se agrega el producto o actualiza la cantidad
|
||||||
$this->productos()->syncWithoutDetaching([
|
$this->productos()->syncWithoutDetaching([
|
||||||
$producto->id => [
|
$producto->id => [
|
||||||
'cantidad' => $cantidad,
|
'cantidad' => $cantidad,
|
||||||
'total' => $cantidad * $producto->precio,
|
'total' => $cantidad * $producto->precio
|
||||||
'notas' => $notas,
|
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
class NotasProducto extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::table('producto_subpedido', function (Blueprint $table) {
|
|
||||||
$table->string('notas')->nullable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::table('producto_subpedido', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('notas');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
<?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');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -61,8 +61,7 @@ class CanastaSeeder extends Seeder
|
||||||
'nombre' => trim(str_replace('*', ' ',$registro['Producto'])),
|
'nombre' => trim(str_replace('*', ' ',$registro['Producto'])),
|
||||||
'precio' => $registro['Precio'],
|
'precio' => $registro['Precio'],
|
||||||
'proveedor_id' => $this->obtenerProveedor($registro['Producto']),
|
'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",
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,5 @@ class DatabaseSeeder extends Seeder
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$this->call(CanastaSeeder::class);
|
$this->call(CanastaSeeder::class);
|
||||||
$this->call(GrupoDeCompraSeeder::class);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,14 @@ class GrupoDeCompraSeeder extends Seeder
|
||||||
|
|
||||||
$usersToInsert[] = [
|
$usersToInsert[] = [
|
||||||
'name' => $registro['barrio'],
|
'name' => $registro['barrio'],
|
||||||
'password' => Hash::make("asd"),
|
'password' => Hash::make($registro['barrio']),
|
||||||
"is_admin" => 0,
|
"is_admin" => 0,
|
||||||
'grupo_de_compra_id' => $key
|
'grupo_de_compra_id' => $key
|
||||||
];
|
];
|
||||||
|
|
||||||
$usersToInsert[] = [
|
$usersToInsert[] = [
|
||||||
'name' => $registro['barrio'] . "_admin",
|
'name' => $registro['barrio'] . "_admin",
|
||||||
'password' => Hash::make("asd"),
|
'password' => Hash::make($registro['barrio'] . "admin"),
|
||||||
"is_admin" => 1,
|
"is_admin" => 1,
|
||||||
'grupo_de_compra_id' => $key
|
'grupo_de_compra_id' => $key
|
||||||
];
|
];
|
||||||
|
|
9
resources/js/app.js
vendored
9
resources/js/app.js
vendored
|
@ -70,10 +70,6 @@ const app = new Vue({
|
||||||
cantidad(producto) {
|
cantidad(producto) {
|
||||||
let pedido = this.productos.some(p => p.id == producto.id)
|
let pedido = this.productos.some(p => p.id == producto.id)
|
||||||
return pedido ? this.productos.find(p => p.id == producto.id).pivot.cantidad : 0
|
return pedido ? this.productos.find(p => p.id == producto.id).pivot.cantidad : 0
|
||||||
},
|
|
||||||
notas(producto) {
|
|
||||||
let pedido = this.productos.some(p => p.id == producto.id);
|
|
||||||
return pedido ? this.productos.find(p => p.id == producto.id).pivot.notas : "";
|
|
||||||
},
|
},
|
||||||
settearDevoluciones() {
|
settearDevoluciones() {
|
||||||
axios.get(`/api/grupos-de-compra/${this.gdc}/devoluciones`)
|
axios.get(`/api/grupos-de-compra/${this.gdc}/devoluciones`)
|
||||||
|
@ -103,15 +99,14 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
Event.$on('sync-subpedido', (cantidad, id, notas) => {
|
Event.$on('sync-subpedido', (cantidad, id) => {
|
||||||
if (this.pedido.aprobado) {
|
if (this.pedido.aprobado) {
|
||||||
this.$toast('No se puede modificar un pedido ya aprobado', 2000);
|
this.$toast('No se puede modificar un pedido ya aprobado', 2000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
axios.post("/api/subpedidos/" + this.pedido.id + "/sync", {
|
axios.post("/api/subpedidos/" + this.pedido.id + "/sync", {
|
||||||
cantidad: cantidad,
|
cantidad: cantidad,
|
||||||
producto_id: id,
|
producto_id: id
|
||||||
notas: notas,
|
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
this.pedido = response.data.data
|
this.pedido = response.data.data
|
||||||
this.$toast('Pedido actualizado exitosamente')
|
this.$toast('Pedido actualizado exitosamente')
|
||||||
|
|
|
@ -11,16 +11,6 @@
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
|
||||||
<p class="control">
|
|
||||||
<a href="/compras/pedidos/notas" class="button">
|
|
||||||
<span class="icon is-small">
|
|
||||||
<i class="fas fa-sticky-note"></i>
|
|
||||||
</span>
|
|
||||||
<span>Descargar planilla de notas</span>
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,44 +1,28 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="field has-addons contador">
|
||||||
<div class="field has-addons contador">
|
<div class="control">
|
||||||
<div class="control">
|
<button class="button is-small" @click.capture="decrementar();">
|
||||||
<button class="button is-small" @click.capture="decrementar();">
|
<i class="fa fa-solid fa-minus"></i>
|
||||||
<i class="fa fa-solid fa-minus"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="control">
|
|
||||||
<input id="cantidad" v-model="cantidad" class="input is-small" type="number" style="text-align: center">
|
|
||||||
</div>
|
|
||||||
<div class="control" @click="incrementar();">
|
|
||||||
<button class="button is-small">
|
|
||||||
<i class="fa fa-solid fa-plus"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<button :disabled="disableConfirm()" class="button is-small is-success ml-1" @click="confirmar()">
|
|
||||||
<span class="icon">
|
|
||||||
<i class="fas fa-check"></i>
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
<button :disabled="!puedeBorrar()" class="button is-small is-danger ml-1" @click="borrar()">
|
|
||||||
<span class="icon">
|
|
||||||
<i class="fas fa-trash-alt"></i>
|
|
||||||
</span>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="producto.requiere_notas" v-bind:class="{'has-icons-right': notas_warning_visible}" class="control is-full-width has-icons-left">
|
<div class="control">
|
||||||
<span class="icon is-small is-left">
|
<input id="cantidad" v-model="cantidad" class="input is-small" type="number" style="text-align: center">
|
||||||
<i class="fas fa-sticky-note"></i>
|
|
||||||
</span>
|
|
||||||
<input v-model="notas" v-bind:class="{'is-danger': notas_warning_visible}" id="notas" class="input" type="text" placeholder="Talle o color" />
|
|
||||||
<span v-if="notas_warning_visible" class="icon is-small is-right">
|
|
||||||
<i class="fas fa-exclamation-triangle"></i>
|
|
||||||
</span>
|
|
||||||
<article v-if="notas_warning_visible" class="message is-danger is-small">
|
|
||||||
<div class="message-body">
|
|
||||||
No se puede dejar este campo vacío
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="control" @click="incrementar();">
|
||||||
|
<button class="button is-small">
|
||||||
|
<i class="fa fa-solid fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<button :disabled="!hayCambios()" class="button is-small is-success ml-1" @click="confirmar()">
|
||||||
|
<span class="icon">
|
||||||
|
<i class="fas fa-check"></i>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<button :disabled="!puedeBorrar()" class="button is-small is-danger ml-1" @click="borrar()">
|
||||||
|
<span class="icon">
|
||||||
|
<i class="fas fa-trash-alt"></i>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -49,24 +33,21 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
cantidad: this.cantidadEnChismosa(),
|
cantidad: this.producto.cantidad,
|
||||||
notas: this.notasEnChismosa(),
|
enChismosa: this.producto.cantidad,
|
||||||
notas_warning_visible: false,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
Event.$on('sync-subpedido', (cantidad, productoId, notas) => {
|
if (this.producto.pivot !== undefined) {
|
||||||
|
this.cantidad = this.producto.pivot.cantidad;
|
||||||
|
this.enChismosa = this.cantidad;
|
||||||
|
}
|
||||||
|
Event.$on('sync-subpedido', (cantidad,productoId) => {
|
||||||
if (this.producto.id === productoId)
|
if (this.producto.id === productoId)
|
||||||
this.sincronizar(cantidad, notas);
|
this.sincronizar(cantidad);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
notasEnChismosa() {
|
|
||||||
return this.producto.pivot !== undefined ? this.producto.pivot.notas : "";
|
|
||||||
},
|
|
||||||
cantidadEnChismosa() {
|
|
||||||
return this.producto.pivot !== undefined ? this.producto.pivot.cantidad : 0;
|
|
||||||
},
|
|
||||||
decrementar() {
|
decrementar() {
|
||||||
this.cantidad -= 1;
|
this.cantidad -= 1;
|
||||||
},
|
},
|
||||||
|
@ -74,39 +55,26 @@
|
||||||
this.cantidad += 1;
|
this.cantidad += 1;
|
||||||
},
|
},
|
||||||
confirmar() {
|
confirmar() {
|
||||||
if (this.warningNotas()) {
|
Event.$emit('sync-subpedido', this.cantidad, this.producto.id);
|
||||||
this.notas_warning_visible = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log("Emit sync " + this.cantidad + " " + this.notas);
|
|
||||||
Event.$emit('sync-subpedido', this.cantidad, this.producto.id, this.notas);
|
|
||||||
},
|
},
|
||||||
borrar() {
|
borrar() {
|
||||||
this.cantidad = 0;
|
this.cantidad = 0;
|
||||||
this.confirmar();
|
this.confirmar();
|
||||||
},
|
},
|
||||||
sincronizar(cantidad, notas) {
|
sincronizar(cantidad) {
|
||||||
this.notas_warning_visible = false;
|
|
||||||
this.notas = notas;
|
|
||||||
this.cantidad = cantidad;
|
this.cantidad = cantidad;
|
||||||
if (this.producto.pivot !== undefined) {
|
if (this.producto.pivot != null) {
|
||||||
this.producto.pivot.cantidad = cantidad;
|
this.producto.pivot.cantidad = cantidad;
|
||||||
this.producto.pivot.notas = notas;
|
} else {
|
||||||
|
this.producto.cantidad = cantidad;
|
||||||
}
|
}
|
||||||
|
this.enChismosa = cantidad;
|
||||||
},
|
},
|
||||||
hayCambios() {
|
hayCambios() {
|
||||||
if (this.cantidad != this.cantidadEnChismosa()) return true;
|
return this.cantidad != this.enChismosa;
|
||||||
|
|
||||||
return this.cantidad > 0 && this.notas != this.notasEnChismosa();
|
|
||||||
},
|
},
|
||||||
puedeBorrar() {
|
puedeBorrar() {
|
||||||
return this.cantidadEnChismosa() > 0;
|
return this.enChismosa > 0;
|
||||||
},
|
|
||||||
warningNotas() {
|
|
||||||
return this.producto.requiere_notas && this.cantidad > 0 && !this.notas;
|
|
||||||
},
|
|
||||||
disableConfirm() {
|
|
||||||
return !this.hayCambios();
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,12 +97,4 @@
|
||||||
.contador {
|
.contador {
|
||||||
min-width: 178px;
|
min-width: 178px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-danger {
|
|
||||||
background-color: #fca697;
|
|
||||||
}
|
|
||||||
.is-danger::placeholder {
|
|
||||||
color: #fff;
|
|
||||||
opacity: 1; /* Firefox */
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
|
@ -8,13 +8,12 @@ export default {
|
||||||
return {
|
return {
|
||||||
cantidad: this.producto.cantidad,
|
cantidad: this.producto.cantidad,
|
||||||
enChismosa: this.producto.cantidad,
|
enChismosa: this.producto.cantidad,
|
||||||
notas: this.producto.notas,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
Event.$on('sync-subpedido', (cantidad, productoId, notas) => {
|
Event.$on('sync-subpedido', (cantidad,productoId) => {
|
||||||
if (this.producto.id === productoId)
|
if (this.producto.id === productoId)
|
||||||
this.sincronizar(cantidad, notas);
|
this.sincronizar(cantidad);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -25,21 +24,19 @@ export default {
|
||||||
this.cantidad += 1;
|
this.cantidad += 1;
|
||||||
},
|
},
|
||||||
confirmar() {
|
confirmar() {
|
||||||
Event.$emit('sync-subpedido', this.cantidad, this.producto.id, this.notas);
|
Event.$emit('sync-subpedido', this.cantidad, this.producto.id);
|
||||||
},
|
},
|
||||||
borrar() {
|
borrar() {
|
||||||
this.cantidad = 0;
|
this.cantidad = 0;
|
||||||
this.confirmar();
|
this.confirmar();
|
||||||
},
|
},
|
||||||
sincronizar(cantidad, notas) {
|
sincronizar(cantidad) {
|
||||||
this.cantidad = cantidad;
|
this.cantidad = cantidad;
|
||||||
this.producto.cantidad = cantidad;
|
this.producto.cantidad = cantidad;
|
||||||
this.enChismosa = cantidad;
|
this.enChismosa = cantidad;
|
||||||
this.notas = notas;
|
|
||||||
this.producto.notas = notas;
|
|
||||||
},
|
},
|
||||||
hayCambios() {
|
hayCambios() {
|
||||||
return this.cantidad != this.enChismosa || this.notas != this.producto.notas;
|
return this.cantidad != this.enChismosa;
|
||||||
},
|
},
|
||||||
puedeBorrar() {
|
puedeBorrar() {
|
||||||
return this.enChismosa > 0;
|
return this.enChismosa > 0;
|
||||||
|
|
|
@ -34,11 +34,7 @@ export default {
|
||||||
params: this.params(filtro,valor)
|
params: this.params(filtro,valor)
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.productos = response.data.data;
|
this.productos = response.data.data;
|
||||||
this.productos.forEach(p => {
|
this.productos.forEach(p => p.cantidad = this.$root.cantidad(p))
|
||||||
p.pivot = {};
|
|
||||||
p.pivot.cantidad = this.$root.cantidad(p);
|
|
||||||
p.pivot.notas = this.$root.notas(p);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
Event.$emit("migas-agregar",this.miga);
|
Event.$emit("migas-agregar",this.miga);
|
||||||
|
|
|
@ -27,13 +27,9 @@
|
||||||
|
|
||||||
@foreach($subpedido->productos as $producto)
|
@foreach($subpedido->productos as $producto)
|
||||||
@if(!$producto->bono)
|
@if(!$producto->bono)
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{{ $producto->nombre }}
|
{{ $producto->nombre }}
|
||||||
@if($producto->pivot->notas)
|
|
||||||
<br /><b>Talle/Color:</b> {{ $producto->pivot->notas }}
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: center">
|
<td style="text-align: center">
|
||||||
{{ $producto->pivot->cantidad }}
|
{{ $producto->pivot->cantidad }}
|
||||||
|
|
|
@ -81,5 +81,4 @@ Route::get('/compras', 'ComprasController@show')->name('compras_login.show');
|
||||||
Route::middleware(['compras'])->group( function() {
|
Route::middleware(['compras'])->group( function() {
|
||||||
Route::get('/compras/pedidos', 'ComprasController@indexPedidos')->name('compras.pedidos');
|
Route::get('/compras/pedidos', 'ComprasController@indexPedidos')->name('compras.pedidos');
|
||||||
Route::get('/compras/pedidos/descargar', 'ComprasController@descargarPedidos')->name('compras.pedidos.descargar');
|
Route::get('/compras/pedidos/descargar', 'ComprasController@descargarPedidos')->name('compras.pedidos.descargar');
|
||||||
Route::get('/compras/pedidos/notas', 'ComprasController@descargarNotas')->name('compras.pedidos.descargar');
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue