Skip to content

Commit b89844d

Browse files
Thomas FinkThomas Fink
Thomas Fink
authored and
Thomas Fink
committed
Merge branch 'next' into bugfix-zms-3253-3466-3415-1891-validation-opening-hours-of-the-same-appointment-type-must-not-overlap
2 parents 8e0cdc8 + 7565e11 commit b89844d

File tree

4 files changed

+56
-3
lines changed

4 files changed

+56
-3
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import $ from 'jquery'
2+
3+
class EndEmergencyView {
4+
5+
constructor(element, options) {
6+
this.includeUrl = options.includeurl
7+
this.scope = options.scope
8+
this.workstationName = "" + options.workstationname
9+
this.data = {}
10+
this.$ = $(element)
11+
12+
this.$.find('.emergency__button-end').on('click', this.endEmergency.bind(this))
13+
}
14+
15+
endEmergency() {
16+
this.update({ activated: "0", calledByWorkstation: "-1", acceptedByWorkstation: "-1" })
17+
this.sendEmergencyCancel()
18+
}
19+
20+
update(newData) {
21+
this.data = Object.assign({}, this.data, newData)
22+
}
23+
24+
sendEmergencyCancel() {
25+
const url = `${this.includeUrl}/scope/${this.scope.id}/emergency/`
26+
27+
return new Promise((resolve, reject) => {
28+
$.ajax(url, {
29+
method: 'GET'
30+
}).done(() => {
31+
resolve()
32+
}).fail(err => {
33+
console.log('XHR error', url, err)
34+
reject(err)
35+
})
36+
})
37+
}
38+
}
39+
40+
export default EndEmergencyView;

zmsadmin/js/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import PickupKeyboardHandheldView from "./page/pickup/keyboard-handheld"
2626
import StatisticView from './page/statistic'
2727

2828
import LoginScopeSelectView from './block/scope/loginselectform'
29+
import EmergencyEnd from './block/scope/emergencyend'
2930
//import AvailabilityDayPage from './page/availabilityDay'
3031
import WeekCalendarPage from './page/weekCalendar'
3132
import printScopeAppointmentsByDay from './page/scopeAppointmentsByDay/print'
@@ -108,6 +109,10 @@ $('[data-scope-select-form]').each(function () {
108109
new LoginScopeSelectView(this, getDataAttributes(this));
109110
})
110111

112+
$('.emergency-end').each(function () {
113+
new EmergencyEnd(this, getDataAttributes(this));
114+
})
115+
111116
$('.pickup-view').each(function () {
112117
new PickupView(this, getDataAttributes(this));
113118
})

zmsadmin/templates/block/scope/form.twig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,18 +627,24 @@
627627

628628
<fieldset>
629629
<legend>Notruf</legend>
630-
<div class="panel--heavy">
630+
<div class="panel--heavy emergency-end"
631+
data-scope="{{workstation.scope | json_encode}}"
632+
data-scopestate={{ scopeState|json_encode|e('html_attr') }}
633+
data-labels={{ dataLabels|json_encode|e('html_attr') }}
634+
data-includeurl="{{ includeUrl() }}"
635+
>
631636
{{ formgroup(
632637
{
633638
"label": null
634639
},
635640
[{
636641
"type":"checkbox",
637642
"parameter": {
638-
"label": "Notruffunktion im Backend",
643+
"label": "Notruffunktion im Backend (Durch das Deaktivieren der Funktion wird auch ein aktuell bestehender Notruf am Standort beendet.)",
639644
"name": "preferences[workstation][emergencyEnabled]",
640645
"value": 1,
641646
"checked": scope.preferences.workstation.emergencyEnabled|default(0),
647+
"class": "emergency__button-end"
642648
}
643649
}]
644650
) }}

zmsentities/src/Zmsentities/Schema/Entity.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,9 @@ public function withLessData()
308308
public function withCleanedUpFormData()
309309
{
310310
$entity = clone $this;
311-
unset($entity['save']);
311+
if (isset($entity['save'])) {
312+
unset($entity['save']);
313+
}
312314
if (isset($entity['removeImage'])) {
313315
unset($entity['removeImage']);
314316
}

0 commit comments

Comments
 (0)