# README

This is a simple project to generate registration lists for sessions in **Panamá
Hace Yoga.**

## Development

This project was developed using Tempest. To run the project, follow these steps:


### Icons

All the icons used in the project are Material Design Icons listed in this link:
https://icon-sets.iconify.design/mdi/. Please continue to use this icon set in
the future to keep consistency.


## Event Configuration

To configure a new event in the app, use the console commands and verify the 
results in the database using phpMyAdmin. 

### 1. Download Events

The first step is to download the events from RegFox. To do this, run the 
following command:

```bash
php tempest download:events
```

This command will download all the events from RegFox and store them in the 
`events` table.


### 2. Add Classrooms

Once the events are saved in the database, you can add classrooms to an event
using the following command:

```bash
php tempest add:classroom <event_id> <classroom_name>
```

The arguments for this command are:

| Argument           | Description                                    |
|--------------------|------------------------------------------------|
| `<event_id>`       | The row ID of the event in the `events` table. |
| `<classroom_name>` | The name of the classroom.                     |

This command will add a new classroom to the `classrooms` table and will 
associate the classroom with the event. Call this command for each classroom
in the event.


### 3. Download Sessions

Next, download all the sessions in the event using the following command:

```bash
php tempest download:sessions <event_id>
```

The value for `<event_id>` is the row ID of the event in the `events` table.
The sessions will be stored in the `sessions` table.


### 4. Configure Sessions

Once the sessions are downloaded, configure the sessions using the following
command:

```bash
php tempest configure:session <session_id> <session_time> <classroom_id> [<display_name>]
```

The arguments for this command are:

| Argument         | Description                                                                                                                                   |
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| `<session_id>`   | The row ID of the session in the `sessions` table.                                                                                            |
| `<session_time>` | The time of the session in yyyy-MM-dd HH:mm format (the time in 24-hour format).                                                              |
| `<classroom_id>` | The row ID of the classroom in the `classrooms` table.                                                                                        |
| `<display_name>` | The name of the session to display in the app. This argument is optional; the name downloaded from Regfox is used by default if not provided. |


### 5. Download Registrations

Once the sessions are configured, download the registrations for each session
using the following command:

```bash
php tempest download:registrations <event_id>
```

The value for `<event_id>` is the row ID of the event in the `events` table.

This command will download the names of all the registered people for each
session and store them in the `participants` table. Then, it will add rows to
the `registrations` associating each session with the participants.

> **Note:** The sessions must be configured before downloading the registrations.


### 6. Activate Event

Finally, run the following command to activate the event:

```bash
php tempest activate:event <event_id>
```

The value for `<event_id>` is the row ID of the event in the `events` table.

This command will set the `active` column to `1` for the event and set the 
`active` column to `0` for all the other events. This ensures that only one
event is active at a time so that only that event is displayed in the app.
