Skip to content

Commit

Permalink
feat(ZMS-817): disable plus minus button
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Manjencic committed Nov 7, 2023
1 parent 39cb03d commit 7d22e1a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 20 additions & 0 deletions frontend/src/components/ServiceFinder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
class="appointment-count-button button-down"
:aria-label="`Anzahl der Dienstleistung verringern auf ` + (appointmentCounts[$store.state.data.service.id] - 1)"
:aria-describedby="`appointment-count-name-` + $store.state.data.service.id"
:disabled="!canDecreaseAppointments($store.state.data.service)"
fab
@click="decreaseAppointments($store.state.data.service)"
>
Expand All @@ -87,6 +88,7 @@
class="appointment-count-button"
:aria-label="`Anzahl der Dienstleistung erhöhen auf` + (appointmentCounts[$store.state.data.service.id] + 1)"
:aria-describedby="`appointment-count-name-` + $store.state.data.service.id"
:disabled="!canIncreaseAppointments($store.state.data.service)"
fab
@click="increaseAppointments($store.state.data.service)"
>
Expand All @@ -109,6 +111,7 @@
class="appointment-count-button button-down"
:aria-label="`Anzahl der Dienstleistung verringern auf ` + (appointmentCounts[subService.id] - 1)"
:aria-describedby="`appointment-count-name-` + subService.id"
:disabled="!canDecreaseAppointments(subService)"
fab
@click="decreaseAppointments(subService)"
>
Expand All @@ -127,6 +130,7 @@
class="appointment-count-button"
:aria-label="`Anzahl der Dienstleistung erhöhen auf ` + (appointmentCounts[subService.id] + 1)"
:aria-describedby="`appointment-count-name-` + subService.id"
:disabled="!canIncreaseAppointments(subService)"
fab
@click="increaseAppointments(subService)"
>
Expand Down Expand Up @@ -215,6 +219,22 @@ export default {
this.$store.commit('data/decreaseAppointmentCount', service.id)
this.appointmentCountTriggered++
},
canIncreaseAppointments(service) {
if (this.$store.state.data.appointmentCounts[service.id] + 1
> this.$store.state.data.servicesById[service.id].maxQuantity
) {
return false
}
return true
},
canDecreaseAppointments(service) {
if (this.$store.state.data.appointmentCounts[service.id] - 1 < 0) {
return false
}
return true
},
onChange(value) {
if (!value) {
return
Expand Down
1 change: 0 additions & 1 deletion frontend/src/store/modules/formData/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const checkMaxSlots = (state) => {
let minSlots = 0
for (var selectedServiceId in state.appointmentCounts) {
minSlots += state.appointmentCounts[selectedServiceId] * state.servicesById[selectedServiceId].minSlots
console.log(minSlots)
}

if (minSlots > MAX_SLOTS) {
Expand Down

0 comments on commit 7d22e1a

Please sign in to comment.