Commit 0149b643dad737f12e9bcb9a9d3cf23d62c8866c
1 parent
9cb80934c3
Exists in
master
modelo de orden carga - falta crear las funciones
Showing
3 changed files
with
194 additions
and
11 deletions
Show diff stats
src/js/controller.js
| 1 | angular.module('focaOrdenCarga') | 1 | angular.module('focaOrdenCarga') |
| 2 | .controller('focaOrdenCargaController', [ | 2 | .controller('focaOrdenCargaController', [ |
| 3 | '$scope', | 3 | '$scope', |
| 4 | function ($scope) { | 4 | '$uibModal', |
| 5 | '$location', | ||
| 6 | '$filter', | ||
| 7 | '$timeout', | ||
| 8 | 'focaOrdenCargaService', | ||
| 9 | 'focaBotoneraLateralService', | ||
| 10 | 'focaModalService', | ||
| 11 | 'notaPedidoBusinessService', | ||
| 12 | '$rootScope', | ||
| 13 | 'focaSeguimientoService', | ||
| 14 | 'APP', | ||
| 15 | 'focaLoginService', | ||
| 16 | '$localStorage', | ||
| 17 | function ( | ||
| 18 | $scope, $uibModal, $location, $filter, $timeout, focaOrdenCargaService, | ||
| 19 | focaBotoneraLateralService, focaModalService, notaPedidoBusinessService, | ||
| 20 | $rootScope, focaSeguimientoService, APP, focaLoginService, $localStorage) { | ||
| 21 | config(); | ||
| 5 | 22 | ||
| 6 | //#region VARIABLES | 23 | function config() { |
| 24 | // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA | ||
| 25 | $scope.tmpCantidad = Number; | ||
| 26 | $scope.tmpPrecio = Number; | ||
| 27 | $scope.isNumber = angular.isNumber; | ||
| 28 | $scope.datepickerAbierto = false; | ||
| 29 | $scope.show = false; | ||
| 30 | $scope.cargando = true; | ||
| 31 | $scope.cabeceras = []; | ||
| 32 | $scope.botonera = focaOrdenCargaService.getBotonera(); | ||
| 33 | $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); | ||
| 34 | $scope.comprobante = $filter('rellenarDigitos')(0, 8); | ||
| 35 | $scope.dateOptions = { | ||
| 36 | maxDate: new Date(), | ||
| 37 | minDate: new Date(2010, 0, 1) | ||
| 38 | }; | ||
| 7 | 39 | ||
| 8 | //#endregion | 40 | //SETEO BOTONERA LATERAL |
| 41 | $timeout(function () { | ||
| 42 | focaBotoneraLateralService.showSalir(false); | ||
| 43 | focaBotoneraLateralService.showPausar(true); | ||
| 44 | focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); | ||
| 45 | focaBotoneraLateralService.addCustomButton('Salir', salir); | ||
| 46 | }); | ||
| 9 | 47 | ||
| 10 | //#region METODOS | 48 | init(); |
| 11 | init(); | 49 | |
| 50 | } | ||
| 12 | 51 | ||
| 13 | function init() { | 52 | function init() { |
| 53 | |||
| 54 | } | ||
| 55 | |||
| 56 | $scope.$watch('ordenCarga', function (newValue) { | ||
| 57 | focaBotoneraLateralService.setPausarData({ | ||
| 58 | label: 'ordenCarga', | ||
| 59 | val: newValue | ||
| 60 | }); | ||
| 61 | }, true); | ||
| 62 | |||
| 63 | $scope.$watch('ordenCarga', function (newValue) { | ||
| 64 | focaBotoneraLateralService.setPausarData({ | ||
| 65 | label: 'ordenCarga', | ||
| 66 | val: newValue | ||
| 67 | }); | ||
| 68 | focaBotoneraLateralService.setRutasPausadas({ | ||
| 69 | label: 'rutas', | ||
| 70 | val: 'orden-carga' | ||
| 71 | }); | ||
| 72 | }, true); | ||
| 73 | |||
| 74 | $scope.crearOrdenCarga = function () { | ||
| 75 | |||
| 76 | focaBotoneraLateralService.startGuardar(); | ||
| 77 | $scope.saveLoading = true; | ||
| 78 | |||
| 79 | } | ||
| 80 | |||
| 81 | $scope.salir = function () { | ||
| 82 | $location.path('/'); | ||
| 83 | }; | ||
| 84 | |||
| 85 | function salir() { | ||
| 86 | var confirmacion = false; | ||
| 87 | |||
| 88 | if (!angular.equals($scope.ordenCarga, $scope.inicial)) { | ||
| 89 | confirmacion = true; | ||
| 90 | } | ||
| 91 | |||
| 92 | if (confirmacion) { | ||
| 93 | focaModalService.confirm( | ||
| 94 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | ||
| 95 | ).then(function (data) { | ||
| 96 | if (data) { | ||
| 97 | $location.path('/'); | ||
| 98 | } | ||
| 99 | }); | ||
| 100 | } else { | ||
| 101 | $location.path('/'); | ||
| 102 | } | ||
| 14 | } | 103 | } |
| 15 | //#endregion | 104 | }]); |
| 16 | } |
src/js/service.js
| 1 | angular.module('focaOrdenCarga') | 1 | angular.module('focaOrdenCarga') |
| 2 | .factory('focaOrdenCargaService', ['$http', 'API_ENDPOINT', | 2 | .factory('focaOrdenCargaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
| 3 | function ($http, API_ENDPOINT) { | 3 | var route = API_ENDPOINT.URL; |
| 4 | return { | 4 | return { |
| 5 | getBotonera: function() { | ||
| 6 | var result = [ | ||
| 7 | { | ||
| 8 | label: 'Vehiculo', | ||
| 9 | image: 'vehiculo_secundario.png' | ||
| 10 | }, | ||
| 11 | { | ||
| 12 | label: 'Fecha de Reparto', | ||
| 13 | image: 'fechaDeEntrega.png' | ||
| 14 | }, | ||
| 15 | { | ||
| 16 | label: 'Hojas de Ruta', | ||
| 17 | image: 'hojaDeRuta.png' | ||
| 18 | }, | ||
| 19 | { | ||
| 20 | label: 'Remito Abierto', | ||
| 21 | image: 'remito_abierto.png' | ||
| 22 | }, | ||
| 23 | { | ||
| 24 | label: 'Chofer', | ||
| 25 | image: 'chofer_secundario.png' | ||
| 26 | }, | ||
| 27 | { | ||
| 28 | label: 'Ver Cisternas', | ||
| 29 | image: 'verCisterna.png' | ||
| 30 | } | ||
| 31 | ]; | ||
| 32 | return result; | ||
| 33 | }, | ||
| 5 | }; | 34 | }; |
| 6 | }]); | 35 | }]); |
| 7 | 36 |
src/views/orden-carga.html
| 1 | <div class="row"> | ||
| 2 | <foca-cabecera-facturador | ||
| 3 | titulo="'Orden de Carga'" | ||
| 4 | numero="puntoVenta + '-' + comprobante" | ||
| 5 | fecha="notaPedido.fechaCarga" | ||
| 6 | class="mb-0 col-lg-12" | ||
| 7 | ></foca-cabecera-facturador> | ||
| 8 | </div> | ||
| 9 | <div class="row"> | ||
| 10 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> | ||
| 11 | <div class="row px-5 py-2 botonera-secundaria"> | ||
| 12 | <div class="col-12"> | ||
| 13 | <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> | ||
| 14 | </div> | ||
| 15 | </div> | ||
| 16 | |||
| 17 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | ||
| 18 | <thead> | ||
| 19 | <tr> | ||
| 20 | <th>Cisterna</th> | ||
| 21 | <th>Producto</th> | ||
| 22 | <th>Capacidad Total</th> | ||
| 23 | <th>Carga</th> | ||
| 24 | <th>Disponible</th> | ||
| 25 | <th class="text-center"> | ||
| 26 | </th> | ||
| 27 | </tr> | ||
| 28 | </thead> | ||
| 29 | <tbody> | ||
| 30 | <tr ng-repeat="hojaRuta in hojasRuta | filter:filtros"> | ||
| 31 | <td> | ||
| 32 | <b ng-show="hojaRuta.abierta !== null">RA </b> | ||
| 33 | <b ng-show="hojaRuta.abierta === null">  </b> | ||
| 34 | <span ng-bind="[hojaRuta.sucursal, hojaRuta.numeroHojaRuta] | comprobante"></span> | ||
| 35 | </td> | ||
| 36 | <td ng-bind="hojaRuta.fechaReparto | date:'yyyy-MM-dd':'-0300'"></td> | ||
| 37 | <td> | ||
| 38 | <div ng-bind="hojaRuta.remitos.length" class="d-inline-block"></div> | ||
| 39 | <button class="btn btn-outline-dark boton-accion" ng-click="mostrarRemitos(hojaRuta)"> | ||
| 40 | <i class="fa fa-eye"></i> | ||
| 41 | </button> | ||
| 42 | </td> | ||
| 43 | <td | ||
| 44 | ng-bind="setearEstado(hojaRuta.estado)" | ||
| 45 | ng-class="{'text-white':hojaRuta.estado == 0, | ||
| 46 | 'text-danger':hojaRuta.estado == 1, | ||
| 47 | 'text-dark': hojaRuta.estado == 2 | ||
| 48 | }" | ||
| 49 | ></td> | ||
| 50 | <td></td> | ||
| 51 | <td class="text-center"> | ||
| 52 | <button | ||
| 53 | class="btn btn-outline-dark boton-accion" | ||
| 54 | title="Activar" | ||
| 55 | ng-click="activarHojaRuta(hojaRuta)" | ||
| 56 | > | ||
| 57 | <i | ||
| 58 | ng-class="{'fa-check': hojaRuta.estado == 0,'fa-times': hojaRuta.estado == 1}" | ||
| 59 | class="fa"> | ||
| 60 | </i> | ||
| 61 | </button> | ||
| 62 | </td> | ||
| 63 | </tr> | ||
| 64 | </body> | ||
| 65 | </table> | ||
| 66 | </div> | ||
| 67 | </div> | ||
| 68 |