appointments.js
1 week ago
attendees.js
1 week ago
colorManipulation.js
1 week ago
customer.js
1 week ago
date.js
1 week ago
defaultCustomize.js
1 week ago
employee.js
1 week ago
events.js
1 week ago
formFieldsTemplates.js
1 week ago
formatting.js
1 week ago
helper.js
1 week ago
image.js
1 week ago
integrationApple.js
1 week ago
integrationGoogle.js
1 week ago
integrationOutlook.js
1 week ago
integrationStripe.js
1 week ago
integrationZoom.js
1 week ago
licence.js
1 week ago
phone.js
1 week ago
pricing.js
1 week ago
recurring.js
1 week ago
responsive.js
1 week ago
scrollElements.js
1 week ago
settings.js
1 week ago
translationsElementPlus.js
1 week ago
utilHeaderHeight.js
1 week ago
customer.js
27 lines
| 1 | import moment from 'moment' |
| 2 | |
| 3 | function useFrontendCustomer(store, customer) { |
| 4 | return Object.assign({}, customer, { |
| 5 | gender: customer.gender ? customer.gender : '', |
| 6 | note: customer.note ? customer.note : '', |
| 7 | phone: customer.phone ? customer.phone : '', |
| 8 | birthday: customer.birthday ? moment(customer.birthday.date.split(' ')[0]).toDate() : null, |
| 9 | translations: customer.translations |
| 10 | ? JSON.parse(customer.translations) |
| 11 | : { defaultLanguage: '' }, |
| 12 | }) |
| 13 | } |
| 14 | |
| 15 | function useBackendCustomer(store) { |
| 16 | let customer = store.getters['customerInfo/getCustomer'] |
| 17 | |
| 18 | return Object.assign({}, customer, { |
| 19 | birthday: customer.birthday ? moment(customer.birthday).format('YYYY-MM-DD') : null, |
| 20 | translations: customer.translations.defaultLanguage |
| 21 | ? JSON.stringify(customer.translations) |
| 22 | : null, |
| 23 | }) |
| 24 | } |
| 25 | |
| 26 | export { useFrontendCustomer, useBackendCustomer } |
| 27 |