Commit 5860b1ef94d2ca258d7259f6f7be489d500d8712

Authored by Pablo Marco del Pont
1 parent 92521b388e
Exists in master

- Agregué botones Vendedor y Cliente.

- Modifiqué los botones, primera letra en mayúsculas.
- Agregue los métodos relacionados con cada botón.
- Agregué la lógica para selección de moneda.
- Removí la llamada a limpiarPantalla.
- Modifiqué la estructura de los componentes.
Showing 2 changed files with 180 additions and 200 deletions   Show diff stats
src/js/controller.js
... ... @@ -3,14 +3,16 @@ angular.module('focaCrearNotaPedido')
3 3 ['$scope', '$uibModal', 'crearNotaPedidoService', 'focaModalService',
4 4 function($scope, $uibModal, crearNotaPedidoService, focaModalService) {
5 5 $scope.botonera = [
6   - {texto: 'moneda', accion: function() {$scope.abrirModalMoneda();}},
  6 + {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}},
  7 + {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}},
  8 + {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}},
7 9 {
8   - texto: 'precios y condiciones',
  10 + texto: 'Precios y condiciones',
9 11 accion: function() {$scope.abrirModalListaPrecio();}},
10   - {texto: 'flete', accion: function() {$scope.abrirModalFlete();}},
11   - {texto: 'bomba', accion: function() {}},
12   - {texto: 'detalle', accion: function() {}},
13   - {texto: 'totales', accion: function() {}}
  12 + {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}},
  13 + {texto: 'Bomba', accion: function() {}},
  14 + {texto: 'Detalle', accion: function() {}},
  15 + {texto: 'Totales', accion: function() {}}
