Commit b7ba0e070a4d589b4b44f104a00ca94723f2f14e

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request modulos-npm/foca-crear-nota-pedido!12
... ... @@ -45,7 +45,7 @@ gulp.task('uglify', ['templates'], function() {
45 45 uglify(),
46 46 replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+
47 47 '"focaModalPetroleras","focaBusquedaCliente","focaModalPrecioCondicion",'+
48   - '"focaModalFlete"', ''),
  48 + '"focaModalFlete","focaDirectivas","focaModal"', ''),
49 49 gulp.dest(paths.dist)
50 50 ]
51 51 );
... ... @@ -21,6 +21,8 @@
21 21 <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script>
22 22 <script src="node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js"></script>
23 23 <script src="node_modules/foca-modal-flete/dist/foca-modal-flete.min.js"></script>
  24 + <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script>
  25 +
24 26 <script src="src/js/app.js"></script>
25 27 <script src="src/js/controller.js"></script>
26 28 <script src="src/js/service.js"></script>
... ... @@ -8,7 +8,7 @@
8 8 "compile": "gulp uglify",
9 9 "gulp-pre-commit": "gulp pre-commit",
10 10 "postinstall": "npm run compile && gulp clean-post-install",
11   - "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git git+https://debo.suite.repo/modulos-npm/foca-modal-flete"
  11 + "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git"
