Advertisement
rmrevin

Untitled

Nov 18th, 2020
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { debounce } from 'lodash-es';
  2. import * as moment from 'moment';
  3. import Vuex from 'vuex';
  4. import {
  5.     canCreateCompany,
  6.     conditionCashboxIsValid,
  7.     conditionDaysIsValid,
  8.     conditionDiscountCodeIsValid,
  9.     customerEmailIsValid,
  10.     customerInnIsValid,
  11.     customerOrgIsValid,
  12.     customerPhoneIsValid,
  13.     isIndividualEntrepreneur,
  14.     isLegalEntity,
  15.     recalculate,
  16.     setCanCreate,
  17.     setConditions,
  18.     setCustomer,
  19.     setOrder,
  20.     setPayment,
  21.     setPaymentMethod,
  22.     setPrice,
  23.     setRegisterNewAccountStatus,
  24.     setUser,
  25. } from './store';
  26.  
  27. export interface VendaCartStoreState extends CartStoreState
  28. {
  29.     newField: boolean;
  30. }
  31.  
  32. export const vendaCartStore = new Vuex.Store<VendaCartStoreState>({
  33.     state,
  34.     mutations: {
  35.         // vendaCartStore
  36.         // new mutations
  37.  
  38.         // cartStore
  39.         setCanCreate,
  40.         setPrice,
  41.         setConditions,
  42.         setCustomer,
  43.         setPaymentMethod,
  44.         setPayment,
  45.         setOrder,
  46.         setUser,
  47.         setRegisterNewAccountStatus,
  48.     },
  49.     getters: {
  50.         // vendaCartStore
  51.         // new getters
  52.  
  53.         // cartStore
  54.         canCreateCompany,
  55.         conditionCashboxIsValid,
  56.         conditionDaysIsValid,
  57.         conditionDiscountCodeIsValid,
  58.         customerPhoneIsValid,
  59.         customerEmailIsValid,
  60.         customerInnIsValid,
  61.         customerOrgIsValid,
  62.         isIndividualEntrepreneur,
  63.         isLegalEntity,
  64.     },
  65.     actions: {
  66.         // vendaCartStore
  67.         // new actions
  68.  
  69.         // cartStore
  70.         recalculate: debounce(recalculate, 100),
  71.     },
  72. });
  73.  
  74. /* region State */
  75.  
  76. function state (): VendaCartStoreState {
  77.     return {
  78.         // VendaCartStoreState
  79.         newField: false,
  80.  
  81.         // CartStoreState
  82.         conditions: {
  83.             cashbox: '1',
  84.             days: '1',
  85.             date: moment().startOf('day').add(1, 'day').format('YYYY-MM-DD'),
  86.             receiptEmail: false,
  87.             discountCode: '',
  88.         },
  89.         customer: {
  90.             email: '',
  91.             inn: '',
  92.             kpp: '',
  93.             ogrn: '',
  94.             orgName: '',
  95.             org: null,
  96.             password: '',
  97.             passwordApp: '',
  98.         },
  99.         paymentMethod: 'CreditCard',
  100.         price: null,
  101.         payment: null,
  102.         order: null,
  103.         user: null,
  104.         canCreate: null,
  105.         registerNewAccountStatus: null,
  106.     };
  107. }
  108.  
  109. /** endregion **/
  110.  
  111. /* region Getters */
  112.  
  113. /** endregion **/
  114.  
  115. /* region Mutations */
  116.  
  117. /** endregion **/
  118.  
  119. /* region Actions */
  120.  
  121. /** endregion **/
  122.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement