modal-punto-descarga.html
7.28 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
<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 articulos en puntos de descarga</h5>
    <button 
        class="btn btn-primary"
        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>Latitud</th>
                <th>Longitud</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <tr ng-show="puntosDescarga.length == 0">
                <td colspan="3">
                    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"></td>
                <td ng-bind="puntoDescarga.descripcion"></td>
                <td ng-bind="puntoDescarga.latitud"></td>
                <td ng-bind="puntoDescarga.longitud"></td>
                <td class="d-md-none text-primary">
                    <i class="fa fa-circle-thin" aria-hidden="true"></i>
                </td>
                <td class="d-none d-md-table-cell">
                    <input 
                        type="checkbox"
                        class="custom-control-input float-right" 
                        id="checkSelect{{key}}">
                    <label 
                        class="custom-control-label float-right"
                        for="checkSelect{{key}}"
                        ng-click="seleccionarPunto(key)"></label>
                    <button
                        type="button"
                        class="btn btn-xs p-1 float-right mr-5"
                        ng-click="eliminar(key, puntoDescarga.id)">
                        <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)">
                        <i class="fa fa-pencil" aria-hidden="true"></i>
                    </button>
                </td>
            </tr>
        </tbody>
    </table>
    <form ng-show="ingreso">
        <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"
                />
            </div>
            <div class="col-6">
                <label>Longitud</label>
                <input
                    type="text"
                    class="form-control form-control-sm"
                    ng-model="puntoDescarga.longitud"
                    ng-required="true"
                />
            </div>
        </div>
        <div class="row">
            <div class="col-12">
                <label>Descripción</label>
                <textarea 
                    class="form-control form-control-sm"
                    cols="30"
                    rows="5"
                    ng-model="puntoDescarga.descripcion"></textarea>
            </div>
        </div>
    </form>
    <div ng-show="cargaArticulos">
        <div ng-show="articulos.length === 0">
            <h6>No existen articulos para agregar</h6>
        </div>
        <div ng-show="articulos.length > 0">
            <div class="row">
                <div class="form-check ml-4" ng-repeat="(key, articulo) in articulos">
                    <input 
                        class="form-check-input"
                        type="radio"
                        name="exampleRadios"
                        id="inputRadio{{key}}"
                        ng-value="key"
                        ng-model="$parent.articuloSeleccionado"
                        >
                    <label class="form-check-label" for="inputRadio{{key}}">
                        {{articulo.descripcion}} <strong>Cantidad:</strong> {{articulo.cantidad}}
                    </label>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-3 mt-3">
                    <label for="inputCantidad">Cantidad</label>
                    <input
                        type="text" 
                        class="form-control" 
                        id="inputCantidad" 
                        placeholder="Cantidad"
                        ng-model="cantidadArticulo"
                        >
                </div>
            </div>
            <div class="row">
                <div class="col-6" ng-repeat="punto in puntosACargar">
                    <div class="d-flex">
                        <h6>{{punto.descripcion}}</h6>
                        <button
                            class="btn btn-sm btn-outline-primary ml-auto"
                            type="button"
                            ng-click="agregarArticulo(punto)"
                        >
                            Agregar
                        </button>
                    </div>
                    <table class="table table-sm">
                        <thead>
                            <tr>
                                <th>Articulo</th>
                                <th class="text-right">Cantidad</th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat="(key, articulo) in punto.articulosAgregados">
                                <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)">
                                        <i class="fa fa-trash" aria-hidden="true"></i>
                                    </button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</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()"
        ng-show="ingreso">Guardar</button>
</div>