Conjunto de cambios 84aeeb7 en seiven para productivo
- Fecha y hora:
- 20/12/2017 14:09:08 (hace 6 años)
- Branches:
- master
- Children:
- 5bd3e39
- Parents:
- 00f3e65
- Ubicación:
- productivo
- Ficheros:
-
- 6 editados
Leyenda
- No modificado
- Añadido
- Eliminado
-
productivo/ajax.py
raccc529 r84aeeb7 67 67 68 68 return HttpResponse(json.dumps({'result': False, 'message': str(message)})) 69 70 @login_required 71 def get_result_unidad_economica(request): 72 try: 73 if not request.is_ajax(): 74 return HttpResponse(json.dumps({'result': False, 'message': str(MSG_NOT_AJAX)})) 75 76 items_ue = request.POST.getlist('items_ue[]') 77 items_su = request.POST.getlist('items_su[]') 78 items_pp = request.POST.getlist('items_pp[]') 79 items_ae = request.POST.getlist('items_ae[]') 80 id_list = request.POST.getlist('id_list[]') 81 print(id_list) 82 data = api_unidad_economica(id_list) 83 message = _('No existen datos') 84 85 86 #data = api_unidad_economica(rif, nombre, estado, anho, id_list) 87 88 #if data['results']: 89 # return HttpResponse(json.dumps({ 90 # 'result': True, 'unidades_economicas': data['results'], 'message': '' 91 # })) 92 93 except Exception as e: 94 message = e 95 96 return HttpResponse(json.dumps({'result': False, 'message': str(message)})) -
productivo/templates/productivo.menu.area.html
r085e07f r84aeeb7 17 17 <h2 class="text-center">{% trans 'Unidad Económica' %}</h2> 18 18 </div> 19 < div class="col-md-3">19 <!--<div class="col-md-3"> 20 20 <img src="{% static 'img/area-productiva/actividades-economicas.png' %}" 21 21 alt="{% trans 'Actividades Economicas' %}" class="img-area img-responsive" … … 49 49 </li> 50 50 </ul> 51 </div> 51 </div>--> 52 52 </div> 53 53 </div> -
productivo/templates/productivo.ue.datos.consultados.html
rca8b5aa r84aeeb7 18 18 <div class="row"> 19 19 <div class="col-md-12"> 20 <table class="table table-striped table-hover display dataTable responsive" width="100%" id="result-consult"> 21 <thead> 22 <tr> 23 <th class="col-md-1"> 24 <input type="checkbox" id="check_all" role="button" data-toggle="tooltip" 25 title="{% trans 'Marque para seleccionar todos los registros' %}"> 26 </th> 27 <th class="col-md-3">{% trans 'R.I.F.' %}</th> 28 <th class="col-md-4">{% trans 'Nombre' %}</th> 29 <th class="col-md-4">{% trans 'Razon Social' %}</th> 30 <th class="col-md-4">{% trans 'Estado' %}</th> 31 </tr> 32 </thead> 33 <tbody></tbody> 20 <table class="table table-striped table-hover display responsive" width="100%" id="result-consult"> 21 34 22 </table> 23 <input type="hidden" id="ue_checked_for_consult"> 35 24 </div> 36 25 </div> -
productivo/templates/productivo.ue.resultado.filtros.html
rca8b5aa r84aeeb7 26 26 <div class="row"> 27 27 <div class="col-md-12"> 28 <table class="table table-striped table-hover display dataTable responsive" width="100%" id="result-consult"> 28 <table class="table table-striped table-hover display dataTable responsive" width="100%" 29 id="result-consult-datos-ue"> 29 30 <thead> 30 31 <tr> … … 67 68 <div class="row"> 68 69 <div class="col-md-12"> 69 <table class="table table-striped table-hover display dataTable responsive" width="100%" id="result-consult"> 70 <table class="table table-striped table-hover display dataTable responsive" width="100%" 71 id="result-consult-datos-sub-ue"> 70 72 <thead> 71 73 <tr> … … 108 110 <div class="row"> 109 111 <div class="col-md-12"> 110 <table class="table table-striped table-hover display dataTable responsive" width="100%" id="result-consult"> 112 <table class="table table-striped table-hover display dataTable responsive" width="100%" 113 id="result-consult-datos-proceso-productivo"> 111 114 <thead> 112 115 <tr> … … 149 152 <div class="row"> 150 153 <div class="col-md-12"> 151 <table class="table table-striped table-hover display dataTable responsive" width="100%" id="result-consult"> 154 <table class="table table-striped table-hover display dataTable responsive" width="100%" 155 id="result-consult-datos-actividad"> 152 156 <thead> 153 157 <tr> -
productivo/templates/productivo.unidad.economica.html
raccc529 r84aeeb7 32 32 </div> 33 33 <hr> 34 <h4 >{% trans 'Realice la búsqueda por una de las tres categorías' %}</h4>34 <h4 id="title-consult">{% trans 'Realice la búsqueda por una de las tres categorías' %}</h4> 35 35 <div class="row"> 36 36 <div class="col-md-4"> … … 95 95 96 96 $(document).ready(function(){ 97 var table_ue; 97 98 /** 98 99 * Evento que permite buscar datos de las Unidades Económicas de acuerdo a los datos de consulta indicados … … 117 118 dataSet.push([ 118 119 '<input type="checkbox" class="ue_consulted" value="'+datos.pk+'">', 119 datos.nombre_ue, datos.rif, datos.razon_social, ''120 datos.nombre_ue, datos.rif, datos.razon_social, datos.get_estado[1] 120 121 ]); 121 122 }); 122 123 123 $("#result-consult").DataTable({ 124 var check_all_results = '<input type="checkbox" id="check_all" role="button" ' + 125 'data-toggle="tooltip" onclick="marcar_todos($(this))" ' + 126 'title="{% trans 'Marque para seleccionar todos los registros' %}">'; 127 128 table_ue = $("#result-consult").DataTable({ 124 129 "destroy": true, 125 "data": dataSet 130 "data": dataSet, 131 "columns": [ 132 {title: check_all_results}, 133 {title: '{% trans 'R.I.F.' %}'}, 134 {title: '{% trans 'Nombre' %}'}, 135 {title: '{% trans 'Razon Social' %}'}, 136 {title: '{% trans 'Estado' %}'} 137 ] 126 138 }); 127 139 show_hide_elements([$("#datos-consultados")], []); 128 129 140 } 130 141 else { … … 147 158 if ($(this).is(':checked')) { 148 159 is_checked_ue = true; 160 var elem = $("#ue_checked_for_consult"); 161 var valor = elem.val() + "," + $(this).val(); 162 valor = (valor.indexOf(',') === 0)?valor.substring(1):valor; 163 elem.val(valor); 149 164 } 150 165 }); … … 154 169 } 155 170 show_hide_elements([$('#filtros-consulta')], [ 156 $("#form-consulta .row"), $("#datos-consultados"),$('#resultado-filtros') 171 $("#form-consulta .row"), $("#datos-consultados"),$('#resultado-filtros'), $('#title-consult') 157 172 ]); 158 173 }); … … 171 186 } 172 187 show_hide_elements([$('#resultado-filtros')], [ 173 $("#form-consulta .row"), $("#datos-consultados"), $('#filtros-consulta') 188 $("#form-consulta .row"), $("#datos-consultados"), $('#filtros-consulta'), $('#title-consult') 174 189 ]); 190 191 var opciones_ue = function() { 192 var items_ue = []; 193 $('#opciones-unidad_economica input[type=checkbox]').each(function() { 194 if ($(this).is(':checked')) { 195 items_ue.push($(this).val()); 196 } 197 }); 198 return items_ue; 199 }; 200 var opciones_pp = function () { 201 var items_pp = []; 202 $('#opciones-proceso_productivo input[type=checkbox]').each(function() { 203 if ($(this).is(':checked')) { 204 items_pp.push($(this).val()); 205 } 206 }); 207 return items_pp; 208 }; 209 210 var opciones_su = function () { 211 var items_su = []; 212 $('#opciones-sub_unidad_economica input[type=checkbox]').each(function() { 213 if ($(this).is(':checked')) { 214 items_su.push($(this).val()); 215 } 216 }); 217 return items_su; 218 }; 219 220 var opciones_ae = function () { 221 var items_ae = []; 222 $('#opciones-actividad_economica input[type=checkbox]').each(function() { 223 if ($(this).is(':checked')) { 224 items_ae.push($(this).val()); 225 } 226 }); 227 return items_ae; 228 }; 229 230 $.ajax({ 231 type: 'POST', 232 url: "{% url 'get_result_unidad_economica' %}", 233 data: { 234 items_ue: opciones_ue(), 235 items_su: opciones_su(), 236 items_pp: opciones_pp(), 237 items_ae: opciones_ae(), 238 id_list: $("#ue_checked_for_consult").val().split(','), 239 csrfmiddlewaretoken: '{{ csrf_token }}' 240 }, 241 dataType: 'JSON', 242 success: function(data) { 243 if (data.result) { 244 // Datos a mostrar de los filtros de las unidades económicas 245 246 // Datos a mostrar de los filtros de las sub unidades 247 248 // Datos a mostrar de los filtros del proceso productivo 249 250 // Datos a mostrar de los filtros de las actividades económicas 251 } 252 else { 253 //bootbox.alert(data.message); 254 } 255 }, 256 error: function(jqxhr, textStatus, error) { 257 var err = textStatus + ", " + error + ", " + jqxhr.responseJSON; 258 console.log( err ); 259 } 260 }).fail(function(jqxhr, textStatus, error) { 261 console.log(textStatus + ", " + error + ", " + jqxhr.responseJSON); 262 }); 175 263 }); 176 264 … … 181 269 182 270 /** Evento que permite seleccionar o deseleccionar todas las Unidades Económicas a consultar */ 183 $("#check_all").on('click', function() { 271 $("#check_all").on('click', function(e) { 272 e.preventDefault(); 184 273 var check_all = $(this); 185 274 $(".ue_consulted").each(function() { … … 187 276 }); 188 277 }); 278 279 189 280 190 281 /** Valida el número máximo de filtros a seleccionar para la categoría de búsqueda de Unidad Económica */ … … 241 332 }); 242 333 } 334 335 /** 336 * Marca todas las opciones mostradas en la tabla de consulta 337 * @param element object Objeto del elemento del DOM seleccionado 338 */ 339 function marcar_todos(element) { 340 var check_all = element; 341 $(".ue_consulted").each(function() { 342 $(this).prop('checked', check_all.is(':checked')); 343 }); 344 } 243 345 </script> 244 346 {% endblock %} -
productivo/urls.py
re0640af r84aeeb7 15 15 from django.contrib.auth.decorators import login_required 16 16 from .views import consultar_datos, UnidadEconomicaView, ActividadEconomicaView 17 from .ajax import get_unidad_economica 18 17 from .ajax import get_unidad_economica, get_result_unidad_economica 19 18 20 19 urlpatterns = [ … … 29 28 urlpatterns += [ 30 29 url(r'^ajax/get-unidad-economica/?$', get_unidad_economica, name='get_unidad_economica'), 30 url(r'^ajax/get-result-unidad-economica/?$', get_result_unidad_economica, name='get_result_unidad_economica'), 31 31 ]
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.