# GesagtGetan.Inquiry

Configurable formbuilder with inquiry management backend module.

You can see the Inquiries in the Neos Backend under "Anfragen" in the menu. The View in the Plugin is always the same:

| ID        | Vorname    | Nachname  | E-Mail | Newsletter | Typ             | Erstellt am   |
| --------- | ---------- | --------- | ------ | ---------- | --------------- | ------------- |
| Unique ID | First Name | Last Name | email  | Ja or Nein | Type of Inquiry | Date and Time |

You can take a look at single entries in the Inquiry by clicking on the info icon on the right side of every entry.
You have more details like **salutation, telphone numer, address, message and additional Fields**.

In the additional fields are all properties of the Form that are not included as a single field already.
(f.e. the hotel room ID, Date from/until of a hotel)

| Version | Neos          | maintained        |
| ------- | ------------- | ------------------|
| 1.\*    | 1.0.x-2.3 LTS | :x:               |
| 2.\*    | 3.\*          | :x:               |
| 3.\*    | 4.\*          | :x:               |
| 4.\*    | 4.3 LTS       | :x:               |
| 5.\*    | 4.3 LTS       | :x:               |
| 6.\*    | 4.3 LTS       | :heavy_check_mark:|
| 7.\*    | 5.3 LTS       | :heavy_check_mark:|

## Installation

Most of the time you have to make small adjustments to a package (e.g. configuration in `Settings.yaml`). Because of that, it is important to add the corresponding package to the composer from your theme package. Mostly this is the site packages located under `Packages/Sites/`. To install it correctly go to your theme package (e.g.`Packages/Sites/GesagtGetan.Theme`) and run following command:

```
composer require gesagtgetan/inquiry --no-update
```

To install the package under Neos 2.\* you have to enter

```
composer require "gesagtgetan/inquiry:^1.0" --no-update
```

The `--no-update` command prevent the automatic update of the dependencies. After the package was added to your theme `composer.json`, go back to the root of the Neos installation and run `composer update`. Et voilà! Your desired package is now installed correctly.

## How to set it up for 2.\*

First apply the migrations just like:

```
./flow doctrine:migrate
```

Then set a logo in the [Settings.yaml](Configuration/Settings.yaml). Underneath is a example yaml Code

```yaml
newsletterForm:
...
  finisher:
    email:
    ...
      options:
        logo:
          image: 'resource://GesagtGetan.<site package name>/<path to image file>
```

Add a new site in the Neos Backend and define a "Dankes-Seite", so that Neos can redirect a User after subscribing to a newsletter.

Go to the Site Package and create a **Routes.yaml** or edit the existing one. Add the following lines of code:

```yaml
- name: "gesagt.getan. Newsletter"
  uriPattern: "<GesagtGetanNewsletter>"
  subRoutes:
    "GesagtGetanNewsletter":
      package: "GesagtGetan.Inquiry"
```

#### Zurzeit wird das neue Routes.yaml nicht eingebunden.

## How to set it up for 3.\* & 4.\*

First apply the migrations just like:

```yaml
./flow doctrine:migrate
```

Then set a logo in the [Settings.yaml](Configuration/Settings.yaml). Underneath is a example yaml Code

```yaml
newsletterForm:
...
  finisher:
    email:
    ...
      options:
        logo:
          image: 'resource://GesagtGetan.<site package name>/<path to image file>
```

Add a new site in the Neos Backend and define a "Dankes-Seite", so that Neos can redirect a User after subscribing to a newsletter.

#### Go to the Site Package and add the Controller classes in the **Settings.yaml**

## There are 2 possible usages for this plugin:

1. Save data from a form and save the data in the Inquiry

You have to edit the email finisher class in the [Settings.yaml](Configuration/Settings.yaml) of your Site Package just like that:

```yaml
Neos:
  Form:
  presets:
  ...
    newsletterForm:
    ...
      finisher:
        email:
          class: \GesagtGetan\Inquiry\Form\EmailFinisher
```

2. Send an email to the User and let him subscribe to a newsletter

You have to edit the email finisher class in the [Settings.yaml](Configuration/Settings.yaml) of your Site Package just like that:

```yaml
Neos:
  Form:
  presets:
  ...
    newsletterForm:
    ...
      finisher:
        email:
          class: \GesagtGetan\Inquiry\Form\NewsletterEmailFinisher
```
