Compare commits
No commits in common. "02aba80fc94c7514591969ef5718a7adb7053037" and "d8c8865d13032d9c4efc1b81b1832bb104980d7e" have entirely different histories.
02aba80fc9
...
d8c8865d13
9 changed files with 7 additions and 123 deletions
|
@ -14,7 +14,7 @@ use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class GrupoDeCompra extends Model
|
class GrupoDeCompra extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = ["nombre", "region", "devoluciones_habilitadas", "saldo"];
|
protected $fillable = ["nombre", "region", "devoluciones_habilitadas"];
|
||||||
protected $table = 'grupos_de_compra';
|
protected $table = 'grupos_de_compra';
|
||||||
|
|
||||||
public function subpedidos(): HasMany
|
public function subpedidos(): HasMany
|
||||||
|
@ -69,17 +69,11 @@ class GrupoDeCompra extends Model
|
||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function totalDePedido()
|
public function totalATransferir()
|
||||||
{
|
{
|
||||||
return $this->totalCentralesQueNoPaganTransporte()
|
return $this->totalCentralesQueNoPaganTransporte()
|
||||||
+ $this->totalCentralesQuePaganTransporte()
|
+ $this->totalCentralesQuePaganTransporte()
|
||||||
+ $this->totalTransporte()
|
+ $this->totalTransporte();
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function totalATransferir()
|
|
||||||
{
|
|
||||||
return $this->totalDePedido() - $this->saldo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function totalCentralesQueNoPaganTransporte()
|
public function totalCentralesQueNoPaganTransporte()
|
||||||
|
|
|
@ -21,11 +21,9 @@ class GrupoDeCompraResource extends JsonResource
|
||||||
'devoluciones_habilitadas' => $this->devoluciones_habilitadas,
|
'devoluciones_habilitadas' => $this->devoluciones_habilitadas,
|
||||||
'pedidos' => SubpedidoResource::collection($this->subpedidos),
|
'pedidos' => SubpedidoResource::collection($this->subpedidos),
|
||||||
'total_a_recaudar' => number_format($this->totalARecaudar(),2),
|
'total_a_recaudar' => number_format($this->totalARecaudar(),2),
|
||||||
'saldo' => number_format($this->saldo,2),
|
|
||||||
'total_sin_devoluciones' => number_format($this->totalSinDevoluciones(),2),
|
'total_sin_devoluciones' => number_format($this->totalSinDevoluciones(),2),
|
||||||
'total_barrial' => number_format($this->totalBarrial(),2),
|
'total_barrial' => number_format($this->totalBarrial(),2),
|
||||||
'total_devoluciones' => number_format($this->totalDevoluciones(),2),
|
'total_devoluciones' => number_format($this->totalDevoluciones(),2),
|
||||||
'total_de_pedido' => number_format($this->totalDePedido(),2),
|
|
||||||
'total_a_transferir' => number_format($this->totalATransferir(),2),
|
'total_a_transferir' => number_format($this->totalATransferir(),2),
|
||||||
'total_transporte' => number_format($this->totalTransporte()),
|
'total_transporte' => number_format($this->totalTransporte()),
|
||||||
'cantidad_transporte' => number_format($this->cantidadTransporte()),
|
'cantidad_transporte' => number_format($this->cantidadTransporte()),
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
class AgregarSaldosABarrios extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
// Agregar columna 'saldo' a la tabla 'grupos_de_compra'
|
|
||||||
Schema::table('grupos_de_compra', function (Blueprint $table) {
|
|
||||||
$table->double('saldo', 10, 2);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
// Remover columna 'saldo' de la tabla 'grupos_de_compra'
|
|
||||||
Schema::table('grupos_de_compra', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('saldo');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -43,15 +43,7 @@
|
||||||
<td class="has-text-right">$ {{ total_transporte }}</td>
|
<td class="has-text-right">$ {{ total_transporte }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Total de pedido:</th>
|
<th>Total a depositar:</th>
|
||||||
<td class="has-text-right">$ {{ total_de_pedido }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Saldo a favor:</th>
|
|
||||||
<td class="has-text-right">$ {{ saldo }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Total a transferir:</th>
|
|
||||||
<td class="has-text-right">$ {{ total_a_transferir }}</td>
|
<td class="has-text-right">$ {{ total_a_transferir }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -75,9 +67,7 @@ export default {
|
||||||
"total_devoluciones",
|
"total_devoluciones",
|
||||||
"cantidad_transporte",
|
"cantidad_transporte",
|
||||||
"total_transporte",
|
"total_transporte",
|
||||||
"total_de_pedido",
|
|
||||||
"total_a_transferir",
|
"total_a_transferir",
|
||||||
"saldo",
|
|
||||||
]),
|
]),
|
||||||
...mapGetters('admin', ['pedidosAprobados']),
|
...mapGetters('admin', ['pedidosAprobados']),
|
||||||
},
|
},
|
||||||
|
|
|
@ -41,22 +41,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
class="block pb-6"
|
|
||||||
id="saldos-compras-seccion"
|
|
||||||
:class="seccionActiva === 'saldos-compras-seccion' ? 'is-active' : 'is-hidden'"
|
|
||||||
>
|
|
||||||
<div class="block" id="saldos-compras-seccion">
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="gdc in grupos_de_compra">
|
|
||||||
<th>{{ gdc.nombre }}</th>
|
|
||||||
<td>{{ gdc.saldo }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -64,7 +48,6 @@
|
||||||
import TabsSecciones from "../comunes/TabsSecciones.vue";
|
import TabsSecciones from "../comunes/TabsSecciones.vue";
|
||||||
import DropdownDescargar from "./DropdownDescargar.vue";
|
import DropdownDescargar from "./DropdownDescargar.vue";
|
||||||
import CanastaInput from "./CanastaInput.vue";
|
import CanastaInput from "./CanastaInput.vue";
|
||||||
import { mapActions, mapState } from "vuex";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -74,11 +57,8 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tabs: [
|
tabs: [{ id: "pedidos-compras", nombre: "Pedidos" },
|
||||||
{ id: "pedidos-compras", nombre: "Pedidos" },
|
{ id: "canasta-compras", nombre: "Canasta" }],
|
||||||
{ id: "canasta-compras", nombre: "Canasta" },
|
|
||||||
{ id: "saldos-compras", nombre: "Saldos" },
|
|
||||||
],
|
|
||||||
tabActiva: "pedidos-compras",
|
tabActiva: "pedidos-compras",
|
||||||
seccionActiva: "pedidos-compras-seccion",
|
seccionActiva: "pedidos-compras-seccion",
|
||||||
archivo: undefined,
|
archivo: undefined,
|
||||||
|
@ -89,15 +69,6 @@ export default {
|
||||||
this.tabActiva = tabId;
|
this.tabActiva = tabId;
|
||||||
this.seccionActiva = tabId + "-seccion";
|
this.seccionActiva = tabId + "-seccion";
|
||||||
},
|
},
|
||||||
...mapActions('comisiones', ['getGruposDeCompra']),
|
}
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState('comisiones', [
|
|
||||||
'grupos_de_compra',
|
|
||||||
]),
|
|
||||||
},
|
|
||||||
async mounted() {
|
|
||||||
await this.getGruposDeCompra();
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
2
resources/js/store/index.js
vendored
2
resources/js/store/index.js
vendored
|
@ -1,7 +1,6 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
import admin from "./modules/admin";
|
import admin from "./modules/admin";
|
||||||
import comisiones from "./modules/comisiones";
|
|
||||||
import login from "./modules/login";
|
import login from "./modules/login";
|
||||||
import pedido from "./modules/pedido";
|
import pedido from "./modules/pedido";
|
||||||
import productos from "./modules/productos";
|
import productos from "./modules/productos";
|
||||||
|
@ -12,7 +11,6 @@ Vue.use(Vuex);
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
modules: {
|
modules: {
|
||||||
admin,
|
admin,
|
||||||
comisiones,
|
|
||||||
login,
|
login,
|
||||||
pedido,
|
pedido,
|
||||||
productos,
|
productos,
|
||||||
|
|
4
resources/js/store/modules/admin.js
vendored
4
resources/js/store/modules/admin.js
vendored
|
@ -10,11 +10,9 @@ const state = {
|
||||||
total_sin_devoluciones: null,
|
total_sin_devoluciones: null,
|
||||||
total_barrial: null,
|
total_barrial: null,
|
||||||
total_devoluciones: null,
|
total_devoluciones: null,
|
||||||
total_de_pedido: null,
|
|
||||||
total_a_transferir: null,
|
total_a_transferir: null,
|
||||||
total_transporte: null,
|
total_transporte: null,
|
||||||
cantidad_transporte: null,
|
cantidad_transporte: null,
|
||||||
saldo: null,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
|
@ -28,11 +26,9 @@ const mutations = {
|
||||||
state.total_sin_devoluciones = grupo_de_compra.total_sin_devoluciones;
|
state.total_sin_devoluciones = grupo_de_compra.total_sin_devoluciones;
|
||||||
state.total_barrial = grupo_de_compra.total_barrial;
|
state.total_barrial = grupo_de_compra.total_barrial;
|
||||||
state.total_devoluciones = grupo_de_compra.total_devoluciones;
|
state.total_devoluciones = grupo_de_compra.total_devoluciones;
|
||||||
state.total_de_pedido = grupo_de_compra.total_de_pedido;
|
|
||||||
state.total_a_transferir = grupo_de_compra.total_a_transferir;
|
state.total_a_transferir = grupo_de_compra.total_a_transferir;
|
||||||
state.total_transporte = grupo_de_compra.total_transporte;
|
state.total_transporte = grupo_de_compra.total_transporte;
|
||||||
state.cantidad_transporte = grupo_de_compra.cantidad_transporte;
|
state.cantidad_transporte = grupo_de_compra.cantidad_transporte;
|
||||||
state.saldo = grupo_de_compra.saldo;
|
|
||||||
},
|
},
|
||||||
toggleCaracteristica(state, { caracteristica_id }) {
|
toggleCaracteristica(state, { caracteristica_id }) {
|
||||||
state[`${caracteristica_id}_habilitadas`] = !state[`${caracteristica_id}_habilitadas`];
|
state[`${caracteristica_id}_habilitadas`] = !state[`${caracteristica_id}_habilitadas`];
|
||||||
|
|
28
resources/js/store/modules/comisiones.js
vendored
28
resources/js/store/modules/comisiones.js
vendored
|
@ -1,28 +0,0 @@
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
const state = {
|
|
||||||
grupos_de_compra: null,
|
|
||||||
};
|
|
||||||
|
|
||||||
const mutations = {
|
|
||||||
setGruposDeCompra(state, { grupos_de_compra }) {
|
|
||||||
state.grupos_de_compra = grupos_de_compra;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const actions = {
|
|
||||||
async getGruposDeCompra({ commit }) {
|
|
||||||
const response = await axios.get('/api/grupos-de-compra');
|
|
||||||
commit('setGruposDeCompra', response.data);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const getters = {};
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state,
|
|
||||||
mutations,
|
|
||||||
actions,
|
|
||||||
getters,
|
|
||||||
};
|
|
|
@ -18,7 +18,6 @@ Route::middleware('api')->group(function() {
|
||||||
Route::get('/regiones/{region}', 'Api\GrupoDeCompraController@region');
|
Route::get('/regiones/{region}', 'Api\GrupoDeCompraController@region');
|
||||||
|
|
||||||
Route::prefix('grupos-de-compra')->group(function() {
|
Route::prefix('grupos-de-compra')->group(function() {
|
||||||
Route::get('/', 'Api\GrupoDeCompraController@index');
|
|
||||||
Route::get('/{grupoDeCompra}', 'Api\GrupoDeCompraController@show');
|
Route::get('/{grupoDeCompra}', 'Api\GrupoDeCompraController@show');
|
||||||
Route::post('/{gdc}/devoluciones', 'Api\GrupoDeCompraController@toggleDevoluciones');
|
Route::post('/{gdc}/devoluciones', 'Api\GrupoDeCompraController@toggleDevoluciones');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue