Commit 5f0ec229956d0f5ad9bda097cf587322d244f291

Authored by Nicolás Guarnieri
1 parent c84f58dd46
Exists in master

demo 9/10

foca-busqueda-cliente-modal.html
File was created 1 <div class="modal-header">
2 <h3 class="modal-title">Búsqueda de cliente</h3>
3 </div>
4 <div class="modal-body">
5 <form>
6 <div class="form-group row">
7 <label class="col-sm-4 col-form-label">Nombre o CUIT</label>
8 <div class="col-sm-8">
9 <input
10 type="text"
11 ng-model="cliente"
12 placeholder="Nombre o CUIT"
13 uib-typeahead="
14 cliente.nom + ' (' + cliente.cuit + ')'
15 for cliente
16 in obtenerClientesPorNombreOCuit($viewValue)
17 "
18 typeahead-loading="cargandoClientes"
19 typeahead-no-results="sinResultados"
20 typeahead-min-length="3"
21 typeahead-on-select="seleccionar($item)"
22 class="form-control"
23 >
24 <i ng-show="cargandoClientes" class="fas fa-sync"></i>
25 <div ng-show="sinResultados">
26 <i class="fa fa-minus"></i> No se encontraron resultados.
27 </div>
28 </div>
29 </div>
30 </form>
31 </div>
32 <div class="modal-footer">
33 <button class="btn" ng-click="aceptar()">Aceptar</button>
34 <button class="btn" ng-click="cancelar()">Cancelar</button>
35 </div>
36
1 const gulp = require('gulp'); 1 const gulp = require('gulp');
2 const sass = require('gulp-sass'); 2 const sass = require('gulp-sass');
3 const concat = require('gulp-concat'); 3 const concat = require('gulp-concat');
4 const rename = require('gulp-rename'); 4 const rename = require('gulp-rename');
5 const uglify = require('gulp-uglify-es').default; 5 const uglify = require('gulp-uglify-es').default;
6 const pump = require('pump'); 6 const pump = require('pump');
7 const jshint = require('gulp-jshint'); 7 const jshint = require('gulp-jshint');
8 const replace = require('gulp-replace'); 8 const replace = require('gulp-replace');
9 const connect = require('gulp-connect'); 9 const connect = require('gulp-connect');
10 const watch = require('gulp-watch'); 10 const watch = require('gulp-watch');
11 11
12 var paths = { 12 var paths = {
13 srcHTML : 'src/views/*.html', 13 srcHTML : 'src/views/*.html',
14 srcJS : 'src/**/*.js', 14 srcJS : 'src/**/*.js',
15 dist : 'dist/', 15 dist : 'dist/',
16 distHTML : 'dist/views/' 16 distHTML : 'dist/views/'
17 }; 17 };
18 18
19 gulp.task('uglify', function() { 19 gulp.task('uglify', function() {
20 pump( 20 pump(
21 [ 21 [
22 gulp.src(paths.srcJS), 22 gulp.src(paths.srcJS),
23 concat('wrapper-demo.js'), 23 concat('wrapper-demo.js'),
24 replace('/src/', '/dist/'), 24 replace('/src/', '/dist/'),
25 gulp.dest(paths.dist), 25 gulp.dest(paths.dist),
26 rename('wrapper-demo.min.js'), 26 rename('wrapper-demo.min.js'),
27 uglify(), 27 uglify(),
28 gulp.dest(paths.dist) 28 gulp.dest(paths.dist)
29 ] 29 ]
30 ); 30 );
31 }); 31 });
32 32
33 gulp.task('html', function() { 33 gulp.task('html', function() {
34 pump([ 34 pump([
35 gulp.src('index.html'), 35 gulp.src('index.html'),
36 replace(/\<!\-\- BUILD \-\-\>.*\<!\-\- \/BUILD \-\-\>/sgm, '<script src="wrapper-demo.min.js"></script>'), 36 replace(/\<!\-\- BUILD \-\-\>.*\<!\-\- \/BUILD \-\-\>/sgm, '<script src="wrapper-demo.min.js"></script>'),
37 gulp.dest(paths.dist) 37 gulp.dest(paths.dist)
38 ]); 38 ]);
39 pump([ 39 pump([
40 gulp.src(paths.srcHTML), 40 gulp.src(paths.srcHTML),
41 gulp.dest(paths.distHTML) 41 gulp.dest(paths.distHTML)
42 ]); 42 ]);
43 }) 43 })
44 44
45 gulp.task('sass', function() { 45 gulp.task('sass', function() {
46 return gulp.src('src/style/scss/**/*.scss') 46 return gulp.src('src/style/scss/**/*.scss')
47 .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) 47 .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
48 .pipe(gulp.dest('css')); 48 .pipe(gulp.dest('css'));
49 }); 49 });
50 50
51 gulp.task('pre-commit', function() { 51 gulp.task('pre-commit', function() {
52 pump( 52 pump(
53 [ 53 [
54 gulp.src(paths.srcJS), 54 gulp.src(paths.srcJS),
55 jshint('.jshintrc'), 55 jshint('.jshintrc'),
56 jshint.reporter('default'), 56 jshint.reporter('default'),
57 jshint.reporter('fail') 57 jshint.reporter('fail')
58 ] 58 ]
59 ); 59 );
60 gulp.start('uglify'); 60 gulp.start('uglify');
61 gulp.start('sass'); 61 gulp.start('sass');
62 }); 62 });
63 63
64 gulp.task('webserver', function() { 64 gulp.task('webserver', function() {
65 pump [ 65 pump [
66 connect.server( 66 connect.server(
67 { 67 {
68 port: 3000, 68 port: 3000,
69 livereload: true 69 host: '0.0.0.0'
70 } 70 }
71 ) 71 )
72 ] 72 ]
73 }); 73 });
74 74
75 gulp.task('watch', function() { 75 gulp.task('watch', function() {
76 gulp.watch(archivosJS, ['uglify']); 76 gulp.watch(archivosJS, ['uglify']);
77 gulp.watch('css/scss/*.scss', ['sass']); 77 gulp.watch('css/scss/*.scss', ['sass']);
78 }) 78 })
79 79
80 gulp.task('reload'), function() { 80 gulp.task('reload'), function() {
81 connect.reload(); 81 connect.reload();
82 } 82 }
83 83
84 gulp.task('livereload', function() { 84 gulp.task('livereload', function() {
85 gulp.watch('css/*.css', ['reload']); 85 gulp.watch('css/*.css', ['reload']);
86 gulp.watch('js/dist/*.js', ['reload']); 86 gulp.watch('js/dist/*.js', ['reload']);
87 gulp.watch('vistas/**/*.html', ['reload']); 87 gulp.watch('vistas/**/*.html', ['reload']);
88 }); 88 });
89 89
90 gulp.task('default', ['webserver']); 90 gulp.task('default', ['webserver']);
91 91
1 <html ng-app="appWrapperDemo"> 1 <html ng-app="appWrapperDemo">
2 <head> 2 <head>
3 <meta charset="UTF-8"/> 3 <meta charset="UTF-8"/>
4 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> 4 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
5 <base href="./"> 5 <base href="./">
6 6
7 <!--CSS--> 7 <!--CSS-->
8 <link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> 8 <link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
9 <link href="./node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/> 9 <link href="./node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
10 10
11 <!--VENDOR JS--> 11 <!--VENDOR JS-->
12 <script src="./node_modules/jquery/dist/jquery.min.js"></script> 12 <script src="./node_modules/jquery/dist/jquery.min.js"></script>
13 <script src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script> 13 <script src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
14 <script src="./node_modules/angular/angular.min.js"></script> 14 <script src="./node_modules/angular/angular.min.js"></script>
15 <script src="./node_modules/angular-route/angular-route.min.js"></script> 15 <script src="./node_modules/angular-route/angular-route.min.js"></script>
16 <script src="./node_modules/foca-botonera-horizontal/dist/botonera-horizontal.min.js"></script> 16 <script src="./node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script>
17
18 <script src="./node_modules/foca-directivas/dist/foca-directivas.min.js"></script>
19 <script src="./node_modules/foca-botonera-horizontal/dist/foca-botonera-horizontal.min.js"></script>
17 <script src="./node_modules/foca-turno-apertura/dist/foca-turno-apertura.min.js"></script> 20 <script src="./node_modules/foca-turno-apertura/dist/foca-turno-apertura.min.js"></script>
21 <script src="./node_modules/foca-abm-plazo-pago/dist/foca-abm-plazo-pago.min.js"></script>
22 <script src="./node_modules/foca-abm-precios-condiciones/dist/foca-abm-precios-condiciones.min.js"></script>
23 <script src="./node_modules/foca-abm-sectores/dist/foca-abm-sectores.min.js"></script>
24 <script src="./vendor/foca-crear-nota-pedido.js"></script>
25 <script src="./node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script>
26 <script src="./node_modules/foca-modal-petroleras/dist/foca-modal-petroleras.min.js"></script>
27 <script src="./node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script>
28 <script src="./node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script>
18 29
19 <!-- BUILD --> 30 <!-- BUILD -->
20 <script src="./src/js/app.js"></script> 31 <script src="./src/js/app.js"></script>
21 <!-- /BUILD --> 32 <!-- /BUILD -->
33
22 </head> 34 </head>
23 <body> 35 <body>
36 <style>
37 .selectable {
38 cursor: pointer;
39 }
40
41 .table-nonfluid {
42 width: auto;
43 }
44 </style>
24 <botonera-horizontal></botonera-horizontal> 45 <botonera-horizontal></botonera-horizontal>
25 <div ng-view id="contenedor" class="container-fluid" style="margin-bottom: 100px"></div>
26 </body> 46 </body>
27 </html> 47 </html>
1 { 1 {
2 "name": "wrapper-demo", 2 "name": "wrapper-demo",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "", 4 "description": "",
5 "main": "main.js", 5 "main": "main.js",
6 "scripts": { 6 "scripts": {
7 "initdev": "npm install gulp --global && npm install && npm install -g jshint", 7 "initdev": "npm install gulp --global && npm install && npm install -g jshint",
8 "gulp-pre-commit": "gulp pre-commit", 8 "gulp-pre-commit": "gulp pre-commit",
9 "compile": "gulp uglify && gulp sass", 9 "compile": "gulp uglify && gulp sass",
10 "electron": "electron .", 10 "electron": "electron .",
11 "electron-build": "gulp uglify && gulp html && gulp sass && electron ." 11 "electron-build": "gulp uglify && gulp html && gulp sass && electron ."
12 }, 12 },
13 "pre-commit": [ 13 "pre-commit": [
14 "gulp-pre-commit" 14 "gulp-pre-commit"
15 ], 15 ],
16 "repository": { 16 "repository": {
17 "type": "git", 17 "type": "git",
18 "url": "https://192.168.0.11/Wrappers/wrapper-demo.git" 18 "url": "https://192.168.0.11/Wrappers/wrapper-demo.git"
19 }, 19 },
20 "author": "Nicolas Guarnieri", 20 "author": "Nicolas Guarnieri",
21 "license": "ISC", 21 "license": "ISC",
22 "dependencies": { 22 "dependencies": {
23 "angular": "^1.7.4", 23 "angular": "^1.7.4",
24 "angular-route": "1.7.3", 24 "angular-route": "1.7.3",
25 "bootstrap": "4.1.3", 25 "bootstrap": "4.1.3",
26 "foca-abm-plazo-pago": "git+https://192.168.0.11/modulos-npm/foca-abm-plazo-pago.git",
27 "foca-abm-precios-condiciones": "git+https://192.168.0.11/modulos-npm/foca-abm-precios-condiciones.git",
28 "foca-abm-sectores": "git+https://192.168.0.11/modulos-npm/foca-abm-sectores",
26 "foca-botonera-horizontal": "git+https://192.168.0.11/modulos-npm/foca-botonera-horizontal.git", 29 "foca-botonera-horizontal": "git+https://192.168.0.11/modulos-npm/foca-botonera-horizontal.git",
30 "foca-busqueda-cliente": "git+https://192.168.0.11/modulos-npm/foca-busqueda-cliente.git",
31 "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas.git",
32 "foca-modal-busqueda-productos": "git+https://192.168.0.11/nguarnieri/foca-modal-busqueda-productos",
33 "foca-modal-petroleras": "git+https://192.168.0.11/modulos-npm/foca-modal-petroleras.git",
34 "foca-modal-vendedores": "git+https://192.168.0.11/modulos-npm/foca-modal-vendedores.git",
27 "foca-turno-apertura": "git+https://192.168.0.11/modulos-npm/foca-turno-apertura.git", 35 "foca-turno-apertura": "git+https://192.168.0.11/modulos-npm/foca-turno-apertura.git",
28 "font-awesome": "4.7.0", 36 "font-awesome": "4.7.0",
29 "jquery": "3.3.1" 37 "gulp-angular-templatecache": "^2.2.1",
38 "gulp-htmlmin": "^5.0.1",
39 "gulp-uglify": "^3.0.1",
40 "jquery": "3.3.1",
41 "uglify": "^0.1.5",
42 "ui-bootstrap4": "^3.0.5"
30 }, 43 },
31 "devDependencies": { 44 "devDependencies": {
32 "gulp": "3.9.1", 45 "electron": "^3.0.2",
46 "gulp": "^3.9.1",
33 "gulp-concat": "2.6.1", 47 "gulp-concat": "2.6.1",
34 "gulp-connect": "^5.6.1", 48 "gulp-connect": "^5.6.1",
35 "gulp-jshint": "^2.1.0", 49 "gulp-jshint": "^2.1.0",
36 "gulp-rename": "1.4.0", 50 "gulp-rename": "1.4.0",
37 "gulp-replace": "^1.0.0", 51 "gulp-replace": "^1.0.0",
38 "gulp-sass": "4.0.1", 52 "gulp-sass": "4.0.1",
39 "gulp-uglify-es": "^1.0.4", 53 "gulp-uglify-es": "^1.0.4",
40 "gulp-watch": "^5.0.1", 54 "gulp-watch": "^5.0.1",
41 "jasmine-core": "3.2.1", 55 "jasmine-core": "3.2.1",
42 "jshint": "^2.9.6", 56 "jshint": "^2.9.6",
43 "pre-commit": "^1.2.2", 57 "pre-commit": "^1.2.2",
44 "pump": "^3.0.0" 58 "pump": "^3.0.0"
45 } 59 }
46 } 60 }
47 61
1 angular.module('appWrapperDemo', ['ngRoute', 'focaBotoneraHorizontal', 'focaTurnoApertura']); 1 angular
2 .module('appWrapperDemo', [
3 'ngRoute',
4 'ui.bootstrap',
5
6 'focaBotoneraHorizontal',
7 'focaTurnoApertura',
8 'focaAbmPreciosCondiciones',
9 'focaAbmPlazoPago',
10 'focaAbmSectores',
11 'focaBusquedaCliente',
12 'focaCrearNotaPedido'
13 ])
14 .constant("API_ENDPOINT", {
15 'URL': '//201.190.140.28:9900'
16 });
17
2 18
vendor/foca-crear-nota-pedido.js
File was created 1 angular.module('focaCrearNotaPedido', ['ngRoute', 'ui.bootstrap', 'focaModalVendedores',
2 'focaBusquedaProductos', 'focaModalPetroleras', 'focaBusquedaCliente'])
3 .config(['$routeProvider', function($routeProvider) {
4 $routeProvider.when('/venta-nota-pedido/crear', {
5 controller: 'notaPedidoListaCtrl',
6 templateUrl: 'nota-pedido-lista.html'
7 });
8 }])
9 .config(['$routeProvider', function($routeProvider) {
10 $routeProvider.when('/venta-nota-pedido/abm', {
11 controller: 'notaPedidoCtrl',
12 templateUrl: 'nota-pedido.html'
13 });
14 }]);
15
16 angular.module('focaCrearNotaPedido')
17 .controller('notaPedidoCtrl',
18 [
19 '$scope',
20 '$uibModal',
21 '$location',
22 'crearNotaPedidoService',
23 function($scope, $uibModal, $location, crearNotaPedidoService) {
24 $scope.notaPedido = {};
25 $scope.articulosTabla = [];
26 var idLista;
27 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido();
28 $scope.domiciliosCliente = crearNotaPedidoService.getDomicilios(1);
29 crearNotaPedidoService.getPrecioCondicion().then(
30 function(res) {
31 $scope.precioCondiciones = res.data;
32 }
33 );
34 if (notaPedidoTemp != undefined) {
35 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga);
36 $scope.notaPedido = notaPedidoTemp;
37 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString();
38 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString();
39 idLista = $scope.notaPedido.precioCondicion;
40 crearNotaPedidoService.getArticulosByIdNotaPedido($scope.notaPedido.id).then(
41 function(res) {
42 $scope.articulosTabla = res.data;
43 }
44 );
45 crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then(
46 function(res) {
47 $scope.notaPedido.domicilio = res.data;
48 }
49 )
50 } else {
51 $scope.notaPedido.fechaCarga = new Date();
52 $scope.notaPedido.domicilio = [{ id: 0 }]
53 $scope.notaPedido.bomba = '1';
54 $scope.notaPedido.flete = '1';
55 idLista = undefined;
56 }
57 $scope.addNewDom = function() {
58 $scope.notaPedido.domicilio.push({ 'id': 0 });
59 }
60 $scope.removeNewChoice = function(choice) {
61 if ($scope.notaPedido.domicilio.length > 1) {
62 $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex(c => c.$$hashKey == choice.$$hashKey), 1)
63 }
64 }
65 $scope.crearNotaPedido = function() {
66 var total = 0;
67 for (var i = $scope.articulosTabla.length - 1; i >= 0; i--) {
68 total += $scope.articulosTabla[i].precio * $scope.articulosTabla[i].cantidad;
69 }
70
71 var notaPedido = {
72 id: 0,
73 precioCondicion: $scope.notaPedido.precioCondicion,
74 fechaCarga: $scope.notaPedido.fechaCarga,
75 vendedor: $scope.notaPedido.vendedor,
76 cliente: $scope.notaPedido.cliente,
77 producto: $scope.notaPedido.producto,
78 bomba: $scope.notaPedido.bomba,
79 petrolera: $scope.notaPedido.petrolera,
80 domicilio: $scope.notaPedido.domicilio,
81 kilometros: $scope.notaPedido.kilometros,
82 jurisdiccionIIBB: $scope.notaPedido.jurisdiccionIIBB,
83 costoFinanciacion: $scope.notaPedido.costoFinanciacion,
84 flete: $scope.notaPedido.flete,
85 costoUnitarioKmFlete: $scope.notaPedido.costoUnitarioKmFlete,
86 total : total
87 }
88 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
89 function(res) {
90 $location.path('/venta-nota-pedido/crear');
91 }
92 )
93 var articulosNotaPedido = $scope.articulosTabla;
94 for(var i = 0; i< articulosNotaPedido.length;i++) {
95 crearNotaPedidoService.crearArticulosParaNotaPedido(articulosNotaPedido[i]).then(
96 function(res) {
97 return;
98 }
99 )
100 }
101
102 }
103 $scope.siguienteTab = function() {
104 $scope.active = 1;
105 }
106 $scope.seleccionarArticulo = function() {
107 if (idLista == undefined) {
108 alert('primero seleccione una lista de precio y condicion');
109 return;
110 }
111 var modalInstance = $uibModal.open(
112 {
113 ariaLabelledBy: 'Busqueda de Productos',
114 templateUrl: 'modal-busqueda-productos.html',
115 controller: 'modalBusquedaProductosCtrl',
116 resolve: { idLista: function() { return idLista } },
117 size: 'lg'
118 }
119 )
120 modalInstance.result.then(
121 function(producto) {
122 var newArt =
123 {
124 id: 0,
125 codigo: producto.FiltroSectorCodigo,
126 item: $scope.articulosTabla.length + 1,
127 nombre: producto.descripcion,
128 precio: producto.precio,
129 costoUnitario: producto.costo,
130 cantidad: 1
131 }
132 $scope.articulosTabla.unshift(newArt);
133 }, function() {
134 // funcion ejecutada cuando se cancela el modal
135 }
136 );
137 }
138 $scope.seleccionarVendedor = function() {
139 var modalInstance = $uibModal.open(
140 {
141 ariaLabelledBy: 'Busqueda de Vendedores',
142 templateUrl: 'modal-vendedores.html',
143 controller: 'modalVendedoresCtrl',
144 size: 'lg'
145 }
146 )
147 modalInstance.result.then(
148 function(vendedor) {
149 $scope.notaPedido.vendedor = vendedor.NomVen;
150 }, function() {
151
152 }
153 );
154 }
155 $scope.seleccionarPetrolera = function() {
156 var modalInstance = $uibModal.open(
157 {
158 ariaLabelledBy: 'Busqueda de Petrolera',
159 templateUrl: 'modal-petroleras.html',
160 controller: 'modalPetrolerasCtrl',
161 size: 'lg'
162 }
163 )
164 modalInstance.result.then(
165 function(petrolera) {
166 $scope.notaPedido.petrolera = petrolera.NOM;
167 }, function() {
168
169 }
170 );
171 }
172 $scope.seleccionarCliente = function() {
173 var modalInstance = $uibModal.open(
174 {
175 ariaLabelledBy: 'Busqueda de Cliente',
176 templateUrl: 'foca-busqueda-cliente-modal.html',
177 controller: 'focaBusquedaClienteModalController',
178 size: 'lg'
179 }
180 )
181 modalInstance.result.then(
182 function(cliente) {
183 $scope.notaPedido.cliente = cliente.nom;
184 }, function() {
185
186 }
187 );
188 }
189 $scope.obtenerDomicilios = function(id) {
190 crearNotaPedidoService.getDomicilios(id).then(
191 function(res) {
192 $scope.notaPedido.domicilio = res.data;
193 }
194 )
195 }
196 $scope.getSubTotal = function(item) {
197 var subTotal = 0;
198 var array = $scope.articulosTabla.filter(a => a.item <= item);
199 for (var i = 0; i < array.length; i++) {
200 subTotal += array[i].precio * array[i].cantidad
201 }
202 return subTotal.toFixed(2);
203 }
204 $scope.cargarArticulos = function() {
205 idLista = $scope.notaPedido.precioCondicion;
206 $scope.articulosTabla = [];
207 }
208 }
209 ]
210 )
211 .controller('notaPedidoListaCtrl', [
212 '$scope',
213 'crearNotaPedidoService',
214 '$location',
215 function($scope, crearNotaPedidoService, $location) {
216 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
217 $scope.notaPedidos = datos.data;
218 });
219 $scope.editar = function(notaPedido) {
220 crearNotaPedidoService.setNotaPedido(notaPedido);
221 $location.path('/venta-nota-pedido/abm/');
222 }
223 $scope.crearPedido = function() {
224 crearNotaPedidoService.clearNotaPedido();
225 $location.path('/venta-nota-pedido/abm/');
226 }
227 }
228 ])
229
230 angular.module('focaCrearNotaPedido')
231 .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT',function($http, API_ENDPOINT) {
232 var route = API_ENDPOINT.URL;
233 var notaPedido;
234 return {
235 crearNotaPedido: function(notaPedido) {
236 return $http.post(route + '/nota-pedido', {notaPedido: notaPedido});
237 },
238 obtenerNotaPedido: function() {
239 return $http.get(route +'/nota-pedido');
240 },
241 setNotaPedido: function(notaPedido) {
242 this.notaPedido = notaPedido;
243 },
244 clearNotaPedido: function() {
245 this.notaPedido = undefined;
246 },
247 getNotaPedido: function() {
248 return this.notaPedido;
249 },
250 getArticulosByIdNotaPedido: function(id) {
251 return $http.get(route+'/articulos/nota-pedido/'+id);
252 },
253 crearArticulosParaNotaPedido: function(articuloNotaPedido) {
254 return $http.post(route + '/articulos/nota-pedido', {articuloNotaPedido});
255 },
256 getDomiciliosByIdNotaPedido: function(id) {
257 return $http.get(route +'/nota-pedido/'+id+'/domicilios');
258 },
259 //EN DESARROLLO
260 getDomicilios: function(id) {
261 // return $http.get(route + '/'+id)
262 var domicilio = [
263 {
264 id: 1,
265 dom: 'RISSO PATRON 781'
266 },
267 {
268 id: 2,
269 dom: 'MARIANO MORENO 533'
270 },
271 {
272 id: 3,
273 dom: 'SALTA 796'
274 }
275 ]
276 return domicilio;
277 },
278 getPrecioCondicion: function() {
279 return $http.get(route + '/precio-condicion')
280 },
281 getPrecioCondicionById: function(id) {
282 return $http.get(route + '/precio-condicion/' + id)
283 },
284 getPlazoPagoByPrecioCondicion: function(id) {
285 return $http.get(route + '/plazo-pago/precio-condicion/'+ id)
286 }
287 }
288 }])
289
290 angular.module('focaCrearNotaPedido').run(['$templateCache', function($templateCache) {$templateCache.put('nota-pedido-lista.html','<table class="table table-sm table-hover table-nonfluid">\r\n <thead>\r\n <tr>\r\n <th>C\xF3digo</th>\r\n <th>Vendedor</th>\r\n <th>Cliente</th>\r\n <th>Petrolera</th>\r\n <th>Total</th>\r\n <th><button class="btn btn-primary" ng-click="crearPedido()">Crear</button></th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr ng-repeat="item in notaPedidos">\r\n <td ng-bind="item.id"></td>\r\n <td ng-bind="item.vendedor"></td>\r\n <td ng-bind="item.cliente"></td>\r\n <td ng-bind="item.petrolera"></td>\r\n <td ng-bind="item.total | currency"></td>\r\n <td>\r\n <button class="btn btn-info" ng-show="false" ng-click="editar(item)"><i class="fa fa-edit"></i></button>\r\n <!-- <button class="btn btn-danger" ng-click="borrar(item.id)"><i class="fa fa-trash"></i></button> -->\r\n </td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n');
291 $templateCache.put('nota-pedido.html','<form name="formCrearNota" ng-submit="siguienteTab()">\r\n <uib-tabset active="active">\r\n <uib-tab index="0" heading="General">\r\n <input type="hidden" name="id" ng-model="notaPedido.id">\r\n <div>\r\n <div class="col-auto my-2">\r\n <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button>\r\n </div>\r\n </div>\r\n <br>\r\n <br>\r\n <div class="row">\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Fecha de carga</label>\r\n </div>\r\n </div>\r\n <div class="col-md-3">\r\n <div class="col-auto">\r\n <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true">\r\n </div>\r\n </div>\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Kil\xF3metros</label>\r\n </div>\r\n </div>\r\n <div class="col-md-3">\r\n <div class="col-auto">\r\n <input type="number" min="0" step="0.01" class="form-control" placeholder="Kil\xF3metros recorridos para la entrega en el cliente" ng-model="notaPedido.kilometros" ng-required="true">\r\n </div>\r\n </div>\r\n </div>\r\n <div class="row my-3">\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Jurisdicci\xF3n de IIBB</label>\r\n </div>\r\n </div>\r\n <div class="col-md-3">\r\n <div class="col-auto">\r\n <input type="text" class="form-control" placeholder="Jurisdicci\xF3n de IIBB donde se realiza la entrega" ng-model="notaPedido.jurisdiccionIIBB" ng-required="true">\r\n </div>\r\n </div>\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Costo de financiaci\xF3n</label>\r\n </div>\r\n </div>\r\n <div class="col-md-3">\r\n <div class="col-auto">\r\n <div class="input-group mb-2">\r\n <div class="input-group-prepend">\r\n <div class="input-group-text">$</div>\r\n </div>\r\n <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiaci\xF3n" ng-model="notaPedido.costoFinanciacion">\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class="row">\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Bomba</label>\r\n </div>\r\n </div>\r\n <div class="col-md-1">\r\n <div class="col-auto">\r\n <div class="form-check custom-radio custom-control-inline">\r\n <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba">\r\n <label class="form-check-label">\r\n Si\r\n </label>\r\n </div>\r\n <div class="form-check custom-radio custom-control-inline">\r\n <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba">\r\n <label class="form-check-label">\r\n No\r\n </label>\r\n </div>\r\n </div>\r\n </div>\r\n <div class="col-md-1">\r\n <div class="col-auto">\r\n <label>Flete</label>\r\n </div>\r\n </div>\r\n <div class="col-md-1">\r\n <div class="col-auto">\r\n <div class="form-check custom-radio custom-control-inline">\r\n <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete">\r\n <label class="form-check-label">\r\n Si\r\n </label>\r\n </div>\r\n <div class="form-check custom-radio custom-control-inline">\r\n <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete">\r\n <label class="form-check-label">\r\n FOB\r\n </label>\r\n </div>\r\n </div>\r\n </div>\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Costo unitario kilometro flete</label>\r\n </div>\r\n </div>\r\n <div class="col-md-3">\r\n <div class="col-auto">\r\n <div class="input-group mb-2">\r\n <div class="input-group-prepend">\r\n <div class="input-group-text">$</div>\r\n </div>\r\n <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true">\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class="row my-3">\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Vendedor</label>\r\n </div>\r\n </div>\r\n <div class="col-md-3">\r\n <div class="col-auto">\r\n <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" ng-click="seleccionarVendedor()" readonly="readonly">\r\n </div>\r\n </div>\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Petrolera</label>\r\n </div>\r\n </div>\r\n <div class="col-md-3">\r\n <div class="col-auto">\r\n <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera" ng-click="seleccionarPetrolera()" readonly="readonly">\r\n </div>\r\n </div>\r\n </div>\r\n \r\n <div class="row">\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Cliente</label>\r\n </div>\r\n </div>\r\n <div class="col-md-3">\r\n <div class="col-auto">\r\n <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly="readonly">\r\n </div>\r\n </div>\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Domicilio</label>\r\n </div>\r\n </div>\r\n <div class="col-md-4">\r\n <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio">\r\n <div class="col-auto">\r\n <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead="\r\n domi.dom\r\n for domi\r\n in domiciliosCliente\r\n " typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true">\r\n <i ng-show="cargandoClientes" class="fas fa-sync"></i>\r\n <div ng-show="sinResultados">\r\n No se encontraron resultados.\r\n </div>\r\n </div>\r\n <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a>\r\n <a class="btn" ng-click="addNewDom()">+</a>\r\n </div>\r\n </div>\r\n </div>\r\n </uib-tab>\r\n <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid">\r\n <div>\r\n <div class="col-auto my-2">\r\n <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button>\r\n </div>\r\n </div>\r\n <br>\r\n <br>\r\n <div class="row">\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Precios y condiciones</label>\r\n </div>\r\n </div>\r\n <div class="col-md-4">\r\n <div class="col-auto">\r\n <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones">\r\n </select>\r\n </div>\r\n </div>\r\n <div class="col-md-2">\r\n <div class="col-auto">\r\n <label>Producto</label>\r\n </div>\r\n </div>\r\n <div class="col-md-4">\r\n <div class="col-auto">\r\n <input type="text" class="form-control" placeholder="Seleccione producto" ng-model="notaPedido.producto" ng-click="seleccionarArticulo()" readonly="readonly">\r\n </div>\r\n </div>\r\n </div>\r\n <div class="col-md-12">\r\n <table class="table my-3 table-hover table-nonfluid">\r\n <thead>\r\n <tr>\r\n <th>C\xF3digo</th>\r\n <th>Nombre</th>\r\n <th>Precio unitario</th>\r\n <th>Costo unitario bruto</th>\r\n <th>Cantidad</th>\r\n <th>Subtotal</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr ng-repeat="articulo in articulosTabla">\r\n <td ng-bind="articulo.codigo"></td>\r\n <td ng-bind="articulo.nombre"></td>\r\n <td ng-bind="articulo.precio"></td>\r\n <td ng-bind="articulo.costoUnitario"></td>\r\n <td><input ng-model="articulo.cantidad" class="form-control" type="number" min="0" value="1"></td>\r\n <td ng-bind="getSubTotal(articulo.item)"></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n </uib-tab>\r\n </uib-tabset>\r\n</form>');}]);