An add-on for Plone
Project description
redturtle.prenotazioni
A booking product for Plone which allows to reserve time slots throughout the week.
Installation
Add redturtle.prenotazioni to the egg section of your instance:
[instance] eggs= ... redturtle.prenotazioni
To avoid spam, there is a background validation with collective.honeypot .
With a version of plone.app.dexterity lower than 3.* (ie Plone 5.2) you need to add collective.dexteritytextindexer as requirement.
[instance] eggs= ... redturtle.prenotazioni collective.dexteritytextindexer
Introduction
This product introduces two new content types to your Plone site:
Booking
Booking Folder
Booking content
Booking is a content type used to store information about reservation.
The product interface provides a way to add new booking elements, by clicking on one of the plus signs available in the slots calendar.
Each booking element once created is storerd into its own Booking Folder.
Booking Folder content
Booking Folder is a folderish content type which store your Booking objects.
Using redturtle.prenotazioni
Creating a new Booking Folder
If the product is correctly installed the Booking Folder entry is available on the add new action menu.
You can configure:
more then one gate
booking vacations
custom duration for booking types
week schedule for morning and afternoon time tables
Creating a new booking content
Anonymous and authenticated users are allowed to add new booking content by clicking on the plus signs on the default booking folder view.
After its creation the slot will be displayed as “busy” for anonymous user and the slot won’t be available anymore.
Back-end users can see and manage the reservation according to the assigned Plone roles.
Workflow
The product comes with its own workflow “prenotazioni_workflow”.
Here below a list of all the states available:
Private: booking object initial state:
submit (Automatic transition to pending)
Pending
Transaction available:
publish (to published)
refuse (to refused)
Published
Transaction available:
refuse (to refused)
Refused
Transaction available:
restore (to pending)
Managers can confirm a Booking using workflow transitions. The workflow transition triggers an email to be sent to the booker (see below).
Content Rules (mail notifications)
There are additional content rules that can be used to notify booking owner when his booking has been created, accepted or re-scheduled.
Rules are NOT automatically enabled in every Booking Folder. If you want to send some notification, you only need to enable them from rules link in Booking folder.
If you set “Responsible email” field, an email will be sent each time a new Booking has been submitted.
The rules which are available by default:
booking-accepted (Invia un’email all’utente quando la prenotazione è stata accettata)
booking-moved (Invia un’email all’utente quando la data della prenotazione viene cambiata)
booking-created-user (Invia un’email all’utente quando la prenotazione è stata creata)
booking-refuse (Invia un’email all’utente quando la prenotazione è stata rifiutata)
booking-confirm (Conferma automatica prenotazioni)
Vacations
You can specify days when the Booking Folder will not accept bookings. Those days are called “Vacation days”.
Vacation days can be specified compiling the “Vacation days” field in the Booking Folder edit form. Values are allowed in the format DD/MM/YYYY. Instead of the year you can put an asterisk, in this case every here the day DD of month MM will be considered a vacation day.
It is also possible to specify a vacation period for a single gate using the vacation booking form with a link that you can see in the toolbar.
Searching
Using the prenotazioni_search view it is possible to search bookings within a given time interval. You can also filter the results specifying a searchable text, a gate or a review state.
Rest API
There are some endpoints useful to use this tool also with external frontends (like Volto).
@booking
GET
This endpoint allows to retrieve a booking by its UID.
Example:
curl http://localhost:8080/Plone/++api++/@booking/<booking UID> -H 'Accept: application/json'
Response:
{ "booking_code": "17E3E6", "booking_date": "2023-05-22T09:09:00", "booking_expiration_date": "2023-05-22T09:10:00", "booking_type": "SPID: SOLO riconoscimento \"de visu\" (no registrazione)", "company": null, "cosa_serve": null, "description": "", "email": "mario.rossi@example", "fiscalcode": "", "gate": "postazione2", "id": "mario-rossi", "phone": "", "staff_notes": null, "title": "Mario Rossi" }
POST
This endpoint allows to create a new booking.
Example:
curl http://localhost:8080/Plone/++api++/<booking_folder_path>/@booking \ -X POST \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "booking_date": "2023-05-23T09:00:00+02:00", "booking_type": "SPID: SOLO riconoscimento \"de visu\" (no registrazione)", "fields": [ {"name": "fullname", "value": "Mario Rossi"}, {"name": "email", "value": "mario.rossi@example"} ], }'
Response:
{ "booking_code": "17E3E6", "booking_date": "2023-05-22T09:09:00", "booking_expiration_date": "2023-05-22T09:10:00", "booking_type": "SPID: SOLO riconoscimento \"de visu\" (no registrazione)", "company": null, "cosa_serve": null, "description": "", "email": "mario.rossi@example", "fiscalcode": "", "gate": "postazione1", "id": "mario-rossi-1", "phone": "", "staff_notes": null, "title": "Mario Rossi" }
DELETE
This endpoint allows to delete a booking by its UID.
Example:
curl -X DELETE http://localhost:8080/Plone/++api++/@booking/<booking UID> -H 'Accept: application/json'
A booking can be deleted only if on of the following rules are satisfied:
Anonymous user and booking has been created by an anonymous user
Booking created by current logged-in user
Current logged-in user has redturtle.prenotazioni.ManagePrenotazioni permission
Booking has a date > today
MOVE
This endpoint allows to move a booking by its UID to a different date/time slot.
Example:
curl http://localhost:8080/Plone/++api++/<booking_folder_path>/@booking-move \ -X POST \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "booking_date": "2023-05-23T09:00:00+02:00", "booking_id": "<booking UID>", }'
@prenotazione
Leave for compatibility reasons (identical to @booking’s GET). Could be removed in future.
Example:
curl http://localhost:8080/Plone/@prenotazione?uid=<booking UID> -H 'Accept: application/json'
Response, see: @booking
@vacation
POST
This endpoint allows to create a new vacation.
Example:
curl http://localhost:8080/Plone/++api++/<booking_folder_path>/@vacation \ -X POST \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "start": "2023-05-23T09:00:00+02:00", "end": "2023-05-23T10:00:00+02:00", "gate": "gate A", "title": "vacation" }'
@available-slots
Endpoint that need to be called on a PrenotazioniFolder. It returns the list of all available slots based on some parameters.
An available slot is the first free time on each hour slot (each day is split in 1h slots).
By default (without parameters) the endpoint returns available slots for the current month, starting from today.
Parameters:
start a start date. If not given, the start will be today.
end an end date. If not given, the end will be the last day of current month.
Example:
curl -i http://localhost:8080/Plone/folder/@available-slots -H 'Accept: application/json'
Response:
{ "@id": "http://localhost:8080/Plone/folder/@available-slots", "items": [ '2023-04-10T07:30:00', '2023-04-10T08:00:00', '2023-04-10T09:00:00', '2023-04-17T07:00:00', '2023-04-17T08:00:00', '2023-04-17T09:00:00', '2023-04-24T07:00:00', '2023-04-24T08:00:00', '2023-04-24T09:00:00' ] }
Example:
curl -i http://localhost:8080/Plone/folder/@available-slots?start=2023-04-12 -H 'Accept: application/json'
Response:
{ "@id": "http://localhost:8080/Plone/folder/@available-slots", "items": [ '2023-04-17T07:00:00', '2023-04-17T08:00:00', '2023-04-17T09:00:00', '2023-04-24T07:00:00', '2023-04-24T08:00:00', '2023-04-24T09:00:00' ] }
@booking-schema
Endpoint that need to be called on a PrenotazioniFolder. It returns the list of all fields to fill in for the booking.
The booking date is passed via querystring (e.g ?booking_date=2023-04-13+10%3A00’)
Example:
curl -i -X GET 'http://localhost:8080/Plone/prenotazioni/@prenotazione-schema?booking_date=2023-05-15T13:00:00' -H 'Accept: application/json'
Response:
{ "booking_types": { "bookable": [], "unbookable": [ { "duration": "60", "name": "Rilascio CIE" } ] }, "fields": [ { "desc": "Inserisci l'email", "label": "Email", "name": "email", "readonly": false, "required": false, "type": "text", "value": "" }, { "desc": "Inserisci il numero di telefono", "label": "Numero di telefono", "name": "phone", "readonly": false, "required": false, "type": "text", "value": "" }, { "desc": "Inserisci ulteriori informazioni", "label": "Note", "name": "description", "readonly": false, "required": false, "type": "textarea", "value": "" }, { "desc": "Inserisci il codice fiscale", "label": "Codice Fiscale", "name": "fiscalcode", "readonly": false, "required": true, "type": "text", "value": "" }, { "desc": "Inserire il nome completo", "label": "Nome completo", "name": "Nome", "readonly": false, "required": true, "type": "text", "value": "" } ] }
@bookings
Endpoint that returns a list of own Prenotazione content by parameters
Parameters:
SearchableText: The SearchableText of content.
from: The start date of research.
to: The end date of research.
gate: The booking gate.
userid: The userid(basically it is the fiscalcode). Allowed to be used by users having the ‘redturtle.prenotazioni: search prenotazioni’ permission.
booking_type: The booking_type, available values are stored in ‘redturtle.prenotazioni.booking_types’ vocabulary.
review_state: The booking status, one of: ‘confirmed’, ‘refused’, ‘private’, ‘pending’
Example:
curl -i http://localhost:8080/Plone/@bookings?from=10-10-2023&to=20-10-2023&gate=Gate1&userid=user1&booking_type=type1&SearchableText=text1 \ -H 'Accept: application/json'
Response:
{ "@id": "http://localhost:8080/Plone/folder/@bookings", "items": [ { "title": "Booking Title", "booking_id": "abcdefgh1234567890", "booking_url": "https://url.ioprenoto.it/prenotazione/abcd", "booking_date": "2018-04-25T10:00:00", "booking_expiration_date": "2018-04-30T10:00:00", "booking_type": "Servizio di prova", "booking_room": "stanza-1", "booking_gate": "sportello-urp-polifunzionale", "booking_status": "confirmed", "booking_status_label": "Confermata", "booking_status_date": "2018-04-25T10:00:00", "booking_status_notes": "Prenotazione confermata", "userid": "FISCALCODE", }, ... ], } }
@booking-notify
Endpoint that fires the confirm email to user
Example:
curl -i http://localhost:8080/Plone/booking_folder/@booking-notify/<booking UID> \ -H 'Accept: application/json'
If the user is not logged in, the endpoint will return a 401 error.
- Response::
HTTP 200 OK
@day-busy-slots
Endpoint that returns a list of busy slots and pauses based on the passed date
Parameters:
date: Date
Example:
curl -i "http://localhost:8080/Plone/prenotazioni_folder/@day-busy-slots?date=2023/05/22"\ -H 'Accept: application/json'\
Response:
{ "@id": "http://localhost:8080/Plone/prenotazioni_folder/@day-busy-slots", "bookings": { "gate1": [ { "booking_code": "17E3E6", "booking_date": "2023-05-22T09:09:00", "booking_expiration_date": "2023-05-22T09:10:00", "booking_type": "SPID: SOLO riconoscimento \"de visu\" (no registrazione)", "company": null, "cosa_serve": null, "description": "", "email": "mario.rossi@example", "fiscalcode": "", "gate": "postazione1", "id": "mario-rossi-1", "phone": "", "staff_notes": null, "title": "Mario Rossi" }, ... ], "gate2": [ { "booking_code": "17E3E6", "booking_date": "2023-05-22T09:09:00", "booking_expiration_date": "2023-05-22T09:10:00", "booking_type": "SPID: SOLO riconoscimento \"de visu\" (no registrazione)", "company": null, "cosa_serve": null, "description": "", "email": "mario.rossi@example", "fiscalcode": "", "gate": "postazione2", "id": "mario-rossi", "phone": "", "staff_notes": null, "title": "Mario Rossi" }, ... ] }, "pauses": [ { "start": "2023-05-22T07:15:00+00:00", "stop": "2023-05-22T08:30:00+00:00" }, ... ] }
Special Views
@@download/bookings.xlsx
This view allows to download the bookings filtered by passed parameters
text: The SearchableText of content.
from: The start date of research.
to: The end date of research.
gate: The booking gate.
userid: The userid(basically it is the fiscalcode). Allowed to be used by users having the ‘redturtle.prenotazioni: search prenotazioni’ permission.
booking_type: The booking_type, available values are stored in ‘redturtle.prenotazioni.booking_types’ vocabulary.
review_state: The booking status, one of: ‘confirmed’, ‘refused’, ‘private’, ‘pending’
- Example::
- Response::
Binary file
How to develop
Frontend
There is a custom widget made in React and registered as bundle. To develop it, you should do following steps:
First of all, enable nvm:
> nvm use
Install dependencies:
> yarn
Run webpack:
> yarn start
This will start webpack with autoreload. To see changes on your site, you need to enable development mode in Resources Registry in your Plone site, and enable CSS and js development of “week-table-overrides-widget-bundle” bundle.
When changes are ok, you need to make a production build:
> yarn build
Contribute
Issue Tracker: https://github.com/RedTurtle/redturtle.prenotazioni/issues
Source Code: https://github.com/RedTurtle/redturtle.prenotazioni
Notes
redturtle.prenotazioni has been tested with Plone 5.2 and works with Python 3.
This is a merge from other two booking products:
Credits
Developed with the support of:
All of them supports the PloneGov initiative.
Contributors
Daniele Andreotti, daniele.andreotti@redturtle.it
Changelog
2.1.1 (2023-10-11)
Sort gate slots in get_free_slots method to better handle also pauses. [cekk]
2.1.0 (2023-10-11)
Add booking details to the export file [folix-01]
Change PrenotazioniFolder.cosa_serve field type to RichText [folix-01]
Utilizzare defaultFactory se il default è una funzione, altrimenti non viene eseguita nel momento corretto. [mamico]
Rimosso searchabletext di prenotazioni doppio [mamico]
Aggiunto indexer per fiscalcode uppercase per fare ricerche case insensitive [mamico]
Remove Contributor from the package permissions map [folix-01]
Add configurable simultaneous bookings limit for the same user. [folix-01]
Remove “immediate=True” from mailhost send in send_email_to_managers because can cause multiple sends when there are conflicts. [cekk]
Better handle edge-case when a booking is created inside a pause (booking created before pause set in folder config). [cekk]
2.0.0 (2023-09-12)
workaround per download prenotazioni, parametri in base64 sul path per gestire bug Volto [mamico]
add xlsx tests [mamico]
add booking description in @bookings [mamico]
add booking_code field to IPrenotazione schema update locales [lucabel]
Call booking url adapter on plone.stringinterp.adapters.ContextWrapper [foxli-01]
Traduzioni [mamico]
Restapi @booking-notify. [foxli-01]
2.0.0rc5 (2023-09-05)
Update locales. [foxli-01]
2.0.0rc4 (2023-09-05)
Add a dedicated role to manage the bookings. [folix-01]
2.0.0.rc2 (2023-08-31)
Show default gates as unavailable in get_gates method, if they are overrided. [cekk]
Skip required field validation when add out of office bookings in @booking endpoint. [cekk]
Only users with permission can add out of office bookings in @booking endpoint. [cekk]
Fix slots overlap valiation on booking move [folix-01]
2.0.0.rc1 (2023-08-25)
Remove complexity in same_day_booking_disallowed` field: now you can set only yes or no. [cekk]
duration in minutes instead of days [mamico]
allow to add out-of-office in api (aka blocco prenotazione) [mamico]
2.0.0.dev5 (2023-08-21)
Add logic to override pauses and gates. [daniele]
Permit to force gate / duration to operator (restapi add booking) [mamico]
Changes required to migrate the old bookings. [folix-01]
Allow to override also gates and pauses. [cekk]
Remove unused unavailable_gates field. [cekk]
2.0.0.dev4 (2023-08-11)
Moved contacts fields to a dedicated behavior. [daniele]
Tabs/fields reordering for the booking folder. [daniele]
fix date in @@download [mamico]
fix tz in pause [mamico]
skip email to manager on block/vacation creation [mamico]
Manage timezone in booking dates. (upgrade step) [cekk]
Fix: only valid interval in the subtraction slots operation. [mamico]
Fix boking code uniqueness [folix-01]
Fix default start/end time for search @bookings [mamico]
Add @vacation rest api [mamico]
Customized status message in prenotazione_print.pt based on review_state. [cekk]
Add @booking-move restapi [mamico]
Extend @@bookings search view parameters list. [folix-01]
Added event handler on booking creation to send email to managers. [daniele]
Rename routes: months-slots => available-slots prenotazione-schema => booking-schema @@download_reservation => @@download/bookings.xlsx [cekk] [mamico]
2.0.0.dev3 (2023-07-20)
Handle contentrules by the plone events and do not use contentrules anymore. [folix-01]
Change “day” type in week_table (TODO: need an upgrade step?). [mauro]
2.0.0.dev2 (2023-06-30)
reorganize backend form [mamico]
booking_type filter in @months-slots [mamico]
Register adapters for IMailFromFieldAction for both Site root and dx containers. [cekk]
2.0.0.dev1 (2023-06-12)
Add Booking restapi [mamico]
Fix Plone6 compatibility. [cekk]
Removed unused type PrenotazioniFolderContainer. [cekk]
Added endpoint to get booking schema. [daniele]
Avoid change gate, booking date, booking end from /edit; this would allow you to skip the checks; Fix profile registration name; [lucabel]
Add @bookings endpoint to get booking items for a user [foxtrot-dfm1]
Add a new endpoint to get booking details. (#40442). [daniele]
Add autoconfirm content rule to profile. [foxtrot-dfm1]
Added field “cosa_serve” (#40445). [daniele]
Refactor booking delete machinery and remove unused token. [cekk]
Add DELETE endpoint for booking. [cekk]
Add new field that allows to override week schedule for a certain date range. [cekk]
Send iCal attachment on approved or moved booking. [cekk]
1.7.1 (2023-03-28)
Add plone5 profile to setup. [foxtrot-dfm1]
1.7.0 (2023-03-24)
Remove sort order on week-legend table (#33584). [foxtrot-dfm1]
RestAPI endpoint to have available week slots. [foxtrot-dfm1]
Plone 6 support [mamico]
1.6.5 (2023-02-06)
Fix the upgrade step of release 1.6.4 [foxtrot-dfm1]
1.6.4 (2023-02-06)
Fix the upgrade step of release 1.6.1 [foxtrot-dfm1]
1.6.3 (2023-02-01)
Fix cookies encoding [foxtrot-dfm1]
1.6.2 (2023-01-30)
Handle prenotation type passed by url. [foxtrot-dfm1]
1.6.1 (2023-01-11)
Handle confirmed state instead of published. [cekk]
1.6.0 (2023-01-10)
The workflow state ‘public’ of prenotazioni_workflow was renamed to ‘confirmed’ [foxtrot-dfm1]
Show review state column of prenotations (#37119) [foxtrot-dfm1]
1.5.7 (2022-12-29)
updated mail sent to the final user to show report with delete option for accepted booking. [daniele]
1.5.6 (2022-12-06)
fix: now handle differente dst in prenotazione_add booking_date. [cekk]
1.5.5 (2022-12-06)
- fix: booking hour.
[cekk]
1.5.4 (2022-12-06)
fix: show actual booking hour un prenotazione_add view. [cekk]
1.5.3 (2022-12-06)
chore: updated time label of booking add view [sara]
1.5.2 (2022-11-30)
fix: export all visible fields in the ods report. [cekk]
1.5.1 (2022-11-16)
fix: fixed booking labels [sara]
1.5.0 (2022-11-14)
[BREAKING CHANGE] Remove recaptcha dependency and use collective.honeypot. UNINSTALL plone.formwidget.recaptcha before upgrading to this version. [cekk]
1.4.4 (2022-09-30)
Fix upgrade-step. [cekk]
1.4.3 (2022-08-01)
Add caching profile and enable it on install. [cekk]
1.4.2 (2022-05-22)
Disable check_valid_fiscalcode constraint. [cekk]
1.4.1 (2022-05-04)
Standardize fields between schema and creation form. [cekk]
Improve extensibility of add form and required fields. [cekk]
Handle (do not broke) non existent fiscalcode member field. [cekk]
1.4.0 (2022-01-13)
Better manage fiscalcode. [cekk]
Add github actions for code quality and fix black/zpretty/flake8 linting. [cekk]
1.3.5 (2021-10-15)
[new] Added field “Note prenotante” e “Note del personale” inside the exported .ods file. [arsenico13]
1.3.4 (2021-09-08)
[chg] only editor/manager can view booking data [mamico]
[fix] fix check title on vacation booking [eikichi18]
1.3.3 (2021-08-09)
[chg] autofill data from user context [mamico]
1.3.2 (2021-06-17)
Prevented booking without gate [eikichi18]
1.3.1 (2021-06-14)
Booking tipology as required [eikichi18]
1.3.0 (2021-06-07)
[fix] translations [nzambello]
[chg] prenotazioni slot as required [nzambello]
[fix] slot prenotazione search button [nzambello]
1.2.0 (2021-05-31)
[fix] handle reservation move without any gate set [cekk]
[new] dependency with collective.z3cform.datagridfield>=2.0 [cekk]
1.1.8 (2021-05-27)
[fix] project urls in setup.py
1.1.7 (2021-05-27)
[fix] changelog syntax
[chg] project urls in setup.py
1.1.6 (2021-04-26)
[fix] fix reservation download. ods writer can’t cast none to empty string
1.1.5 (2021-04-26)
[fix] force gate on authenticated reservation
[fix] fix slot dimension in case of confirmed reservation
[fix] Reindex subject on move
[fix] download reservation after search give error calculating review_state
1.1.4 (2021-03-10)
[fix] fix translations
[chg] change prenotazioni search adding phone number and removing state
[fix] fix problem with sending mail if mail not compiled
[fix] allow to not use not required fields [lucabel]
1.1.3 (2021-02-22)
[fix] fix search reservation accessing by gate icon
1.1.2 (2021-02-22)
[chg] change ‘sportello’ label with ‘postazione’
[fix] now we can handle more gates and layout is safe
[fix] fix insufficient permission deleting reservation
[fix] pauses are spread over more gate if more gate are available
[fix] hide “download” link in search reservation print
1.1.1 (2021-02-19)
[chg] tuning permission to allow reader to see everything
[chg] tuning css for mobile
[new] add pause to prenotazioni folder
[chg] add some accessibility to prenotazioni folder
[new] add logic to delete reservation using a link sendable by mail
1.1.0 (2020-12-15)
feat: tooltip on add button [nzambello]
1.0.3 (2020-12-10)
Fix return url when click Cancel button. [cekk]
1.0.2 (2020-12-09)
Changed fields order for prenotazione ct. [daniele]
1.0.1 (2020-12-09)
Added logic to generate booking code on the fly. This code is calculated on the basis of the booking date and time. [daniele]
Add new stringinterp for prenotazione print url and update contentrules. [cekk]
Added fiscal code field to required fields. Added widget for visible fields. Updated views and templates. [daniele]
1.0.0 (2020-11-23)
Initial release. [cekk]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for redturtle.prenotazioni-2.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a0c6ef92a4b9960a51e22a5508d3bece7ff1f2918b57b5b89f0e35a8ec6603d |
|
MD5 | 1503fe46c6903f219229ac79e25f10fd |
|
BLAKE2b-256 | ad5b449b4084a7d8c382f33efcd30580efa0b878368e986c3d3f949be1ea688c |