Commit f11af7f89cd7aa828213e4768922f0efbbf09a5e
1 parent
dfa9935fd7
Exists in
master
Cambio en interfaz de modal de despachos.
Showing
2 changed files
with
73 additions
and
29 deletions
Show diff stats
src/js/controllerCombustibles.js
1 | angular.module('focaCrearFactura') | 1 | angular.module('focaCrearFactura') |
2 | .controller('focaModalCombustiblesController', [ | 2 | .controller('focaModalCombustiblesController', [ |
3 | '$filter', | 3 | '$filter', |
4 | '$scope', | 4 | '$scope', |
5 | '$uibModalInstance', | 5 | '$uibModalInstance', |
6 | 'parametros', | 6 | 'parametros', |
7 | function($filter, $scope, $uibModalInstance, parametros) { | 7 | function ($filter, $scope, $uibModalInstance, parametros) { |
8 | 8 | ||
9 | $scope.mangueras = []; | 9 | $scope.mangueras = []; |
10 | 10 | $scope.nombreProducto = parametros.nombreProducto; | |
11 | $scope.colorTexto = { color: 'black' }; | ||
11 | var productosByMangera = []; | 12 | var productosByMangera = []; |
12 | 13 | ||
14 | setColorNombreProducto(); | ||
15 | |||
16 | //TODO: Cambiar switch case con los casos de nombres de productos axion | ||
17 | function setColorNombreProducto() { | ||
18 | |||
19 | // Diesel #FF852E | Euro+Diesel #6C389A | Premium #00A857 | Super #175AA5 | ||
20 | switch ($scope.nombreProducto) { | ||
21 | case 'NAFTA SUPER XXI': | ||
22 | $scope.colorTexto = { color: '#FF852E' }; | ||
23 | break; | ||
24 | case 'GO-INFINIA DIESEL': | ||
25 | $scope.colorTexto = { color: '#6C389A' }; | ||
26 | break; | ||
27 | case 'ULTRADIESEL XXI - RED': | ||
28 | $scope.colorTexto = { color: '#00A857' }; | ||
29 | break; | ||
30 | case 'NAFTA INFINIA': | ||
31 | $scope.colorTexto = { color: '#175AA5' }; | ||
32 | break; | ||
33 | default: | ||
34 | $scope.colorTexto = { color: 'black' }; | ||
35 | break; | ||
36 | } | ||
37 | } | ||
38 | |||
13 | parametros.despachos.forEach(function (despacho) { | 39 | parametros.despachos.forEach(function (despacho) { |
14 | 40 | ||
15 | var findCsu = productosByMangera.filter(function (csu) { | 41 | var findCsu = productosByMangera.filter(function (csu) { |
16 | return csu.csu == despacho.CSU.trim(); | 42 | return csu.csu == despacho.CSU.trim(); |
17 | })[0]; | 43 | })[0]; |
18 | 44 | ||
19 | if (!findCsu) { | 45 | if (!findCsu) { |
20 | 46 | ||
21 | var mangera = { | 47 | var mangera = { |
22 | csu: despacho.CSU.trim(), | 48 | csu: despacho.CSU.trim(), |
23 | despachos: [despacho] | 49 | despachos: [despacho] |
24 | }; | 50 | }; |
25 | 51 | ||
26 | productosByMangera.unshift(mangera); | 52 | productosByMangera.unshift(mangera); |
27 | } else { | 53 | } else { |
28 | findCsu.despachos.push(despacho); | 54 | findCsu.despachos.push(despacho); |
29 | } | 55 | } |
30 | }); | 56 | }); |
31 | 57 | ||
32 | $scope.mangueras = productosByMangera; | 58 | $scope.mangueras = productosByMangera; |
33 | 59 | ||
34 | $scope.aceptar = function (despacho) { | 60 | $scope.aceptar = function (despacho) { |
35 | $uibModalInstance.close(despacho); | 61 | $uibModalInstance.close(despacho); |
36 | }; | 62 | }; |
37 | 63 | ||
38 | $scope.cancel = function () { | 64 | $scope.cancel = function () { |
39 | $uibModalInstance.dismiss('cancel'); | 65 | $uibModalInstance.dismiss('cancel'); |
40 | }; | 66 | }; |
41 | } | 67 | } |
42 | ]); | 68 | ]); |
43 | 69 |
src/views/modal-combustibles.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">Despachos Disponibles</h5> | 4 | <h5 class="modal-title my-1"><b>Despachos Disponibles</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 | |||
10 | <div class="row pb-2 border-bottom"> | ||
11 | <div class="col"> | ||
12 | <p ng-style="colorTexto" class="m-1 h6"> | ||
13 | <b> | ||
14 | <i class="fa fa-circle" aria-hidden="true"></i> {{nombreProducto}} | ||
15 | </b> | ||
16 | </p> | ||
17 | </div> | ||
18 | </div> | ||
9 | <div ng-repeat="(key, manguera) in mangueras"> | 19 | <div ng-repeat="(key, manguera) in mangueras"> |
10 | <strong> | 20 | <div class="row my-2"> |
11 | Manguera {{manguera.csu}} | 21 | <div class="col"> |
12 | </strong> | 22 | <label> |
13 | <button type="button" class="btn" ng-click="manguera.show = !manguera.show"> | 23 | <img class="w-50" ng-src="./img/surtidor.png" alt=""> |
14 | <i ng-show="manguera.show" class="fa fa-minus"></i> | 24 | {{manguera.csu}} |
15 | <i ng-show="!manguera.show" class="fa fa-plus"></i> | 25 | </label> |
16 | </button> | 26 | <button |
17 | <table class="table table-sm" ng-show="manguera.show"> | 27 | type="button" |
18 | <tbody> | 28 | class="btn p-1 text-secondary float-right border" |
19 | <tr ng-repeat="(key, despacho) in manguera.despachos"> | 29 | ng-click="manguera.show = !manguera.show"> |
20 | <td ng-bind="despacho.FEC | date:'dd/MM/yyyy hh:MM:ss'"></td> | 30 | <i ng-show="manguera.show" class="fa fa-minus px-1"></i> |
21 | <td ng-bind="despacho.LTS"></td> | 31 | <i ng-show="!manguera.show" class="fa fa-plus px-1"></i> |
22 | <td ng-bind="despacho.IMP | currency: '$'"></td> | 32 | </button> |
23 | <td> | 33 | <table class="table table-sm table-striped" ng-show="manguera.show"> |
24 | <button | 34 | <tbody> |
25 | type="button" | 35 | <tr ng-repeat="(key, despacho) in manguera.despachos"> |
26 | class="btn btn-xs p-1 float-right" | 36 | <td class="py-2 py-sm-1" ng-bind="despacho.FEC | date:'dd/MM/yyyy hh:MM:ss'"></td> |
27 | title="Seleccionar" | 37 | <td class="py-2 py-sm-1" ng-bind="despacho.LTS"></td> |
28 | ng-click="aceptar(despacho)" | 38 | <td class="py-2 py-sm-1" ng-bind="despacho.IMP | currency: '$'"></td> |
29 | ><i class="fa fa-circle-thin" aria-hidden="true"></i> | 39 | <td class="py-2 py-sm-1"> |
30 | </button> | 40 | <button |
31 | </td> | 41 | type="button" |
32 | </tr> | 42 | class="btn btn-default btn-xs p-1 float-right" |
33 | </tbody> | 43 | title="Seleccionar" |
34 | </table> | 44 | ng-click="aceptar(despacho)" |
45 | ><i class="fa fa-circle-thin" aria-hidden="true"></i> | ||
46 | </button> | ||
47 | </td> | ||
48 | </tr> | ||
49 | </tbody> | ||
50 | </table> | ||
51 | </div> | ||
52 | </div> | ||
35 | </div> | 53 | </div> |
36 | 54 | ||
37 | </div> | 55 | </div> |
38 | <div class="modal-footer py-1"> | 56 | <div class="modal-footer py-2"> |
39 | <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda" class="mr-auto"> | 57 | <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda" class="mr-auto"> |
40 | <ul class="pagination pagination-sm mb-0"> | 58 | <ul class="pagination pagination-sm mb-0"> |
41 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | 59 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> |
42 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> | 60 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> |
43 | <span aria-hidden="true">«</span> | 61 | <span aria-hidden="true">«</span> |
44 | <span class="sr-only">Anterior</span> | 62 | <span class="sr-only">Anterior</span> |
45 | </a> | 63 | </a> |
46 | </li> | 64 | </li> |
47 | <li | 65 | <li |
48 | class="page-item" | 66 | class="page-item" |
49 | ng-repeat="pagina in paginas" | 67 | ng-repeat="pagina in paginas" |
50 | ng-class="{'active': pagina == currentPage}" | 68 | ng-class="{'active': pagina == currentPage}" |
51 | > | 69 | > |
52 | <a | 70 | <a |
53 | class="page-link" | 71 | class="page-link" |
54 | href="javascript:void();" | 72 | href="javascript:void();" |
55 | ng-click="selectPage(pagina)" | 73 | ng-click="selectPage(pagina)" |
56 | ng-bind="pagina" | 74 | ng-bind="pagina" |
57 | ></a> | 75 | ></a> |
58 | </li> | 76 | </li> |
59 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | 77 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> |
60 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> | 78 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> |
61 | <span aria-hidden="true">»</span> | 79 | <span aria-hidden="true">»</span> |
62 | <span class="sr-only">Siguiente</span> | 80 | <span class="sr-only">Siguiente</span> |
63 | </a> | 81 | </a> |
64 | </li> | 82 | </li> |
65 | </ul> | 83 | </ul> |
66 | </nav> | 84 | </nav> |
67 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 85 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
68 | </div> | 86 | </div> |
69 | 87 |