Skip to content

Commit

Permalink
Merge pull request #22 from it-at-m/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
manjencic authored Nov 27, 2023
2 parents d1de6af + 31e5736 commit b70d6ae
Show file tree
Hide file tree
Showing 16 changed files with 5,694 additions and 426 deletions.
5,430 changes: 5,077 additions & 353 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.

5 changes: 5 additions & 0 deletions zmsadmin/src/Zmsadmin/Helper/GraphDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ public static function getProcess()
waitingTime,
callCount
}
processingTime
waitingTime
services
name
withAppointment
requests{
id
link
Expand Down
42 changes: 39 additions & 3 deletions zmsadmin/src/Zmsadmin/ProcessSave.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function readResponse(
$dateTime = ($process->isWithAppointment()) ?
(new \DateTime())->setTimestamp($process->getFirstAppointment()->date) :
\App::$now;
$shouldNotify = $this->shouldSendNotifications($input, $process);
$process->withUpdatedData($input, $dateTime, $scope);

$validatedForm = ($process->isWithAppointment()) ?
Expand All @@ -51,7 +52,12 @@ public function readResponse(
);
}

$process = $this->writeUpdatedProcess($input, $process, $validator);
$process = $this->writeUpdatedProcess(
$input,
$process,
$validator,
$shouldNotify
);
$appointment = $process->getFirstAppointment();
$conflictList = ($process->isWithAppointment()) ?
static::getConflictList($scope->getId(), $appointment) :
Expand Down Expand Up @@ -84,7 +90,7 @@ public static function getConflictList($scopeId, $appointment)
return (isset($conflictList)) ? $conflictList[$appointment->getStartTime()->format('Y-m-d')] : null;
}

protected function writeUpdatedProcess($input, Entity $process, $validator)
protected function writeUpdatedProcess($input, Entity $process, $validator, $notify = true)
{
$initiator = $validator->getParameter('initiator')->isString()->getValue();
$process = \App::$http->readPostResult(
Expand All @@ -96,7 +102,37 @@ protected function writeUpdatedProcess($input, Entity $process, $validator)
'slotsRequired' => (isset($input['slotCount']) && 1 < $input['slotCount']) ? $input['slotCount'] : 0
]
)->getEntity();
AppointmentFormHelper::updateMailAndNotification($input, $process);

if ($notify) {
AppointmentFormHelper::updateMailAndNotification($input, $process);
}

return $process;
}

