Commit 4cee7ed9234aec711ed288935c0bc3d383b0cbfe
1 parent
29128b7e8e
Exists in
master
and in
1 other branch
demo
Showing
6 changed files
with
75 additions
and
14 deletions
Show diff stats
gulpfile.js
| ... | ... | @@ -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","focaModal"', ''), | |
| 49 | 49 | gulp.dest(paths.dist) |
| 50 | 50 | ] |
| 51 | 51 | ); |
index.html
| ... | ... | @@ -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> |
package.json
| ... | ... | @@ -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", |
src/js/app.js
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('focaCrearNotaPedido') |
| 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('focaCrearNotaPedido') |
| 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('focaCrearNotaPedido') |
| 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('focaCrearNotaPedido') |
| 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"> |
| ... | ... | @@ -79,6 +84,7 @@ |
| 79 | 84 | <label>Flete</label> |
| 80 | 85 | <div class="form-check custom-radio custom-control-inline"> |
| 81 | 86 | <input |
| 87 | + ng-change="limpiarFlete()" | |
| 82 | 88 | class="form-check-input" |
| 83 | 89 | type="radio" |
| 84 | 90 | name="radioFlete" |
| ... | ... | @@ -87,7 +93,7 @@ |
| 87 | 93 | <label class="form-check-label">Si</label> |
| 88 | 94 | </div> |
| 89 | 95 | <div class="form-check custom-radio custom-control-inline"> |
| 90 | - <input | |
| 96 | + <input | |
| 91 | 97 | class="form-check-input" |
| 92 | 98 | type="radio" |
| 93 | 99 | name="radioFlete" |
| ... | ... | @@ -101,17 +107,40 @@ |
| 101 | 107 | class="form-control selectable" |
| 102 | 108 | type="text" |
| 103 | 109 | readonly="true" |
| 110 | + ng-show="notaPedido.flete == 1" | |
| 104 | 111 | ng-model="notaPedido.fleteNombre" |
| 105 | 112 | ng-click="abrirModalFlete()" |
| 106 | 113 | placeholder="Seleccione Flete" |
| 107 | 114 | > |
| 108 | 115 | </div> |
| 109 | 116 | <div class="form-group col-12 col-sm-6 col-md-4"> |
| 117 | + <input | |
| 118 | + class="form-control selectable" | |
| 119 | + type="text" | |
| 120 | + ng-show="notaPedido.flete == 1" | |
| 121 | + ng-model="notaPedido.chofer" | |
| 122 | + placeholder="Seleccione Chofer" | |
| 123 | + uib-typeahead="chofer.nombre for chofer in choferes" | |
| 124 | + typeahead-min-length="0" | |
| 125 | + > | |
| 126 | + </div> | |
| 127 | + <div class="form-group col-12 col-sm-6 col-md-4"> | |
| 128 | + <input | |
| 129 | + class="form-control selectable" | |
| 130 | + type="text" | |
| 131 | + ng-show="notaPedido.flete == 1" | |
| 132 | + ng-model="notaPedido.vehiculo" | |
| 133 | + placeholder="Seleccione Vehículo" | |
| 134 | + uib-typeahead="vehiculo.tractor for vehiculo in vehiculos" | |
| 135 | + typeahead-min-length="0" | |
| 136 | + > | |
| 137 | + </div> | |
| 138 | + <div class="form-group col-12 col-sm-6 col-md-4"> | |
| 110 | 139 | <input |
| 111 | 140 | class="form-control selectable" |
| 112 | 141 | type="number" |
| 113 | 142 | step="0.01" |
| 114 | - ng-disabled="notaPedido.flete == 0" | |
| 143 | + ng-show="notaPedido.flete == 1" | |
| 115 | 144 | ng-model="notaPedido.costoUnitarioKmFlete" |
| 116 | 145 | placeholder="Costo por kilómetro" |
| 117 | 146 | > |
| ... | ... | @@ -121,13 +150,16 @@ |
| 121 | 150 | class="form-control selectable" |
| 122 | 151 | type="number" |
| 123 | 152 | step="0.1" |
| 124 | - ng-disabled="notaPedido.flete == 0" | |
| 153 | + ng-show="notaPedido.flete == 1" | |
| 125 | 154 | ng-model="notaPedido.kilometros" |
| 126 | 155 | placeholder="Kilómetros recorridos" |
| 127 | 156 | > |
| 128 | 157 | </div> |
| 129 | 158 | </div> |
| 130 | 159 | </div> |
| 160 | + <div class="col-auto my-2"> | |
| 161 | + <button ng-click="crearPedidoDemo()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button> | |
| 162 | + </div> | |
| 131 | 163 | </div> |
| 132 | 164 | <div class="row"> |
| 133 | 165 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |