From ca4a939fd8aadf3ac08b56d60626f3c8dd96f2e9 Mon Sep 17 00:00:00 2001 From: AdalbertoCV <34152734@uaz.edu.mx> Date: Wed, 16 Oct 2024 13:06:00 -0600 Subject: [PATCH] =?UTF-8?q?Actualizaci=C3=B3n=20de=20estilos=20+=20formato?= =?UTF-8?q?=20de=20diccionario=20en=20lookups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cosiap_api/dynamic_tables/DynamicTable.py | 18 +++-- cosiap_frontend/src/App.css | 56 ++++++++++++-- .../src/components/admin/HistorialAdmin.jsx | 2 +- .../components/modalidades/CrearModalidad.jsx | 77 ++++++++++++++++--- .../modalidades/EditarModalidad.jsx | 55 ++++++++++--- .../solicitudes/HistorialSolicitudes.jsx | 4 +- 6 files changed, 173 insertions(+), 39 deletions(-) diff --git a/cosiap_api/dynamic_tables/DynamicTable.py b/cosiap_api/dynamic_tables/DynamicTable.py index a8f7cbb..ca33432 100644 --- a/cosiap_api/dynamic_tables/DynamicTable.py +++ b/cosiap_api/dynamic_tables/DynamicTable.py @@ -198,6 +198,7 @@ class DynamicTable(serializers.ModelSerializer): field_path = column.split('__') field = model label = "" + for part in field_path: if field._meta.get_field(part).is_relation: field = field._meta.get_field(part).related_model @@ -208,30 +209,34 @@ class DynamicTable(serializers.ModelSerializer): else: label = part.capitalize() + # Inicializar lookups como un diccionario con valores nulos + lookups_dict = {lookup: None for lookup in []} + filter_info = { 'campo': column, 'label': label, 'html_type': '', - 'lookups': [], + 'lookups': lookups_dict, } + # Verificamos el tipo de campo actual para poder enviar los filtros disponibles # correctos según el tipo de campo, y el html_value correspondiente if isinstance(field, models.CharField) or isinstance(field, models.TextField): filter_info['html_type'] = 'textInput' - filter_info['lookups'] = ['icontains'] + filter_info['lookups'] = {'icontains': None} # verificamos si existen choices para crear un nuevo diccionario "exact" con las keys y values if field.choices: - filter_info['lookups'] = ['iexact'] + filter_info['lookups'] = {'iexact': None} filter_info['choices'] = [{'label': choice[1], 'value': choice[0]} for choice in field.choices] elif isinstance(field, models.IntegerField) or isinstance(field, models.FloatField) or isinstance(field, models.DecimalField): filter_info['html_type'] = 'numberInput' - filter_info['lookups'] = ['gt', 'lt'] + filter_info['lookups'] = {'gt': None, 'lt': None} elif isinstance(field, models.DateField) or isinstance(field, models.DateTimeField): filter_info['html_type'] = 'dateInput' - filter_info['lookups'] = ['gt', 'lt', 'gte', 'lte'] + filter_info['lookups'] = {'gt': None, 'lt': None, 'gte': None, 'lte': None} elif isinstance(field, models.BooleanField): filter_info['html_type'] = 'checkbox' - filter_info['lookups'] = ['iexact'] + filter_info['lookups'] = {'iexact': None} filter_info['choices'] = ['True', 'False'] available_filters.append(filter_info) @@ -239,6 +244,7 @@ class DynamicTable(serializers.ModelSerializer): return available_filters + @staticmethod def validate_and_clean_filters(request_data, available_filters): ''' diff --git a/cosiap_frontend/src/App.css b/cosiap_frontend/src/App.css index 61cc03b..c6e36f4 100644 --- a/cosiap_frontend/src/App.css +++ b/cosiap_frontend/src/App.css @@ -126,12 +126,18 @@ textarea { background-color: #696d69; color: white; border: none; - padding: 8px 12px; + padding: 12px 18px; /* Más espacio para alargar el botón */ font-size: 14px; border-radius: 16px; cursor: pointer; margin-top: 10px; margin-right: 10px; + + display: flex; /* Alinear el contenido del botón */ + align-items: center; + justify-content: center; + gap: 8px; /* Espacio entre el ícono y el texto */ + transition: background-color 0.3s ease; } .add-button:hover { @@ -225,13 +231,50 @@ input[type="checkbox"] { } .card { - border: 1px solid #ddd; - border-radius: 5px; - margin: 15px 0; - padding: 10px; - background-color: #f5f5f5; + border: 2px solid #b4756e; + border-radius: 12px; + margin: 20px 0; + padding: 15px; + background-color: #f1f1f1; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + transition: transform 0.3s ease, box-shadow 0.3s ease; +} + + +.card-header-section { + font-weight: bold; + font-size: 18px; + color: brown; /* Color verde oscuro para el título */ + margin-bottom: 10px; + border-bottom: 1px solid #6b1a08; /* Línea inferior */ + padding-bottom: 5px; +} + +.card-header-element { + font-weight: bold; + font-size: 16px; + color: brown; /* Color verde oscuro para el título */ + margin-bottom: 10px; + border-bottom: 1px solid #6b1a08; /* Línea inferior */ + padding-bottom: 5px; } +.card-header-option { + font-weight: bold; + font-size: 14px; + color: brown; /* Color verde oscuro para el título */ + margin-bottom: 10px; + border-bottom: 1px solid #6b1a08; /* Línea inferior */ + padding-bottom: 5px; +} + +.card-body { + padding: 10px 0; + font-size: 16px; + line-height: 1.6; /* Mejor legibilidad */ +} + + .element-card { border: 1px solid #ddd; border-radius: 5px; @@ -893,3 +936,4 @@ th, td { .confirm-delete-menu button:hover { opacity: 0.9; /* Efecto hover */ } + diff --git a/cosiap_frontend/src/components/admin/HistorialAdmin.jsx b/cosiap_frontend/src/components/admin/HistorialAdmin.jsx index 7f0b110..aa9232c 100644 --- a/cosiap_frontend/src/components/admin/HistorialAdmin.jsx +++ b/cosiap_frontend/src/components/admin/HistorialAdmin.jsx @@ -101,7 +101,7 @@ const ListaSolicitudesSolicitante = () => {