App.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template lang="pug">
  2. .pos
  3. form-wizard(title="" subtitle="" nextButtonText="Continuar" backButtonText="Volver" finishButtonText="Finalizar" color="#7c7bad")
  4. tab-content(title="Agregue productos al carrito" :before-change="checkCart")
  5. .products
  6. .products-container
  7. products-searcher
  8. products-grid(:symbol="currency.symbol")
  9. .cart-container
  10. cart-total(:total="total" :symbol="currency.symbol")
  11. cart-items(:symbol="currency.symbol")
  12. tab-content(title="Seleccione un cliente" :before-change="checkCustomer")
  13. customer-searcher
  14. customers-grid
  15. tab-content(title="Vea un resumen de su operación")
  16. summary-display
  17. loader
  18. </template>
  19. <script>
  20. import { FormWizard, TabContent } from 'vue-form-wizard'
  21. import 'vue-form-wizard/dist/vue-form-wizard.min.css'
  22. import Loader from '@/components/Loader'
  23. import ProductsSearcher from '@/components/ProductsSearcher'
  24. import ProductsGrid from '@/components/ProductsGrid'
  25. import CartTotal from '@/components/CartTotal'
  26. import CartItems from '@/components/CartItems'
  27. import CartItem from '@/components/CartItem'
  28. import CustomerSearcher from '@/components/CustomerSearcher'
  29. import CustomersGrid from '@/components/CustomersGrid'
  30. import SummaryDisplay from '@/components/SummaryDisplay'
  31. import { mapActions, mapGetters } from 'vuex'
  32. import Vuex from 'vuex'
  33. export default {
  34. components: {
  35. 'form-wizard': FormWizard,
  36. 'tab-content': TabContent,
  37. 'loader': Loader,
  38. 'products-searcher': ProductsSearcher,
  39. 'products-grid': ProductsGrid,
  40. 'cart-total': CartTotal,
  41. 'cart-items': CartItems,
  42. 'cart-item': CartItem,
  43. 'customer-searcher': CustomerSearcher,
  44. 'customers-grid': CustomersGrid,
  45. 'summary-display': SummaryDisplay
  46. },
  47. computed: mapGetters({
  48. total: 'getTotal',
  49. currency: 'getCurrency',
  50. cartIsEmpty: 'cartIsEmpty',
  51. hasSelectedCustomer: 'hasSelectedCustomer'
  52. }),
  53. methods: {
  54. checkCart() {
  55. if (!this.cartIsEmpty) {
  56. this.notify('Necesitas agregar productos al carrito para continuar')
  57. }
  58. return this.cartIsEmpty
  59. },
  60. checkCustomer() {
  61. if (!this.hasSelectedCustomer) {
  62. this.notify('Necesitas seleccionar un cliente para continuar')
  63. }
  64. return this.hasSelectedCustomer
  65. },
  66. ...mapActions([
  67. 'fetchData',
  68. 'notify'
  69. ])
  70. },
  71. mounted() {
  72. this.fetchData()
  73. }
  74. }
  75. </script>
  76. <style lang="sass">
  77. .pos
  78. width: 100%
  79. height: 100%
  80. position: absolute
  81. .vue-form-wizard
  82. width: 100%
  83. height: 100%
  84. padding-bottom: 0
  85. .wizard-header
  86. display: none
  87. .wizard-navigation
  88. width: 100%
  89. height: 100%
  90. .wizard-progress-with-circle
  91. top: 35px
  92. .wizard-icon-circle
  93. width: 60px
  94. height: 60px
  95. .wizard-tab-content
  96. width: 100%
  97. height: calc(100% - 82px)
  98. padding: 0
  99. overflow: hidden
  100. .wizard-tab-container
  101. width: calc(100% - 20px)
  102. height: calc(100% - 20px)
  103. margin: 10px
  104. .products
  105. width: 100%
  106. height: 100%
  107. display: block
  108. background: #fff
  109. .products-container
  110. width: calc(100% - 300px)
  111. height: 100%
  112. padding-right: 5px
  113. display: inline-block
  114. .cart-container
  115. width: 300px
  116. height: 100%
  117. border-left: 1px solid #d3d3d3
  118. padding-left: 10px
  119. display: inline-block
  120. vertical-align: top
  121. .wizard-card-footer
  122. width: 100%
  123. padding: 10px 10px
  124. position: absolute
  125. bottom: 0
  126. .wizard-btn
  127. width: 160px
  128. height: 40px
  129. border-radius: 0
  130. box-shadow: none
  131. border: none
  132. &:hover, &:focus
  133. background: #7c7bad
  134. </style>