Calculate 18 dates to fetch separately in another form

Calculate 18 dates to fetch separately in another form

Hello,

I have a form called "Subscription" that holds the following informations :

Customer name (or ID, it is from a lookup)
Delivery day (ex. tuesday, using single line string field)
Number of deliveries (9 or 18)
Start date (a given monday)

As soon as this form is sumitted, I want 18 (or 9 ) dates entries in another form called "Calendar" linked with the customer ID, and possibly an auto number like Delivery 1, Delivery 2, etc. (it will eventually be used in a calendar view.).

Example : John Doe ; Wednesdays ; 18 ; Monday 7-oct-2024

The result I want in the form "Calendar" is:

John Doe - Delivery 1 - Wednesday 9-oct-2024
John Doe - Delivery 2 - Wednesday 16-oct-2024
John Doe - Delivery 3 - Wednesday 23-oct-2024
And so on up to Delivery 18.

Other details :

  1. If it is a 9 deliveries, it is a bi-weekly count (9-oct, 23-oct...)
  2. It could be a subscription for tuesdays, or fridays, but with the same start date on a monday.
  3. The "original" number of deliveries (9 or 18) must be kept in mind because the customers will be granted the permission to change dates in the calendar report (with the portal), but not exceed his original number (18 or 9). It could be done with a count script, or, and I do not know if it is possible, permit changes in the calendar only for existing dates (i.e. the customer could not clic on an emplty date and add a 19th delivery).
  4. Customer could have 2 deliveries the same day.
  5. I want to set quotas per day of delivery (ex. 80) not to overbook a specific day. In that case customer will not be able to change its date to a fully booked day.
  6. I will use the Calendar form to print myself a report of a specific day of delivery to check customer's presence. In that report I usually like to have their phone number and a mention if they placed an extra web order.
Voilà !

If somebody can be so kind to start me up in the good direction with the bases of the Deluge Scripts.

Sylvain