Commit f6c7d201b2f3b20b53fd27bda12bfe9973c0ffcc
1 parent
2e2bc802fc
Exists in
master
Cambio en data de ultimos despachos.
Showing
3 changed files
with
66 additions
and
35 deletions
Show diff stats
src/js/controllerUltimosDespachos.js
1 | angular.module('focaCrearFactura') | 1 | angular.module('focaCrearFactura') |
2 | .controller('ultimosDespachosController', [ | 2 | .controller('ultimosDespachosController', [ |
3 | '$filter', | 3 | '$filter', |
4 | '$scope', | 4 | '$scope', |
5 | '$uibModalInstance', | 5 | '$uibModalInstance', |
6 | 'crearFacturaService', | 6 | 'crearFacturaService', |
7 | 'parametros', | 7 | 'parametros', |
8 | function ($filter, $scope, $uibModalInstance, crearFacturaService, parametros) { | 8 | function ($filter, $scope, $uibModalInstance, crearFacturaService, parametros) { |
9 | 9 | ||
10 | config(); | 10 | config(); |
11 | 11 | ||
12 | function config() { | 12 | function config() { |
13 | 13 | ||
14 | $scope.productos = []; | ||
15 | |||
14 | crearFacturaService.getUltimosDespachos(parametros.planilla).then(function (res) { | 16 | crearFacturaService.getUltimosDespachos(parametros.planilla).then(function (res) { |
15 | $scope.productos = res.data.slice(1, res.data.length); | 17 | |
18 | res.data.slice(1, res.data.length).forEach(function (producto) { | ||
19 | |||
20 | producto.mangueras = []; | ||
21 | |||
22 | producto.despachos.forEach(function (despacho) { | ||
23 | |||
24 | var findCsu = producto.mangueras.filter(function (csu) { | ||
25 | return csu.csu === despacho.CSU.trim(); | ||
26 | })[0]; | ||
27 | |||
28 | if (!findCsu) { | ||
29 | |||
30 | var manguera = { | ||
31 | csu: despacho.CSU.trim(), | ||
32 | despachos: [despacho], | ||
33 | show: true | ||
34 | }; | ||
35 | |||
36 | producto.mangueras.unshift(manguera); | ||
37 | } else { | ||
38 | findCsu.despachos.push(despacho); | ||
39 | } | ||
40 | }); | ||
41 | |||
42 | $scope.productos.push(producto); | ||
43 | }); | ||
44 | |||
45 | console.log($scope.productos); | ||
46 | |||
16 | }); | 47 | }); |
17 | } | 48 | } |
18 | 49 | ||
19 | $scope.aceptar = function (despacho) { | 50 | $scope.aceptar = function (despacho) { |
20 | $uibModalInstance.close(despacho); | 51 | $uibModalInstance.close(despacho); |
21 | }; | 52 | }; |
22 | 53 | ||
23 | $scope.cancel = function () { | 54 | $scope.cancel = function () { |
24 | $uibModalInstance.dismiss('cancel'); | 55 | $uibModalInstance.dismiss('cancel'); |
25 | }; | 56 | }; |
26 | 57 | ||
27 | } | 58 | } |
28 | ]); | 59 | ]); |
29 | 60 |
src/js/service.js
1 | angular.module('focaCrearFactura') | 1 | angular.module('focaCrearFactura') |
2 | .service('crearFacturaService', ['$http', 'API_ENDPOINT', 'APP', | 2 | .service('crearFacturaService', ['$http', 'API_ENDPOINT', 'APP', |
3 | function ($http, API_ENDPOINT, APP) { | 3 | function ($http, API_ENDPOINT, APP) { |
4 | var route = API_ENDPOINT.URL; | 4 | var route = API_ENDPOINT.URL; |
5 | return { | 5 | return { |
6 | guardarFactura: function (factura) { | 6 | guardarFactura: function (factura) { |
7 | return $http.post(route + '/factura/guardar', factura); | 7 | return $http.post(route + '/factura/guardar', factura); |
8 | }, | 8 | }, |
9 | getParametros: function () { | 9 | getParametros: function () { |
10 | return $http.get(API_ENDPOINT.URL + '/parametros/factura'); | 10 | return $http.get(API_ENDPOINT.URL + '/parametros/factura'); |
11 | }, | 11 | }, |
12 | validarPlanillaVendedor: function (idVendedor) { | 12 | validarPlanillaVendedor: function (idVendedor) { |
13 | return $http.get(route + '/turnos/validar-planilla/' + idVendedor); | 13 | return $http.get(route + '/turnos/validar-planilla/' + idVendedor); |
14 | }, | 14 | }, |
15 | getProductosByPlanilla: function (numeroPlanilla) { | 15 | getProductosByPlanilla: function (numeroPlanilla) { |
16 | return $http.get(route + '/turnos/productos/' + numeroPlanilla); | 16 | return $http.get(route + '/turnos/productos/' + numeroPlanilla); |
17 | }, | 17 | }, |
18 | getUltimosDespachos: function (numeroPlanilla) { | 18 | getUltimosDespachos: function (numeroPlanilla) { |
19 | return $http.get(route + '/turnos/productos/' + numeroPlanilla + '/true'); | 19 | return $http.get('http://10.231.45.194:9900' + '/turnos/productos/' + numeroPlanilla + '/true'); |
20 | }, | 20 | }, |
21 | setearDespachoOcupado: function (parametros) { | 21 | setearDespachoOcupado: function (parametros) { |
22 | return $http.post(route + '/turnos/despacho-en-uso', parametros); | 22 | return $http.post(route + '/turnos/despacho-en-uso', parametros); |
23 | }, | 23 | }, |
24 | setearDespachoDesocupado: function (parametros) { | 24 | setearDespachoDesocupado: function (parametros) { |
25 | return $http.post(route + '/turnos/depacho-sin-uso', parametros); | 25 | return $http.post(route + '/turnos/depacho-sin-uso', parametros); |
26 | }, | 26 | }, |
27 | getResumenCuenta: function (idCliente) { | 27 | getResumenCuenta: function (idCliente) { |
28 | return $http.get(route + '/cliente/resumen-cuenta/' + idCliente); | 28 | return $http.get(route + '/cliente/resumen-cuenta/' + idCliente); |
29 | }, | 29 | }, |
30 | getVendedorPlayaById: function (id) { | 30 | getVendedorPlayaById: function (id) { |
31 | return $http.get(route + '/vendedor-playa/' + id); | 31 | return $http.get(route + '/vendedor-playa/' + id); |
32 | }, | 32 | }, |
33 | getBotonera: function () { | 33 | getBotonera: function () { |
34 | var vendedor = { | 34 | var vendedor = { |
35 | label: 'Vendedor', | 35 | label: 'Vendedor', |
36 | image: 'vendedor.png' | 36 | image: 'vendedor.png' |
37 | }; | 37 | }; |
38 | // $scope.botoneraProductos.push({ | 38 | // $scope.botoneraProductos.push({ |
39 | // label: 'Busqueda Productos', | 39 | // label: 'Busqueda Productos', |
40 | // image: 'buscarProductos.png', | 40 | // image: 'buscarProductos.png', |
41 | // imageDefault: 'productoDefault.png' | 41 | // imageDefault: 'productoDefault.png' |
42 | // }); | 42 | // }); |
43 | var botones = [ | 43 | var botones = [ |
44 | { | 44 | { |
45 | label: 'Cliente', | 45 | label: 'Cliente', |
46 | image: 'cliente.png' | 46 | image: 'cliente.png' |
47 | }, | 47 | }, |
48 | { | 48 | { |
49 | label: 'Busqueda Productos', | 49 | label: 'Busqueda Productos', |
50 | image: 'productos.png' | 50 | image: 'productos.png' |
51 | } | 51 | } |
52 | // { | 52 | // { |
53 | // label: 'Moneda', | 53 | // label: 'Moneda', |
54 | // image: 'moneda.png' | 54 | // image: 'moneda.png' |
55 | // }, | 55 | // }, |
56 | // { | 56 | // { |
57 | // label: 'Observaciones', | 57 | // label: 'Observaciones', |
58 | // image: 'botonObservaciones.png' | 58 | // image: 'botonObservaciones.png' |
59 | // } | 59 | // } |
60 | ]; | 60 | ]; |
61 | 61 | ||
62 | if (APP !== 'facturador') { | 62 | if (APP !== 'facturador') { |
63 | botones.unshift(vendedor); | 63 | botones.unshift(vendedor); |
64 | } | 64 | } |
65 | 65 | ||
66 | return botones; | 66 | return botones; |
67 | } | 67 | } |
68 | }; | 68 | }; |
69 | } | 69 | } |
70 | ]); | 70 | ]); |
71 | 71 |
src/views/modal-ultimos-despachos.html
1 | <div class="modal-header py-1"> | 1 | <div class="modal-header py-1"> |
2 | <div class="row w-100"> | 2 | <div class="row w-100"> |
3 | <div class="col-lg-6"> | 3 | <div class="col-lg-6"> |
4 | <h5 class="modal-title my-1"><b>Últimos Despachos</b></h5> | 4 | <h5 class="modal-title my-1"><b>Últimos Despachos</b></h5> |
5 | </div> | 5 | </div> |
6 | </div> | 6 | </div> |
7 | </div> | 7 | </div> |
8 | <div class="modal-body" id="modal-body"> | 8 | <div class="modal-body" id="modal-body"> |
9 | <div ng-repeat="(key, producto) in productos"> | 9 | <div ng-repeat="(key, producto) in productos"> |
10 | <div class="row pb-2 border-bottom"> | 10 | <div class="row pb-2 border-bottom"> |
11 | <div class="col"> | 11 | <div class="col"> |
12 | <p class="m-1 h6"> | 12 | <p class="m-1 h6"> |
13 | <b> | 13 | <b> |
14 | <i class="fa fa-circle" aria-hidden="true"></i> {{producto.DetArt}} | 14 | <i class="fa fa-circle" aria-hidden="true"></i> {{producto.DetArt}} |
15 | </b> | 15 | </b> |
16 | </p> | 16 | </p> |
17 | </div> | 17 | </div> |
18 | </div> | 18 | </div> |
19 | <div class="row my-2"> | 19 | <div class="row my-2" ng-repeat="(key, manguera) in producto.mangueras"> |
20 | <div class="col"> | 20 | <div class="col"> |
21 | <label> | 21 | <label> |
22 | <img class="w-50" ng-src="./img/surtidor.png" alt=""> | 22 | <img class="w-50" ng-src="./img/surtidor.png" alt=""> |
23 | {{producto.despachos[0].CSU}} | 23 | {{manguera.csu}} |
24 | </label> | 24 | </label> |
25 | <button | 25 | <button |
26 | type="button" | 26 | type="button" |
27 | class="btn p-1 text-secondary float-right border" | 27 | class="btn p-1 text-secondary float-right border" |
28 | ng-click="manguera.show = !manguera.show"> | 28 | ng-click="manguera.show = !manguera.show"> |
29 | <i ng-show="!manguera.show" class="fa fa-minus px-1"></i> | 29 | <i ng-show="manguera.show" class="fa fa-minus px-1"></i> |
30 | <i ng-show="manguera.show" class="fa fa-plus px-1"></i> | 30 | <i ng-show="!manguera.show" class="fa fa-plus px-1"></i> |
31 | </button> | 31 | </button> |
32 | <table class="table table-sm table-striped" ng-show="!manguera.show"> | 32 | <table class="table table-sm table-striped" ng-show="manguera.show"> |
33 | <tbody> | 33 | <tbody> |
34 | <tr> | 34 | <tr ng-repeat="despacho in manguera.despachos"> |
35 | <td class="py-2 py-sm-1" ng-bind="producto.despachos[0].FEC | date:'dd/MM/yyyy hh:MM:ss'"></td> | 35 | <td class="py-2 py-sm-1" ng-bind="despacho.FEC | date:'dd/MM/yyyy hh:MM:ss'"></td> |
36 | <td class="py-2 py-sm-1" ng-bind="producto.despachos[0].LTS"></td> | 36 | <td class="py-2 py-sm-1" ng-bind="despacho.LTS"></td> |
37 | <td class="py-2 py-sm-1" ng-bind="producto.despachos[0].IMP | currency: '$'"></td> | 37 | <td class="py-2 py-sm-1" ng-bind="despacho.IMP | currency: '$'"></td> |
38 | <td class="py-2 py-sm-1"> | 38 | <td class="py-2 py-sm-1"> |
39 | <button | 39 | <button |
40 | type="button" | 40 | type="button" |
41 | class="btn btn-default btn-xs p-1 float-right" | 41 | class="btn btn-default btn-xs p-1 float-right" |
42 | title="Seleccionar" | 42 | title="Seleccionar" |
43 | ng-click="aceptar(producto)" | 43 | ng-click="aceptar(producto)" |
44 | ><i class="fa fa-circle-thin" aria-hidden="true"></i> | 44 | ><i class="fa fa-circle-thin" aria-hidden="true"></i> |
45 | </button> | 45 | </button> |
46 | </td> | 46 | </td> |
47 | </tr> | 47 | </tr> |
48 | </tbody> | 48 | </tbody> |
49 | </table> | 49 | </table> |
50 | </div> | 50 | </div> |
51 | </div> | 51 | </div> |
52 | </div> | 52 | </div> |
53 | 53 | ||
54 | </div> | 54 | </div> |
55 | <div class="modal-footer py-2"> | 55 | <div class="modal-footer py-2"> |
56 | <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda" class="mr-auto"> | 56 | <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda" class="mr-auto"> |
57 | <ul class="pagination pagination-sm mb-0"> | 57 | <ul class="pagination pagination-sm mb-0"> |
58 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | 58 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> |
59 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> | 59 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> |
60 | <span aria-hidden="true">«</span> | 60 | <span aria-hidden="true">«</span> |
61 | <span class="sr-only">Anterior</span> | 61 | <span class="sr-only">Anterior</span> |
62 | </a> | 62 | </a> |
63 | </li> | 63 | </li> |
64 | <li | 64 | <li |
65 | class="page-item" | 65 | class="page-item" |
66 | ng-repeat="pagina in paginas" | 66 | ng-repeat="pagina in paginas" |
67 | ng-class="{'active': pagina == currentPage}" | 67 | ng-class="{'active': pagina == currentPage}" |
68 | > | 68 | > |
69 | <a | 69 | <a |
70 | class="page-link" | 70 | class="page-link" |
71 | href="javascript:void();" | 71 | href="javascript:void();" |
72 | ng-click="selectPage(pagina)" | 72 | ng-click="selectPage(pagina)" |
73 | ng-bind="pagina" | 73 | ng-bind="pagina" |
74 | ></a> | 74 | ></a> |
75 | </li> | 75 | </li> |
76 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | 76 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> |
77 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> | 77 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> |
78 | <span aria-hidden="true">»</span> | 78 | <span aria-hidden="true">»</span> |
79 | <span class="sr-only">Siguiente</span> | 79 | <span class="sr-only">Siguiente</span> |
80 | </a> | 80 | </a> |
81 | </li> | 81 | </li> |
82 | </ul> | 82 | </ul> |
83 | </nav> | 83 | </nav> |
84 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 84 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
85 | </div> | 85 | </div> |
86 | 86 |