Skip to content

Commit

Permalink
Merge pull request #39 from it-at-m/feature-1498-wiederaufruf-erst-na…
Browse files Browse the repository at this point in the history
…ch-5-minuten-patch

Feature 1498 wiederaufruf erst nach 5 minuten patch
  • Loading branch information
ThomasAFink authored Dec 4, 2023
2 parents 8f619b9 + affa54f commit b4319a7
Show file tree
Hide file tree
Showing 23 changed files with 221 additions and 397 deletions.
51 changes: 47 additions & 4 deletions zmsadmin/js/block/calldisplay/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class CallDisplayConfigView extends Component {
webtemplate: 'defaultplatz',
hmac: '',
enableQrCode: false,
twoDisplays: false,
showQrCode: false
}

Expand All @@ -73,9 +74,9 @@ class CallDisplayConfigView extends Component {
return document.location.origin;
}

buildCalldisplayUrl() {
buildCalldisplayUrl(displayNumber = 1) {
const baseUrl = this.props.config.calldisplay.baseUrl
let parameters = this.buildParameters(false);
let parameters = this.buildParameters(false, 'calldisplay', displayNumber);

return `${this.buildHost()}${baseUrl}?${parameters.join('&')}`
}
Expand All @@ -87,7 +88,7 @@ class CallDisplayConfigView extends Component {
return `${this.buildHost()}${baseUrl}?${parameters.join('&')}`
}

buildParameters(hashParameters, target = 'calldisplay') {
buildParameters(hashParameters, target = 'calldisplay', displayNumber = 1) {
const collections = this.getSelectedItemsCollection(this.state)
let queryParts = []

Expand Down Expand Up @@ -115,6 +116,10 @@ class CallDisplayConfigView extends Component {
queryParts.push(`qrcode=1`)
}

if (! hashParameters && this.state.twoDisplays) {
queryParts.push(`display=` + displayNumber)
}

if (hashParameters) {
queryParts.push(`hmac=${this.state.hmac}`)
}
Expand Down Expand Up @@ -229,6 +234,22 @@ class CallDisplayConfigView extends Component {
)
}

renderTwoDisplays() {
const onChange = () => {
this.setState({
twoDisplays: !this.state.twoDisplays
});
}
return (
<fieldset>
<legend className="label">2 Aufrufanzeige</legend>
<div key="twoDisplays" className="form-check ticketprinter-config__item">
{this.renderCheckbox(this.state.twoDisplays, onChange, "2 Aufrufanzeige erstellen")}
</div>
</fieldset>
)
}

renderScopes(scopes) {
if (scopes.length > 0) {
return (
Expand Down Expand Up @@ -267,6 +288,7 @@ class CallDisplayConfigView extends Component {

render() {
const calldisplayUrl = this.buildCalldisplayUrl()
const calldisplayUrl2 = this.buildCalldisplayUrl(2)
const webcalldisplayUrl = this.buildWebcalldisplayUrl()

const onQueueStatusChange = (_, value) => {
Expand All @@ -291,6 +313,7 @@ class CallDisplayConfigView extends Component {
<form className="form--base form-group calldisplay-config">
{this.state.departments.map(this.renderDepartment.bind(this))}
{this.renderQrCodeEnabled()}
{this.renderTwoDisplays()}
<FormGroup>
<Label
attributes={{ "htmlFor": "visibleCalls" }}
Expand Down Expand Up @@ -331,7 +354,10 @@ class CallDisplayConfigView extends Component {
</Controls>
</FormGroup>
<FormGroup>
<Label attributes={{ "htmlFor": "calldisplayUrl" }} value="URL"></Label>
{ this.state.twoDisplays ?
<Label attributes={{ "htmlFor": "calldisplayUrl" }} value="URL Anzeige 1"></Label>
:
<Label attributes={{ "htmlFor": "calldisplayUrl" }} value="URL"></Label> }
<Controls>
<Inputs.Text
value={calldisplayUrl}
Expand All @@ -342,6 +368,23 @@ class CallDisplayConfigView extends Component {
<a href={calldisplayUrl} target="_blank" rel="noopener noreferrer" className="button button-submit"><i className="fas fa-external-link-alt"></i> Aktuelle Konfiguration in einem neuen Fenster öffnen</a>
</div>


{ this.state.twoDisplays ?
<div className="firstDisplay">
<FormGroup>
<Label attributes={{ "htmlFor": "calldisplayUrl2" }} value="URL Anzeige 2"></Label>
<Controls>
<Inputs.Text
value={calldisplayUrl2}
attributes={{ readOnly: true, id: "calldisplayUrl2" }} />
</Controls>
</FormGroup>
<div className="form-actions">
<a href={calldisplayUrl2} target="_blank" rel="noopener noreferrer" className="button button-submit"><i className="fas fa-external-link-alt"></i> Aktuelle Konfiguration in einem neuen Fenster öffnen</a>
</div>
</div>
: null }

<FormGroup>
<Label attributes={{ "htmlFor": "webcalldisplayLayout" }} value="Layout mobile Aufrufanzeige"></Label>
<Controls>
Expand Down
2 changes: 1 addition & 1 deletion zmsadmin/public/_css/admin.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion zmsadmin/public/_css/admin.css.map

Large diffs are not rendered by default.

384 changes: 24 additions & 360 deletions zmsadmin/public/_js/reactcomponents.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion zmsadmin/public/_js/reactcomponents.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion zmsadmin/src/Zmsadmin/WorkstationProcessNext.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function readResponse(
$filteredProcessList = new ProcessList;

foreach ($processList as $process) {
if ($process->status === "queued") {
if ($process->status === "queued" || $process->status === "confirmed") {
$timeoutTimeUnix = isset($process->timeoutTime) ? $this->timeToUnix($process->timeoutTime) : null;
$currentTimeUnix = time();

Expand Down
2 changes: 1 addition & 1 deletion zmscalldisplay/public/_css/calldisplay.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion zmscalldisplay/public/_css/calldisplay.css.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions zmscalldisplay/scss/block/aufrufanzeige.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@
background: #F2F6FA;
}

#display_number {
position: fixed;
bottom: 20px;
right: 54px;
font-size: 28px;
font-weight: bold;
}

#infoicon {
background: url(img/info-icon.svg) top left no-repeat;
width: 21px;
Expand Down
3 changes: 2 additions & 1 deletion zmscalldisplay/src/Zmscalldisplay/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function readResponse(
$validator = $request->getAttribute('validator');
$defaultTemplate = $validator->getParameter("template")
->isPath()
->setDefault('defaultplatz')
->setDefault('default_platz')
->getValue();

$calldisplayHelper = (new Helper\Calldisplay($request));
Expand All @@ -42,6 +42,7 @@ public function readResponse(
$calldisplay = $calldisplayHelper->getEntity();

$template = (new Helper\TemplateFinder($defaultTemplate))->setCustomizedTemplate($calldisplay);
$parameters['displayNumber'] = $request->getParam('display') ?? null;

return \BO\Slim\Render::withHtml(
$response,
Expand Down
15 changes: 12 additions & 3 deletions zmscalldisplay/src/Zmscalldisplay/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function readResponse(
array $args
) {
$validator = $request->getAttribute('validator');
$displayNumber = $validator->getParameter('display')->isNumber()->getValue();

$calldisplay = new Helper\Calldisplay($request);

Expand All @@ -32,16 +33,24 @@ public function readResponse(
])
->getCollection();

$queueList = ($queueList) ?
$queueList->withStatus($calldisplay::getRequestedQueueStatus($request)) :
new \BO\Zmsentities\Collection\QueueList();

if ($displayNumber === 1) {
$queueList = $queueList->chunk(10)[0];
} else if ($displayNumber === 2) {
$queueList = $queueList->chunk(10)[1] ?? new \BO\Zmsentities\Collection\QueueList();
}

return Render::withHtml(
$response,
'block/queue/queueTable.twig',
array(
'tableSettings' => $validator->getParameter('tableLayout')->isArray()->getValue(),
'calldisplay' => $calldisplay->getEntity(false),
'scope' => $calldisplay->getSingleScope(),
'queueList' => ($queueList) ?
$queueList->withStatus($calldisplay::getRequestedQueueStatus($request)) :
new \BO\Zmsentities\Collection\QueueList()
'queueList' => $queueList
)
);
}
Expand Down
6 changes: 6 additions & 0 deletions zmscalldisplay/templates/page/customized/base.twig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
<div class="aufrufanzeige_text">
{% include "block/marginal/infoColumn.twig" %}
</div>

{% if displayNumber %}
<div id="display_number">
{{ displayNumber }}/2
</div>
{% endif %}
{% endblock %}

{% block tableLayoutSettings %}
Expand Down
3 changes: 3 additions & 0 deletions zmscalldisplay/templates/page/customized/default_platz.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ window.bo.zmscalldisplay.queue.timeWaitingInfo = 20;
window.bo.zmscalldisplay.queue.showOnlyNumeric = false;
// Seconds to reload table
window.bo.zmscalldisplay.reloadInterval = 5;
{% if displayNumber %}
window.bo.zmscalldisplay.display = {{ displayNumber }};
{% endif %}
</script>
{% endblock %}

3 changes: 3 additions & 0 deletions zmscalldisplay/templates/page/customized/default_raum.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ window.bo.zmscalldisplay.queue.timeWaitingInfo = 20;
window.bo.zmscalldisplay.queue.showOnlyNumeric = false;
// Seconds to reload table
window.bo.zmscalldisplay.reloadInterval = 5;
{% if displayNumber %}
window.bo.zmscalldisplay.display = {{ displayNumber }};
{% endif %}
</script>
{% endblock %}

3 changes: 3 additions & 0 deletions zmscalldisplay/templates/page/customized/default_tuer.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ window.bo.zmscalldisplay.queue.timeWaitingInfo = 20;
window.bo.zmscalldisplay.queue.showOnlyNumeric = false;
// Seconds to reload table
window.bo.zmscalldisplay.reloadInterval = 5;
{% if displayNumber %}
window.bo.zmscalldisplay.display = {{ displayNumber }};
{% endif %}
</script>
{% endblock %}

17 changes: 17 additions & 0 deletions zmsentities/src/Zmsentities/Collection/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,21 @@ public function withResolveLevel($resolveLevel)
}
return $collection;
}

public function chunk($length)
{
$chunks = [new static()];
$id = 0;
foreach ($this as $entry) {
if (! isset($chunks[floor($id / $length)])) {
$chunks[floor($id / $length)] = new static();
}

$chunks[floor($id / $length)][] = $entry;

$id++;
}

return $chunks;
}
}
15 changes: 10 additions & 5 deletions zmsentities/src/Zmsentities/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,18 @@ public function getGroupedHashSet(array $fields, array $hashfields)
if (count($fields)) {
$field = array_shift($fields);
$fieldposition = $this->getPositionByName($field);

foreach ($this->data as $element) {
if (! isset($list[$element[$fieldposition]])) {
$list[$element[$fieldposition]] = clone $this;
$list[$element[$fieldposition]]->data = [];
// Check if $fieldposition exists in $element
if (isset($element[$fieldposition])) {
if (!isset($list[$element[$fieldposition]])) {
$list[$element[$fieldposition]] = clone $this;
$list[$element[$fieldposition]]->data = [];
}
$list[$element[$fieldposition]]->data[] = $element;
}
$list[$element[$fieldposition]]->data[] = $element;
}

foreach ($list as $key => $row) {
if ($row instanceof Exchange) {
$list[$key] = $row->getGroupedHashSet($fields, $hashfields);
Expand All @@ -256,5 +261,5 @@ public function getGroupedHashSet(array $fields, array $hashfields)
return $this->getHashData($hashfields, true);
}
return $list;
}
}
}
18 changes: 9 additions & 9 deletions zmsstatistic/src/Zmsstatistic/Download/WaitingReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
class WaitingReport extends Base
{
protected $reportParts = [
'waitingcalculated' => 'maximal berechnetet Wartezeit Spontankunde',
'waitingcount' => 'maximal Wartende Spontankunde',
'waitingtime' => 'maximal gemessene Wartezeit Spontankunde',
'waitingcount_termin' => 'maximal Wartende Terminkunde',
'waitingtime_termin' => 'maximal gemessene Wartezeit Terminkunde'
'waitingcalculated' => 'maximal berechnete Wartezeit Spontankunden',
'waitingcount' => 'maximal Wartende Spontankunden',
'waitingtime' => 'maximal gemessene Wartezeit Spontankunden',
'waitingcount_termin' => 'maximal Wartende Terminkunden',
'waitingtime_termin' => 'maximal gemessene Wartezeit Terminkunden'
];

/**
Expand Down Expand Up @@ -81,8 +81,8 @@ public function writeTotals(ReportEntity $report, $sheet)
{
$entity = clone $report;
$totals = array_pop($entity->data);
$reportTotal['max'][] = 'Tagesmaximum Spontantkunde';
$reportTotal['average'][] = 'Tagesdurchschnitt Spontantkunde';
$reportTotal['max'][] = 'Tagesmaximum Spontankunden';
$reportTotal['average'][] = 'Tagesdurchschnitt Spontankunden';
$reportTotal['max'][] = $totals['max_waitingtime'];
$reportTotal['average'][] = $totals['average_waitingtime'];
foreach ($entity->data as $entry) {
Expand All @@ -91,8 +91,8 @@ public function writeTotals(ReportEntity $report, $sheet)
}
$sheet->fromArray($reportTotal, null, 'A'. ($sheet->getHighestRow() + 1));

$reportTotal2['max'][] = 'Tagesmaximum Terminkunde';
$reportTotal2['average'][] = 'Tagesdurchschnitt Terminkunde';
$reportTotal2['max'][] = 'Tagesmaximum Terminkunden';
$reportTotal2['average'][] = 'Tagesdurchschnitt Terminkunden';
$reportTotal2['max'][] = $totals['max_waitingtime_termin'];
$reportTotal2['average'][] = $totals['average_waitingtime_termin'];
foreach ($entity->data as $entry) {
Expand Down
3 changes: 2 additions & 1 deletion zmsstatistic/src/Zmsstatistic/ReportRequestDepartment.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function readResponse(
->readGetResult('/warehouse/requestdepartment/' . $this->department->id . '/'. $args['period']. '/')
->getEntity()
->toGrouped($this->groupfields, $this->hashset)
->withRequestsSum();
->withRequestsSum()
->withAverage('processingtime');
}

$type = $validator->getParameter('type')->isString()->getValue();
Expand Down
3 changes: 2 additions & 1 deletion zmsstatistic/src/Zmsstatistic/ReportRequestOrganisation.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function readResponse(
->readGetResult('/warehouse/requestorganisation/' . $this->organisation->id . '/'. $args['period']. '/')
->getEntity()
->toGrouped($this->groupfields, $this->hashset)
->withRequestsSum();
->withRequestsSum()
->withAverage('processingtime');
}

$type = $validator->getParameter('type')->isString()->getValue();
Expand Down
31 changes: 30 additions & 1 deletion zmsstatistic/src/Zmsstatistic/ReportWaitingDepartment.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class ReportWaitingDepartment extends BaseController
protected $hashset = [
'waitingcount',
'waitingtime',
'waitingcalculated'
'waitingcalculated',
'waitingcount_termin',
'waitingtime_termin'
];

protected $groupfields = [
Expand Down Expand Up @@ -44,6 +46,9 @@ public function readResponse(
->toGrouped($this->groupfields, $this->hashset)
->withMaxByHour($this->hashset)
->withMaxAndAverageFromWaitingTime();

$exchangeWaiting = $this->withMaxAndAverageFromWaitingTime($exchangeWaiting, 'waitingtime');
$exchangeWaiting = $this->withMaxAndAverageFromWaitingTime($exchangeWaiting, 'waitingtime_termin');
}

$type = $validator->getParameter('type')->isString()->getValue();
Expand Down Expand Up @@ -73,4 +78,28 @@ public function readResponse(
)
);
}


public function withMaxAndAverageFromWaitingTime($entity, $targetKey)
{
foreach ($entity->data as $date => $dateItems) {
$maxima = 0;
$total = 0;
$count = 0;
foreach ($dateItems as $hourItems) {
if (is_array($hourItems)) { // Check if $hourItems is an array
foreach ($hourItems as $key => $value) {
if (is_numeric($value) && $targetKey == $key && 0 < $value) {
$total += $value;
$count += 1;
$maxima = ($maxima > $value) ? $maxima : $value;
}
}
}
}
$entity->data[$date]['max_' . $targetKey] = $maxima;
$entity->data[$date]['average_' . $targetKey] = (! $total || ! $count) ? 0 : floor($total / $count);
}
return $entity;
}
}
Loading

0 comments on commit b4319a7

Please sign in to comment.