Commit dcfb219ac3e89cf9076d0f0c217aa23e70285130

Authored by Pablo Marco del Pont
Exists in master

Merge branch 'master' into 'master'

renovación a creación de nota de pedido

See merge request modulos-npm/foca-crear-nota-pedido!5
... ... @@ -2,3 +2,5 @@
2 2 /dist
3 3 package-lock\.json
4 4 /src/etc/develop.js
  5 +
  6 +tmp/
... ... @@ -14,6 +14,7 @@
14 14 <script src="node_modules/angular-route/angular-route.min.js"></script>
15 15 <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script>
16 16  
  17 + <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script>
17 18 <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script>
18 19 <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script>
19 20 <script src="node_modules/foca-modal-petroleras/dist/foca-modal-petroleras.min.js"></script>
... ... @@ -22,9 +23,11 @@
22 23 <script src="src/js/app.js"></script>
23 24 <script src="src/js/controller.js"></script>
24 25 <script src="src/js/service.js"></script>
  26 + <script src="src/js/route.js"></script>
  27 +
25 28 <script src="src/etc/develop.js"></script>
26 29 </head>
27   - <body ng-view>
28   -
  30 + <body>
  31 + <div ng-view class="container-fluid"></div>
29 32 </body>
30 33 </html>
... ... @@ -18,8 +18,14 @@
18 18 "angular": "^1.7.x",
19 19 "angular-route": "^1.7.4",
20 20 "bootstrap": "^4.1.x",
  21 + "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas.git",
  22 + "foca-modal-busqueda-productos": "git+https://192.168.0.11/nguarnieri/foca-modal-busqueda-productos",
  23 + "foca-modal-petroleras": "git+https://192.168.0.11/modulos-npm/foca-modal-petroleras.git",
  24 + "foca-modal-vendedores": "git+https://192.168.0.11/modulos-npm/foca-modal-vendedores.git",
21 25 "font-awesome": "^4.7.x",
22 26 "gulp": "^3.9.x",
  27 + "gulp-angular-templatecache": "^2.2.1",
  28 + "gulp-clean": "^0.4.0",
23 29 "gulp-concat": "2.6.x",
24 30 "gulp-jshint": "^2.1.x",
25 31 "gulp-rename": "^1.4.x",
... ... @@ -31,7 +37,10 @@
31 37 "ui-bootstrap4": "^3.0.5"
32 38 },
33 39 "devDependencies": {
  40 + "foca-busqueda-cliente": "git+https://192.168.0.11/modulos-npm/foca-busqueda-cliente",
34 41 "gulp-connect": "^5.6.1",
  42 + "gulp-htmlmin": "^5.0.1",
  43 + "gulp-uglify": "^3.0.1",
35 44 "jasmine-core": "3.2.1",
36 45 "pre-commit": "^1.2.2"
37 46 }
src/etc/develop.js.ejemplo
... ... @@ -0,0 +1,4 @@
  1 +angular.module('focaCrearNotaPedido')
  2 + .constant("API_ENDPOINT", {
  3 + 'URL': '//127.0.0.1:9000'
  4 + });
1   -angular.module('focaCrearNotaPedido', ['ngRoute', 'ui.bootstrap', 'focaModalVendedores',
2   - 'focaBusquedaProductos', 'focaModalPetroleras', 'focaBusquedaCliente'])
3   - .config(['$routeProvider', function($routeProvider) {
4   - $routeProvider.when('/venta-nota-pedido', {
5   - controller: 'notaPedidoListaCtrl',
6   - templateUrl: 'src/views/nota-pedido-lista.html'
7   - });
8   - }])
9   - .config(['$routeProvider', function($routeProvider) {
10   - $routeProvider.when('/venta-nota-pedido/abm', {
11   - controller: 'notaPedidoCtrl',
12   - templateUrl: 'src/views/nota-pedido.html'
13   - });
14   - }]);
  1 +angular.module('focaCrearNotaPedido', [
  2 + 'ngRoute',
  3 + 'ui.bootstrap',
  4 + 'focaModalVendedores',
  5 + 'focaBusquedaProductos',
  6 + 'focaModalPetroleras',
  7 + 'focaBusquedaCliente'
  8 +]);
  9 +
