finished ##172
This commit is contained in:
		
							parent
							
								
									5d8befdaec
								
							
						
					
					
						commit
						e0697b2a6d
					
				| 
						 | 
				
			
			@ -0,0 +1,125 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <v-content>
 | 
			
		||||
    <v-container>
 | 
			
		||||
      <v-card>
 | 
			
		||||
        <v-card-title>
 | 
			
		||||
          Preisliste
 | 
			
		||||
          <v-spacer />
 | 
			
		||||
          <v-text-field
 | 
			
		||||
            v-model="search"
 | 
			
		||||
            label="Suche Getränk"
 | 
			
		||||
            single-line
 | 
			
		||||
            hide-details
 | 
			
		||||
          >
 | 
			
		||||
            <template v-slot:append>
 | 
			
		||||
              <v-icon>{{searchIcon}}</v-icon>
 | 
			
		||||
            </template>
 | 
			
		||||
          </v-text-field>
 | 
			
		||||
        </v-card-title>
 | 
			
		||||
        <v-data-table :headers="headers" :items="priceList" :search="search">
 | 
			
		||||
          <template v-slot:item.price="{ item }">
 | 
			
		||||
            {{ item.price ? (item.price / 100).toFixed(2) : '' }}
 | 
			
		||||
          </template>
 | 
			
		||||
          <template v-slot:item.price_big="{ item }">
 | 
			
		||||
            {{ item.price_big ? (item.price_big / 100).toFixed(2) : '' }}
 | 
			
		||||
          </template>
 | 
			
		||||
          <template v-slot:item.price_club="{ item }">
 | 
			
		||||
            {{
 | 
			
		||||
              item.name.toLowerCase() == 'long island ice tea'.toLowerCase()
 | 
			
		||||
                ? 'Ein Klubmitglied bestellt keinen Long Island Icetea'
 | 
			
		||||
                : item.price_club
 | 
			
		||||
                ? (item.price_club / 100).toFixed(2)
 | 
			
		||||
                : ''
 | 
			
		||||
            }}
 | 
			
		||||
          </template>
 | 
			
		||||
          <template v-slot:item.price_club_big="{ item }">
 | 
			
		||||
            {{
 | 
			
		||||
              item.price_club_big ? (item.price_club_big / 100).toFixed(2) : ''
 | 
			
		||||
            }}
 | 
			
		||||
          </template>
 | 
			
		||||
          <template v-slot:item.premium="{ item }">
 | 
			
		||||
            {{ item.premium ? (item.premium / 100).toFixed(2) : '' }}
 | 
			
		||||
          </template>
 | 
			
		||||
          <template v-slot:item.premium_club="{ item }">
 | 
			
		||||
            {{ item.premium_club ? (item.premium_club / 100).toFixed(2) : '' }}
 | 
			
		||||
          </template>
 | 
			
		||||
          <template v-slot:item.price_extern_club="{ item }">
 | 
			
		||||
            {{
 | 
			
		||||
              item.price_extern_club
 | 
			
		||||
                ? (item.price_extern_club / 100).toFixed(2)
 | 
			
		||||
                : ''
 | 
			
		||||
            }}
 | 
			
		||||
          </template>
 | 
			
		||||
        </v-data-table>
 | 
			
		||||
      </v-card>
 | 
			
		||||
    </v-container>
 | 
			
		||||
  </v-content>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { mapGetters, mapActions } from 'vuex'
 | 
			
		||||
import { mdiMagnify } from '@mdi/js'
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'PriceList',
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      searchIcon: mdiMagnify,
 | 
			
		||||
      search: null,
 | 
			
		||||
      headers: [
 | 
			
		||||
        {
 | 
			
		||||
          text: 'Name',
 | 
			
		||||
          value: 'name'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          text: 'Kategorie',
 | 
			
		||||
          value: 'type'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          text: 'Preis in €',
 | 
			
		||||
          value: 'price'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          text: 'Preis groß in €',
 | 
			
		||||
          value: 'price_big'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          text: 'Preis Club in €',
 | 
			
		||||
          value: 'price_club'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          text: 'Preis groß Club in €',
 | 
			
		||||
          value: 'price_club_big'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          text: 'Aufpreis in €',
 | 
			
		||||
          value: 'premium'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          text: 'Aufpreis Club in €',
 | 
			
		||||
          value: 'premium_club'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          text: 'Preis Club extern in €',
 | 
			
		||||
          value: 'price_extern_club'
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      items: []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    ...mapActions({
 | 
			
		||||
      getPriceList: 'priceList/getPriceList'
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    ...mapGetters({
 | 
			
		||||
      priceList: 'priceList/priceList'
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    this.getPriceList()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped></style>
 | 
			
		||||
| 
						 | 
				
			
			@ -5,6 +5,7 @@ const main = 'http://localhost:5000/'
 | 
			
		|||
 | 
			
		||||
const url = {
 | 
			
		||||
  login: main + 'login',
 | 
			
		||||
  pricelist: main + 'pricelist',
 | 
			
		||||
  getFinanzerMain: main + 'getFinanzerMain',
 | 
			
		||||
  bar: main + 'bar',
 | 
			
		||||
  barGetUser: main + 'barGetUser',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,10 +18,16 @@ import ServiceManagement from '../components/vorstand/ServiceManagement'
 | 
			
		|||
import Config from '@/components/user/Config'
 | 
			
		||||
import Jobs from '@/components/user/Jobs'
 | 
			
		||||
import JobRequests from '@/components/user/JobRequests'
 | 
			
		||||
import PriceList from "@/components/pricelist/PriceList";
 | 
			
		||||
 | 
			
		||||
Vue.use(VueRouter)
 | 
			
		||||
 | 
			
		||||
const routes = [
 | 
			
		||||
  {
 | 
			
		||||
    path: '/pricelist',
 | 
			
		||||
    name: 'priceListNoLogin',
 | 
			
		||||
    component: PriceList
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    path: '/login',
 | 
			
		||||
    name: 'login',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@ import user from '@/store/modules/user'
 | 
			
		|||
import sm from '@/store/modules/serviceManagement'
 | 
			
		||||
import jobs from '@/store/modules/jobs'
 | 
			
		||||
import requestJobs from '@/store/modules/jobRequests'
 | 
			
		||||
import priceList from '@/store/modules/pricelist'
 | 
			
		||||
 | 
			
		||||
Vue.use(Vuex)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -18,6 +19,7 @@ export default new Vuex.Store({
 | 
			
		|||
    user,
 | 
			
		||||
    sm,
 | 
			
		||||
    jobs,
 | 
			
		||||
    requestJobs
 | 
			
		||||
    requestJobs,
 | 
			
		||||
    priceList
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
import url from '@/plugins/routes'
 | 
			
		||||
import axios from 'axios'
 | 
			
		||||
 | 
			
		||||
const state = {
 | 
			
		||||
  priceList: []
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const mutations = {
 | 
			
		||||
  setPriceList: (state, priceList) => {
 | 
			
		||||
    state.priceList = priceList
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const actions = {
 | 
			
		||||
  async getPriceList({ commit }) {
 | 
			
		||||
    try {
 | 
			
		||||
      const response = await axios.get(url.pricelist)
 | 
			
		||||
      commit('setPriceList', response.data)
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      console.log(e)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const getters = {
 | 
			
		||||
  priceList: state => {
 | 
			
		||||
    return state.priceList
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  namespaced: true,
 | 
			
		||||
  state,
 | 
			
		||||
  mutations,
 | 
			
		||||
  actions,
 | 
			
		||||
  getters
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue