feat: additional fields for groups price calculator

This commit is contained in:
Björn Fromme
2025-01-17 15:20:41 +01:00
parent a0cd81c498
commit 566c4bfad9
6 changed files with 153 additions and 8 deletions
@@ -84,9 +84,18 @@ class AjaxGroupsPriceController extends ActionController
$selectedOptions = [];
}
$mode = $groupsPriceInquiry->getMode();
if (false === in_array($mode, [GroupsPriceInquiry::MODE_BOOKING, GroupsPriceInquiry::MODE_INQUIRY])) {
$mode = GroupsPriceInquiry::MODE_BOOKING;
}
$variables = [
'mode' => $mode,
'hotel' => $hotel,
'name' => $groupsPriceInquiry->getName(),
'group' => $groupsPriceInquiry->getGroup(),
'address' => $groupsPriceInquiry->getAddress(),
'email' => $groupsPriceInquiry->getEmail(),
'phone' => $groupsPriceInquiry->getPhone(),
'remarks' => $groupsPriceInquiry->getRemarks(),
@@ -28,12 +28,32 @@ namespace EP\EpProducts\Domain\Model\Dto;
class GroupsPriceInquiry
{
const MODE_INQUIRY = 'inquiry';
const MODE_BOOKING = 'booking';
/**
* @var string
*/
protected $mode;
/**
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $name;
/**
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $group;
/**
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $address;
/**
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
@@ -99,6 +119,27 @@ class GroupsPriceInquiry
*/
protected $summary;
public function __construct()
{
$this->mode = self::MODE_BOOKING;
}
/**
* @return string
*/
public function getMode()
{
return $this->mode;
}
/**
* @param string $mode
*/
public function setMode($mode)
{
$this->mode = $mode;
}
/**
* @return string
*/
@@ -115,6 +156,42 @@ class GroupsPriceInquiry
$this->name = $name;
}
/**
* @return string
*/
public function getGroup()
{
return $this->group;
}
/**
* @param string $group
*/
public function setGroup($group)
{
$this->group = $group;
return $this;
}
/**
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* @param string $address
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* @return string
*/
@@ -153,7 +153,7 @@
<div class="mb-8"
v-show="nightsCount > 0 && !submitted">
<div class="p-2 uppercase bg-ep-primary-dark text-white w-full">
Angebot anfordern
Jetzt buchen
</div>
<div class="bg-zinc-100 p-2">
<div class="grid md:grid-cols-2 gap-4 mb-4">
@@ -168,6 +168,29 @@
v-show="formErrors.name"
v-html="formErrors.name"></div>
</div>
<div :class="{ 'has-error': formErrors.name }">
<label class="font-bold mb-2">
Adresse*
</label>
<textarea class="form-field"
cols="30"
rows="3"
v-model="address"/>
<div class="text-sm text-red-600 mt-1"
v-show="formErrors.address"
v-html="formErrors.address"></div>
</div>
<div :class="{ 'has-error': formErrors.group }">
<label class="font-bold mb-2">
Name der Gruppe*
</label>
<input type="text"
class="form-field"
v-model="group">
<div class="text-sm text-red-600 mt-1"
v-show="formErrors.group"
v-html="formErrors.group"></div>
</div>
<div :class="{ 'has-error': formErrors.email }">
<label class="font-bold mb-2">
E-Mail*
@@ -200,11 +223,22 @@
v-model="remarks"/>
</div>
</div>
<button class="button"
type="submit"
@click.prevent="submitForm()">
Senden
</button>
<div class="py-4">
Ihr erhaltet von uns eine Bestätigung. Wir behalten uns vor die Buchung zu prüfen / erst nach
Rückbestätigung von uns gilt die Buchung auch von unserer Seite als bindend.
</div>
<div class="flex items-center space-x-2">
<button class="button bg-button"
type="submit"
@click.prevent="submitForm('booking')">
Buchung abschicken
</button>
<button class="button bg-button button--small bg-ep-secondary"
type="submit"
@click.prevent="submitForm('inquiry')">
nur als Anfrage senden
</button>
</div>
</div>
</div>
<div class="py-8 text-xl text-center font-bold" v-show="submitted">
@@ -336,9 +370,12 @@ export default {
this.selectedBoard = null;
}
},
submitForm() {
submitForm(mode) {
let formData = new URLSearchParams({
'tx_epproducts_ajax[groupsPriceInquiry][mode]': mode,
'tx_epproducts_ajax[groupsPriceInquiry][name]': this.name ? this.name : '',
'tx_epproducts_ajax[groupsPriceInquiry][group]': this.group ? this.group : '',
'tx_epproducts_ajax[groupsPriceInquiry][address]': this.address ? this.address : '',
'tx_epproducts_ajax[groupsPriceInquiry][email]': this.email? this.email : '',
'tx_epproducts_ajax[groupsPriceInquiry][phone]': this.phone ? this.phone : '',
'tx_epproducts_ajax[groupsPriceInquiry][remarks]': this.remarks,
@@ -84,6 +84,12 @@
<trans-unit id="tx_eptheme.message.name.1221560718">
<source>Bitte angeben</source>
</trans-unit>
<trans-unit id="tx_eptheme.message.group.1221560910">
<source>Bitte angeben</source>
</trans-unit>
<trans-unit id="tx_eptheme.message.address.1221560910">
<source>Bitte angeben</source>
</trans-unit>
<trans-unit id="tx_eptheme.message.phone.1221560718">
<source>Bitte angeben</source>
</trans-unit>
@@ -7,6 +7,14 @@
<f:section name="Main">
<h1>Anfrage Gruppenhaus vom <f:format.date date="now" format="d.m.y" /></h1>
<table>
<tr>
<th>
Art
</th>
<td>
{f:if(condition: '{mode} == "booking"', then: 'Buchung', else: 'Anfrage')}
</td>
</tr>
<tr>
<th>Haus</th>
<td>{hotel.name}</td>
@@ -15,6 +23,14 @@
<th>Name</th>
<td>{name}</td>
</tr>
<tr>
<th>Name der Gruppe</th>
<td>{group}</td>
</tr>
<tr>
<th>Adresse</th>
<td>{address -> f:format.nl2br()}</td>
</tr>
<tr>
<th>E-Mail</th>
<td>{email}</td>
@@ -6,7 +6,7 @@
<div class="max-w-screen-lg mx-auto">
<h1 class="headline--underlined headline--has-subline">
<span class="subline">{hotel.name}</span>
Preisberechnung
Preisrechner und buchen
</h1>
<f:format.raw>
<groups-price-calculator