Extend form entry and save to firebase firestore as unique requests

EDIT: Trying this: https://masteringionic.com/blog/2018-02-06-dynamically-add-and-remove-form-input-fields-with-ionic/

I don’t know the proper terms to describe what i need to do so i can’t find the correct posts to help, so here it goes:

I have a request form that has a preset number of fields to fill out (from, to, date, time) and once submitted a bunch of firebase functions are triggered to pass the data to sendgrid email, sending a confirmation to the user and a quote request to the admins.

Right now everything is explicitly laid out as in the form fields are named and then passed to the function upon hitting submit.

My new hurdle is adding an unknown amount of additional requests to the form and saving them appropriately in firestore. So someone can fill out from, to, date, time, then click “Another Request” which will cause a new empty form to show below the one they filled in and allow them to enter a completely new set of from, to, date and time. Upon submitting the information both requests get filed under the same firestore document with the first one have “1” after the field names ( from1, to1, date1, time1) and the 2nd one having "2"s after (from2, to2, date2, time2). This would continue up until about 5 requests which then i would block additional ones from being added.

Currently i was just going to duplicate the entirety of the form, give all the field names a “2” at the end, and then have an *ngIf watch for if they click the “Another Request” button. But then i would have to have logic on all subsequent pages checking for if a 2, 3, 4 and 5 request count exist for each main request.

I’m using ionic 5 and firebase firestore.

TL:DR : Current form is setup to take 4 named fields and submit them to firestore collection/document. I would like to setup logic for the user to be able to add another form (the 4 same fields) but dynamically create the fields in the database grouped under a main ID (so i’m not creating a form with the same 4 fields repeating 5 times, and then having to track 5 sets of the variables in the database when most of them will be blank). Then subsequent pages that use these fields can just query the main ID, see how many sets of requests there are, and show the data in a list style loop.