diff --git a/package-lock.json b/package-lock.json
index e8b918a..b099db4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1707,10 +1707,13 @@
"dev": true
},
"serialize-javascript": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.0.0.tgz",
- "integrity": "sha512-skZcHYw2vEX4bw90nAr2iTTsz6x2SrHEnfxgKYmZlvJYBEZrvbKtobJWlQ20zczKb3bsHHXXTYt48zBA7ni9cw==",
- "dev": true
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.1.0.tgz",
+ "integrity": "sha512-JIJT1DGiWmIKhzRsG91aS6Ze4sFUrYbltlkg2onR5OrnNM02Kl/hnY/T4FN2omvyeBbQmMJv+K4cPOpGzOTFBg==",
+ "dev": true,
+ "requires": {
+ "randombytes": "^2.1.0"
+ }
},
"source-map": {
"version": "0.6.1",
@@ -4538,9 +4541,9 @@
"dev": true
},
"elliptic": {
- "version": "6.5.2",
- "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
- "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
+ "version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
+ "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
"dev": true,
"requires": {
"bn.js": "^4.4.0",
@@ -6842,9 +6845,9 @@
}
},
"lodash": {
- "version": "4.17.15",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
+ "version": "4.17.20",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
+ "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
"dev": true
},
"lodash.defaultsdeep": {
@@ -11026,9 +11029,9 @@
"dev": true
},
"vuetify": {
- "version": "2.2.29",
- "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-2.2.29.tgz",
- "integrity": "sha512-UI1i8kEdV+s7tNQe2yJJMPlvxGTE8cZfUAXEGV2yO4owHmeybn6p5YzFpJqimoKkfX6ok+zV29+6yIKfkyUDAA=="
+ "version": "2.3.9",
+ "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-2.3.9.tgz",
+ "integrity": "sha512-E5K9flTvS21tCkHgqDBMl0BY/Rld4SLUaJpQ+sQdL8/2uPcWmWLrdumn4SI8LBFojE0UP1GSaH4zKuxLL36fYg=="
},
"vuetify-loader": {
"version": "1.4.4",
diff --git a/package.json b/package.json
index 35207c7..f8c4b13 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
"core-js": "^3.6.5",
"vue": "^2.6.10",
"vue-router": "^3.2.0",
- "vuetify": "^2.2.29",
+ "vuetify": "^2.3.8",
"vuex": "^3.4.0"
},
"devDependencies": {
diff --git a/src/components/baruser/BarFreedrinks.vue b/src/components/baruser/BarFreedrinks.vue
new file mode 100644
index 0000000..bc47eba
--- /dev/null
+++ b/src/components/baruser/BarFreedrinks.vue
@@ -0,0 +1,433 @@
+
+
+
+
+
+ Dienstgetränke
+ Gesperrt
+
+
+
+ Noch
+ {{ ((limit - free_drink_list_history_job_credit) / 100).toFixed(2) }}
+ € übrig!!
+
+
+
+
+
+
+ {{ freeDrink.label }}
+
+
+
+
+
+
+
+ {{
+ (free_drink_list_history_job_credit / 100).toFixed(2)
+ }}
+ €
+
+
+
+
+
+
+
+
+
+
+
+ Bandgetränke
+
+
+
+
+
+
+
+ {{ freeDrink.label }}
+
+
+
+
+
+
+
+ {{
+ free_drink_list_history_band_without_canceled.length
+ }}
+ Getränke
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Verlauf
+
+
+
+
+
+ {{
+ now(freeDrinkHistory.timestamp)
+ }}
+ {{ freeDrinkHistory.free_drink_type.name }}:
+ {{ freeDrinkHistory.free_drink_config.label }} wurde für
+ {{
+ (freeDrinkHistory.free_drink_config.price / 100).toFixed(2)
+ }}
+ € hinzugefügt.
+
+ STORNIERT!!!
+ Klicken um zu Stornieren
+
+
+
+
+
+
+
+
+ Willst du wirklich??
+
+ {{ canceledMessage.free_drink_type.name }}: Willst du wirklich ein
+ {{ canceledMessage.free_drink_config.label }} im Wert von
+ {{ (canceledMessage.free_drink_config.price / 100).toFixed(2) }} €
+ stornieren?
+
+
+
+ Abbrechen
+ Stornieren
+
+
+
+
+
+
+
+
+
+
+
+ {{ createMessage(message) }}
+
+
+
+
+
+ mdi-close
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/baruser/BarNavigation.vue b/src/components/baruser/BarNavigation.vue
index ef58718..c08adc4 100644
--- a/src/components/baruser/BarNavigation.vue
+++ b/src/components/baruser/BarNavigation.vue
@@ -8,16 +8,25 @@
Geruecht
+
+
+ {{ beer }}
+
+
+ Freigetränke
+
+
+
+
diff --git a/src/components/vorstand/FreeDrinkList.vue b/src/components/vorstand/FreeDrinkList.vue
new file mode 100644
index 0000000..d4189a7
--- /dev/null
+++ b/src/components/vorstand/FreeDrinkList.vue
@@ -0,0 +1,138 @@
+
+
+
+
+ Übersicht
+
+
+ Dienstgetränke
+
+
+ AG-Getränke
+
+
+ Bandgetränke
+
+
+ Einstellungen
+ mdi-cogs
+
+
+
+
+
+
+ mdi-chevron-left
+
+
+
+ {{month[date.getMonth()]}} {{date.getFullYear()}}
+
+
+
+ mdi-chevron-right
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue
new file mode 100644
index 0000000..98848c1
--- /dev/null
+++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue
@@ -0,0 +1,123 @@
+
+
+
+
+
+ Anzahl Freigetränke
+
+
+ {{free_drink_list_history_band_without_canceled.length}}
+
+
+
+
+ Summe Freigetränke
+
+
+ {{ (sum/100).toFixed(2)}} €
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue
new file mode 100644
index 0000000..498ebf9
--- /dev/null
+++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue
@@ -0,0 +1,212 @@
+
+
+
+
+ Freigetränke
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mdi-plus
+
+
+
+
+ Gründe für Freigetränke
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mdi-plus
+
+
+
+
+
+
+
+ Wirklich löschen?
+
+
+ Willst du wirklich {{check_model.label}} mit dem Getränk {{check_model.drink.name}} löschen?
+ Wenn du dies löscht, wird auch der ganze Verlauf gelöscht. Dh. es ist nicht mehr vollständig nachvollziehbar, was getrunken wurde.
+
+
+
+ Abbrechen
+ Löschen
+
+
+
+
+
+
+
+ Wirklich löschen?
+
+
+ Willst du wirklich den Grund {{check_model_reason.name}} löschen?
+ Wenn du dies löscht, wird auch der im Verlauf alle dieser Gründe gelöscht.. Dh. es ist nicht mehr vollständig nachvollziehbar, aus welchem Grund ein Freigetränk rausgegeben wurde.
+
+
+
+ Abbrechen
+ Löschen
+
+
+
+
+
+
+
+
+
diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue
new file mode 100644
index 0000000..ea797f5
--- /dev/null
+++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mdi-delete
+
+
+ mdi-minus
+
+ {$emit('save', model); $emit('delete_free_drink_config'); model = null}"
+ >
+ Save
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigReasonItem.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigReasonItem.vue
new file mode 100644
index 0000000..7ccf745
--- /dev/null
+++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigReasonItem.vue
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+ mdi-delete
+
+
+ mdi-minus
+
+ {$emit('save', model); $emit('delete_free_drink_reason'); model = null}"
+ >
+ Save
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue
new file mode 100644
index 0000000..7d35878
--- /dev/null
+++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue
@@ -0,0 +1,123 @@
+
+
+
+
+
+ Anzahl Freigetränke
+
+
+ {{free_drink_list_history_job_without_canceled.length}}
+
+
+
+
+ Summe Freigetränke
+
+
+ {{ (sum/100).toFixed(2)}} €
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue
new file mode 100644
index 0000000..f5f8801
--- /dev/null
+++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue
@@ -0,0 +1,166 @@
+
+
+
+
+
+ Anzahl Freigetränke
+
+
+ {{free_drink_list_history_without_canceled.length}}
+
+
+ Summe Freigetränke
+
+
+ {{ (sum/100).toFixed(2)}} €
+
+
+
+
+ Anzahl Dienstgetränke
+
+
+ {{ free_drink_list_history_job_without_canceled.length }}
+
+
+ Summe Dienstgetränke
+
+
+ {{(sumJob/100).toFixed(2)}} €
+
+
+
+
+ Anzahl AG-Getränke
+
+
+ {{ free_drink_list_history_workgroup_without_canceled.length }}
+
+
+ Summe AG-Getränke
+
+
+ {{(sumWorkgroup/100).toFixed(2)}} €
+
+
+
+
+ Anzahl Bandgetränke
+
+
+ {{ free_drink_list_history_band_without_canceled.length }}
+
+
+ Summe Bandgetränke
+
+
+ {{(sumBand/100).toFixed(2)}} €
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue
new file mode 100644
index 0000000..84b6f77
--- /dev/null
+++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue
@@ -0,0 +1,112 @@
+
+
+
+
+
+ Anzahl Freigetränke
+
+
+ {{free_drink_list_history_workgroup_without_canceled.length}}
+
+
+
+
+ Summe Freigetränke
+
+
+ {{ (sum/100).toFixed(2)}} €
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/vorstand/ManagementNavigation.vue b/src/components/vorstand/ManagementNavigation.vue
index 6631763..fb61006 100644
--- a/src/components/vorstand/ManagementNavigation.vue
+++ b/src/components/vorstand/ManagementNavigation.vue
@@ -31,6 +31,14 @@
Dienstarten
+
+
+ mdi-beer
+
+
+ Freigetränke
+
+
diff --git a/src/plugins/routes.js b/src/plugins/routes.js
index 00fe5e4..a4bc5de 100644
--- a/src/plugins/routes.js
+++ b/src/plugins/routes.js
@@ -28,6 +28,14 @@ const url = {
saveLifeTime: main + 'saveLifeTime',
getLifeTime: main + 'getLifeTime',
resetPassword: main + 'passwordReset',
+ freeDrinkListConfig: main + 'freeDrinkListConfig',
+ freeDrinkListHistory: main + 'freeDrinkListHistory',
+ freeDrinkListHistoryFromTo: main + 'freeDrinkListHistoryFromTo',
+ deleteDrinkListHistory: main + 'deleteDrinkListHistory',
+ freeDrinkListReasons: main + 'freeDrinkListReasons',
+ deleteFreeDrinkListReason: main + 'deleteFreeDrinkListReason',
+ freeDrinkTypes: main + 'freeDrinkTypes',
+ deleteFreeDrinkListConfig: main + 'deleteFreeDrinkListConfig',
vorstand: {
sm: {
addUser: main + 'sm/addUser',
diff --git a/src/router/index.js b/src/router/index.js
index 8ebe80f..4a4a7cb 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -4,6 +4,7 @@ import FinanzerView from '@/views/FinanzerView'
import Login from '@/views/Login'
import store from '@/store/index'
import GeruechteView from '../views/contents/GeruechteView'
+import BarFreedrinksView from '../views/contents/BarFreedrinksView'
import AddAmount from '../components/user/AddAmount'
import CreditOverview from '../components/user/CreditOverview'
import MainView from '../views/MainView'
@@ -16,6 +17,7 @@ import Overview from '../components/finanzer/Overview'
import User from '../components/finanzer/User'
import ServiceManagement from '../components/vorstand/ServiceManagement'
import Config from '@/components/user/Config'
+import FreedrinkUserView from '@/components/user/freedrink/freedrinkUserView'
import Jobs from '@/components/user/Jobs'
import PriceList from '@/components/pricelist/PriceList'
import ManagementNavigation from '@/components/vorstand/ManagementNavigation'
@@ -26,6 +28,12 @@ import WorkgroupManagement from '@/components/vorstand/WorkgroupManagement'
import JobKindManager from '@/components/vorstand/JobKindManager'
import JobsRequest from '@/components/user/JobsRequest'
import ResetPassword from '@/components/ResetPassword'
+import FreeDrinkList from '@/components/vorstand/FreeDrinkList'
+import FreeDrinkListMain from '@/components/vorstand/FreeDrinkList/FreeDrinkListMain'
+import FreeDrinkListConfig from '@/components/vorstand/FreeDrinkList/FreeDrinkListConfig'
+import FreeDrinkListJob from '@/components/vorstand/FreeDrinkList/FreeDrinkListJob'
+import FreeDrinkListWorkgroup from '@/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup'
+import FreeDrinkListBand from '@/components/vorstand/FreeDrinkList/FreeDrinkListBand'
Vue.use(VueRouter)
@@ -80,6 +88,38 @@ const routes = [
path: 'jobkindmanagement',
name: 'jobkindManagement',
component: JobKindManager
+ },
+ {
+ path: 'freeDrinkList',
+ name: 'freeDrinkList',
+ component: FreeDrinkList,
+ children: [
+ {
+ path: 'main',
+ name: 'freeDrinkListMain',
+ component: FreeDrinkListMain
+ },
+ {
+ path: 'config',
+ name: 'freeDrinkListConfig',
+ component: FreeDrinkListConfig
+ },
+ {
+ path: 'freeDrinkListJob',
+ name: 'freeDrinkListJob',
+ component: FreeDrinkListJob
+ },
+ {
+ path: 'freeDrinkListWorkgroup',
+ name: 'freeDrinkListWorkgroup',
+ component: FreeDrinkListWorkgroup
+ },
+ {
+ path: 'freeDrinkListBand',
+ name: 'freeDrinkListBand',
+ component: FreeDrinkListBand
+ }
+ ]
}
]
},
@@ -93,6 +133,11 @@ const routes = [
name: 'add',
component: AddAmount
},
+ {
+ path: 'freedrinkUser',
+ name: 'freedrinkUser',
+ component: FreedrinkUserView
+ },
{
path: 'overview',
name: 'userOverview',
@@ -124,6 +169,11 @@ const routes = [
path: 'geruecht',
name: 'geruecht',
component: GeruechteView
+ },
+ {
+ path: 'baruserFreedrinks',
+ name: 'baruserFreedrinks',
+ component: BarFreedrinksView
}
]
},
diff --git a/src/store/index.js b/src/store/index.js
index 7c4eed4..41c8768 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -13,6 +13,7 @@ import jkm from '@/store/modules/jobkindManager'
import jobInvites from '@/store/modules/jobInvites'
import jobRequests from '@/store/modules/jobRequests'
import connectionError from '@/store/modules/connectionError'
+import freeDrinkList from '@/store/modules/freeDrinkList'
Vue.use(Vuex)
@@ -30,6 +31,7 @@ export default new Vuex.Store({
jkm,
jobInvites,
jobRequests,
- connectionError
+ connectionError,
+ freeDrinkList
}
})
diff --git a/src/store/modules/freeDrinkList.js b/src/store/modules/freeDrinkList.js
new file mode 100644
index 0000000..f95451b
--- /dev/null
+++ b/src/store/modules/freeDrinkList.js
@@ -0,0 +1,438 @@
+import axios from 'axios'
+import url from '@/plugins/routes'
+const timeout = 20000
+
+const state = {
+ free_drink_list_config: [],
+ free_drink_list_history: [],
+ free_drink_list_reasons: [],
+ free_drink_types: [],
+ free_drink_list_config_loading: false,
+ free_drink_list_history_loading: false,
+ free_drink_list_reasons_loading: false,
+ free_drink_types_loading: false,
+ snackbar_messages: []
+}
+
+const mutations = {
+ set_free_drink_list_config(state, data) {
+ state.free_drink_list_config = data
+ },
+ set_free_drink_list_history(state, data) {
+ data.forEach(item => {
+ item.timestamp = new Date(
+ item.timestamp.year,
+ item.timestamp.month - 1,
+ item.timestamp.day,
+ item.timestamp.hour,
+ item.timestamp.minute,
+ item.timestamp.second
+ )
+ })
+ state.free_drink_list_history = data
+ state.free_drink_list_history.reverse()
+ },
+ set_free_drink_list_config_loading(state, loading) {
+ state.free_drink_list_config_loading = loading
+ },
+ set_free_drink_list_history_loading(state, loading) {
+ state.free_drink_list_history_loading = loading
+ },
+ set_free_drink_list_reasons_loading(state, loading) {
+ state.free_drink_list_reasons_loading = loading
+ },
+ add_snackbar_message(state, { data, error }) {
+ data.error = error
+ data.visible = true
+ data.free_drink_type = data.free_drink_types.find(item => {
+ return item.id == data.free_drink_type_id
+ })
+ data.timer = setTimeout(() => {
+ if (!data.error) {
+ data.visible = false
+ }
+ }, 5000)
+ console.log(data)
+ state.snackbar_messages.unshift(data)
+ },
+ set_free_drink_list_reasons(state, data) {
+ state.free_drink_list_reasons = data
+ },
+ set_free_drink_types(state, data) {
+ state.free_drink_types = data
+ },
+ set_free_drink_types_loading(state, loading) {
+ state.free_drink_types_loading = loading
+ },
+ set_free_drink_config(state, data) {
+ let config = state.free_drink_list_config.find(item => {
+ return item.id == data.id
+ })
+ Object.assign(config, data)
+ }
+}
+
+const actions = {
+ async get_free_drink_list_config({ commit, dispatch, rootState }) {
+ try {
+ commit('set_free_drink_list_config_loading', true)
+ const response = await axios.get(url.freeDrinkListConfig, {
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_config', response.data)
+ } catch (e) {
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_config_loading', false)
+ }
+ },
+ async get_free_drink_list_history({ commit, dispatch, rootState }) {
+ try {
+ commit('set_free_drink_list_history_loading', true)
+ const response = await axios.get(url.freeDrinkListHistory, {
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_history', response.data)
+ } catch (e) {
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_history_loading', false)
+ }
+ },
+ async get_free_drink_list_history_from_to({ commit, dispatch, rootState }, data) {
+ try {
+ commit('set_free_drink_list_history_loading', true)
+ const response = await axios.post(url.freeDrinkListHistoryFromTo, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_history', response.data)
+ } catch (e) {
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_history_loading', false)
+ }
+ },
+ async set_free_drink_list_history({ commit, dispatch, rootState }, data) {
+ try {
+ commit('set_free_drink_list_history_loading', true)
+ const response = await axios.post(
+ url.freeDrinkListHistory,
+ { ...data },
+ {
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ }
+ )
+ commit('set_free_drink_list_history', response.data)
+ commit('add_snackbar_message', { data, error: false })
+ } catch (e) {
+ commit('add_snackbar_message', { data, error: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_history_loading', false)
+ }
+ },
+ async update_free_drink_list_history({ commit, dispatch, rootState }, data) {
+ try {
+ commit('set_free_drink_list_history_loading', true)
+ const response = await axios.put(
+ url.freeDrinkListHistory,
+ { ...data },
+ { headers: { Token: rootState.login.user.accessToken }, timeout }
+ )
+ commit('set_free_drink_list_history', response.data)
+ commit('add_snackbar_message', { data, error: false })
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_history_loading', false)
+ }
+ },
+ async get_free_drink_list_reasons({ commit, dispatch, rootState }) {
+ try {
+ commit('set_free_drink_list_reasons_loading', true)
+ const response = await axios.get(url.freeDrinkListReasons, {
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_reasons', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_reasons_loading', false)
+ }
+ },
+ async get_free_drink_types({ commit, dispatch, rootState }) {
+ try {
+ commit('set_free_drink_types_loading', true)
+ const response = await axios.get(url.freeDrinkTypes, {
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_types', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_types_loading', false)
+ }
+ },
+ async set_free_drink_list_config({commit, dispatch, rootState}, data) {
+ try {
+ commit('set_free_drink_list_config_loading', true)
+ const response = await axios.post(url.freeDrinkListConfig, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_config', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_config_loading', false)
+ }
+ },
+ async update_free_drink_list_config({commit, dispatch, rootState}, data) {
+ try {
+ commit('set_free_drink_list_config_loading', true)
+ const response = await axios.put(url.freeDrinkListConfig, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_config', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_config_loading', false)
+ }
+ },
+ async delete_free_drink_list_config({commit, dispatch, rootState}, data) {
+ try {
+ commit('set_free_drink_list_config_loading', true)
+ const response = await axios.post(url.deleteFreeDrinkListConfig, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_config', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_config_loading', false)
+ }
+ },
+ async set_free_drink_list_reason({ commit, dispatch, rootState }, data) {
+ try {
+ commit('set_free_drink_list_reasons_loading', true)
+ const response = await axios.post(url.freeDrinkListReasons, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_reasons', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_reasons_loading', false)
+ }
+ }
+ ,
+ async update_free_drink_list_reason({ commit, dispatch, rootState }, data) {
+ try {
+ commit('set_free_drink_list_reasons_loading', true)
+ const response = await axios.put(url.freeDrinkListReasons, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_reasons', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_reasons_loading', false)
+ }
+ },
+ async delete_free_drink_list_reason({ commit, dispatch, rootState }, data) {
+ try {
+ commit('set_free_drink_list_reasons_loading', true)
+ const response = await axios.post(url.deleteFreeDrinkListReason, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_reasons', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_reasons_loading', false)
+ }
+ }
+
+}
+
+const getters = {
+ free_drink_list_config(state) {
+ return state.free_drink_list_config
+ },
+ free_drink_list_config_job(state) {
+ return state.free_drink_list_config.filter(item => {
+ console.log(item)
+ return item.free_drink_types.find(drink_type => {
+ return drink_type.id == 1
+ })
+ })
+ },
+ free_drink_list_config_workgroup(state) {
+ return state.free_drink_list_config.filter(item => {
+ return item.free_drink_types.find(drink_type => {
+ return drink_type.id == 2
+ })
+ })
+ },
+ free_drink_list_config_band(state) {
+ return state.free_drink_list_config.filter(item => {
+ return item.free_drink_types.find(drink_type => {
+ return drink_type.id == 3
+ })
+ })
+ },
+ free_drink_list_history(state) {
+ return state.free_drink_list_history
+ },
+ free_drink_list_history_without_canceled(state) {
+ return state.free_drink_list_history.filter(item => {
+ return !item.canceled
+ })
+ },
+ free_drink_list_history_band(state) {
+ return state.free_drink_list_history.filter(item => {
+ return item.free_drink_type.id == 3
+ })
+ },
+ free_drink_list_history_band_without_canceled(state) {
+ return state.free_drink_list_history.filter(item => {
+ return item.free_drink_type.id == 3 && !item.canceled
+ })
+ },
+ free_drink_list_history_job_without_canceled(state) {
+ return state.free_drink_list_history.filter(item => {
+ return item.free_drink_type.id == 1 && !item.canceled
+ })
+ },
+ free_drink_list_history_job_credit(state) {
+ let jobDrinks = state.free_drink_list_history.filter(item => {
+ return item.free_drink_type.id == 1 && !item.canceled
+ })
+ let credit = 0
+ jobDrinks.forEach(item => {
+ credit += item.free_drink_config.price
+ })
+ return credit
+ },
+ free_drink_list_history_workgroup_without_canceled(state) {
+ return state.free_drink_list_history.filter(item => {
+ return item.free_drink_type.id == 2 && !item.canceled
+ })
+ },
+ free_drink_list_history_workgroup(state) {
+ return state.free_drink_list_history.filter(item => {
+ return item.free_drink_type.id == 2
+ })
+ },
+ loading(state) {
+ return (
+ state.free_drink_list_history_loading ||
+ state.free_drink_list_config_loading
+ )
+ },
+ snackbar_messages(state) {
+ return state.snackbar_messages
+ },
+ free_drink_list_reasons(state) {
+ return state.free_drink_list_reasons
+ },
+ free_drink_list_reasons_loading(state) {
+ return state.free_drink_list_reasons_loading
+ },
+ free_drink_types(state) {
+ return state.free_drink_types
+ },
+ free_drink_list_history_loading(state) {
+ return state.free_drink_list_history_loading
+ },
+ free_drink_list_config_loading(state) {
+ return state.free_drink_list_config_loading
+ },
+ free_drink_types_loading(state) {
+ return state.free_drink_types_loading
+ },
+ free_drink_list_config_by_id: (state) => (id) => {
+ return state.free_drink_list_config.find(item => { return item.id == id})
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions,
+ getters
+}
diff --git a/src/views/contents/BarFreedrinksView.vue b/src/views/contents/BarFreedrinksView.vue
new file mode 100644
index 0000000..bbe6270
--- /dev/null
+++ b/src/views/contents/BarFreedrinksView.vue
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+