lista de subpedidos del barrio loggeado

This commit is contained in:
Ale 2022-06-08 20:32:50 -03:00
parent dd1b66bd06
commit b0f25de000
23 changed files with 25316 additions and 85 deletions

9
.directory Normal file
View File

@ -0,0 +1,9 @@
[Dolphin]
HeaderColumnWidths=372,72,103
SortRole=modificationtime
Timestamp=2022,6,1,16,36,48
Version=4
ViewMode=1
[Settings]
HiddenFilesShown=true

View File

@ -10,4 +10,8 @@ class AdminController extends Controller
{
return view('auth/admin_login');
}
public function index() {
return view('auth/admin_subpedidos');
}
}

View File

@ -27,6 +27,11 @@ class SubpedidoController extends Controller
return Subpedido::filtrar($filtros)->get();
}
public function indexResources(FiltroDeSubpedido $filtros, Request $request)
{
return SubpedidoResource::collection(Subpedido::filtrar($filtros)->get());
}
/**
* Store a newly created resource in storage.
*

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
@ -28,6 +29,16 @@ class LoginController extends Controller
*/
protected $redirectTo = RouteServiceProvider::HOME;
protected function authenticated(Request $request, $user)
{
if ($user->is_admin) {
session(['admin_gdc' => $user->grupo_de_compra_id]);
return redirect('admin/pedidos');
} else {
return redirect('/');
}
}
/**
* Create a new controller instance.
*

View File

@ -23,7 +23,8 @@ class SubpedidoResource extends JsonResource
'subtotal_bonos_de_transporte' => number_format($this->getSubtotalBDT(),0),
'total' => number_format($this->getTotal(),0),
'grupo_de_compra' => $this->grupoDeCompra,
'productos' => $this->productos
'productos' => $this->productos,
'aprobado' => (bool) $this->aprobado
];
}
}

View File

@ -29,7 +29,6 @@ class Subpedido extends Model
return $this->productos()->where('bono',false);
}
public function grupoDeCompra()
{
return $this->belongsTo('App\GrupoDeCompra');
@ -65,7 +64,6 @@ class Subpedido extends Model
return $this->bonos()->sum('total');
}
public function getTotal()
{
return $this->getSubtotalProductos() + $this->getSubtotalBDT() + $this->getSubtotalBonos();

View File

@ -19,6 +19,8 @@ class CreateUsersTable extends Migration
$table->string('email')->unique()->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->foreignId('grupo_de_compra_id')->nullable();
$table->boolean('is_admin');
$table->unique(['name', 'is_admin']);
$table->string('password');
$table->rememberToken();
$table->timestamps();

View File

@ -17,7 +17,7 @@ class CreateSubpedidosTable extends Migration
$table->id();
$table->string('nombre');
$table->foreignId('grupo_de_compra_id');
$table->boolean('aprobado')->nullable();
$table->boolean('aprobado')->default(false);
$table->timestamps();
});

View File

@ -1,43 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePedidosView extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("CREATE VIEW pedidos AS
SELECT
g.id as grupo_de_compra_id,
g.nombre as grupo_de_compra_nombre,
g.region as grupo_de_compra_region,
pr.id AS producto_id,
pr.nombre as producto_nombre,
pr.precio as producto_precio,
SUM(ps.cantidad) as cantidad_pedida,
pr.precio*SUM(ps.cantidad) as total_por_producto
FROM grupos_de_compra g
JOIN subpedidos s ON (s.grupo_de_compra_id = g.id)
JOIN producto_subpedido ps ON (ps.subpedido_id = s.id)
JOIN productos pr ON (pr.id = ps.producto_id)
GROUP BY g.id, g.nombre, pr.id, pr.nombre;"
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement("DROP VIEW pedidos");
}
}

View File

@ -32,16 +32,24 @@ class GrupoDeCompraSeeder extends Seeder
$usersToInsert[] = [
'name' => $registro['barrio'],
'password' => Hash::make($registro['barrio']),
"is_admin" => 0,
'grupo_de_compra_id' => $key
];
$usersToInsert[] = [
'name' => $registro['barrio'] . "_admin",
'password' => Hash::make($registro['barrio'] . "admin"),
"is_admin" => 1,
'grupo_de_compra_id' => $key
];
}
foreach (array_chunk($gdcToInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk)
foreach (array_chunk($gdcToInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk)
{
DB::table('grupos_de_compra')->insert($chunk);
DB::table('grupos_de_compra')->insert($chunk);
}
foreach (array_chunk($usersToInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk)
foreach (array_chunk($usersToInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk)
{
DB::table('users')->insert($chunk);
}

24570
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

559
public/js/app.js vendored
View File

@ -1954,6 +1954,8 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
data: function data() {
return {
@ -1962,7 +1964,7 @@ __webpack_require__.r(__webpack_exports__);
gdcs: [],
isDefaultDisabled: 0,
gdc: null,
whiteText: this.admin == null ? false : this.admin
isAdmin: this.admin == null ? false : this.admin
};
},
mounted: function mounted() {
@ -2024,6 +2026,43 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=script&lang=js&":
/*!*********************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=script&lang=js& ***!
\*********************************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: "BotonAdminSubpedidoRow",
props: {
'subpedido': Object
},
data: function data() {
return {
mensaje: this.aprobado ? "Desaprobar pedido" : "Aprobar pedido"
};
},
methods: {
toggleAprobacion: function toggleAprobacion() {
alert("Hay que implementarlo con axios o algo de eso");
}
}
});
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CategoriasContainer.vue?vue&type=script&lang=js&":
/*!******************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CategoriasContainer.vue?vue&type=script&lang=js& ***!
@ -2201,7 +2240,6 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
data: function data() {
return {
@ -2247,7 +2285,6 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: "LoginAdmin.vue",
data: function data() {
@ -2703,6 +2740,37 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/SubpedidoRow.vue?vue&type=script&lang=js&":
/*!***********************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/SubpedidoRow.vue?vue&type=script&lang=js& ***!
\***********************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _BotonAdminSubpedidoRow__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BotonAdminSubpedidoRow */ "./resources/js/components/BotonAdminSubpedidoRow.vue");
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: "SubpedidoRow",
components: {
BotonAdminSubpedidoRow: _BotonAdminSubpedidoRow__WEBPACK_IMPORTED_MODULE_0__["default"]
},
props: {
subpedido: Object
}
});
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/SubpedidoSelect.vue?vue&type=script&lang=js&":
/*!**************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/SubpedidoSelect.vue?vue&type=script&lang=js& ***!
@ -2742,6 +2810,7 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
data: function data() {
return {
@ -2808,6 +2877,72 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/SubpedidosGdc.vue?vue&type=script&lang=js&":
/*!************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/SubpedidosGdc.vue?vue&type=script&lang=js& ***!
\************************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _SubpedidoRow__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SubpedidoRow */ "./resources/js/components/SubpedidoRow.vue");
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: "SubpedidosGdc",
components: {
SubpedidoRow: _SubpedidoRow__WEBPACK_IMPORTED_MODULE_0__["default"]
},
data: function data() {
return {
gdc: null,
subpedidos: []
};
},
beforeCreate: function beforeCreate() {
var _this = this;
axios.get("/admin/obtener_sesion").then(function (response) {
_this.gdc = response.data.gdc;
_this.fetchSubpedidos();
});
},
methods: {
fetchSubpedidos: function fetchSubpedidos() {
var _this2 = this;
axios.get("/api/subpedidos/resources").then(function (response) {
_this2.subpedidos = response.data.data;
});
}
}
});
/***/ }),
/***/ "./node_modules/bulma-toast/dist/bulma-toast.min.js":
/*!**********************************************************!*\
!*** ./node_modules/bulma-toast/dist/bulma-toast.min.js ***!
@ -4234,10 +4369,7 @@ var render = function () {
_c("div", { staticClass: "field" }, [
_c(
"label",
{
staticClass: "label",
class: _vm.whiteText ? "has-text-white" : "",
},
{ staticClass: "label", class: _vm.isAdmin ? "has-text-white" : "" },
[_vm._v("Seleccioná tu barrio o grupo de compra")]
),
_vm._v(" "),
@ -4288,8 +4420,12 @@ var render = function () {
_vm._v(" "),
_vm._l(_vm.gdcs, function (gdc) {
return _c("option", {
attrs: { name: gdc.nombre },
domProps: { textContent: _vm._s(gdc.nombre) },
attrs: { name: gdc.nombre + (_vm.isAdmin ? "_admin" : "") },
domProps: {
textContent: _vm._s(
gdc.nombre + (_vm.isAdmin ? "_admin" : "")
),
},
})
}),
],
@ -4352,6 +4488,47 @@ render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=template&id=048436e9&scoped=true&":
/*!*************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=template&id=048436e9&scoped=true& ***!
\*************************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"button",
{
staticClass: "button",
class: _vm.subpedido.aprobado ? "is-danger" : "is-success",
on: { click: _vm.toggleAprobacion },
},
[
_c("span", { staticClass: "icon is-small" }, [
_c("i", {
staticClass: "fas",
class: _vm.subpedido.aprobado ? "fa-times" : "fa-check",
}),
]),
_vm._v(" "),
_c("span", [_vm._v(_vm._s(_vm.mensaje))]),
]
)
}
var staticRenderFns = []
render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CategoriasContainer.vue?vue&type=template&id=a958dfb4&":
@ -4725,7 +4902,7 @@ var staticRenderFns = [
return _c("div", { staticClass: "field" }, [
_c("div", { staticClass: "control" }, [
_c("input", {
staticClass: "button is-success",
staticClass: "button is-warning",
attrs: { type: "submit", value: "Ingresar" },
}),
]),
@ -5442,6 +5619,44 @@ render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/SubpedidoRow.vue?vue&type=template&id=9eca5900&scoped=true&":
/*!***************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/SubpedidoRow.vue?vue&type=template&id=9eca5900&scoped=true& ***!
\***************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("tr", [
_c("td", [_vm._v(_vm._s(_vm.subpedido.nombre))]),
_vm._v(" "),
_c("td", [_vm._v(_vm._s(_vm.subpedido.total))]),
_vm._v(" "),
_c(
"td",
[
_c("boton-admin-subpedido-row", {
attrs: { subpedido: _vm.subpedido },
}),
],
1
),
])
}
var staticRenderFns = []
render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/SubpedidoSelect.vue?vue&type=template&id=bdbffa74&":
@ -5603,6 +5818,118 @@ render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/SubpedidosGdc.vue?vue&type=template&id=652b385d&scoped=true&":
/*!****************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/SubpedidosGdc.vue?vue&type=template&id=652b385d&scoped=true& ***!
\****************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{
directives: [
{
name: "show",
rawName: "v-show",
value: !_vm.init,
expression: "!init",
},
],
staticClass:
"container table-container chismosa-container is-max-widescreen is-max-desktop animate__animated",
class: _vm.animation,
},
[
_c(
"table",
{
directives: [
{
name: "show",
rawName: "v-show",
value: this.subpedidos.length !== 0,
expression: "this.subpedidos.length !== 0",
},
],
staticClass: "table is-fullwidth is-striped is-bordered",
},
[
_vm._m(0),
_vm._v(" "),
_c(
"tbody",
_vm._l(this.subpedidos, function (subpedido) {
return _c("subpedido-row", {
key: subpedido.id,
attrs: { subpedido: subpedido },
})
}),
1
),
]
),
_vm._v(" "),
_c(
"p",
{
directives: [
{
name: "show",
rawName: "v-show",
value: this.subpedidos.length === 0,
expression: "this.subpedidos.length === 0",
},
],
staticClass: "has-text-centered",
},
[
_vm._v(
"\n Todavía no hay ningún pedido para administrar.\n "
),
]
),
]
)
}
var staticRenderFns = [
function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("thead", [
_c("tr", [
_c("th", [_vm._v("Núcleo")]),
_vm._v(" "),
_c("th", [
_c("abbr", { attrs: { title: "Total a Pagar" } }, [
_vm._v("Total $"),
]),
]),
_vm._v(" "),
_c("th", [
_c("abbr", { attrs: { title: "Aprobacion" } }, [
_vm._v("Aprobación"),
]),
]),
]),
])
},
]
render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
@ -17793,6 +18120,7 @@ module.exports = g;
var map = {
"./components/BarrioSelect.vue": "./resources/js/components/BarrioSelect.vue",
"./components/BotonAdminLogin.vue": "./resources/js/components/BotonAdminLogin.vue",
"./components/BotonAdminSubpedidoRow.vue": "./resources/js/components/BotonAdminSubpedidoRow.vue",
"./components/CategoriasContainer.vue": "./resources/js/components/CategoriasContainer.vue",
"./components/Chismosa.vue": "./resources/js/components/Chismosa.vue",
"./components/Login.vue": "./resources/js/components/Login.vue",
@ -17803,7 +18131,9 @@ var map = {
"./components/ProductoRow.vue": "./resources/js/components/ProductoRow.vue",
"./components/ProductosContainer.vue": "./resources/js/components/ProductosContainer.vue",
"./components/RegionSelect.vue": "./resources/js/components/RegionSelect.vue",
"./components/SubpedidoSelect.vue": "./resources/js/components/SubpedidoSelect.vue"
"./components/SubpedidoRow.vue": "./resources/js/components/SubpedidoRow.vue",
"./components/SubpedidoSelect.vue": "./resources/js/components/SubpedidoSelect.vue",
"./components/SubpedidosGdc.vue": "./resources/js/components/SubpedidosGdc.vue"
};
@ -18013,6 +18343,75 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./resources/js/components/BotonAdminSubpedidoRow.vue":
/*!************************************************************!*\
!*** ./resources/js/components/BotonAdminSubpedidoRow.vue ***!
\************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _BotonAdminSubpedidoRow_vue_vue_type_template_id_048436e9_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BotonAdminSubpedidoRow.vue?vue&type=template&id=048436e9&scoped=true& */ "./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=template&id=048436e9&scoped=true&");
/* harmony import */ var _BotonAdminSubpedidoRow_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BotonAdminSubpedidoRow.vue?vue&type=script&lang=js& */ "./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
/* normalize component */
var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
_BotonAdminSubpedidoRow_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_BotonAdminSubpedidoRow_vue_vue_type_template_id_048436e9_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
_BotonAdminSubpedidoRow_vue_vue_type_template_id_048436e9_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
false,
null,
"048436e9",
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "resources/js/components/BotonAdminSubpedidoRow.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
/***/ }),
/***/ "./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=script&lang=js&":
/*!*************************************************************************************!*\
!*** ./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=script&lang=js& ***!
\*************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_BotonAdminSubpedidoRow_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./BotonAdminSubpedidoRow.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_BotonAdminSubpedidoRow_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
/***/ }),
/***/ "./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=template&id=048436e9&scoped=true&":
/*!*******************************************************************************************************!*\
!*** ./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=template&id=048436e9&scoped=true& ***!
\*******************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_BotonAdminSubpedidoRow_vue_vue_type_template_id_048436e9_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./BotonAdminSubpedidoRow.vue?vue&type=template&id=048436e9&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/BotonAdminSubpedidoRow.vue?vue&type=template&id=048436e9&scoped=true&");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_BotonAdminSubpedidoRow_vue_vue_type_template_id_048436e9_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_BotonAdminSubpedidoRow_vue_vue_type_template_id_048436e9_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/***/ }),
/***/ "./resources/js/components/CategoriasContainer.vue":
@ -18811,6 +19210,75 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./resources/js/components/SubpedidoRow.vue":
/*!**************************************************!*\
!*** ./resources/js/components/SubpedidoRow.vue ***!
\**************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _SubpedidoRow_vue_vue_type_template_id_9eca5900_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SubpedidoRow.vue?vue&type=template&id=9eca5900&scoped=true& */ "./resources/js/components/SubpedidoRow.vue?vue&type=template&id=9eca5900&scoped=true&");
/* harmony import */ var _SubpedidoRow_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SubpedidoRow.vue?vue&type=script&lang=js& */ "./resources/js/components/SubpedidoRow.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
/* normalize component */
var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
_SubpedidoRow_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_SubpedidoRow_vue_vue_type_template_id_9eca5900_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
_SubpedidoRow_vue_vue_type_template_id_9eca5900_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
false,
null,
"9eca5900",
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "resources/js/components/SubpedidoRow.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
/***/ }),
/***/ "./resources/js/components/SubpedidoRow.vue?vue&type=script&lang=js&":
/*!***************************************************************************!*\
!*** ./resources/js/components/SubpedidoRow.vue?vue&type=script&lang=js& ***!
\***************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_SubpedidoRow_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./SubpedidoRow.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/SubpedidoRow.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_SubpedidoRow_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
/***/ }),
/***/ "./resources/js/components/SubpedidoRow.vue?vue&type=template&id=9eca5900&scoped=true&":
/*!*********************************************************************************************!*\
!*** ./resources/js/components/SubpedidoRow.vue?vue&type=template&id=9eca5900&scoped=true& ***!
\*********************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_SubpedidoRow_vue_vue_type_template_id_9eca5900_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./SubpedidoRow.vue?vue&type=template&id=9eca5900&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/SubpedidoRow.vue?vue&type=template&id=9eca5900&scoped=true&");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_SubpedidoRow_vue_vue_type_template_id_9eca5900_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_SubpedidoRow_vue_vue_type_template_id_9eca5900_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/***/ }),
/***/ "./resources/js/components/SubpedidoSelect.vue":
@ -18880,6 +19348,75 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./resources/js/components/SubpedidosGdc.vue":
/*!***************************************************!*\
!*** ./resources/js/components/SubpedidosGdc.vue ***!
\***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _SubpedidosGdc_vue_vue_type_template_id_652b385d_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SubpedidosGdc.vue?vue&type=template&id=652b385d&scoped=true& */ "./resources/js/components/SubpedidosGdc.vue?vue&type=template&id=652b385d&scoped=true&");
/* harmony import */ var _SubpedidosGdc_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SubpedidosGdc.vue?vue&type=script&lang=js& */ "./resources/js/components/SubpedidosGdc.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
/* normalize component */
var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
_SubpedidosGdc_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_SubpedidosGdc_vue_vue_type_template_id_652b385d_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
_SubpedidosGdc_vue_vue_type_template_id_652b385d_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
false,
null,
"652b385d",
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "resources/js/components/SubpedidosGdc.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
/***/ }),
/***/ "./resources/js/components/SubpedidosGdc.vue?vue&type=script&lang=js&":
/*!****************************************************************************!*\
!*** ./resources/js/components/SubpedidosGdc.vue?vue&type=script&lang=js& ***!
\****************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_SubpedidosGdc_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./SubpedidosGdc.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/SubpedidosGdc.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_SubpedidosGdc_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
/***/ }),
/***/ "./resources/js/components/SubpedidosGdc.vue?vue&type=template&id=652b385d&scoped=true&":
/*!**********************************************************************************************!*\
!*** ./resources/js/components/SubpedidosGdc.vue?vue&type=template&id=652b385d&scoped=true& ***!
\**********************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_SubpedidosGdc_vue_vue_type_template_id_652b385d_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./SubpedidosGdc.vue?vue&type=template&id=652b385d&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/SubpedidosGdc.vue?vue&type=template&id=652b385d&scoped=true&");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_SubpedidosGdc_vue_vue_type_template_id_652b385d_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_SubpedidosGdc_vue_vue_type_template_id_652b385d_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/***/ }),
/***/ "./resources/sass/app.scss":

