From 95668319682d326c21dec7a694b9fbfcc3479c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bovard?= Date: Fri, 23 Feb 2024 16:57:53 +0100 Subject: [PATCH 01/12] Display user full name in timeline instead of username --- .../submissions/templates/submissions/submission_detail.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geocity/apps/submissions/templates/submissions/submission_detail.html b/geocity/apps/submissions/templates/submissions/submission_detail.html index 98fef780c..b4dee80b0 100644 --- a/geocity/apps/submissions/templates/submissions/submission_detail.html +++ b/geocity/apps/submissions/templates/submissions/submission_detail.html @@ -122,7 +122,7 @@

{% translate "Historique" %}

{% translate "Demande soumise par" %}
- {{ archive.history_user }} + {{ archive.history_user.get_full_name }}
{% else %} @@ -135,7 +135,7 @@

{% translate "Historique" %}

{{ archive.get_status_display }}
- ({{ archive.history_user }}) + ({{ archive.history_user.get_full_name }})
{% endif %} From 58b878272d7e25e0d786559a08e22bc05887786e Mon Sep 17 00:00:00 2001 From: monodo Date: Wed, 28 Feb 2024 16:18:15 +0100 Subject: [PATCH 02/12] fix entrypoint (#946) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix entrypoint * adress review comments * use elif * compile messages * DRY version --------- Co-authored-by: Rémi Bovard --- entrypoint.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6361dd014..fc32baf24 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,19 +6,19 @@ set -e # If not will, the container will fail and restart. python3 manage.py shell -c "import django; django.db.connection.ensure_connection();" -# On PROD, we run migrations at startup unless explicitly disabled. -# If disabled, this command must be run manually for the application to function correctly after a model update. -if [ "$ENV" == "PROD" ] && [ "${DISABLE_MIGRATION_SCRIPT_ON_PRODUCTION}" != "true" ]; then - python3 manage.py migrate -fi - -# On PROD, we always collect statics if [ "$ENV" == "PROD" ]; then + # On PROD, we run migrations at startup unless explicitly disabled. + # If disabled, this command must be run manually for the application to function correctly after a model update. + if [ "${DISABLE_MIGRATION_SCRIPT_ON_PRODUCTION}" != "true" ]; then + python3 manage.py migrate + fi python3 manage.py collectstatic --no-input +elif [ "$ENV" == "DEV" ]; then + python3 manage.py migrate fi -python3 manage.py update_integrator_permissions python3 manage.py compilemessages -l fr +python3 manage.py update_integrator_permissions # Run the command exec $@ From 6f2103402be4a307cf7d2ede970cb823a0a4e71a Mon Sep 17 00:00:00 2001 From: monodo Date: Wed, 28 Feb 2024 16:54:51 +0100 Subject: [PATCH 03/12] Service fee for submission yc 785 (#925) * Initial work on 'emoluments' for polcons. * Add table and update view + minor fixes in models and form. * Update date widget for Prestations. * Update settings: add default prestation price. * Update payment models. * Update submission form. * Add prestation_price to the AdministrativeEntity accounts/model. * Add new entry in AdministrativeEntityAdmin. * Add new entry 'administrative_entity' in list_display and search_fields in the admin. * Update submission form. * Update dev compose file. * Update payement models; add administrative_entity and permit_department fields. * Add new permission 'has_permission_to_add_prestations'. * Add new action fields to PrestationTable. * Add new url /prestations * Remove for from _submission_actions in order to keep it an other file. * Update dev Compose file. * Add new statuses for the ability to add prestations and remove unused variable. * Formatting * Add new function 'create_new_submission_prestation' to create a new prestation. * Update LC_MESSAGES. * Update submissions templates related to prestations. * Update _submission_actions template. * Update shortcuts. * Add empty_text to prestation table. * Update _submission_actions template. * Minor fix. * Minor fix. * Update urls; add a route for editing services fees. * Update messages. * Remove comments. * Major update: filter service fees by submissions and user groups' status. Harmonize namming. Add missing translations. * Update locale. * Add reset script for convenience. * Minor fix. * Minor fix. * Update ServiceFeesForm in forms.py. * Fix agenda_visible variable default value. * Update submission model: add an action for updating a service fee. * Update urls.py add routes for CRUD operation on service fees. * Update ServiceFees and ServicesFeesType models. * Update tables.py: add permit_department column. * Rename service fee creation template to fit CRUD naming. * Update permissions for creating a service fee and add permission for updating a service fee. * Update shortcuts.py: add function to get services fee for user or 404. * Minor fix on _submission_actions template. * Update logging capabilities. * Minor fix in reset script for development. * Update locale. * Update views.py: add some view to update and delete service fees. * Add templates for deleting and updating service fees. * Add table template for editing and deleting service fees. * Add condition on db service in dev Compose file. * Minor fix on AdministrativeEntity account model. * Get pricing from administrative_entity in ServicesFees model. * Minor fix. * Upgrade fixturize data. * Minor fix. * Minor: fix visibility of 'services_fees_type' in ServicesFeesForm. * Minor fix. * Code cleaning. * Code cleaning. * Upgrade the get_service_fees() method to get_service_fees_for_user(). * Code cleaning. * Add permission to delete a service fee. * Update locale. * Update locale. Switch back main language to fr. * Update base_generic.html. Add timer script to display info messages. * Update account admin. * Update account model: add min_cfc2_price and services_fees_hourly_rate fields. * Add message timer script. * Add fixed is_fixed_price field to ServicesFeesTypeAdmin. * Add SubmissionCFC2Price model in payements. * Minor fix. * Minor fix. * Add action to manage CFC 2 amount in the Submission model. * Minor fix. * Minor fix. * Minor fix. * Minor fix. * Minor update in settings. * Add permissions to create, update and delete service fees for all 3 main user groups. * Add permissions to create, update and delete service fees in Submission model. * Update urlpatterns for a clearer separation. * Minor fix in ServicesFees model. * Update permissions to allow validators to create, update and delete sercice fees. * Update submission forms: add CFC2Form + fix set form in readonly when instantiate from the delete view. * Update service fees html templates. * Major refactor of the service fees views. * Minor fix. * Restore .pre-commit-config.yaml. * Minor fix. * Remove unnecessary code. * Code cleaning. * Update service fees views and templates: add a cancel button on update view. * Retore dev Compose file. * Add Cancel button everywhere in service fees views. * Update locale. * UX/UI enhancements. * Minor fix. * Update main.css. * Code cleaning. * Update submission model: remove unnecessary constants. * Update tables: add footer with sum over the amount of the services fees. * Minor updates on service fees templates. * Fix locale. * Fix error in ServicesFeesTable. * Minor fix. * Update ServicesFeesTable: add sum for timedelta. * Formatting. * Add convenience functions. * Minor fix in ServicesFeesForm. * Update *_submission_service_fees views to autofill 'provided_by' when not present. * Update submission views and forms; move logic about the 'provided_by' autocompletion for validators in forms.py. * Update locale. * UX/UI update on buttons. * Add is_fixed_priced boolean field to ServicesFees model. * Major update: add the abilit to add a fix price service fee. * Minor update. * Harmonize service fees templates. * Minor update. * Minor update. * Update locale. * Make get_service_fee_for_user_or_404 function more robust. * Move some logic from service fees related views to ServicesFeesForm. * Add new generic template for services fees actions. * Add new generic view and url for services fees actions. * Clean ServicesFeesForm. * Move mode from URL to query params. Add action to query params. * Update template to include the CREATE action. * Minor fix. * Update urls: remove CRUD verbs from endpoints. * Remove deprecated code: add the ability to CREATE a new service fee in submission_service_fees(). * Remove deprecated templates. * Add verbosity. * Add missing form for create action in template. * Add some missing condition checks for create action in submission_service_fees() and remove deprecated code. * Minor fix. * Replace detailed permissions in Submission model. * Remove unncessary field and minor fix. * Replace detailed permissions with a unique generic one for managing services fees. * Add inline for ServicesFees in the account admin in order to manage sercices fees at the administrative entity level. * Replace detailed permissions by a unique and more generic one for managing services fees. * Add verbosity. * Update locale. * Minor fix. * Override form for ServicesFeesTypeAdmin using ServicesFeesTypeAdminForm. * Add statuses to get_service_fee(). * Update locale. * Minor update. * Minor fix. * Update ServicesFeesType() model; set a fix_price attribute. * Add fix_price to ServicesFeesTypeAdminForm and ServicesFeesTypeAdmin. * Add context data to submission_service_fees view. * Add icon for ServicesFeesType in jazzmin admin. * Use a global settings for the currency of service fees. * Cleaning. * Update monetary_amount in the form based on the service fee type defined by the admin. * Update locale. * Add migrations files. * Update migations. * Fix _submission_actions template. * Fixtures, Tests, Bugfixes, DRYer approach * handle validator + backoffice user case * fix according to review and handle user name representation * keep same tab open after crud * change migration numbers and dependencies * make forms.py more readable for future improvement * update comment * add more security to ServiceFee access * reformat file, add missing div and missing space * fix tests * rename function --------- Co-authored-by: nicolas-heigvd Co-authored-by: Alexandre Junod --- docker-compose.dev.yml | 12 +- geocity/apps/accounts/admin.py | 30 +- .../accounts/migrations/0017_service_fee.py | 24 + geocity/apps/accounts/models.py | 10 +- geocity/apps/accounts/permissions_groups.py | 5 + geocity/apps/accounts/users.py | 1 + geocity/apps/api/serializers.py | 22 +- geocity/apps/api/views.py | 4 +- geocity/apps/core/static/css/main.css | 8 + geocity/apps/core/static/js/messages_timer.js | 8 + .../core/static/js/submission_prestation.js | 21 + geocity/apps/core/templates/base_generic.html | 9 +- geocity/apps/forms/admin.py | 2 + .../apps/forms/migrations/0035_service_fee.py | 21 + geocity/apps/forms/models.py | 3 + geocity/apps/submissions/admin.py | 2 +- geocity/apps/submissions/forms.py | 209 +- .../management/commands/fixturize.py | 159 +- .../management/fixturize_data/generic.py | 12 +- .../migrations/0026_service_fee.py | 254 + geocity/apps/submissions/models.py | 55 +- geocity/apps/submissions/payments/models.py | 173 + geocity/apps/submissions/permissions.py | 30 +- geocity/apps/submissions/shortcuts.py | 36 +- geocity/apps/submissions/signal_receivers.py | 0 geocity/apps/submissions/tables.py | 90 +- .../submissions/_submission_actions.html | 663 ++- .../submissions/submission_detail.html | 21 +- .../submissions/submission_service_fees.html | 131 + .../submissions/submissions_list.html | 2 +- .../tables/_archived_submission_actions.html | 4 +- .../templates/tables/_submission_actions.html | 8 +- ...submission_service_fees_table_actions.html | 19 + geocity/apps/submissions/urls.py | 10 + geocity/apps/submissions/views.py | 314 +- geocity/settings.py | 20 +- geocity/tests/factories.py | 52 +- .../test_pdf_preview/page-000.expected.png | Bin 355457 -> 370492 bytes .../test_submission_service_fees.py | 595 +++ .../functional/test_submission_update.py | 2 - geocity/urls.py | 19 +- locale/de/LC_MESSAGES/django.mo | Bin 0 -> 380 bytes locale/de/LC_MESSAGES/django.po | 4554 ++++++++++++++--- locale/en/LC_MESSAGES/django.mo | Bin 466 -> 8332 bytes locale/en/LC_MESSAGES/django.po | 4542 +++++++++++++--- locale/fr/LC_MESSAGES/django.mo | Bin 473 -> 347 bytes locale/fr/LC_MESSAGES/django.po | 4505 +++++++++++++--- locale/it/LC_MESSAGES/django.mo | Bin 0 -> 380 bytes locale/it/LC_MESSAGES/django.po | 4508 +++++++++++++--- 49 files changed, 17964 insertions(+), 3205 deletions(-) create mode 100644 geocity/apps/accounts/migrations/0017_service_fee.py create mode 100644 geocity/apps/core/static/js/messages_timer.js create mode 100644 geocity/apps/core/static/js/submission_prestation.js create mode 100644 geocity/apps/forms/migrations/0035_service_fee.py create mode 100644 geocity/apps/submissions/migrations/0026_service_fee.py delete mode 100644 geocity/apps/submissions/signal_receivers.py create mode 100644 geocity/apps/submissions/templates/submissions/submission_service_fees.html create mode 100644 geocity/apps/submissions/templates/tables/_submission_service_fees_table_actions.html create mode 100644 geocity/tests/submissions/functional/test_submission_service_fees.py create mode 100644 locale/de/LC_MESSAGES/django.mo create mode 100644 locale/it/LC_MESSAGES/django.mo diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 0e73509b3..ee5b74ea1 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -5,6 +5,9 @@ volumes: services: web: + # Uncomment those two lines for debug + #tty: true + #stdin_open: true build: args: ENV: DEV @@ -19,13 +22,20 @@ services: - ./_dev_volumes/private_documents:/private_documents - ./_dev_volumes/archive:/archive depends_on: - - "postgres" + postgres: + condition: service_healthy ports: - "${DJANGO_DOCKER_PORT}:9000" postgres: image: postgis/postgis:13-3.2 restart: unless-stopped + healthcheck: + test: [ "CMD", "pg_isready", "-q", "-U", "${PGUSER}" ] + interval: 5s + timeout: 10s + retries: 3 + start_period: 10s environment: - POSTGRES_USER=${PGUSER} - POSTGRES_PASSWORD=${PGPASSWORD} diff --git a/geocity/apps/accounts/admin.py b/geocity/apps/accounts/admin.py index af99ded5c..611bd9cac 100644 --- a/geocity/apps/accounts/admin.py +++ b/geocity/apps/accounts/admin.py @@ -17,6 +17,7 @@ from geocity.apps.accounts.models import AdministrativeEntity, UserProfile from geocity.apps.reports.models import Report from geocity.apps.submissions.models import Submission, SubmissionWorkflowStatus +from geocity.apps.submissions.payments.models import ServiceFeeType from geocity.fields import GeometryWidget from . import models, permissions_groups @@ -67,6 +68,7 @@ """ + # Allow a user belonging to integrator group to see only objects created by this group def filter_for_user(user, qs): if not user.is_superuser: @@ -453,7 +455,6 @@ class Media: css = {"all": ("css/admin/admin.css",)} def clean_permissions(self): - permissions = self.cleaned_data["permissions"] permissions_for_trusted_users = Permission.objects.filter( codename__in=permissions_groups.AVAILABLE_FOR_INTEGRATOR_PERMISSION_CODENAMES @@ -603,7 +604,6 @@ def get__sites_number(self, obj): get__sites_number.short_description = _("Nombre de sites") def get_queryset(self, request): - if request.user.is_superuser: qs = Group.objects.all() else: @@ -627,14 +627,12 @@ def save_model(self, request, obj, form, change): def formfield_for_manytomany(self, db_field, request, **kwargs): # permissions that integrator role can grant to group if db_field.name == "permissions": - if ( not request.user.is_superuser and request.user.groups.get( permit_department__is_integrator_admin=True ).pk ): - integrator_permissions = Permission.objects.filter( codename__in=permissions_groups.AVAILABLE_FOR_INTEGRATOR_PERMISSION_CODENAMES ) @@ -649,7 +647,6 @@ def label_from_instance(self, obj): def get_sites_field(user): - qs = models.Site.objects.all() if not user.is_superuser: @@ -702,6 +699,7 @@ class Meta: "signature_sheet", "signature_sheet_description", "additional_searchtext_for_address_field", + "services_fees_hourly_rate", "geom", "integrator", ] @@ -760,9 +758,15 @@ class SubmissionWorkflowStatusInline(admin.TabularInline): verbose_name_plural = _("Flux (complet par défaut)") +class ServiceFeeInline(admin.TabularInline): + model = ServiceFeeType + extra = 3 + verbose_name = _("Type de prestation") + verbose_name_plural = _("Types de prestation") + + @admin.register(models.AdministrativeEntityForAdminSite) class AdministrativeEntityAdmin(IntegratorFilterMixin, admin.ModelAdmin): - fieldsets = ( ( None, @@ -822,7 +826,17 @@ class AdministrativeEntityAdmin(IntegratorFilterMixin, admin.ModelAdmin): ), }, ), + ( + _("Tarification des prestations"), + { + "fields": ("services_fees_hourly_rate",), + "description": _( + "La tarification des prestations permet de saisir le tarif horaire de facturation des prestations pour l'entité administrative courante." + ), + }, + ), ) + # Pass the user from ModelAdmin to ModelForm def get_form(self, request, obj=None, **kwargs): Form = super().get_form(request, obj, **kwargs) @@ -837,6 +851,7 @@ def __new__(cls, *args, **kwargs): change_form_template = "accounts/admin/administrative_entity_change.html" form = AdministrativeEntityAdminForm inlines = [ + ServiceFeeInline, SubmissionWorkflowStatusInline, ] list_filter = [ @@ -854,6 +869,7 @@ def __new__(cls, *args, **kwargs): "get_tags", "get_is_single_form", "get_sites", + "services_fees_hourly_rate", ] def sortable_str(self, obj): @@ -882,7 +898,6 @@ def get_is_single_form(self, obj): get_is_single_form.admin_order_field = "is_single_form_submissions" def formfield_for_foreignkey(self, db_field, request, **kwargs): - if db_field.name == "integrator": kwargs["queryset"] = Group.objects.filter( permit_department__is_integrator_admin=True, @@ -890,7 +905,6 @@ def formfield_for_foreignkey(self, db_field, request, **kwargs): return super().formfield_for_foreignkey(db_field, request, **kwargs) def save_model(self, request, obj, form, change): - if not request.user.is_superuser: obj.integrator = request.user.groups.get( permit_department__is_integrator_admin=True diff --git a/geocity/apps/accounts/migrations/0017_service_fee.py b/geocity/apps/accounts/migrations/0017_service_fee.py new file mode 100644 index 000000000..926a606e4 --- /dev/null +++ b/geocity/apps/accounts/migrations/0017_service_fee.py @@ -0,0 +1,24 @@ +# Generated by Django 4.2.9 on 2024-01-24 08:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("accounts", "0016_administrativeentity_reply_to_email"), + ] + + operations = [ + migrations.AddField( + model_name="administrativeentity", + name="services_fees_hourly_rate", + field=models.DecimalField( + decimal_places=2, + default=0.0, + help_text="Tarif horaire des prestations de l'entité administrative", + max_digits=12, + verbose_name="Tarif horaire", + ), + ), + ] diff --git a/geocity/apps/accounts/models.py b/geocity/apps/accounts/models.py index 6c1a15c61..1296960f5 100644 --- a/geocity/apps/accounts/models.py +++ b/geocity/apps/accounts/models.py @@ -334,7 +334,6 @@ class AdministrativeEntity(models.Model): default=True, help_text=_("Nécessaire pour l'utilisation du système de paiement en ligne"), ) - sites = models.ManyToManyField( Site, related_name="administrative_entity", @@ -357,6 +356,14 @@ class AdministrativeEntity(models.Model): signature_sheet_description = models.TextField( _("Texte explicatif relatif au volet de transmission"), blank=True ) + services_fees_hourly_rate = models.DecimalField( + decimal_places=2, + max_digits=12, + default=settings.DEFAULT_SERVICES_FEES_RATE, + verbose_name=_("Tarif horaire"), + help_text=_("Tarif horaire des prestations de l'entité administrative"), + ) + objects = AdministrativeEntityManager() class Meta: @@ -611,7 +618,6 @@ class Meta: verbose_name_plural = _("3.2 Consultation des auteurs") def __str__(self): - return ( str(self.user.first_name) + " " + str(self.user.last_name) if self.user diff --git a/geocity/apps/accounts/permissions_groups.py b/geocity/apps/accounts/permissions_groups.py index f62c1c4cf..500ffb5c6 100644 --- a/geocity/apps/accounts/permissions_groups.py +++ b/geocity/apps/accounts/permissions_groups.py @@ -20,6 +20,7 @@ "submissions": [ "submissionamendfield", "submissionworkflowstatus", + "servicefeetype", ], "reports": [ "report", @@ -28,6 +29,7 @@ "section", "headerfooter", ], + # FIXME: get nested submissions.payments } # define permissions required by integrator role @@ -62,6 +64,7 @@ "can_generate_pdf", "can_refund_transactions", "can_revert_refund_transactions", + "can_manage_service_fee", ] DEFAULT_PILOT_PERMISSION_CODENAMES = [ @@ -69,9 +72,11 @@ "amend_submission", "classify_submission", "can_generate_pdf", + "can_manage_service_fee", ] DEFAULT_VALIDATOR_PERMISSION_CODENAMES = [ "read_submission", "validate_submission", + "can_manage_service_fee", ] diff --git a/geocity/apps/accounts/users.py b/geocity/apps/accounts/users.py index e7cc8a111..0d4901bd7 100644 --- a/geocity/apps/accounts/users.py +++ b/geocity/apps/accounts/users.py @@ -114,4 +114,5 @@ def get_users_list_for_integrator_admin(user, remove_anonymous=False): ): anonymous_users.append(user.pk) qs = qs.exclude(pk__in=anonymous_users) + return qs diff --git a/geocity/apps/api/serializers.py b/geocity/apps/api/serializers.py index a4e468c0e..0b9427e6a 100644 --- a/geocity/apps/api/serializers.py +++ b/geocity/apps/api/serializers.py @@ -24,7 +24,7 @@ SubmissionGeoTime, SubmissionInquiry, ) -from geocity.apps.submissions.payments.models import SubmissionPrice +from geocity.apps.submissions.payments.models import ServiceFee, SubmissionPrice from geocity.apps.submissions.payments.postfinance.models import PostFinanceTransaction @@ -291,6 +291,23 @@ class Meta: ) +class SubmissionServiceFeeSerializer(serializers.ModelSerializer): + + permit_department = serializers.SlugRelatedField( + read_only=True, slug_field="shortname" + ) + service_fee_type = serializers.SlugRelatedField(read_only=True, slug_field="name") + + class Meta: + model = ServiceFee + fields = ( + "permit_department", + "service_fee_type", + "time_spent_on_task", + "monetary_amount", + ) + + class PostFinanceTransactionPrintSerializer(serializers.ModelSerializer): def to_representation(self, instance): repr = super(PostFinanceTransactionPrintSerializer, self).to_representation( @@ -338,6 +355,7 @@ class Meta: "forms_names", "current_inquiry", "price", + "service_fees_total_price", "sent_date", ) @@ -638,6 +656,7 @@ class SubmissionPrintSerializer(gis_serializers.GeoFeatureModelSerializer): read_only=True, source="author.userprofile", default=None ) validations = SubmissionValidationSerializer(source="*", read_only=True) + service_fee = SubmissionServiceFeeSerializer(many=True, read_only=True) def get_creditor_type(self, obj): if obj.creditor_type is not None: @@ -673,6 +692,7 @@ class Meta: "author", "geo_envelop", "validations", + "service_fee", ) @classmethod diff --git a/geocity/apps/api/views.py b/geocity/apps/api/views.py index fe116ba35..806276563 100644 --- a/geocity/apps/api/views.py +++ b/geocity/apps/api/views.py @@ -249,7 +249,6 @@ def get_queryset(self, geom_type=None): ), to_attr="current_inquiries_filtered", ) - qs = ( Submission.objects.filter(base_filter) .filter( @@ -263,6 +262,9 @@ def get_queryset(self, geom_type=None): .prefetch_related(geotime_prefetch) .prefetch_related(current_inquiry_prefetch) .prefetch_related("selected_forms", "contacts") + .prefetch_related("service_fee") + .prefetch_related("service_fee__permit_department") + .prefetch_related("service_fee__service_fee_type") .select_related( "administrative_entity", "author", diff --git a/geocity/apps/core/static/css/main.css b/geocity/apps/core/static/css/main.css index 26438d6d5..39be27d6b 100644 --- a/geocity/apps/core/static/css/main.css +++ b/geocity/apps/core/static/css/main.css @@ -159,6 +159,10 @@ input:focus { vertical-align: baseline; } +.table tfoot { + font-weight: bold; +} + .page-item.active .page-link { background-color: var(--primary-color); border-color: var(--primary-color); @@ -407,6 +411,10 @@ h5 { color: crimson; } +.fa-trash-white { + color: #ffffff; +} + .table-container { overflow-x: visible; } diff --git a/geocity/apps/core/static/js/messages_timer.js b/geocity/apps/core/static/js/messages_timer.js new file mode 100644 index 000000000..0c3d8f95d --- /dev/null +++ b/geocity/apps/core/static/js/messages_timer.js @@ -0,0 +1,8 @@ +// Get all messages of the alert-success class +let info_messages = document.getElementsByClassName('alert-success'); + +setTimeout(function(){ + for (let i = 0; i < info_messages.length; i ++) { + info_messages[i].setAttribute('style', 'display:none'); + } +}, 4000); diff --git a/geocity/apps/core/static/js/submission_prestation.js b/geocity/apps/core/static/js/submission_prestation.js new file mode 100644 index 000000000..d8cece13a --- /dev/null +++ b/geocity/apps/core/static/js/submission_prestation.js @@ -0,0 +1,21 @@ +const updateFormMonetaryAmount = () => { + var serviceFeeType = document.getElementById("select2-id_service_fee_type-container"); + let monetaryAmount = document.getElementById("id_monetary_amount"); + let jsonstr = JSON.parse(document.getElementById("get-data").textContent); + if (!jsonstr) { + return; + } + let json = JSON.parse(jsonstr); + if (monetaryAmount) { + json.forEach((item) => { + if (item.name === serviceFeeType.title) { + monetaryAmount.value = item.fix_price + if (item.fix_price_editable ) { + monetaryAmount.readOnly = false; + } else { + monetaryAmount.readOnly = true; + } + } + }); + } +}; diff --git a/geocity/apps/core/templates/base_generic.html b/geocity/apps/core/templates/base_generic.html index 8aab353a1..e5b2887b9 100644 --- a/geocity/apps/core/templates/base_generic.html +++ b/geocity/apps/core/templates/base_generic.html @@ -16,9 +16,10 @@ - + + {% endblock %} {% block stylesheets %} @@ -32,7 +33,7 @@ --text-color: {{ config.TEXT_COLOR }}; --title-color: {{ config.TITLE_COLOR }}; --table-color: {{ config.TABLE_COLOR }}; - --login-background-color:{{ config.LOGIN_BACKGROUND_COLOR }}; + --login-background-color: {{ config.LOGIN_BACKGROUND_COLOR }}; } @@ -44,7 +45,7 @@ {% block navbar %}