From 0149b643dad737f12e9bcb9a9d3cf23d62c8866c Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 2 Oct 2019 10:46:44 -0300 Subject: [PATCH] modelo de orden carga - falta crear las funciones --- src/js/controller.js | 103 +++++++++++++++++++++++++++++++++++++++++---- src/js/service.js | 35 +++++++++++++-- src/views/orden-carga.html | 67 +++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+), 11 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index 06bd1d5..b5ef2dd 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -1,17 +1,104 @@ angular.module('focaOrdenCarga') .controller('focaOrdenCargaController', [ '$scope', - function ($scope) { + '$uibModal', + '$location', + '$filter', + '$timeout', + 'focaOrdenCargaService', + 'focaBotoneraLateralService', + 'focaModalService', + 'notaPedidoBusinessService', + '$rootScope', + 'focaSeguimientoService', + 'APP', + 'focaLoginService', + '$localStorage', + function ( + $scope, $uibModal, $location, $filter, $timeout, focaOrdenCargaService, + focaBotoneraLateralService, focaModalService, notaPedidoBusinessService, + $rootScope, focaSeguimientoService, APP, focaLoginService, $localStorage) { + config(); - //#region VARIABLES + function config() { + // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA + $scope.tmpCantidad = Number; + $scope.tmpPrecio = Number; + $scope.isNumber = angular.isNumber; + $scope.datepickerAbierto = false; + $scope.show = false; + $scope.cargando = true; + $scope.cabeceras = []; + $scope.botonera = focaOrdenCargaService.getBotonera(); + $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); + $scope.comprobante = $filter('rellenarDigitos')(0, 8); + $scope.dateOptions = { + maxDate: new Date(), + minDate: new Date(2010, 0, 1) + }; - //#endregion + //SETEO BOTONERA LATERAL + $timeout(function () { + focaBotoneraLateralService.showSalir(false); + focaBotoneraLateralService.showPausar(true); + focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); + focaBotoneraLateralService.addCustomButton('Salir', salir); + }); - //#region METODOS - init(); + init(); + + } function init() { + + } + + $scope.$watch('ordenCarga', function (newValue) { + focaBotoneraLateralService.setPausarData({ + label: 'ordenCarga', + val: newValue + }); + }, true); + + $scope.$watch('ordenCarga', function (newValue) { + focaBotoneraLateralService.setPausarData({ + label: 'ordenCarga', + val: newValue + }); + focaBotoneraLateralService.setRutasPausadas({ + label: 'rutas', + val: 'orden-carga' + }); + }, true); + + $scope.crearOrdenCarga = function () { + + focaBotoneraLateralService.startGuardar(); + $scope.saveLoading = true; + + } + + $scope.salir = function () { + $location.path('/'); + }; + + function salir() { + var confirmacion = false; + + if (!angular.equals($scope.ordenCarga, $scope.inicial)) { + confirmacion = true; + } + + if (confirmacion) { + focaModalService.confirm( + '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' + ).then(function (data) { + if (data) { + $location.path('/'); + } + }); + } else { + $location.path('/'); + } } - //#endregion - } - ]); + }]); diff --git a/src/js/service.js b/src/js/service.js index 02cc026..fe2ad21 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -1,6 +1,35 @@ angular.module('focaOrdenCarga') - .factory('focaOrdenCargaService', ['$http', 'API_ENDPOINT', - function ($http, API_ENDPOINT) { - return { + .factory('focaOrdenCargaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { + var route = API_ENDPOINT.URL; + return { + getBotonera: function() { + var result = [ + { + label: 'Vehiculo', + image: 'vehiculo_secundario.png' + }, + { + label: 'Fecha de Reparto', + image: 'fechaDeEntrega.png' + }, + { + label: 'Hojas de Ruta', + image: 'hojaDeRuta.png' + }, + { + label: 'Remito Abierto', + image: 'remito_abierto.png' + }, + { + label: 'Chofer', + image: 'chofer_secundario.png' + }, + { + label: 'Ver Cisternas', + image: 'verCisterna.png' + } + ]; + return result; + }, }; }]); diff --git a/src/views/orden-carga.html b/src/views/orden-carga.html index e69de29..460982d 100644 --- a/src/views/orden-carga.html +++ b/src/views/orden-carga.html @@ -0,0 +1,67 @@ +
+ +
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
CisternaProductoCapacidad TotalCargaDisponible +
+ RA +    + + +
+ +
+ +
+
+
-- 1.9.1