View File

@ -1,12 +1,14 @@
<template>
<div v-show="visible" class="block">
<div class="field">
<label class="label" :class="whiteText ? 'has-text-white' : ''">Seleccioná tu barrio o grupo de compra</label>
<label class="label" :class="isAdmin ? 'has-text-white' : ''">Seleccioná tu barrio o grupo de compra</label>
<div class="control">
<div class="select">
<select @change="onGDCSelected" v-model="gdc" name="name">
<option :disabled="isDefaultDisabled==1" value=null>Seleccionar</option>
<option v-for="gdc in gdcs" v-text="gdc.nombre" :name="gdc.nombre"></option>
<option v-for="gdc in gdcs" v-text="gdc.nombre + (isAdmin ? '_admin' : '')"
:name="gdc.nombre + (isAdmin ? '_admin' : '')">
</option>
</select>
</div>
</div>
@ -23,7 +25,7 @@
gdcs: [],
isDefaultDisabled: 0,
gdc: null,
whiteText: this.admin == null ? false : this.admin
isAdmin: this.admin == null ? false : this.admin
}
},
mounted() {

View File

@ -0,0 +1,29 @@
<template>
<button class="button" :class="subpedido.aprobado ? 'is-danger' : 'is-success'" @click="toggleAprobacion">
<span class="icon is-small">
<i class="fas" :class="subpedido.aprobado ? 'fa-times' : 'fa-check'"></i>
</span>
<span>{{ mensaje }}</span>
</button>
</template>
<script>
export default {
name: "BotonAdminSubpedidoRow",
props: {'subpedido': Object},
data() {
return {
mensaje: this.aprobado ? "Desaprobar pedido" : "Aprobar pedido"
}
},
methods: {
toggleAprobacion() {
alert("Hay que implementarlo con axios o algo de eso")
}
}
}
</script>
<style scoped>
</style>

View File

@ -9,8 +9,7 @@
</div>
<div class="field">
<div class="control">
<input type="submit" class="button is-success" value="Ingresar">
</input>
<input type="submit" class="button is-success" value="Ingresar"/>
</div>
</div>
</div>
@ -37,4 +36,4 @@
.help {
font-size: 1rem;
}
</style>
</style>

View File

@ -9,8 +9,7 @@
</div>
<div class="field">
<div class="control">
<input type="submit" class="button is-success" value="Ingresar">
</input>
<input type="submit" class="button is-warning" value="Ingresar"/>
</div>
</div>
</div>

View File

@ -29,6 +29,6 @@
Event.$emit("sync-subpedido", 0, this.producto.id);
Event.$emit("sync-subpedido");
}
}
}
}
</script>
</script>