14 16 ];
15 17 $scope.show = false;
16 18 $scope.cargando = true;
... ... @@ -21,7 +23,8 @@ angular.module('focaCrearNotaPedido')
21 23 $scope.notaPedido = {
22 24 vendedor: {},
23 25 cliente: {},
24   - domicilio: { dom: ''}
  26 + domicilio: {dom: ''},
  27 + moneda: {detalle: ''}
25 28 };
26 29 $scope.articulosTabla = [];
27 30 var idLista;
... ... @@ -196,7 +199,6 @@ angular.module('focaCrearNotaPedido')
196 199 );
197 200 modalInstance.result.then(
198 201 function(cliente) {
199   - $scope.limpiarPantalla();
200 202 $scope.notaPedido.cliente.nombre = cliente.nom;
201 203 $scope.notaPedido.cliente.id = cliente.cod;
202 204 crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then(
... ... @@ -294,7 +296,11 @@ angular.module('focaCrearNotaPedido')
294 296 );
295 297 modalInstance.result.then(
296 298 function(moneda) {
297   - console.log('moneda', moneda);
  299 + $scope.notaPedido.moneda = {
  300 + id: moneda.ID,
  301 + detalle: moneda.DETALLE,
  302 + simbolo: moneda.SIMBOLO
  303 + };
298 304 }, function() {
299 305  
300 306 }
src/views/nota-pedido.html
1   -<form name="formCrearNota" ng-submit="crearNotaPedido()">
2   - <div class="row">
3   - <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2">
4   - <div class="row p-2 panel-informativo">
5   - <div class="col">
6   - <div class="row">
7   - <div class="form-group col-12 col-sm-6 col-md-4">
8   - <div class="input-group">
9   - <input
10   - class="form-control form-control-sm selectable"
11   - type="text"
12   - ng-model="notaPedido.cliente.nombre"
13   - placeholder="Seleccione Cliente"
14   - readonly="true"
15   - ng-click="seleccionarCliente()"
16   - ng-required="true"
17   - foca-focus="true"
18   - >
19   - <span class="input-group-append">
20   - <button
21   - type="button"
22   - class="btn btn-default"
23   - ng-click="seleccionarCliente()"
24   - >
25   - <i class="fa fa-search"></i>
26   - </button>
27   - </span>
  1 +<div class="crear-nota-pedido">
  2 + <form name="formCrearNota" ng-submit="crearNotaPedido()">
  3 + <div class="row">
  4 + <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2">
  5 + <div class="row p-1 panel-informativo">
  6 + <div class="col-12">
  7 + <div class="row">
  8 + <div class="col-5">
  9 + <span class="label">Vendedor:</span>
  10 + <span class="valor" ng-bind="notaPedido.vendedor.nombre"></span>
  11 + </div>
  12 + <div class="col-4">
  13 + <span class="label">Moneda:</span>
  14 + <span class="valor" ng-bind="notaPedido.moneda.detalle"></span>
  15 + </div>
  16 + <div class="col-3">
  17 + <span class="label">Flete:</span>
  18 + <span class="valor" ng-bind="notaPedido.flete"></span>
28 19 </div>
29 20 </div>
30   - </div>
31   - <div class="row">
32   - <div class="form-group col-12 col-sm-6 col-md-4">
33   - <div class="input-group">
34   - <input
35   - class="form-control form-control-sm"
36   - type="text"
37   - ng-model="notaPedido.vendedor.nombre"
38   - placeholder="Seleccione Vendedor"
39   - readonly="true"
40   - >
41   - <span class="input-group-append">
42   - <button
43   - type="button"
44   - class="btn btn-default"
45   - ng-click="seleccionarVendedor()"
46   - >
47   - <i class="fa fa-search"></i>
48   - </button>
49   - </span>
  21 + <div class="row">
  22 + <div class="col-5">
  23 + <span class="label">Cliente:</span>
  24 + <span class="valor" ng-bind="notaPedido.cliente.nombre"></span>
  25 + </div>
  26 + <div class="col-5">
  27 + <span class="label">Precios y condiciones:</span>
  28 + <span class="valor" ng-bind="notaPedido.cliente.nombre"></span>
  29 + </div>
  30 + <div class="col-3">
  31 + <span class="label">Bomba:</span>
  32 + <span class="valor" ng-bind="notaPedido.bomba"></span>
50 33 </div>
51 34 </div>
52 35 </div>
53 36 </div>
54   - </div>
55   - <div class="row p-2 botonera-secundaria">
56   - <div class=" col-12 col-sm-6 col-md-3 botonera" ng-repeat="boton in botonera">
57   - <button
58   - type="button"
59   - class="btn btn-default btn-block btn-sm"
60   - ng-bind="boton.texto"
61   - ng-click="boton.accion()"
62   - ></button>
  37 + <div class="row p-1 botonera-secundaria">
  38 + <div class=" col-12 col-sm-6 col-md-3 botonera" ng-repeat="boton in botonera">
  39 + <button
  40 + type="button"
  41 + class="btn btn-default btn-block btn-xs"
  42 + ng-bind="boton.texto"
  43 + ng-click="boton.accion()"
  44 + ></button>
  45 + </div>
63 46 </div>
64 47 </div>
65 48 </div>
66   - </div>
67   -</form>
68   -<div class="row">
69   - <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2">
70   - <div class="row">
71   - </div>
72   - <div class="row">
73   - <table class="table table-striped table-sm">
74   - <thead>
75   - <tr>
76   - <th>Sector</th>
77   - <th>Código</th>
78   - <th>Descripción</th>
79   - <th>Precio Unitario</th>
80   - <th>Cantidad</th>
81   - <th>SubTotal</th>
82   - <th>
83   - <button
84   - class="btn btn-outline-secondary selectable"
85   - style="float: right;"
86   - ng-click="show = !show; masMenos()"
87   - >
88   - <i
89   - class="fa fa-chevron-down"
90   - ng-hide="show"
91   - aria-hidden="true"
  49 + </form>
  50 + <div class="row">
  51 + <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2">
  52 + <div class="row grilla-articulos align-items-end">
  53 + <table class="table table-striped table-sm table-dark">
  54 + <thead>
  55 + <tr>
  56 + <th>Sector</th>
  57 + <th>Código</th>
  58 + <th>Descripción</th>
  59 + <th>Precio Unitario</th>
  60 + <th>Cantidad</th>
  61 + <th>SubTotal</th>
  62 + <th>
  63 + <button
  64 + class="btn btn-outline-secondary selectable"
  65 + style="float: right;"
  66 + ng-click="show = !show; masMenos()"
92 67 >
  68 + <i
  69 + class="fa fa-chevron-down"
  70 + ng-hide="show"
  71 + aria-hidden="true"
  72 + >
  73 + </i>
  74 + <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i>
  75 + </button>
  76 + </th>
  77 + </tr>
  78 + </thead>
  79 + <tbody>
  80 + <tr ng-show="!cargando">
  81 + <td><input
  82 + class="form-control"
  83 + ng-model="articuloACargar.sector"
  84 + readonly></td>
  85 + <td><input
  86 + class="form-control"
  87 + ng-model="articuloACargar.codigo"
  88 + readonly></td>
  89 + <td><input
  90 + class="form-control"
  91 + ng-model="articuloACargar.descripcion"
  92 + readonly></td>
  93 + <td><input
  94 + class="form-control"
  95 + ng-value="articuloACargar.precio | currency:'$'"
  96 + readonly></td>
  97 + <td><input
  98 + class="form-control"
  99 + type="number"
  100 + min="1"
  101 + ng-model="articuloACargar.cantidad"
  102 + foca-focus="!cargando"
  103 + esc-key="resetFilter()"
  104 + ng-keypress="agregarATabla($event.keyCode)"></td>
  105 + <td><input
  106 + class="form-control"
  107 + ng-value="getSubTotal() | currency:'$'"
  108 + readonly></td>
  109 + <td class="text-center"><button
  110 + class="btn btn-outline-secondary btn-sm"
  111 + ng-click="agregarATabla(13)">
  112 + <i class="fa fa-save"></i>
  113 + </button></td>
  114 + </tr>
  115 + <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0">
  116 + <td ng-bind="articulo.sector"></td>
  117 + <td ng-bind="articulo.codigo"></td>
  118 + <td ng-bind="articulo.descripcion"></td>
  119 + <td ng-bind="articulo.precio | currency:'$'"></td>
  120 + <td><input
  121 + ng-show="articulo.edit"
  122 + ng-model="articulo.cantidad"
  123 + class="form-control"
  124 + type="number"
  125 + min="1"
  126 + foca-focus="articulo.edit"
  127 + ng-keypress="editarArticulo($event.keyCode, articulo)"
  128 + ng-focus="selectFocus($event)"
  129 + >
  130 + <i
  131 + class="selectable"
  132 + ng-click="cambioEdit(articulo)"
  133 + ng-hide="articulo.edit"
  134 + ng-bind="articulo.cantidad">
93 135 </i>
94   - <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i>
95   - </button>
96   - </th>
97   - </tr>
98   - </thead>
99   - <tbody>
100   - <tr ng-show="cargando">
101   - <td colspan="2">
102   - <input
103   - placeholder="Seleccione Articulo"
104   - class="form-control"
105   - readonly
106   - ng-click="seleccionarArticulo()"
107   - />
108   - </td>
109   - <td></td>
110   - <td></td>
111   - <td></td>
112   - <td></td>
113   - <td></td>
114   - </tr>
115   - <tr ng-show="!cargando">
116   - <td><input
117   - class="form-control"
118   - ng-model="articuloACargar.sector"
119   - readonly></td>
120   - <td><input
121   - class="form-control"
122   - ng-model="articuloACargar.codigo"
123   - readonly></td>
124   - <td><input
125   - class="form-control"
126   - ng-model="articuloACargar.descripcion"
127   - readonly></td>
128   - <td><input
129   - class="form-control"
130   - ng-value="articuloACargar.precio | currency:'$'"
131   - readonly></td>
132   - <td><input
133   - class="form-control"
134   - type="number"
135   - min="1"
136   - ng-model="articuloACargar.cantidad"
137   - foca-focus="!cargando"
138   - esc-key="resetFilter()"
139   - ng-keypress="agregarATabla($event.keyCode)"></td>
140   - <td><input
141   - class="form-control"
142   - ng-value="getSubTotal() | currency:'$'"
143   - readonly></td>
144   - <td class="text-center"><button
145   - class="btn btn-outline-secondary btn-sm"
146   - ng-click="agregarATabla(13)">
147   - <i class="fa fa-save"></i>
148   - </button></td>
149   - </tr>
150   - <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0">
151   - <td ng-bind="articulo.sector"></td>
152   - <td ng-bind="articulo.codigo"></td>
153   - <td ng-bind="articulo.descripcion"></td>
154   - <td ng-bind="articulo.precio | currency:'$'"></td>
155   - <td><input
156   - ng-show="articulo.edit"
157   - ng-model="articulo.cantidad"
158   - class="form-control"
159   - type="number"
160   - min="1"
161   - foca-focus="articulo.edit"
162   - ng-keypress="editarArticulo($event.keyCode, articulo)"
163   - ng-focus="selectFocus($event)"
164   - >
165   - <i
166   - class="selectable"
167   - ng-click="cambioEdit(articulo)"
168   - ng-hide="articulo.edit"
169   - ng-bind="articulo.cantidad">
170   - </i>
171   - </td>
172   - <td ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"></td>
173   - <td class="text-center">
174   - <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo(key)">
175   - <i class="fa fa-trash"></i>
176   - </button>
177   - </td>
178   - </tr>
179   - </tbody>
180   - <tfoot>
181   - <tr class="table-secondary">
182   - <td colspan="4">
183   - <strong>Cantidad Items:</strong>
184   - <a ng-bind="articulosTabla.length"></a>
185   - </td>
186   - <td class="text-right"><strong>Total:</strong></td>
187   - <td colspan="3">{{getTotal() | currency:'$'}}</td>
188   - </tr>
189   - </tfoot>
190   - </table>
  136 + </td>
  137 + <td ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"></td>
  138 + <td class="text-center">
  139 + <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo(key)">
  140 + <i class="fa fa-trash"></i>
  141 + </button>
  142 + </td>
  143 + </tr>
  144 + <tr ng-show="cargando">
  145 + <td colspan="7">
  146 + <input
  147 + placeholder="Seleccione Articulo"
  148 + class="form-control form-control-sm"
  149 + readonly
  150 + ng-click="seleccionarArticulo()"
  151 + />
  152 + </td>
  153 + </tr>
  154 + </tbody>
  155 + <tfoot>
  156 + <tr class="">
  157 + <td colspan="4">
  158 + <strong>Cantidad Items:</strong>
  159 + <a ng-bind="articulosTabla.length"></a>
  160 + </td>
  161 + <td class="text-right table-celda-total"><h3>Total:</h3></td>
  162 + <td class="table-celda-total text-right" colspan="1"><h3>{{getTotal() | currency:'$'}}</h3></td>
  163 + <td colspan="2"></td>
  164 + </tr>
  165 + </tfoot>
  166 + </table>
  167 + </div>
  168 + </div>
  169 + <div class="col-auto my-2">
  170 + <button
  171 + ng-click="crearNotaPedido()"
  172 + type="submit"
  173 + title="Crear nota pedido"
  174 + class="btn btn-primary float-right">
  175 + Guardar
  176 + </button>
191 177 </div>
192 178 </div>
193 179 </div>
194   -<div class="row">
195   - <div class="col-auto my-2">
196   - <button
197   - ng-click="crearNotaPedido()"
198   - type="submit"
199   - title="Crear nota pedido"
200   - class="btn btn-primary float-right">
201   - Guardar
202   - </button>
203   - </div>
204   -</div>
205   -
206 180 <!--
207 181 <form name="formCrearNota">
208 182 <uib-tabset active="active">