12 12 },
13 13 "pre-commit": [
14 14 "gulp-pre-commit"
... ... @@ -32,6 +32,7 @@
32 32 "bootstrap": "^4.1.3",
33 33 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git",
34 34 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git",
  35 + "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git",
35 36 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos",
36 37 "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete",
37 38 "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git",
... ... @@ -7,5 +7,6 @@ angular.module(&#39;focaCrearNotaPedido&#39;, [
7 7 'focaBusquedaCliente',
8 8 'focaModalPrecioCondicion',
9 9 'focaModalFlete',
10   - 'focaDirectivas'
  10 + 'focaDirectivas',
  11 + 'focaModal'
11 12 ]);
src/js/controller.js
1 1 angular.module('focaCrearNotaPedido')
2 2 .controller('notaPedidoCtrl',
3   - ['$scope', '$uibModal', '$location', 'crearNotaPedidoService',
4   - function($scope, $uibModal, $location, crearNotaPedidoService) {
  3 + ['$scope', '$uibModal', '$location', 'crearNotaPedidoService', 'focaModalService',
  4 + function($scope, $uibModal, $location, crearNotaPedidoService, focaModalService) {
5 5 $scope.show = false;
6 6 $scope.edit = false;
7 7 $scope.dateOptions = {
8 8 maxDate: new Date(),
9 9 minDate: new Date(2010, 0, 1)
10 10 };
11   -
12 11 $scope.notaPedido = {
13 12 vendedor: {},
14 13 cliente: {}
... ... @@ -78,7 +77,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;)
78 77 };
79 78 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
80 79 function() {
81   - alert('Nota pedido creada');
  80 + focaModalService('Nota pedido creada');
82 81 $location.path('/venta-nota-pedido');
83 82 }
84 83 );
... ... @@ -97,7 +96,8 @@ angular.module(&#39;focaCrearNotaPedido&#39;)
97 96 };
98 97 $scope.seleccionarArticulo = function() {
99 98 if (idLista === undefined) {
100   - alert('primero seleccione una lista de precio y condicion');
  99 + focaModalService.alert(
  100 + 'primero seleccione una lista de precio y condicion');
101 101 return;
102 102 }
103 103 var modalInstance = $uibModal.open(
... ... @@ -245,8 +245,12 @@ angular.module(&#39;focaCrearNotaPedido&#39;)
245 245 );
246 246 modalInstance.result.then(
247 247 function(flete) {
  248 + $scope.choferes = '';
  249 + $scope.vehiculos = '';
248 250 $scope.notaPedido.fleteNombre = flete.nombre;
249 251 $scope.notaPedido.costoUnitarioKmFlete = flete.costoKilometro;
  252 + $scope.choferes = flete.chofer;
  253 + $scope.vehiculos = flete.vehiculo;
250 254 }, function() {
251 255  
252 256 }
... ... @@ -270,6 +274,27 @@ angular.module(&#39;focaCrearNotaPedido&#39;)
270 274 $scope.cambioEdit = function() {
271 275 $scope.edit = !$scope.edit ? true : false;
272 276 };
  277 + $scope.limpiarFlete = function() {
  278 + $scope.notaPedido.fleteNombre = '';
  279 + $scope.notaPedido.chofer = '';
  280 + $scope.notaPedido.vehiculo = '';
  281 + $scope.notaPedido.kilometros = '';
  282 + $scope.notaPedido.costoUnitarioKmFlete = '';
  283 + };
  284 + $scope.crearPedidoDemo = function() {
  285 + focaModalService.alert('Pedido Creado');
  286 + $scope.notaPedido.precioCondicion = '';
  287 + $scope.articulosTabla = [];
  288 + $scope.notaPedido.fleteNombre = '';
  289 + $scope.notaPedido.chofer = '';
  290 + $scope.notaPedido.vehiculo = '';
  291 + $scope.notaPedido.kilometros = '';
  292 + $scope.notaPedido.costoUnitarioKmFlete = '';
  293 + $scope.notaPedido.vendedor.nombre = '';
  294 + $scope.notaPedido.cliente.nombre = '';
  295 + $scope.domicilio.dom = '';
  296 + $scope.notaPedido.flete = 0;
  297 + };
273 298 }
274 299 ]
275 300 )
src/views/nota-pedido.html
... ... @@ -46,7 +46,7 @@
46 46 ng-model="notaPedido.cliente.nombre"
47 47 placeholder="Seleccione Cliente"
48 48 readonly="true"
49   - ng-click="mostrarFichaCliente()"
  49 + ng-click="seleccionarCliente()"
50 50 >
51 51 <span class="input-group-append">
52 52 <button type="button" class="btn btn-default" ng-click="seleccionarCliente()">
... ... @@ -59,10 +59,15 @@
59 59 <input
60 60 class="form-control selectable"
61 61 type="text"
62   - readonly="true"
63   - ng-bind="vendedor.nombre"
  62 + ng-model="domicilio.dom"
64 63 ng-click="abrirModalDomicilio()"
65 64 placeholder="Seleccione Domicilio"
  65 + uib-typeahead="
  66 + domi.dom
  67 + for domi
  68 + in domiciliosCliente
  69 + "
  70 + typeahead-min-length="0"
66 71 >
67 72 </div>
68 73 <div class="form-group col-12 col-sm-6 col-md-4">
... ... @@ -76,9 +81,31 @@
76 81 >
77 82 </div>
78 83 <div class="form-group col-12 col-sm-6 col-md-4">
  84 + <label>Bomba</label>
  85 + <div class="form-check custom-radio custom-control-inline">
  86 + <input
  87 + class="form-check-input"
  88 + type="radio"
  89 + name="radioBomba"
  90 + value="1"
  91 + ng-model="notaPedido.bomba">
  92 + <label class="form-check-label">Si</label>
  93 + </div>
  94 + <div class="form-check custom-radio custom-control-inline">
  95 + <input
  96 + class="form-check-input"
  97 + type="radio"
  98 + name="radioBomba"
  99 + value="0"
  100 + ng-model="notaPedido.bomba">
  101 + <label class="form-check-label">No</label>
  102 + </div>
  103 + </div>
  104 + <div class="form-group col-12 col-sm-6 col-md-4">
79 105 <label>Flete</label>
80 106 <div class="form-check custom-radio custom-control-inline">
81 107 <input
  108 + ng-change="limpiarFlete()"
82 109 class="form-check-input"
83 110 type="radio"
84 111 name="radioFlete"
... ... @@ -87,7 +114,7 @@
87 114 <label class="form-check-label">Si</label>
88 115 </div>
89 116 <div class="form-check custom-radio custom-control-inline">
90   - <input
  117 + <input
91 118 class="form-check-input"
92 119 type="radio"
93 120 name="radioFlete"
... ... @@ -101,17 +128,40 @@
101 128 class="form-control selectable"
102 129 type="text"
103 130 readonly="true"
  131 + ng-show="notaPedido.flete == 1"
104 132 ng-model="notaPedido.fleteNombre"
105 133 ng-click="abrirModalFlete()"
106 134 placeholder="Seleccione Flete"
107 135 >
108 136 </div>
109 137 <div class="form-group col-12 col-sm-6 col-md-4">
  138 + <input
  139 + class="form-control selectable"
  140 + type="text"
  141 + ng-show="notaPedido.flete == 1"
  142 + ng-model="notaPedido.chofer"
  143 + placeholder="Seleccione Chofer"
  144 + uib-typeahead="chofer.nombre for chofer in choferes"
  145 + typeahead-min-length="0"
  146 + >
  147 + </div>
  148 + <div class="form-group col-12 col-sm-6 col-md-4">
  149 + <input
  150 + class="form-control selectable"
  151 + type="text"
  152 + ng-show="notaPedido.flete == 1"
  153 + ng-model="notaPedido.vehiculo"
  154 + placeholder="Seleccione Vehículo"
  155 + uib-typeahead="vehiculo.tractor for vehiculo in vehiculos"
  156 + typeahead-min-length="0"
  157 + >
  158 + </div>
  159 + <div class="form-group col-12 col-sm-6 col-md-4">
110 160 <input
111 161 class="form-control selectable"
112 162 type="number"
113 163 step="0.01"
114   - ng-disabled="notaPedido.flete == 0"
  164 + ng-show="notaPedido.flete == 1"
115 165 ng-model="notaPedido.costoUnitarioKmFlete"
116 166 placeholder="Costo por kilómetro"
117 167 >
... ... @@ -121,13 +171,16 @@
121 171 class="form-control selectable"
122 172 type="number"
123 173 step="0.1"
124   - ng-disabled="notaPedido.flete == 0"
  174 + ng-show="notaPedido.flete == 1"
125 175 ng-model="notaPedido.kilometros"
126 176 placeholder="Kilómetros recorridos"
127 177 >
128 178 </div>
129 179 </div>
130 180 </div>
  181 + <div class="col-auto my-2">
  182 + <button ng-click="crearPedidoDemo()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button>
  183 + </div>
131 184 </div>
132 185 <div class="row">
133 186 <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2">