15 10 \ No newline at end of file
src/js/controller.js
1 1 angular.module('focaCrearNotaPedido')
2 2 .controller('notaPedidoCtrl',
3   - [
4   - '$scope',
5   - '$uibModal',
6   - '$location',
7   - 'crearNotaPedidoService',
  3 + ['$scope', '$uibModal', '$location', 'crearNotaPedidoService',
8 4 function($scope, $uibModal, $location, crearNotaPedidoService) {
  5 + $scope.show = false;
  6 +
  7 + $scope.dateOptions = {
  8 + maxDate: new Date(),
  9 + minDate: new Date(2010,0,1)
  10 + };
  11 +
9 12 $scope.notaPedido = {};
10 13 $scope.articulosTabla = [];
11 14 var idLista;
... ... @@ -22,11 +25,12 @@ angular.module(&#39;focaCrearNotaPedido&#39;)
22 25 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString();
23 26 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString();
24 27 idLista = $scope.notaPedido.precioCondicion;
25   - crearNotaPedidoService.getArticulosByIdNotaPedido($scope.notaPedido.id).then(
26   - function(res) {
27   - $scope.articulosTabla = res.data;
28   - }
29   - );
  28 + crearNotaPedidoService
  29 + .getArticulosByIdNotaPedido($scope.notaPedido.id).then(
  30 + function(res) {
  31 + $scope.articulosTabla = res.data;
  32 + }
  33 + );
30 34 crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then(
31 35 function(res) {
32 36 $scope.notaPedido.domicilio = res.data;
... ... @@ -62,7 +66,8 @@ angular.module(&#39;focaCrearNotaPedido&#39;)
62 66 jurisdiccionIIBB: $scope.notaPedido.jurisdiccionIIBB,
63 67 costoFinanciacion: $scope.notaPedido.costoFinanciacion,
64 68 flete: $scope.notaPedido.flete,
65   - costoUnitarioKmFlete: $scope.notaPedido.costoUnitarioKmFlete
  69 + costoUnitarioKmFlete: $scope.notaPedido.costoUnitarioKmFlete,
  70 + total : $scope.articulosTabla[0].subTotal
66 71 }
67 72 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
68 73 function(res) {
... ... @@ -0,0 +1,7 @@
  1 +angular.module('focaCrearNotaPedido')
  2 + .config(['$routeProvider', function($routeProvider) {
  3 + $routeProvider.when('/venta-nota-pedido/crear', {
  4 + controller: 'notaPedidoCtrl',
  5 + templateUrl: 'src/views/nota-pedido.html'
  6 + });
  7 + }]);
1 1 angular.module('focaCrearNotaPedido')
2   - .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT',function($http, API_ENDPOINT) {
  2 + .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 3 var route = API_ENDPOINT.URL;
4 4 var notaPedido;
5 5 return {
src/views/nota-pedido-lista.html
... ... @@ -5,6 +5,7 @@
5 5 <th>Vendedor</th>
6 6 <th>Cliente</th>
7 7 <th>Petrolera</th>
  8 + <th>Total</th>
8 9 <th><button class="btn btn-primary" ng-click="crearPedido()">Crear</button></th>
9 10 </tr>
10 11 </thead>
... ... @@ -14,8 +15,9 @@
14 15 <td ng-bind="item.vendedor"></td>
15 16 <td ng-bind="item.cliente"></td>
16 17 <td ng-bind="item.petrolera"></td>
  18 + <td ng-bind="(item.total | 0) | currency"></td>
17 19 <td>
18   - <button class="btn btn-info" ng-click="editar(item)"><i class="fa fa-edit"></i></button>
  20 + <button class="btn btn-info" ng-show="false" ng-click="editar(item)"><i class="fa fa-edit"></i></button>
19 21 <!-- <button class="btn btn-danger" ng-click="borrar(item.id)"><i class="fa fa-trash"></i></button> -->
20 22 </td>
21 23 </tr>
src/views/nota-pedido.html
1   -<form name="formCrearNota" ng-submit="siguienteTab()">
  1 +<div class="row">
  2 + <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2">
  3 + <div class="row bg-secondary p-3">
  4 + <div class="form-group col-12 col-sm-6 col-md-4">
  5 + <div class="input-group">
  6 + <input
  7 + type="text"
  8 + class="form-control"
  9 + uib-datepicker-popup="dd/MM/yyyy"
  10 + ng-model="notaPedido.fechaCarga"
  11 + is-open="popup1.opened"
  12 + datepicker-options="dateOptions"
  13 + close-text="Cerrar"
  14 + current-text="Hoy"
  15 + clear-text="Borrar"
  16 + alt-input-formats="altInputFormats"
  17 + />
  18 + <span class="input-group-append">
  19 + <button type="button" class="btn btn-default" ng-click="popup1.opened = true">
  20 + <i class="fa fa-calendar"></i>
  21 + </button>
  22 + </span>
  23 + </div>
  24 + </div>
  25 + <div class="form-group col-12 col-sm-6 col-md-4">
  26 + <input
  27 + class="form-control selectable"
  28 + type="text"
  29 + readonly="true"
  30 + ng-bind="cliente.nombre"
  31 + ng-click="seleccionarVendedor()"
  32 + placeholder="Seleccione Vendedor"
  33 + >
  34 + </div>
  35 + <div class="form-group col-12 col-sm-6 col-md-4">
  36 + <input
  37 + class="form-control selectable"
  38 + type="text"
  39 + readonly="true"
  40 + ng-bind="vendedor.nombre"
  41 + ng-click="seleccionarCliente()"
  42 + placeholder="Seleccione Cliente"
  43 + >
  44 + </div>
  45 + <div class="form-group col-12 col-sm-6 col-md-4">
  46 + <input
  47 + class="form-control selectable"
  48 + type="text"
  49 + readonly="true"
  50 + ng-bind="vendedor.nombre"
  51 + ng-click="abrirModalDomicilio()"
  52 + placeholder="Seleccione Domicilio"
  53 + >
  54 + </div>
  55 + <div class="form-group col-12 col-sm-6 col-md-4">
  56 + <input
  57 + class="form-control selectable"
  58 + type="text"
  59 + readonly="true"
  60 + ng-bind="vendedor.nombre"
  61 + ng-click="abrirModalListaPrecio()"
  62 + placeholder="Seleccione Lista de precio"
  63 + >
  64 + </div>
  65 + </div>
  66 + </div>
  67 +</div>
  68 +<div class="row">
  69 + <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2">
  70 + <div class="row">
  71 +
  72 + </div>
  73 + <div class="row">
  74 + <table class="table table-striped table-sm">
  75 + <thead>
  76 + <tr>
  77 + <th>Sector</th>
  78 + <th>Código</th>
  79 + <th>Descripción</th>
  80 + <th>Cantidad</th>
  81 + <th>Precio Unitario</th>
  82 + <th>SubTotal</th>
  83 + <th></th>
  84 + <th></th>
  85 + </tr>
  86 + </thead>
  87 + <tbody>
  88 + <tr>
  89 + <td colspan="2"><input class="form-control" readonly></td>
  90 + <td></td>
  91 + <td></td>
  92 + <td></td>
  93 + <td></td>
  94 + <td></td>
  95 + <td></td>
  96 + </tr>
  97 + <tr style="cursor: pointer;" ng-click="show = !show">
  98 + <td>1</td>
  99 + <td>1</td>
  100 + <td>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...</td>
  101 + <td>{{10000 | number: 2}}</td>
  102 + <td>{{1000000000 | currency:'$'}}</td>
  103 + <td>{{1000000000 | currency:'$'}}</td>
  104 + <td></td>
  105 + <td>
  106 + <button class="btn btn-outline-secondary" style="float: right;">
  107 + <i class="fa fa-chevron-down" ng-hide="show" aria-hidden="true"></i>
  108 + <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i>
  109 + </button>
  110 + </td>
  111 + </tr>
  112 + <tr ng-show="show">
  113 + <td>1</td>
  114 + <td>2</td>
  115 + <td>Lorem Ipsum</td>
  116 + <td>1</td>
  117 + <td>{{1000000000 | currency:'U$D'}}</td>
  118 + <td>{{10 | currency:'$'}}</td>
  119 + <td></td>
  120 + <td></td>
  121 + </tr>
  122 + <tr ng-show="show">
  123 + <td>1</td>
  124 + <td>2</td>
  125 + <td>Lorem Ipsum</td>
  126 + <td>1</td>
  127 + <td>{{10 | currency:'$'}}</td>
  128 + <td>{{10 | currency:'$'}}</td>
  129 + <td></td>
  130 + <td></td>
  131 + </tr>
  132 + </tbody>
  133 + <tfoot>
  134 + <tr class="table-secondary">
  135 + <td colspan="5"><b>Cantidad Items:</b> 3</td>
  136 + <td colspan="3">{{30 | currency:'$'}}</td>
  137 + </tr>
  138 + </tfoot>
  139 + </table>
  140 + </div>
  141 + </div>
  142 +</div>
  143 +
  144 +<!--
  145 +<form name="formCrearNota">
2 146 <uib-tabset active="active">
3 147 <uib-tab index="0" heading="General">
4 148 <input type="hidden" name="id" ng-model="notaPedido.id" />
... ... @@ -242,4 +386,4 @@
242 386 </div>
243 387 </uib-tab>
244 388 </uib-tabset>
245   -</form>
246 389 \ No newline at end of file
  390 +</form>-->
247 391 \ No newline at end of file
src/views/nota-pedido_1.html
... ... @@ -0,0 +1,245 @@
  1 +<form name="formCrearNota" ng-submit="siguienteTab()">
  2 + <uib-tabset active="active">
  3 + <uib-tab index="0" heading="General">
  4 + <input type="hidden" name="id" ng-model="notaPedido.id" />
  5 + <div>
  6 + <div class="col-auto my-2">
  7 + <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button>
  8 + </div>
  9 + </div>
  10 + <br>
  11 + <br>
  12 + <div class="row">
  13 + <div class="col-md-2">
  14 + <div class="col-auto">
  15 + <label>Fecha de carga</label>
  16 + </div>
  17 + </div>
  18 + <div class="col-md-3">
  19 + <div class="col-auto">
  20 + <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true">
  21 + </div>
  22 + </div>
  23 + <div class="col-md-2">
  24 + <div class="col-auto">
  25 + <label>Kilómetros</label>
  26 + </div>
  27 + </div>
  28 + <div class="col-md-3">
  29 + <div class="col-auto">
  30 + <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente"
  31 + ng-model="notaPedido.kilometros" ng-required="true">
  32 + </div>
  33 + </div>
  34 + </div>
  35 + <div class="row my-3">
  36 + <div class="col-md-2">
  37 + <div class="col-auto">
  38 + <label>Jurisdicción de IIBB</label>
  39 + </div>
  40 + </div>
  41 + <div class="col-md-3">
  42 + <div class="col-auto">
  43 + <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega"
  44 + ng-model="notaPedido.jurisdiccionIIBB" ng-required="true">
  45 + </div>
  46 + </div>
  47 + <div class="col-md-2">
  48 + <div class="col-auto">
  49 + <label>Costo de financiación</label>
  50 + </div>
  51 + </div>
  52 + <div class="col-md-3">
  53 + <div class="col-auto">
  54 + <div class="input-group mb-2">
  55 + <div class="input-group-prepend">
  56 + <div class="input-group-text">$</div>
  57 + </div>
  58 + <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación"
  59 + ng-model="notaPedido.costoFinanciacion">
  60 + </div>
  61 + </div>
  62 + </div>
  63 + </div>
  64 + <div class="row">
  65 + <div class="col-md-2">
  66 + <div class="col-auto">
  67 + <label>Bomba</label>
  68 + </div>
  69 + </div>
  70 + <div class="col-md-1">
  71 + <div class="col-auto">
  72 + <div class="form-check custom-radio custom-control-inline">
  73 + <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba">
  74 + <label class="form-check-label">
  75 + Si
  76 + </label>
  77 + </div>
  78 + <div class="form-check custom-radio custom-control-inline">
  79 + <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba">
  80 + <label class="form-check-label">
  81 + No
  82 + </label>
  83 + </div>
  84 + </div>
  85 + </div>
  86 + <div class="col-md-1">
  87 + <div class="col-auto">
  88 + <label>Flete</label>
  89 + </div>
  90 + </div>
  91 + <div class="col-md-1">
  92 + <div class="col-auto">
  93 + <div class="form-check custom-radio custom-control-inline">
  94 + <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete">
  95 + <label class="form-check-label">
  96 + Si
  97 + </label>
  98 + </div>
  99 + <div class="form-check custom-radio custom-control-inline">
  100 + <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete">
  101 + <label class="form-check-label">
  102 + FOB
  103 + </label>
  104 + </div>
  105 + </div>
  106 + </div>
  107 + <div class="col-md-2">
  108 + <div class="col-auto">
  109 + <label>Costo unitario kilometro flete</label>
  110 + </div>
  111 + </div>
  112 + <div class="col-md-3">
  113 + <div class="col-auto">
  114 + <div class="input-group mb-2">
  115 + <div class="input-group-prepend">
  116 + <div class="input-group-text">$</div>
  117 + </div>
  118 + <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete"
  119 + ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true">
  120 + </div>
  121 + </div>
  122 + </div>
  123 + </div>
  124 + <div class="row my-3">
  125 + <div class="col-md-2">
  126 + <div class="col-auto">
  127 + <label>Vendedor</label>
  128 + </div>
  129 + </div>
  130 + <div class="col-md-3">
  131 + <div class="col-auto">
  132 + <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor"
  133 + ng-click="seleccionarVendedor()" readonly>
  134 + </div>
  135 + </div>
  136 + <div class="col-md-2">
  137 + <div class="col-auto">
  138 + <label>Petrolera</label>
  139 + </div>
  140 + </div>
  141 + <div class="col-md-3">
  142 + <div class="col-auto">
  143 + <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera"
  144 + ng-click="seleccionarPetrolera()" readonly>
  145 + </div>
  146 + </div>
  147 + </div>
  148 + </div>
  149 + <div class="row">
  150 + <div class="col-md-2">
  151 + <div class="col-auto">
  152 + <label>Cliente</label>
  153 + </div>
  154 + </div>
  155 + <div class="col-md-3">
  156 + <div class="col-auto">
  157 + <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente"
  158 + ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly>
  159 + </div>
  160 + </div>
  161 + <div class="col-md-2">
  162 + <div class="col-auto">
  163 + <label>Domicilio</label>
  164 + </div>
  165 + </div>
  166 + <div class="col-md-4">
  167 + <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio">
  168 + <div class="col-auto">
  169 + <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead="
  170 + domi.dom
  171 + for domi
  172 + in domiciliosCliente
  173 + "
  174 + typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)"
  175 + class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true">
  176 + <i ng-show="cargandoClientes" class="fas fa-sync"></i>
  177 + <div ng-show="sinResultados">
  178 + No se encontraron resultados.
  179 + </div>
  180 + </div>
  181 + <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a>
  182 + <a class="btn" ng-click="addNewDom()">+</a>
  183 + </div>
  184 + </div>
  185 + </div>
  186 + </uib-tab>
  187 + <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid">
  188 + <div>
  189 + <div class="col-auto my-2">
  190 + <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button>
  191 + </div>
  192 + </div>
  193 + <br>
  194 + <br>
  195 + <div class="row">
  196 + <div class="col-md-2">
  197 + <div class="col-auto">
  198 + <label>Precios y condiciones</label>
  199 + </div>
  200 + </div>
  201 + <div class="col-md-4">
  202 + <div class="col-auto">
  203 + <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones">
  204 + </select>
  205 + </div>
  206 + </div>
  207 + <div class="col-md-2">
  208 + <div class="col-auto">
  209 + <label>Producto</label>
  210 + </div>
  211 + </div>
  212 + <div class="col-md-4">
  213 + <div class="col-auto">
  214 + <input type="text" class="form-control" placeholder="Seleccione producto" ng-model="notaPedido.producto"
  215 + ng-click="seleccionarArticulo()" readonly>
  216 + </div>
  217 + </div>
  218 + </div>
  219 + <div class="col-md-12">
  220 + <table class="table my-3 table-hover table-nonfluid">
  221 + <thead>
  222 + <tr>
  223 + <th>Código</th>
  224 + <th>Nombre</th>
  225 + <th>Precio unitario</th>
  226 + <th>Costo unitario bruto</th>
  227 + <th>Cantidad</th>
  228 + <th>Subtotal</th>
  229 + </tr>
  230 + </thead>
  231 + <tbody>
  232 + <tr ng-repeat="articulo in articulosTabla">
  233 + <td ng-bind="articulo.codigo"></td>
  234 + <td ng-bind="articulo.nombre"></td>
  235 + <td ng-bind="articulo.precio"></td>
  236 + <td ng-bind="articulo.costoUnitario"></td>
  237 + <td><input ng-model="articulo.cantidad" class="form-control" type="number" min="0" value="1"></td>
  238 + <td ng-bind="getSubTotal(articulo.item)"></td>
  239 + </tr>
  240 + </tbody>
  241 + </table>
  242 + </div>
  243 + </uib-tab>
  244 + </uib-tabset>
  245 +</form>
0 246 \ No newline at end of file