Commit 651c7014b8909f9cedb4b143b16ab887d8e92014

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'develop'

Master(mpuebla)

See merge request !13
src/js/controllerCombustibles.js
... ... @@ -4,30 +4,37 @@ angular.module('focaCrearFactura')
4 4 '$scope',
5 5 '$uibModalInstance',
6 6 'parametros',
7   - function($filter, $scope, $uibModalInstance, parametros) {
  7 + function ($filter, $scope, $uibModalInstance, parametros) {
8 8  
9 9 $scope.mangueras = [];
10   -
  10 + $scope.colorTexto = { color: 'black' };
11 11 var productosByMangera = [];
  12 +
  13 + config();
  14 +
  15 + function config() {
12 16  
13   - parametros.despachos.forEach(function (despacho) {
14   -
15   - var findCsu = productosByMangera.filter(function (csu) {
16   - return csu.csu == despacho.CSU.trim();
17   - })[0];
18   -
19   - if (!findCsu) {
20   -
21   - var mangera = {
22   - csu: despacho.CSU.trim(),
23   - despachos: [despacho]
24   - };
25   -
26   - productosByMangera.unshift(mangera);
27   - } else {
28   - findCsu.despachos.push(despacho);
29   - }
30   - });
  17 + $scope.nombreProducto = parametros.nombreProducto;
  18 + setColorNombreProducto();
  19 + parametros.despachos.forEach(function (despacho) {
  20 +
  21 + var findCsu = productosByMangera.filter(function (csu) {
  22 + return csu.csu == despacho.CSU.trim();
  23 + })[0];
  24 +
  25 + if (!findCsu) {
  26 +
  27 + var mangera = {
  28 + csu: despacho.CSU.trim(),
  29 + despachos: [despacho]
  30 + };
  31 +
  32 + productosByMangera.unshift(mangera);
  33 + } else {
  34 + findCsu.despachos.push(despacho);
  35 + }
  36 + });
  37 + }
31 38  
32 39 $scope.mangueras = productosByMangera;
33 40  
... ... @@ -38,5 +45,28 @@ angular.module('focaCrearFactura')
38 45 $scope.cancel = function () {
39 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 ]);
src/views/modal-combustibles.html
1 1 <div class="modal-header py-1">
2 2 <div class="row w-100">
3 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 5 </div>
6 6 </div>
7 7 </div>
8 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>&nbsp;&nbsp;{{nombreProducto}}
  15 + </b>
  16 + </p>
  17 + </div>
  18 + </div>
9 19 <div ng-repeat="(key, manguera) in mangueras">
10   - <strong>
11   - Manguera&nbsp;{{manguera.csu}}
12   - </strong>
13   - <button type="button" class="btn" ng-click="manguera.show = !manguera.show">
14   - <i ng-show="manguera.show" class="fa fa-minus"></i>
15   - <i ng-show="!manguera.show" class="fa fa-plus"></i>
16   - </button>
17   - <table class="table table-sm" ng-show="manguera.show">
18   - <tbody>
19   - <tr ng-repeat="(key, despacho) in manguera.despachos">
20   - <td ng-bind="despacho.FEC | date:'dd/MM/yyyy hh:MM:ss'"></td>
21   - <td ng-bind="despacho.LTS"></td>
22   - <td ng-bind="despacho.IMP | currency: '$'"></td>
23   - <td>
24   - <button
25   - type="button"
26   - class="btn btn-xs p-1 float-right"
27   - title="Seleccionar"
28   - ng-click="aceptar(despacho)"
29   - ><i class="fa fa-circle-thin" aria-hidden="true"></i>
30   - </button>
31   - </td>
32   - </tr>
33   - </tbody>
34   - </table>
  20 + <div class="row my-2">
  21 + <div class="col">
  22 + <label>
  23 + <img class="w-50" ng-src="./img/surtidor.png" alt="">
  24 + {{manguera.csu}}
  25 + </label>
  26 + <button
  27 + type="button"
  28 + class="btn p-1 text-secondary float-right border"
  29 + ng-click="manguera.show = !manguera.show">
  30 + <i ng-show="manguera.show" class="fa fa-minus px-1"></i>
  31 + <i ng-show="!manguera.show" class="fa fa-plus px-1"></i>
  32 + </button>
  33 + <table class="table table-sm table-striped" ng-show="manguera.show">
  34 + <tbody>
  35 + <tr ng-repeat="(key, despacho) in manguera.despachos">
  36 + <td class="py-2 py-sm-1" ng-bind="despacho.FEC | date:'dd/MM/yyyy hh:MM:ss'"></td>
  37 + <td class="py-2 py-sm-1" ng-bind="despacho.LTS"></td>
  38 + <td class="py-2 py-sm-1" ng-bind="despacho.IMP | currency: '$'"></td>
  39 + <td class="py-2 py-sm-1">
  40 + <button
  41 + type="button"
  42 + class="btn btn-default btn-xs p-1 float-right"
  43 + title="Seleccionar"
  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 53 </div>
36 54  
37 55 </div>
38   -<div class="modal-footer py-1">
  56 +<div class="modal-footer py-2">
39 57 <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda" class="mr-auto">
40 58 <ul class="pagination pagination-sm mb-0">
41 59 <li class="page-item" ng-class="{'disabled': currentPage == 1}">