Calendar in Lino Tera

This document describes the lino_tera.lib.cal plugin which extends lino_xl.lib.cal for Tera.

A tested document

This is a tested document. The following instructions are used for initialization:

>>> from lino import startup
>>> startup('lino_book.projects.lydia.settings.doctests')
>>> from lino.api.doctest import *
>>> from django.db import models

The calendar summary view

Note that the months are listed in reverse chronological order while the days within a month in normal order.

>>> obj = rt.models.courses.Course.objects.order_by('id').first()
>>> rt.show(cal.EntriesByController, obj)
March 2015: *Tue 10.*☑
February 2015: *Tue 24.*☑ *Tue 10.*☑
January 2015: *Tue 27.*☉ *Tue 13.*☑
Suggested : 0 ,  Scheduled : 0 ,  Took place : 4 ,  Missed : 1 ,  Called off : 0

Missed calendar entries

In Lino Tera we introduce a new calendar entry state "missed" for entries where the guest missed the appointment without a valid reason. A missed appointment may get invoiced while a cancelled appointment not.

Changed the symbol for a "Cancelled" calendar entry from ☉ to ⚕. Because the symbol ☉ (a sun) is used for "Missed". The sun reminds a day on the beach while the ⚕ reminds a drugstore.

>>> rt.show(cal.EntryStates)
======= ============ ============ ============= ============= ======== ============= =========
 value   name         text         Button text   Fill guests   Stable   Transparent   No auto
------- ------------ ------------ ------------- ------------- -------- ------------- ---------
 10      suggested    Suggested    ?             Yes           No       No            No
 20      draft        Scheduled    ☐             Yes           No       No            No
 50      took_place   Took place   ☑             No            Yes      No            No
 60      missed       Missed       ☉             No            Yes      No            Yes
 70      cancelled    Called off   ⚕             No            Yes      Yes           Yes
======= ============ ============ ============= ============= ======== ============= =========
>>> rt.show(cal.EntryStates, language="de")
====== ============ =============== ============= ================= ======== =================== =========
 Wert   name         Text            Button text   Gäste ausfüllen   Stabil   nicht blockierend   No auto
------ ------------ --------------- ------------- ----------------- -------- ------------------- ---------
 10     suggested    Vorschlag       ?             Ja                Nein     Nein                Nein
 20     draft        Geplant         ☐             Ja                Nein     Nein                Nein
 50     took_place   Stattgefunden   ☑             Nein              Ja       Nein                Nein
 60     missed       Verpasst        ☉             Nein              Ja       Nein                Ja
 70     cancelled    Abgesagt        ⚕             Nein              Ja       Ja                  Ja
====== ============ =============== ============= ================= ======== =================== =========

Lino Tera uses the EntryState.guest_state attribute.

>>> rt.show(cal.EntryStates, column_names='name text guest_state')
============ ============ =============
 name         text         Guest state
------------ ------------ -------------
 suggested    Suggested
 draft        Scheduled
 took_place   Took place   Present
 missed       Missed       Missing
 cancelled    Called off   Excused
============ ============ =============

Guest workflow

>>> rt.show(cal.GuestStates, language="de")
====== ========= ============== ============== =============
 Wert   name      Nachträglich   Text           Button text
------ --------- -------------- -------------- -------------
 10     invited   Nein           Eingeladen     ?
 40     present   Ja             Anwesend       ☑
 50     missing   Ja             Fehlt          ☉
 60     excused   Nein           Entschuldigt   ⚕
====== ========= ============== ============== =============
>>> show_workflow(cal.GuestStates.workflow_actions, language="de")
============= ============== ============== ============== =========================
 Action name   Verbose name   Help text      Target state   Required states
------------- -------------- -------------- -------------- -------------------------
 wf1           ☑              Anwesend       Anwesend       invited
 wf2           ☉              Fehlt          Fehlt          invited
 wf3           ⚕              Entschuldigt   Entschuldigt   invited
 wf4           ?              Eingeladen     Eingeladen     missing present excused
============= ============== ============== ============== =========================

Calendar entry types

>>> rt.show(cal.EventTypes)
... 
=========== ======================== ================== ======================== ================ ============= ===================== =================
 Reference   Designation              Designation (de)   Designation (fr)         Planner column   Appointment   Automatic presences   Locks all rooms
----------- ------------------------ ------------------ ------------------------ ---------------- ------------- --------------------- -----------------
             Absences                 Absences           Absences                 External         Yes           No                    No
             Group meeting            Gruppengespräch    Group meeting                             Yes           No                    No
             Holidays                 Feiertage          Jours fériés             External         No            No                    Yes
             Individual appointment   Einzelgespräch     Individual appointment                    Yes           Yes                   No
             Internal                 Intern             Interne                  Internal         No            No                    No
             Meeting                  Versammlung        Réunion                  External         Yes           No                    No
=========== ======================== ================== ======================== ================ ============= ===================== =================

Daily planner

>>> rt.show(calview.DailyPlanner)
============ =================================================== ==========
 Time range   External                                            Internal
------------ --------------------------------------------------- ----------
 *All day*    *Rolf Rompen Absent for private reasons Absences*
 *AM*         *08:30 Romain Raffault Rencontre Meeting*
 *PM*
============ =================================================== ==========

My appointments

The My appointments table also shows in the dashboard when it has no data to display.

>>> rt.login("elmar").show_dashboard()
... 
-----------------------------------------------
My appointments **New** `⏏ <My appointments>`__
-----------------------------------------------

No data to display
-----------------------------------
Daily planner `⏏ <Daily planner>`__
-----------------------------------

============ ============================================================== ==========
 Time range   External                                                       Internal
------------ -------------------------------------------------------------- ----------
 *All day*    `Rolf Rompen Absent for private reasons Absences <Detail>`__
 *AM*         `08:30 Romain Raffault Rencontre Meeting <Detail>`__
 *PM*
============ ============================================================== ==========
class lino_tera.lib.cal.Event
amount

The amount perceived during this appointment.