Skip to content

Commit

Permalink
✨ [#2180] Add appointment reschedule/delete link in appointment list
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Mar 21, 2024
1 parent a4e7f8c commit 167326e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/open_inwoner/accounts/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from open_inwoner.openklant.wrap import get_fetch_parameters
from open_inwoner.plans.models import Plan
from open_inwoner.qmatic.client import NoServiceConfigured, QmaticClient
from open_inwoner.qmatic.models import QmaticConfig
from open_inwoner.questionnaire.models import QuestionnaireStep
from open_inwoner.utils.views import CommonPageMixin, LogMixin

Expand Down Expand Up @@ -367,6 +368,8 @@ def get_context_data(self, **kwargs) -> dict[str, Any]:
context["appointments"] = client.list_appointments_for_customer(
quote(self.request.user.email)
)
config = QmaticConfig.get_solo()
context["booking_base_url"] = config.booking_base_url
return context

@cached_property
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.10 on 2024-03-21 10:19

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("qmatic", "0001_initial"),
]

operations = [
migrations.AddField(
model_name="qmaticconfig",
name="booking_base_url",
field=models.URLField(
blank=True,
help_text="The base URL where the user can reschedule or delete their appointment",
max_length=1000,
verbose_name="Booking base URL",
),
),
]
8 changes: 8 additions & 0 deletions src/open_inwoner/qmatic/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ class QmaticConfig(SingletonModel):
"Example: https://example.com:8443/calendar-backend/public/api/v1/"
),
)
booking_base_url = models.URLField(
verbose_name=_("Booking base URL"),
max_length=1000,
help_text=_(
"The base URL where the user can reschedule or delete their appointment"
),
blank=True,
)

objects = QmaticConfigManager()

Expand Down
16 changes: 5 additions & 11 deletions src/open_inwoner/templates/pages/profile/appointments.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,12 @@ <h2 class="card__heading-2">{{ appointment.title }}</h2>
{% list_item text=appointment.branch.addressLine2 compact=True strong=False %}
{% endrender_list %}

<span class="link link--icon link--secondary"
aria-label="{% trans "Wijzig afspraak" %}"
title="{% trans "Wijzig afspraak" %}">
<span class="link__text">{% trans "Wijzig afspraak" %}</span>
<a href="{{ booking_base_url }}{{ appointment.publicId }}" class="link link--icon link--secondary"
aria-label="{% trans "Wijzig of annuleer afspraak" %}"
title="{% trans "Wijzig of annuleer afspraak" %}">
<span class="link__text">{% trans "Wijzig of annuleer afspraak" %}</span>
{% icon icon="arrow_forward" icon_position="after" primary=True outlined=True %}
</span>
<span class="link link--icon link--secondary"
aria-label="{% trans "Annuleer afspraak" %}"
title="{% trans "Annuleer afspraak" %}">
<span class="link__text">{% trans "Annuleer afspraak" %}</span>
{% icon icon="arrow_forward" icon_position="after" primary=True outlined=True %}
</span>
</a>
</div>
</div>
{% endrender_column %}
Expand Down

0 comments on commit 167326e

Please sign in to comment.