Customer.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template lang="pug">
  2. .pos-step
  3. .customer-selection-step
  4. .customer-selector
  5. searcher(:items='customers' :keys="['name', 'displayName']")
  6. card-grid(:items='customers' :loading='loadingCustomers' canAdd @onAdd='showCustomerForm' @onSelect='selectCustomer')
  7. customer-modal(:show='showingCustomerForm' @onAccept='submitCustomer' @onCancel='hideCustomerForm')
  8. transition(name='slide-fade')
  9. customer-form(v-if='!!selectedCustomer' :customer='selectedCustomer' mode='details' type='small')
  10. </template>
  11. <script>
  12. import { mapGetters, mapActions } from 'vuex'
  13. import { Searcher, CardGrid } from '@@/common'
  14. import CustomerModal from '@@/modals/CustomerModal'
  15. import CustomerForm from '@@/forms/CustomerForm'
  16. import { SHOW_CUSTOMER_FORM, SUBMIT_CUSTOMER, HIDE_CUSTOMER_FORM, SELECT_CUSTOMER } from '@/constants/actionTypes'
  17. export default {
  18. components: {
  19. Searcher,
  20. CardGrid,
  21. CustomerModal,
  22. CustomerForm
  23. },
  24. computed: mapGetters([
  25. 'customers',
  26. 'loadingCustomers',
  27. 'showingCustomerForm',
  28. 'selectedCustomer'
  29. ]),
  30. methods: mapActions([
  31. SHOW_CUSTOMER_FORM,
  32. SUBMIT_CUSTOMER,
  33. HIDE_CUSTOMER_FORM,
  34. SELECT_CUSTOMER
  35. ])
  36. }
  37. </script>
  38. <style lang="sass">
  39. .pos-step
  40. .customer-selection-step
  41. width: 100%
  42. height: 100%
  43. display: flex
  44. .customer-selector
  45. width: 100%
  46. height: 100%
  47. .slide-fade-enter-active
  48. transition: all 300ms ease;
  49. .slide-fade-enter
  50. transform: translateX(300px)
  51. opacity: 0
  52. </style>