From d9899f2d56bdd19b964c387f71a9846720bd0be7 Mon Sep 17 00:00:00 2001 From: Joshua Rubingh Date: Thu, 14 May 2020 15:20:19 +0200 Subject: [PATCH] Update schedule module --- .../static/RUG_template/css/base.css | 44 + .../apps/RUG_template/templates/index.html | 4 +- .../apps/RUG_template/templates/menu.html | 15 +- .../templates/registration/login.html | 9 +- .../registration/password_reset_complete.html | 8 +- .../registration/password_reset_confirm.html | 31 +- .../registration/password_reset_done.html | 2 +- .../registration/password_reset_email.html | 27 + .../registration/password_reset_form.html | 23 +- .../apps/RUG_template/templates/singup.html | 4 +- .../management/commands/send_reports.py | 24 + .../migrations/0002_auto_20200514_1318.py | 25 + polyclinic_scheduling/apps/schedule/models.py | 5 + .../templates/schedule/schedule_new.html | 1305 +++++++++-------- .../polyclinic_scheduling/settings.py | 4 +- polyclinic_scheduling/templates/menu.html | 33 +- polyclinic_scheduling/templates/singup.html | 9 +- 17 files changed, 871 insertions(+), 701 deletions(-) create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_email.html create mode 100644 polyclinic_scheduling/apps/schedule/management/commands/send_reports.py create mode 100644 polyclinic_scheduling/apps/schedule/migrations/0002_auto_20200514_1318.py diff --git a/polyclinic_scheduling/apps/RUG_template/static/RUG_template/css/base.css b/polyclinic_scheduling/apps/RUG_template/static/RUG_template/css/base.css index 142a595..90c44aa 100644 --- a/polyclinic_scheduling/apps/RUG_template/static/RUG_template/css/base.css +++ b/polyclinic_scheduling/apps/RUG_template/static/RUG_template/css/base.css @@ -21,4 +21,48 @@ .rug-breadcrumbs { display: none; +} + +p { + max-width: none; +} + +table { + width: 100%; +} + +input { + width: 100% +} + +.alert-warning { + color: #856404; + background-color: #fff3cd; + border-color: #ffeeba; +} + +.alert-success { + color: #155724; + background-color: #d4edda; + border-color: #c3e6cb; +} +.alert-danger { + color: #721c24; + background-color: #f8d7da; + border-color: #f5c6cb; +} +.form-control { + display: block; + width: 100%; + height: calc(1.5em + .75rem + 2px); + padding: .375rem .75rem; + font-size: 1rem; + font-weight: 400; + line-height: 1.5; + color: #495057; + background-color: #fff; + background-clip: padding-box; + border: 1px solid #ced4da; + border-radius: .25rem; + transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out; } \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/index.html b/polyclinic_scheduling/apps/RUG_template/templates/index.html index a9987e0..b5e543e 100644 --- a/polyclinic_scheduling/apps/RUG_template/templates/index.html +++ b/polyclinic_scheduling/apps/RUG_template/templates/index.html @@ -4,8 +4,6 @@ {% block title %}{% trans "Welcome to the RUG Template page" %}{% endblock %} {% block pagetitle %}{% trans "Welcome to the RUG Template page" %}{% endblock %} {% block content %} -

-{% trans "Simple RUG Template" %} -

+

{% trans "Simple RUG Template" %}

{% trans "Some more text" %}

{% endblock %} \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/menu.html b/polyclinic_scheduling/apps/RUG_template/templates/menu.html index 3e9334a..e3d592a 100644 --- a/polyclinic_scheduling/apps/RUG_template/templates/menu.html +++ b/polyclinic_scheduling/apps/RUG_template/templates/menu.html @@ -1,13 +1,10 @@ {% load i18n %}
  • -{% trans "Section" %} - - + {% trans "Section" %} +
  • diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/login.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/login.html index 50d2086..dbb09bf 100644 --- a/polyclinic_scheduling/apps/RUG_template/templates/registration/login.html +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/login.html @@ -5,9 +5,12 @@ {% block pagetitle %}{% trans "Login" %}{% endblock %} {% block content %}

    -{% trans "Login" %} + {% trans "Login" %} +
    + {% blocktrans %} + You can login here to create your schedules. If you do not have a login, please contact: some_one@rug.nl + {% endblocktrans %}

    -
    {% csrf_token %} @@ -18,7 +21,7 @@
    - +
    {# Assumes you setup the password_reset view in your URLconf #}

    {% trans "Lost password?" %}

    {% endblock %} \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_complete.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_complete.html index 89becc9..71f51c6 100644 --- a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_complete.html +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_complete.html @@ -4,9 +4,7 @@ {% block title %}{% trans "Password reset complete" %}{% endblock %} {% block pagetitle %}{% trans "Password reset complete" %}{% endblock %} {% block content %} -

    -{% trans "Password reset complete" %} -
    -

    Your new password has been set. You can log in now on the log in page.

    -

    +

    {% trans "Password reset complete" %}

    +{% url 'login' as login_url %} +

    {% blocktrans %}Your new password has been set. You can log in now on the log in page.{% endblocktrans %}

    {% endblock %} diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_confirm.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_confirm.html index a89576a..e472c5e 100644 --- a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_confirm.html +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_confirm.html @@ -4,22 +4,23 @@ {% block title %}{% trans "Set a new password!" %}{% endblock %} {% block pagetitle %}{% trans "Set a new password!" %}{% endblock %} {% block content %} -

    -{% trans "Set a new password!" %} +

    {% trans "Set a new password!" %}
    {% if validlink %} -

    - - {% csrf_token %} - {{ form.as_table }} - - - -
    - -
    -
    + {% blocktrans %}Here you can set a new password.{% endblocktrans %} +

    +
    + + {% csrf_token %} + {{ form.as_table }} + + + +
    + +
    +
    {% else %} -

    {% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}

    + {% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}

    {% endif %} -

    + {% endblock %} diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_done.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_done.html index 59135be..ffa7012 100644 --- a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_done.html +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_done.html @@ -8,6 +8,6 @@ {% trans "Reset password, email sent" %}

    -We've emailed you instructions for setting your password. You should receive the email shortly! +{% blocktrans %}We've emailed you instructions for setting your password. You should receive the email shortly!{% endblocktrans %}

    {% endblock %} \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_email.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_email.html new file mode 100644 index 0000000..7558911 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_email.html @@ -0,0 +1,27 @@ +{% load i18n %} + + + +{% trans "Password reset" %} + + +RUG Logo +

    {% trans "Password reset" %}

    +

    +{% url 'password_reset_confirm' uidb64=uid token=token as reset_url%} +{% blocktrans %} +You're receiving this email because you requested a password reset for your user account at {{ site_name }}. +
    +Please go to the following page and choose a new password: +
    +{{ protocol}}://{{ domain }}{{ reset_url }} +
    +Your username, in case you’ve forgotten: {{ user }} +
    +Thanks for using our site! +
    +The {{ site_name }} team +{% endblocktrans %} +

    + + \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_form.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_form.html index a199ca4..362f89b 100644 --- a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_form.html +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_form.html @@ -6,19 +6,16 @@ {% block content %}

    {% trans "Reset password" %} +
    +{% blocktrans %}Here you can request a password reset. Please enter your email address that is used for registration.{% endblocktrans %}

    - -
    -{% csrf_token %} - - - - - -
    {{ form.email.label_tag }}{{ form.email }}
    - - + {% csrf_token %} + + {{ form.as_table }} + + + +
    - -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/singup.html b/polyclinic_scheduling/apps/RUG_template/templates/singup.html index d0be6fb..2e6ff1a 100644 --- a/polyclinic_scheduling/apps/RUG_template/templates/singup.html +++ b/polyclinic_scheduling/apps/RUG_template/templates/singup.html @@ -4,9 +4,7 @@ {% block title %}{% trans "Singup" %}{% endblock %} {% block pagetitle %}{% trans "Singup" %}{% endblock %} {% block content %} -

    -{% trans "Singup" %} -

    +

    {% trans "Singup" %}

    {% csrf_token %} diff --git a/polyclinic_scheduling/apps/schedule/management/commands/send_reports.py b/polyclinic_scheduling/apps/schedule/management/commands/send_reports.py new file mode 100644 index 0000000..00f7529 --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/management/commands/send_reports.py @@ -0,0 +1,24 @@ +from django.core.management.base import BaseCommand, CommandError +from apps.schedule.models import Schedule +#from polls.models import Question as Poll + +class Command(BaseCommand): + help = 'Send out all the new reports' + + # def add_arguments(self, parser): + # parser.add_argument('poll_ids', nargs='+', type=int) + + def handle(self, *args, **options): + Schedule.objects.filter(peregrine_result__isnull=False).filter(report_sent__isnull=True) + + + # for poll_id in options['poll_ids']: + # try: + # poll = Poll.objects.get(pk=poll_id) + # except Poll.DoesNotExist: + # raise CommandError('Poll "%s" does not exist' % poll_id) + + # poll.opened = False + # poll.save() + + # self.stdout.write(self.style.SUCCESS('Successfully closed poll "%s"' % poll_id)) \ No newline at end of file diff --git a/polyclinic_scheduling/apps/schedule/migrations/0002_auto_20200514_1318.py b/polyclinic_scheduling/apps/schedule/migrations/0002_auto_20200514_1318.py new file mode 100644 index 0000000..97b5b63 --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/migrations/0002_auto_20200514_1318.py @@ -0,0 +1,25 @@ +# Generated by Django 3.0.6 on 2020-05-14 13:18 + +import collections +from django.db import migrations, models +import jsonfield.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('schedule', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='schedule', + name='peregrine_result', + field=jsonfield.fields.JSONField(blank=True, help_text='The results from the Peregrine job in JSON', load_kwargs={'object_pairs_hook': collections.OrderedDict}, verbose_name='Peregrine JSON output'), + ), + migrations.AddField( + model_name='schedule', + name='report_sent', + field=models.DateTimeField(blank=True, help_text='The date and time when the report has sended to the user.', null=True, verbose_name='Report is send to user'), + ), + ] diff --git a/polyclinic_scheduling/apps/schedule/models.py b/polyclinic_scheduling/apps/schedule/models.py index 88a678f..0676253 100644 --- a/polyclinic_scheduling/apps/schedule/models.py +++ b/polyclinic_scheduling/apps/schedule/models.py @@ -15,12 +15,17 @@ class Schedule(MetaDataModel): email = models.CharField(_('Email address'), max_length=100, help_text=_('Email address where the results will be sent to.')) planning_source = JSONField(_('Schedule input'), blank=True, load_kwargs={'object_pairs_hook': collections.OrderedDict}, help_text=_('The schedule input in JSON format based on the form data')) + planning_peregrine = models.TextField(_('Peregrine input'), blank=True, help_text=_('This is the translated content from the source for use with Peregrine cluster')) peregrine_accepted = models.BooleanField(_('Peregrine accepted'),default=False, help_text=_('When true, the Peregrine cluster has picked up the job.')) + peregrine_result = JSONField(_('Peregrine JSON output'), blank=True, load_kwargs={'object_pairs_hook': collections.OrderedDict}, help_text=_('The results from the Peregrine job in JSON')) + output_peregrine = models.BinaryField(_('Peregrine binary output'), blank=True, help_text=_('This is the output in binary format from the Peregrine cluster')) + report_sent = models.DateTimeField(_('Report is send to user'), blank=True, null=True, help_text=_('The date and time when the report has sended to the user.')) + def __str__(self): """str: Returns a readable name for the schedule. Format is [schedule_name] (employee_name).""" return '{} ({})'.format(self.name, self.employee) \ No newline at end of file diff --git a/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html b/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html index 85ad6fc..2c790f2 100644 --- a/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html +++ b/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html @@ -4,647 +4,704 @@ {% block title %}{% trans "New schedule" %}{% endblock %} {% block pagetitle %}{% trans "New schedule" %}{% endblock %} {% block content %} - -
    - - {% csrf_token %} - {{ form.json }} -

    Algemene informatie

    -

    Als een afdeling meerdere wachtkamers heeft, vul dan dit formulier meerdere keren in; een keer voor elke groep van behandelkamers die een wachtkamer delen.

    -
    - - - Geef de naam op van de afdeling -
    -
    - - - Geef het emailadres op om de uitkomsten te ontvangen -
    -
    - - - Met bewaren 1,5m afstand tussen lopende en zittende patiënten! -
    -
    -
    -
    -

    Specialisaties binnen de afdeling

    -
    -
    - - - Verwijder -
    -
    - - - Geef een afkorting op voor deze specialisatie. Deze gebruiken wij in de figuren van de rapportage. -
    -
    - - - Maximaal aantal artsen dat op enig moment tegelijk aan het werk zou kunnen zijn. -
    -
    - - - Aantal behandelkamers dat beschikbaar is per specialisatie -
    -
    - - - -
    -
    - + + {% csrf_token %} + {{ form.json }} +

    Algemene informatie

    +

    Als een afdeling meerdere wachtkamers heeft, vul dan dit formulier meerdere keren in; een keer voor elke groep van behandelkamers die een wachtkamer delen.

    + + + + + + + + -
    -
    -
    de hele werkdag
    -
    - -
    -
    - -
    +
    + + + + + + + + + + + + + +
    + +
    + + Geef de naam op van de afdeling +
    + +
    + + Geef het emailadres op om de uitkomsten te ontvangen +
    + +
    + + Met bewaren 1,5m afstand tussen lopende en zittende patiënten! +
    + +
    +
    +
    + +

    Specialisaties binnen de afdeling

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + +
    + +
    + + Geef een afkorting op voor deze specialisatie. Deze gebruiken wij in de figuren van de rapportage. +
    + +
    + + Maximaal aantal artsen dat op enig moment tegelijk aan het werk zou kunnen zijn. +
    + +
    + + Aantal behandelkamers dat beschikbaar is per specialisatie +
    + +
    + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    de hele werkdag + + + +
    ochtendpauze + + + +
    lunchpauze + + + +
    middagpauze + + + +
    -
    -
    ochtendpauze
    -
    - -
    -
    - -
    -
    -
    -
    lunchpauze
    -
    - -
    -
    - -
    -
    -
    -
    middagpauze
    -
    - -
    -
    - -
    -
    - - - - - -
    -
    -
    - -

    Behandelingen

    -

    In het model worden slots van 5 minuten gebruikt voor het bepalen van starttijden. etc. Afspraken starten daarmee om bijv. 10.00, 10.05, 10.10.
    Afspraakduur wordt daarmee ook in veelvouden van 5 minuten gevraagd.

    -

    Zowel afspraken waar de patiënt fysiek in het ziekenhuis is, als wel telefoongesprekken worden hier gevraagd. Beide type afspraken kunnen in het raster worden gepland.

    -

    "Normaal" betekent: zoals het was voor COVID-19
    30% betekent: als je maar 30% van de patiënten kunt binnenkrijgen, hoeveel afspraken van elk type zou je dan willen inplannen?

    -
    -
    -
    Naam behandeling
    -
    Duur (in minuten)
    -
    Specialisatie
    -
    Methode
    -
    Normaal aantal
    -
    Gewenst als op 30%
    -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - - Verwijder -
    -
    -
    -
    - - - -
    -
    Totaal aantal afspraken
    -
    0
    -
    0
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - + + jQuery('select.specialismes').each(function(counter,element){ + element = jQuery(element); + let selected_index = element[0].selectedIndex; + + element.find('option').remove(); + jQuery.each(specialismes,function(index,item) { + element.append(jQuery('