modal-punto-descarga.html
9.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<div class="modal-header d-flex">
    <h5 class="modal-title my-1" ng-hide="ingreso || cargaArticulos">Búsqueda de puntos de descarga</h5>
    <h5 class="modal-title my-1" ng-show="ingreso">Crear punto de descarga</h5>
    <h5 class="modal-title my-1" ng-show="cargaArticulos">Cargar artículos en puntos de descarga</h5>
    <button 
        class="btn btn-primary"
        title="Nuevo"
        ng-click="ingreso = true"
        ng-hide="ingreso || cargaArticulos">
        <i class="fa fa-plus" aria-hidden="true"></i>
    </button>
</div>
<div class="modal-body" id="modal-body">
    <table 
        class="table table-striped table-sm col-12"
        ng-hide="ingreso || cargaArticulos">
        <thead>
            <tr>
                <th>Código</th>
                <th>Descripción</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <tr ng-show="!puntosDescarga.length">
                <td colspan="5">
                    No se encontraron resultados.
                </td>
            </tr>
            <tr class="selected"
                ng-repeat="(key, puntoDescarga) in puntosDescarga | filter: filters"
                >
                <td
                    ng-bind="puntoDescarga.id | rellenarDigitos: 3: 0"
                    ng-click="seleccionarPunto(key)"></td>
                <td
                    ng-bind="puntoDescarga.descripcion"
                    ng-click="seleccionarPunto(key)"></td>
                <td>
                    <input 
                        type="checkbox"
                        class="custom-control-input float-right" 
                        id="checkSelect{{key}}"
                        ng-model="puntoDescarga.seleccionado"
                        ng-change="seleccionarPunto(key, true)"
                        >
                    <label 
                        class="custom-control-label float-right"
                        for="checkSelect{{key}}"></label>
                    <button
                        type="button"
                        class="btn btn-xs p-1 float-right mr-5"
                        ng-click="eliminar(key, puntoDescarga)"
                        title="Eliminar">
                        <i class="fa fa-trash" aria-hidden="true"></i>
                    </button>
                    <button
                        type="button"
                        class="btn btn-xs p-1 float-right mr-1"
                        ng-click="editar(puntoDescarga.id)"
                        title="Editar">
                        <i class="fa fa-pencil" aria-hidden="true"></i>
                    </button>
                </td>
            </tr>
        </tbody>
    </table>
    <div ng-show="cargaArticulos">
        <div ng-show="!articulos.length">
            <h6>No existen articulos para agregar</h6>
        </div>
        <div ng-show="articulos.length">
            <div class="row">
                <div class="col-12">
                    <table class="table table-sm">
                        <thead>
                            <tr>
                                <th></th>
                                <th>Articulo</th>
                                <th>Total</th>
                                <th>Restante</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat="(key, articulo) in articulos">
                                <td>
                                    <input 
                                        type="radio"
                                        ng-value="key"
                                        ng-model="$parent.articuloSeleccionado"
                                    >
                                </td>
                                <td ng-bind="articulo.descripcion"></td>
                                <td ng-bind="articulo.cantidad"></td>
                                <td ng-bind="articulo.restante"></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="row">
                <div class="col-12">
                    <h5 class="col-12 my-3">Puntos de descarga</h5>
                    <table class="table table-sm">
                        <thead>
                            <tr>
                                <th>Lugar</th>
                                <th class="text-right">Total cargado</th>
                                <th class="text-right">Cantidad</th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat="punto in puntosACargar">
                                <td ng-bind="punto.descripcion"></td>
                                <td ng-bind="punto.cargado" class="text-right"></td>
                                <td>
                                    <input
                                        type="text" 
                                        class="form-control col-4 float-right" 
                                        id="inputCantidad" 
                                        placeholder="A cargar"
                                        ng-model="punto.cantidadACargar"
                                        ng-keypress="agregarArticulo(punto, $event.keyCode)"
                                    >
                                </td>
                                <td>
                                    <button
                                        class="btn btn-sm btn-outline-primary ml-auto"
                                        type="button"
                                        ng-click="agregarArticulo(punto)"
                                    >
                                        Agregar
                                    </button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <table class="table table-sm">
                        <thead>
                            <tr>
                                <th>Lugar</th>
                                <th>Articulo</th>
                                <th class="text-right">Cantidad</th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody ng-repeat="punto in puntosACargar">
                            <tr ng-repeat="(key, articulo) in punto.articulosAgregados">
                                <td ng-bind="punto.descripcion"></td>
                                <td ng-bind="articulo.descripcion" class="p-2"></td>
                                <td ng-bind="articulo.cantidad" class="text-right p-2"></td>
                                <td class="p-2">
                                    <button
                                        type="button"
                                        class="btn btn-xs p-1 float-right mr-5"
                                        ng-click="quitarArticulo(articulo, key, punto)"
                                        title="Eliminar">
                                        <i class="fa fa-trash" aria-hidden="true"></i>
                                    </button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <form ng-show="ingreso">
        <div class="row">
            <div class="col-12">
                <label>Descripción</label>
                <input 
                    type="text"
                    class="form-control form-control-sm"
                    ng-model="puntoDescarga.descripcion"
                    foca-focus="ingreso"
                    ng-keypress="guardar($event.keyCode)"
                    uppercase-only>
            </div>
        </div>
        <div class="row">
            <div class="col-6">
                <label>Latitud</label>
                <input
                    type="text"
                    class="form-control form-control-sm"
                    ng-model="puntoDescarga.latitud"
                    ng-required="true"
                    ng-readonly="editando"
                />
            </div>
            <div class="col-6">
                <label>Longitud</label>
                <input
                    type="text"
                    class="form-control form-control-sm"
                    ng-model="puntoDescarga.longitud"
                    ng-required="true"
                    ng-readonly="editando"
                />
            </div>
        </div>
        <osm-punto-descarga
            latitud="puntoDescarga.latitud"
            longitud="puntoDescarga.longitud"
            zoom="14"
            ng-if="ingreso",
            draggable="!editando"
        />
    </form>
</div>
<div class="modal-footer">
    <button 
        class="btn btn-sm btn-secondary my-1" 
        type="button" 
        ng-click="cancel()">Cancelar</button>
    <button 
        class="btn btn-sm btn-primary my-1"
        type="button"
        ng-click="aceptar()"
        ng-hide="ingreso">Aceptar</button>
    <button 
        class="btn btn-sm btn-primary my-1"
        type="button"
        ng-click="guardar(13)"
        ng-show="ingreso">Guardar</button>
</div>