private function shouldSendNotifications($requestData, \BO\Zmsentities\Schema\Entity $process)
{
$requestIds = $requestData['requests'] ?? [];
$currentRequestIds = [];
foreach ($process->getRequests() as $request) {
$currentRequestIds[] = $request['id'];
}

if (array_merge(array_diff($requestIds, $currentRequestIds), array_diff($currentRequestIds, $requestIds))) {
return true;
}

if ($process->getFirstClient()['familyName'] !== $requestData['familyName']) {
return true;
}

$newDate = $requestData['selecteddate'] . ' '
. str_replace('-', ':', $requestData['selectedtime']);

if ($process->getFirstAppointment()->toDateTime()->format('Y-m-d H:i') !== $newDate) {
return true;
}

return false;
}
}
2 changes: 2 additions & 0 deletions zmsadmin/src/Zmsadmin/QueueTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function readResponse(
$queueList = $processList->toQueueList(\App::$now);
$queueListVisible = $queueList->withStatus(['preconfirmed', 'confirmed', 'queued', 'reserved', 'deleted']);
$queueListMissed = $queueList->withStatus(['missed']);
$queueListFinished = $queueList->withStatus(['finished']);

// rendering
return \BO\Slim\Render::withHtml(
Expand All @@ -65,6 +66,7 @@ public function readResponse(
'clusterEnabled' => $workstation->isClusterEnabled(),
'processList' => $queueListVisible->toProcessList(),
'processListMissed' => $queueListMissed->toProcessList(),
'processListFinished' => $queueListFinished->toProcessList(),
'changedProcess' => $changedProcess,
'success' => $success,
'debug' => \App::DEBUG,
Expand Down
204 changes: 147 additions & 57 deletions zmsadmin/templates/block/queue/table.twig
Original file line number Diff line number Diff line change
Expand Up @@ -211,64 +211,154 @@
</tbody>
</table>
</div>
<h2>Verpasste Termine</h2>
{% if processListMissed|length %}
<div class="table-responsive-wrapper">
<table class="table--base queue-missed">
<thead>
<tr>
<th>Lfdnr.</th>
<th>Uhrzeit</th>
<th>Name (Nummer)</th>
<th>Dienstleistung</th>
<th>Telefon</th>
<th>Art</th>
<th>Anmerkung</th>
<th>Freitextfeld: {{workstation.scope.preferences.client.customTextfieldLabel}}</th>
<th>Aktion</th>
</tr>
</thead>
{% set lfdnr = 0 %}
{% for item in processListMissed %}
{% set lfdnr = lfdnr + 1 %}
<tr class="missed">
<td>
{{ lfdnr }}.
</td>
<td>
{% if item.queue.withAppointment %}
{{ item.appointments|first.date|date("H:i") }}
{% else %}
{{ item.queue.arrivalTime|date("H:i") }}
{% endif %}
</td>
<td>{% if item.clients|first.familyName %}{{ item.clients|first.familyName }}{% else %}Wartenummer {{ item.queue.number }} {% endif %} ({{ item.queue.number }}) </td>
<td title="{% for request in item.requests%}{{request.name}}{% if not loop.last %}; {% endif %}{% endfor %}">
{{ item.requests|first.name }}
{% if item.requests|length > 1 %}
+{{ (item.requests|length) - 1 }}
{% endif %}
</td>{#DL#}
<td>{{ item.clients|first.telephone }}</td>
<td>
{% if item.queue.withAppointment %}
Termin
{% if 1 < item.appointments|first.slotCount %}
({{ item.appointments|first.slotCount }})

<div class="table-responsive-wrapper">
<h2>Verpasste Termine</h2>
{% if processListMissed|length %}
<div class="table-responsive-wrapper">
<table class="table--base queue-missed">
<thead>
<tr>
<th>Lfdnr.</th>
<th>Uhrzeit</th>
<th>Name (Nummer)</th>
<th>Dienstleistung</th>
<th>Telefon</th>
<th>Art</th>
<th>Anmerkung</th>
<th>Freitextfeld: {{workstation.scope.preferences.client.customTextfieldLabel}}</th>
<th>Aktion</th>
</tr>
</thead>
{% set lfdnr = 0 %}
{% for item in processListMissed %}
{% set lfdnr = lfdnr + 1 %}
<tr class="missed">
<td>
{{ lfdnr }}.
</td>
<td>
{% if item.queue.withAppointment %}
{{ item.appointments|first.date|date("H:i") }}
{% else %}
{{ item.queue.arrivalTime|date("H:i") }}
{% endif %}
{% else %}
Spontankunde
{% endif %}
</td>
<td>Dieser Kunde ist nicht erschienen</td>
<td><a href="#" data-id="{{ item.id }}" class="process-reset">wieder aufnehmen</a></td>
</tr>
{% endfor %}
</table>
</div>
{% else %}
Keine Einträge gefunden.
{% endif %}
</td>
<td>{% if item.clients|first.familyName %}{{ item.clients|first.familyName }}{% else %}Wartenummer {{ item.queue.number }} {% endif %} ({{ item.queue.number }}) </td>
<td title="{% for request in item.requests%}{{request.name}}{% if not loop.last %}; {% endif %}{% endfor %}">
{{ item.requests|first.name }}
{% if item.requests|length > 1 %}
+{{ (item.requests|length) - 1 }}
{% endif %}
</td>{#DL#}
<td>{{ item.clients|first.telephone }}</td>
<td>
{% if item.queue.withAppointment %}
Termin
{% if 1 < item.appointments|first.slotCount %}
({{ item.appointments|first.slotCount }})
{% endif %}
{% else %}
Spontankunde
{% endif %}
</td>
<td>Dieser Kunde ist nicht erschienen</td>
<td><a href="#" data-id="{{ item.id }}" class="process-reset">wieder aufnehmen</a></td>
</tr>
{% endfor %}
</table>
</div>
{% else %}
Keine Einträge gefunden.
{% endif %}
<br>
<br>
</div>

<div class="table-responsive-wrapper">
<h2 id="finished-appointments-control">Abgeschlossene Termine
<i class="fas fa-angle-down" aria-hidden="true"></i>
<i class="fas fa-angle-up hidden" aria-hidden="true"></i>
</h2>
{% if processListFinished|length %}
<div id="finished-appointments-content" class="hidden table-responsive-wrapper">
<table class="table--base queue-missed">
<thead>
<tr>
<th>Lfdnr.</th>
<th>Uhrzeit</th>
<th>Name</th>
<th>Dienstleistung</th>
<th>Art</th>
<th>Wartezeit</th>
<th>Bearbeitungszeit</th>
</tr>
</thead>
{% set lfdnr = 0 %}
{% for item in processListFinished %}
{% set lfdnr = lfdnr + 1 %}
<tr class="missed">
<td>
{{ lfdnr }}.
</td>
<td>
{% if item.queue.withAppointment %}
{{ item.appointments|first.date|date("H:i") }}
{% else %}
{{ item.queue.arrivalTime|date("H:i") }}
{% endif %}
</td>
<td>{{ item.name }}</td>
<td>{{ item.services }}</td>
<td>
{% if item.withAppointment %}
Termin
{% else %}
Spontankunde
{% endif %}
</td>
<td>{{ item.waitingTime }}</td>
<td>{{ item.processingTime }}</td>
</tr>
{% endfor %}
</table>
</div>
{% else %}
Keine Einträge gefunden.
{% endif %}

<script>
(function() {
let control = $('#finished-appointments-control');
let content = $('#finished-appointments-content');
let upButton = $('#finished-appointments-control .fa-angle-up')
let downButton = $('#finished-appointments-control .fa-angle-down')
$(control).click(function(){
if (upButton.hasClass('hidden')) {
upButton.removeClass('hidden')
downButton.addClass('hidden')
content.removeClass('hidden')
} else {
upButton.addClass('hidden')
downButton.removeClass('hidden')
content.addClass('hidden')
}
});
})();
</script>

<style>
.hidden {
display: none;
}
#finished-appointments-control:hover {
cursor: pointer;
}
</style>
</div>

<div class="form-actions">
<div class="right">
<button title="{% trans %}Warteschlange neu laden{% endtrans %}" class="button button-reload reload"><i class="fas fa-sync"></i> Warteschlange aktualisieren</button>
Expand Down
2 changes: 1 addition & 1 deletion zmsadmin/templates/block/useraccount/edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
{
"label": "E-Mail:",
"description": metadata.email.description|filter((v, k) => k != 'pattern'),
"required": true,
"required": false,
"errors": exception.data.email.messages
},
[{
Expand Down
5 changes: 5 additions & 0 deletions zmsapi/src/Zmsapi/ProcessListByScopeAndDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use \BO\Slim\Render;
use \BO\Mellon\Validator;
use \BO\Zmsdb\Scope as Query;
use \BO\Zmsdb\ProcessStatusArchived;

class ProcessListByScopeAndDate extends BaseController
{
Expand Down Expand Up @@ -37,8 +38,12 @@ public function readResponse(
$resolveReferences? $resolveReferences + 1 : 1 // resolveReferences is for process, for queue we have to +1
);

$archivedProcesses =
(new ProcessStatusArchived())->readListByScopeAndDate($scope->getId(), $dateTime);

$message = Response\Message::create($request);
$message->data = $queueList->toProcessList()->withResolveLevel($resolveReferences);
$message->data->addData($archivedProcesses);

$response = Render::withLastModified($response, time(), '0');
$response = Render::withJson($response, $message, 200);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE `buergerarchiv`
ADD COLUMN `name` varchar (255) DEFAULT NULL;

ALTER TABLE `buergerarchiv`
ADD COLUMN `dienstleistungen` varchar (1000) DEFAULT NULL;
12 changes: 11 additions & 1 deletion zmsdb/src/Zmsdb/ProcessStatusArchived.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace BO\Zmsdb;

use \BO\Zmsentities\Process as Entity;
use \BO\Zmsentities\ProcessArchived as Entity;
use \BO\Zmsentities\Collection\ProcessList as Collection;

/**
Expand Down Expand Up @@ -41,6 +41,16 @@ public function readListByDate($dateTime, $resolveReferences = 0)
return $this->readResolvedList($query, $resolveReferences);
}

public function readListByScopeAndDate($scopeId, $dateTime, $resolveReferences = 0)
{
$query = new Query\ProcessStatusArchived(Query\Base::SELECT);
$query->addEntityMapping()
->addConditionScopeId($scopeId)
->addResolvedReferences($resolveReferences)
->addConditionTime($dateTime);
return $this->readResolvedList($query, $resolveReferences);
}

public function readListForStatistic($dateTime, \BO\Zmsentities\Scope $scope, $limit = 500, $resolveReferences = 0)
{
$query = new Query\ProcessStatusArchived(Query\Base::SELECT);
Expand Down
Loading

0 comments on commit b70d6ae

Please sign in to comment.