Feat: Use GET to fetch tables via ajax to make use of cache
This commit is contained in:
@@ -125,7 +125,6 @@ class AjaxTableController extends ActionController
|
||||
(
|
||||
Product $product,
|
||||
Hotel $hotel,
|
||||
string $paCode = null,
|
||||
string $dateFrom = null,
|
||||
string $dateTo = null
|
||||
): void {
|
||||
@@ -133,6 +132,7 @@ class AjaxTableController extends ActionController
|
||||
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
|
||||
$filterSettings['dateFrom'] = $dateFrom;
|
||||
$filterSettings['dateTo'] = $dateTo;
|
||||
$paCode = GeneralUtility::_GET('pa');
|
||||
|
||||
$dates = $this->dateService->getDatesTable([
|
||||
'product' => $product,
|
||||
@@ -226,23 +226,18 @@ class AjaxTableController extends ActionController
|
||||
Product $product,
|
||||
Hotel $hotel,
|
||||
Date $date,
|
||||
string $paCode = null,
|
||||
bool $singleDate = false
|
||||
): void {
|
||||
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
|
||||
|
||||
// if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
|
||||
// $paCode = $reseller['paCode'];
|
||||
// }
|
||||
|
||||
$priceTable = $this->dateService->getPriceTable([
|
||||
'product' => $product,
|
||||
'hotel' => $hotel,
|
||||
'filterSettings' => $filterSettings,
|
||||
'date' => $date,
|
||||
'template' => $this->settings['bpnBookingUrlTemplateCode'],
|
||||
'paCode' => $paCode,
|
||||
'paCode' => GeneralUtility::_GET('pa'),
|
||||
]);
|
||||
$hasSurchargeOrDiscount = $this->dateService->checkSurcharcheOrDiscount($priceTable);
|
||||
|
||||
|
||||
+8
-17
@@ -1,4 +1,4 @@
|
||||
import { Controller } from 'stimulus'
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { useFetch } from '../mixins/use_fetch'
|
||||
import { useConfig } from '../mixins/use_config'
|
||||
|
||||
@@ -13,8 +13,6 @@ export default class extends Controller {
|
||||
|
||||
static values = {
|
||||
datestableUri: String,
|
||||
pricetableUri: String,
|
||||
travelAlertUri: String,
|
||||
loading: Boolean,
|
||||
loaded: Boolean,
|
||||
mode: String,
|
||||
@@ -53,13 +51,11 @@ export default class extends Controller {
|
||||
return
|
||||
}
|
||||
this.loadingValue = true
|
||||
this.datesTableContainerTarget.innerHTML = ''
|
||||
let paCode = this.getConfig().paCode
|
||||
const data = new URLSearchParams()
|
||||
if (paCode) {
|
||||
data.append('tx_epproducts_ajax[paCode]', paCode)
|
||||
}
|
||||
fetch(this.datestableUriValue, { method: 'POST', body: data })
|
||||
data.append('pa', paCode)
|
||||
this.datesTableContainerTarget.innerHTML = ''
|
||||
fetch(`${this.datestableUriValue}&${data}`)
|
||||
.then(this.checkStatus)
|
||||
.then(this.parseHTML)
|
||||
.then(html => {
|
||||
@@ -71,19 +67,14 @@ export default class extends Controller {
|
||||
})
|
||||
}
|
||||
|
||||
loadPrices(e) {
|
||||
loadPrices({ params }) {
|
||||
this.loadingValue = true
|
||||
this.priceTableContainerTarget.innerHTML = ''
|
||||
this.modeValue = 'prices'
|
||||
let dateUid = e.currentTarget.dataset.dateUid
|
||||
const data = new URLSearchParams({
|
||||
'tx_epproducts_ajax[date]': dateUid,
|
||||
})
|
||||
let paCode = this.getConfig().paCode
|
||||
if (paCode) {
|
||||
data.append('tx_epproducts_ajax[paCode]', paCode)
|
||||
}
|
||||
fetch(this.pricetableUriValue, { method: 'POST', body: data })
|
||||
const data = new URLSearchParams()
|
||||
data.append('pa', paCode)
|
||||
fetch(`${params.pricesUrl}&${data}`)
|
||||
.then(this.checkStatus)
|
||||
.then(this.parseHTML)
|
||||
.then(html => {
|
||||
|
||||
Reference in New Issue
Block a user