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