Commit 651c7014b8909f9cedb4b143b16ab887d8e92014
Exists in
master
Merge branch 'master' into 'develop'
Master(mpuebla) See merge request !13
Showing
2 changed files
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.colorTexto = { color: 'black' }; | |
11 | var productosByMangera = []; | 11 | var productosByMangera = []; |
12 | |||
13 | config(); | ||
14 | |||
15 | function config() { | ||
12 | 16 | ||
13 | parametros.despachos.forEach(function (despacho) { | 17 | $scope.nombreProducto = parametros.nombreProducto; |
14 | 18 | setColorNombreProducto(); | |
15 | var findCsu = productosByMangera.filter(function (csu) { | 19 | parametros.despachos.forEach(function (despacho) { |
16 | return csu.csu == despacho.CSU.trim(); | 20 | |
17 | })[0]; | 21 | var findCsu = productosByMangera.filter(function (csu) { |
18 | 22 | return csu.csu == despacho.CSU.trim(); | |
19 | if (!findCsu) { | 23 | })[0]; |
20 | 24 | ||
21 | var mangera = { | 25 | if (!findCsu) { |
22 | csu: despacho.CSU.trim(), | 26 | |
23 | despachos: [despacho] | 27 | var mangera = { |
24 | }; | 28 | csu: despacho.CSU.trim(), |
25 | 29 | despachos: [despacho] | |
26 | productosByMangera.unshift(mangera); | 30 | }; |
27 | } else { | 31 | |
28 | findCsu.despachos.push(despacho); | 32 | productosByMangera.unshift(mangera); |
29 | } | 33 | } else { |
30 | }); | 34 | findCsu.despachos.push(despacho); |
35 | } | ||
36 | }); | ||
37 | } | ||
31 | 38 | ||
32 | $scope.mangueras = productosByMangera; | 39 | $scope.mangueras = productosByMangera; |
33 | 40 | ||
34 | $scope.aceptar = function (despacho) { | 41 | $scope.aceptar = function (despacho) { |
35 | $uibModalInstance.close(despacho); | 42 | $uibModalInstance.close(despacho); |
36 | }; | 43 | }; |
37 | 44 | ||
38 | $scope.cancel = function () { | 45 | $scope.cancel = function () { |
39 | $uibModalInstance.dismiss('cancel'); | 46 | $uibModalInstance.dismiss('cancel'); |
40 | }; | 47 | }; |
48 | |||
49 | //TODO: Cambiar switch case con los casos de nombres de productos axion | ||
50 | function setColorNombreProducto() { | ||
51 | |||
52 | // Diesel #FF852E | Euro+Diesel #6C389A | Premium #00A857 | Super #175AA5 | ||
53 | switch ($scope.nombreProducto) { | ||
54 | case 'NAFTA SUPER XXI': | ||
55 | $scope.colorTexto = { color: '#FF852E' }; | ||
56 | break; | ||
57 | case 'GO-INFINIA DIESEL': | ||
58 | $scope.colorTexto = { color: '#6C389A' }; | ||
59 | break; | ||
60 | case 'ULTRADIESEL XXI - RED': | ||
61 | $scope.colorTexto = { color: '#00A857' }; | ||
62 | break; | ||
63 | case 'NAFTA INFINIA': | ||
64 | $scope.colorTexto = { color: '#175AA5' }; | ||
65 | break; | ||
66 | default: | ||
67 | $scope.colorTexto = { color: 'black' }; | ||
68 | break; | ||
69 | } | ||
70 | } | ||
41 | } | 71 | } |
42 | ]); | 72 | ]); |
43 | 73 |
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 |