View File

@ -0,0 +1,22 @@
<template>
<tr>
<td>{{ subpedido.nombre }}</td>
<td>{{ subpedido.total }}</td>
<td><boton-admin-subpedido-row :subpedido="subpedido"></boton-admin-subpedido-row></td>
</tr>
</template>
<script>
import BotonAdminSubpedidoRow from "./BotonAdminSubpedidoRow";
export default {
name: "SubpedidoRow",
components: {BotonAdminSubpedidoRow},
props: {
subpedido: Object
}
}
</script>
<style scoped>
</style>

View File

@ -5,7 +5,7 @@
<div class="column is-two-thirds">
<div class="field">
<div class="control">
<input class="input" @input="onType" v-model="subpedido"></input>
<input class="input" @input="onType" v-model="subpedido"/>
</div>
<p class="help">Debe ser claro para que tus compas del barrio te identifiquen.</p>
</div>
@ -14,18 +14,19 @@
<button class="button is-danger" v-show="!botonCrearDesabilitado" @click="submit">Crear nuevo pedido</button>
</div>
</div>
<div v-if="subpedidosExistentes.length" class="block">
<label class="label">Si ya comenzaste a hacer tu pedido este mes, elegilo en esta lista:</label>
<p class="help">Podés seguir escribiendo en el campo de arriba para refinar la búsqueda.</p>
<div class="columns is-mobile" v-for="(subpedidoExistente, index) in subpedidosExistentes" :class="{'has-background-grey-lighter': index % 2}">
<div class="column is-half-mobile is-two-thirds-desktop is-two-thirds-tablet"><p style="padding-top: calc(.5em - 1px); margin-bottom: .5rem" v-text="subpedidoExistente.nombre"></p></div>
<div class="buttons column is-half-mobile is-one-third-desktop is-one-third-tablet">
<button class="button is-danger" @click="elegirSubpedido(subpedidoExistente)">Continuar pedido</button>
</div>
</div>
</div>
</div>
</div>
<div v-if="subpedidosExistentes.length" class="block">
<label class="label">Si ya comenzaste a hacer tu pedido este mes, elegilo en esta lista:</label>
<p class="help">Podés seguir escribiendo en el campo de arriba para refinar la búsqueda.</p>
<div class="columns is-mobile" v-for="(subpedidoExistente, index) in subpedidosExistentes" :class="{'has-background-grey-lighter': index % 2}">
<div class="column is-half-mobile is-two-thirds-desktop is-two-thirds-tablet">
<p style="padding-top: calc(.5em - 1px); margin-bottom: .5rem" v-text="subpedidoExistente.nombre"></p>
</div>
<div class="buttons column is-half-mobile is-one-third-desktop is-one-third-tablet">
<button class="button is-danger" @click="elegirSubpedido(subpedidoExistente)">Continuar pedido</button>
</div>
</div>
</div>
</div>
</template>
<script>
@ -85,4 +86,4 @@
}
}
}
</script>
</script>

View File

@ -0,0 +1,52 @@
<template>
<div class="container table-container chismosa-container is-max-widescreen is-max-desktop animate__animated" :class="animation" v-show="!init">
<table v-show="this.subpedidos.length !== 0" class="table is-fullwidth is-striped is-bordered">
<thead>
<tr>
<th>Núcleo</th>
<th><abbr title="Total a Pagar">Total $</abbr></th>
<th><abbr title="Aprobacion">Aprobación</abbr></th>
</tr>
</thead>
<tbody>
<subpedido-row v-for="subpedido in this.subpedidos"
:subpedido="subpedido" :key="subpedido.id">
</subpedido-row>
</tbody>
</table>
<p class="has-text-centered" v-show="this.subpedidos.length === 0">
Todavía no hay ningún pedido para administrar.
</p>
</div>
</template>
<script>
import SubpedidoRow from "./SubpedidoRow";
export default {
name: "SubpedidosGdc",
components: {SubpedidoRow},
data() {
return {
gdc: null,
subpedidos: []
}
},
beforeCreate() {
axios.get("/admin/obtener_sesion").then(response => {
this.gdc = response.data.gdc;
this.fetchSubpedidos();
});
},
methods: {
fetchSubpedidos() {
axios.get("/api/subpedidos/resources").then(response => {
this.subpedidos = response.data.data
});
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,11 @@
@extends('layouts.app')
@section('content')
<subpedidos-gdc></subpedidos-gdc>
@endsection
<script>
import SubpedidosGdc from "../../js/components/SubpedidosGdc";
export default {
components: {SubpedidosGdc}
}
</script>

View File

@ -34,6 +34,7 @@ Route::middleware('api')->group(function () {
Route::prefix('subpedidos')->group(function () {
Route::get('/','Api\SubpedidoController@index');
Route::get('/resources', 'Api\SubpedidoController@indexResources');
Route::get('{subpedido}','Api\SubpedidoController@show');
Route::post('/','Api\SubpedidoController@store');
Route::post('/{subpedido}/sync', 'Api\SubpedidoController@syncProductos');

View File

@ -25,6 +25,19 @@ Route::get('/productos', 'ProductoController@index')->name('productos.index');
Route::get('/admin', 'AdminController@show')->name('admin_login.show');
Route::get('/admin/pedidos', 'AdminController@index')->name('admin_login.index');
Route::get('/admin/obtener_sesion', function() {
$sesion = [
'gdc' => session("admin_gdc")
];
return $sesion;
})->name('admin_obtener_sesion');
Route::middleware(['auth', 'admin'])->group( function () {
});
Route::middleware('auth')->group( function() {
Route::name('subpedidos.')->prefix("subpedidos")->group( function() {