@ozdao/martyrs 0.2.459 → 0.2.460
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Media-Df1hO2ZT.mjs → Media-BKlUty0j.mjs} +1 -1
- package/dist/{Media-B9V7fmz-.js → Media-ChTgw58S.js} +1 -1
- package/dist/chats.server.js +11 -18
- package/dist/chats.server.mjs +11 -18
- package/dist/globals.server.js +104 -1
- package/dist/globals.server.mjs +104 -1
- package/dist/{main-DviXUDiB.js → main-DIXWgUWx.js} +2 -2
- package/dist/{main-DbrX42CV.mjs → main-Q8Dr1-HT.mjs} +2 -2
- package/dist/martyrs/src/components/Button/{Button.vue2.cjs → Button.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Button/{Button.vue2.js.map → Button.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Button/{Button.vue2.js → Button.vue.js} +2 -2
- package/dist/martyrs/src/components/Button/Button.vue.js.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs → Dropdown.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.js → Dropdown.vue2.js} +2 -2
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs.map → Dropdown.vue2.js.map} +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue.cjs +93 -0
- package/dist/martyrs/src/components/EditImages/EditImages.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue.js +94 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue.js.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.cjs +0 -93
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.cjs.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.js +1 -94
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.js.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs +2 -2
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.js +2 -2
- package/dist/martyrs/src/components/Feed/Feed.vue.js.map +1 -1
- package/dist/martyrs/src/components/SelectMulti/{SelectMulti.vue2.cjs → SelectMulti.vue.cjs} +2 -2
- package/dist/martyrs/src/components/SelectMulti/{SelectMulti.vue2.js.map → SelectMulti.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/SelectMulti/{SelectMulti.vue2.js → SelectMulti.vue.js} +2 -2
- package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue.js.map +1 -0
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.js +1 -1
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.cjs +1 -1
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js +1 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs +1 -0
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js +1 -0
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js.map +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.cjs +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.js +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/sections/Comment.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/sections/Comment.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/Comment.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/sections/Comment.vue.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs +3 -3
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +3 -3
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/sections/EventsHot.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/sections/EventsHot.vue.js +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +3 -3
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +3 -3
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +3 -3
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +3 -3
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/PopupDateSelector.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/entities/IconTime.vue.cjs +4 -3
- package/dist/martyrs/src/modules/icons/entities/IconTime.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/entities/IconTime.vue.js +5 -4
- package/dist/martyrs/src/modules/icons/entities/IconTime.vue.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/notifications.client.cjs +2 -61
- package/dist/martyrs/src/modules/notifications/notifications.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/notifications.client.js +2 -61
- package/dist/martyrs/src/modules/notifications/notifications.client.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +1 -0
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +2 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/AskToLogin.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/sections/AskToLogin.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/AskToLogin.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/sections/AskToLogin.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +12 -16
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +15 -19
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Documents.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.cjs +1 -1
- package/dist/martyrs/src/modules/pages/views/components/blocks/CardPage.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.cjs +1 -1
- package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +4 -4
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +4 -4
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditProductInfo.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Map.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Map.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +1 -1
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/notifications.server.js +2 -2
- package/dist/notifications.server.mjs +2 -2
- package/dist/orders.server.js +124 -109
- package/dist/orders.server.mjs +124 -109
- package/package.json +1 -1
- package/src/components/Feed/Feed.vue +1 -1
- package/src/modules/chats/components/sections/ChatWindow.vue +1 -0
- package/src/modules/chats/routes/chats.routes.js +10 -20
- package/src/modules/chats/store/chat.store.js +1 -1
- package/src/modules/community/components/sections/Comment.vue +1 -1
- package/src/modules/globals/controllers/classes/globals.websocket.js +116 -0
- package/src/modules/globals/globals.server.js +3 -0
- package/src/modules/globals/views/components/blocks/CardHeader.vue +1 -1
- package/src/modules/globals/views/plugins/AlertDialog.vue +1 -1
- package/src/modules/icons/entities/IconTime.vue +1 -1
- package/src/modules/notifications/notifications.client.js +2 -79
- package/src/modules/notifications/services/notification.service.js +1 -1
- package/src/modules/orders/components/pages/OrderCreate.vue +6 -1
- package/src/modules/orders/components/partials/ShopCart.vue +1 -1
- package/src/modules/orders/components/sections/AskToLogin.vue +2 -1
- package/src/modules/orders/controllers/orders.controller.js +49 -35
- package/src/modules/organizations/components/blocks/CardOrganization.vue +10 -9
- package/src/modules/products/components/pages/Product.vue +3 -3
- package/dist/martyrs/src/components/Button/Button.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue.js.map +0 -1
- package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue2.cjs.map +0 -1
- package/src/components/AskToLogin/AskToLogin.vue +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.client.js","sources":["../../../../../src/modules/notifications/notifications.client.js"],"sourcesContent":["import { watch, toRefs } from \"vue\";\n// Router import \nimport routerNotifications from './router/notifications.router.js'; \n// Store \nimport * as storeNotifications from './store/notifications.store.js'; \n// Auth store import\nimport * as auth from '@martyrs/src/modules/auth/views/store/auth';\n// Global WebSocket import\nimport globalWebSocket from '@martyrs/src/modules/globals/views/classes/globals.websocket.js';\n// Layouts \nimport NotificationsLayout from './components/layouts/NotificationsLayout.vue'; \n// Sections \nimport NotificationsList from './components/sections/NotificationsList.vue'; \nimport NotificationPreferences from './components/sections/NotificationPreferences.vue'; \n// Pages \nimport Notifications from './components/pages/Notifications.vue'; \n// Components \nimport NotificationBadge from './components/elements/NotificationBadge.vue'; \nimport NotificationItem from './components/blocks/NotificationItem.vue'; \n\n/**\n * WebSocket notification handler that uses the global WebSocket connection\n */\nclass WebSocketNotificationHandler {\n constructor(store, options = {}) {\n this.store = store;\n this.options = options;\n this.moduleName = 'notifications';\n this.listeners = [];\n }\n\n /**\n * Connect to notifications channel\n */\n connect(userId) {\n // Skip if running in SSR\n if (typeof window === 'undefined' || !userId) {\n return Promise.resolve(false);\n }\n\n // First ensure the global WebSocket is connected\n return globalWebSocket.connect(userId).then(() => {\n // Register event listeners\n this._registerListeners();\n return true;\n });\n }\n\n /**\n * Disconnect notification listeners\n */\n disconnect() {\n globalWebSocket.removeModuleListeners(this.moduleName);\n }\n\n /**\n * Register notification event listeners\n */\n _registerListeners() {\n // Listen for notification events\n this.listeners.push(\n globalWebSocket.addEventListener('notification', this._processNotification.bind(this), {\n module: this.moduleName\n })\n );\n \n // Listen for notification read status changes\n this.listeners.push(\n globalWebSocket.addEventListener('notification_read', (data) => {\n this.store.notifications.actions.syncNotificationStatus(data.notificationId, 'read');\n }, { module: this.moduleName })\n );\n }\n\n /**\n * Process incoming notification\n */\n _processNotification(data) {\n if (!data || !data.data) return;\n \n const notification = data.data;\n \n // Add notification to store\n this.store.notifications.actions.addLocalNotification({\n _id: notification._id,\n title: notification.title,\n body: notification.body,\n type: notification.type || 'info',\n metadata: notification.metadata || {},\n status: 'unread',\n createdAt: notification.createdAt || new Date().toISOString(),\n updatedAt: notification.updatedAt || new Date().toISOString()\n });\n }\n}\n\n/**\n * Capacitor Push Notification handler\n */\nclass CapacitorPushHandler {\n constructor(store) {\n this.store = store;\n this.pushNotifications = null;\n this.device = null;\n this.isInitialized = false;\n }\n\n /**\n * Initialize Capacitor plugins\n */\n async initialize() {\n // Skip if running in SSR\n if (typeof window === 'undefined') {\n return false;\n }\n\n try {\n // Dynamic imports to prevent errors in web environment\n const { Capacitor } = await import('@capacitor/core');\n const { PushNotifications } = await import('@capacitor/push-notifications');\n const { Device } = await import('@capacitor/device');\n \n this.capacitor = Capacitor;\n this.pushNotifications = PushNotifications;\n this.device = Device;\n \n // Only proceed if running on a native platform\n if (!this.capacitor.isNativePlatform()) {\n return false;\n }\n \n this.isInitialized = true;\n return true;\n } catch (error) {\n console.error('Error importing Capacitor plugins:', error);\n return false;\n }\n }\n\n /**\n * Request permission and register for push notifications\n */\n async requestPermissions() {\n // Skip if running in SSR\n if (typeof window === 'undefined') {\n return false;\n }\n\n if (!this.isInitialized) {\n const initialized = await this.initialize();\n if (!initialized) return false;\n }\n\n try {\n // Request permission\n const permissionResult = await this.pushNotifications.requestPermissions();\n if (permissionResult.receive !== 'granted') {\n console.log('Push notification permission denied');\n return false;\n }\n \n // Set up event listeners\n this._setupListeners();\n \n // Register with Apple/Google\n await this.pushNotifications.register();\n return true;\n } catch (error) {\n console.error('Error requesting push notification permissions:', error);\n return false;\n }\n }\n\n /**\n * Setup push notification event listeners\n */\n _setupListeners() {\n // Registration event\n this.pushNotifications.addListener('registration', \n this._handleRegistration.bind(this)\n );\n \n // Notification received event\n this.pushNotifications.addListener('pushNotificationReceived',\n this._handleNotificationReceived.bind(this)\n );\n \n // Notification action performed event\n this.pushNotifications.addListener('pushNotificationActionPerformed',\n this._handleNotificationAction.bind(this)\n );\n }\n\n /**\n * Handle registration token received\n */\n async _handleRegistration(token) {\n try {\n // Get device info\n const deviceInfo = await this.device.getInfo();\n const deviceId = await this.device.getId();\n \n // Prepare device data\n const deviceData = {\n deviceId: deviceId.uuid,\n deviceType: deviceInfo.platform.toLowerCase(),\n deviceToken: token.value\n };\n \n // Register device with backend\n await this.store.notifications.actions.registerDevice(deviceData);\n } catch (error) {\n console.error('Error handling push registration:', error);\n }\n }\n\n /**\n * Handle received notification\n */\n _handleNotificationReceived(notification) {\n // Add notification to store\n this.store.notifications.actions.addLocalNotification({\n title: notification.title,\n body: notification.body,\n data: notification.data || {}\n });\n }\n\n /**\n * Handle notification action (when user taps on notification)\n */\n _handleNotificationAction(actionData) {\n if (actionData.notification && actionData.notification.data) {\n this.store.notifications.actions.handleNotificationAction(\n actionData.notification.data\n );\n }\n }\n\n /**\n * Remove push notification listeners\n */\n removeListeners() {\n if (typeof window === 'undefined') {\n return;\n }\n \n if (this.pushNotifications) {\n this.pushNotifications.removeAllListeners();\n }\n }\n}\n\n/**\n * Notification Manager for coordinating WebSocket and Push notifications\n */\nclass NotificationManager {\n constructor(store, options = {}) {\n this.store = store;\n this.options = options;\n this.wsHandler = new WebSocketNotificationHandler(store, options);\n this.pushHandler = new CapacitorPushHandler(store);\n this.initialized = false;\n this.isServer = typeof window === 'undefined';\n }\n\n /**\n * Initialize notifications\n */\n async initialize() {\n if (this.initialized || this.isServer) return;\n \n // Get current user ID from auth store instead of localStorage\n const userId = this.store.auth.state.user?._id;\n if (!userId) {\n console.warn('Cannot initialize notifications: No user ID found in auth store');\n return;\n }\n \n // Initialize WebSocket for realtime notifications\n await this.wsHandler.connect(userId);\n \n // Initialize push notifications for mobile if enabled\n if (this.options.enablePush !== false) {\n await this.pushHandler.requestPermissions();\n }\n \n this.initialized = true;\n \n // Fetch existing notifications\n await this.store.notifications.actions.getNotifications(userId);\n }\n\n /**\n * Disconnect and clean up\n */\n disconnect() {\n if (this.isServer) return;\n \n this.wsHandler.disconnect();\n this.pushHandler.removeListeners();\n this.initialized = false;\n }\n}\n\n/**\n * Server-side utility for pre-fetching notification data\n */\nconst SSRUtils = {\n /**\n * Pre-fetch notifications for SSR\n * @param {Object} store - Store instance\n * @param {Object} context - SSR context\n */\n async prefetchNotifications(store, context) {\n try {\n const userId = store.auth.state.user?._id;\n if (userId) {\n // Fetch notifications without WebSocket or push setup\n await store.notifications.actions.getNotifications(userId);\n }\n } catch (error) {\n console.error('Error pre-fetching notifications for SSR:', error);\n }\n }\n};\n\n/**\n * Function to initialize the notifications module\n * @param {Object} app - Vue app instance\n * @param {Object} store - Vuex/Pinia store\n * @param {Object} router - Vue Router instance\n * @param {Object} options - Configuration options\n */\nfunction initializeNotifications(app, store, router, options = {}) {\n // Add routes and store\n const route = options.route || 'User Profile Root';\n router.addRoute(route, routerNotifications);\n store.addStore('notifications', storeNotifications);\n \n // Initialize global WebSocket if needed\n if (options.wsUrl) {\n globalWebSocket.initialize({ wsUrl: options.wsUrl });\n }\n \n // Create notification manager\n const notificationManager = new NotificationManager(store, {\n enablePush: options.enablePush !== false,\n maxReconnectAttempts: options.maxReconnectAttempts || 5,\n reconnectDelay: options.reconnectDelay || 3000,\n pingInterval: options.pingInterval || 30000\n });\n \n // Attach notification manager to store for access in components\n store.notificationManager = notificationManager;\n \n // Don't auto-initialize on server\n const isServer = typeof window === 'undefined';\n const autoInit = !isServer && options.autoInit !== false;\n \n if (autoInit) {\n // Initialize after auth is confirmed\n const isAuthenticated = store.auth.state.isAuthenticated;\n const userId = store.auth.state.user?._id;\n \n if (isAuthenticated && userId) {\n notificationManager.initialize();\n }\n \n // Watch for user login/logout using auth store\n watch(() => store.auth.state.isAuthenticated, (isAuthenticated) => {\n if (isAuthenticated) {\n notificationManager.initialize();\n } else {\n notificationManager.disconnect();\n store.notifications.mutations.resetNotifications();\n }\n });\n }\n \n // Provide composable for components to access notification functionality\n app.provide('useNotifications', () => {\n return {\n ...toRefs(store.notifications.state),\n ...store.notifications.actions,\n ...store.notifications.mutations,\n init: notificationManager.initialize.bind(notificationManager),\n disconnect: notificationManager.disconnect.bind(notificationManager),\n isServer\n };\n });\n \n return notificationManager;\n}\n\n// Module export\nconst ModuleNotifications = {\n initialize: initializeNotifications,\n SSR: SSRUtils, // Export SSR utilities\n views: {\n store: {\n storeNotifications,\n },\n router: {\n routerNotifications\n },\n components: {\n // Elements\n NotificationBadge,\n // Blocks\n NotificationItem,\n // Sections\n NotificationsList,\n NotificationPreferences,\n // Pages\n Notifications,\n // Layouts\n NotificationsLayout\n }\n }\n};\n\n// Component exports\nexport {\n // Elements\n NotificationBadge,\n // Blocks\n NotificationItem,\n // Sections\n NotificationsList,\n NotificationPreferences,\n // Pages\n Notifications,\n // Layouts\n NotificationsLayout,\n // SSR Utilities\n SSRUtils\n};\n\nexport default ModuleNotifications;\n"],"names":["routerNotifications","storeNotifications","isAuthenticated"],"mappings":";;;;;;;;;;;AAuBA,MAAM,6BAA6B;AAAA,EACjC,YAAY,OAAO,UAAU,IAAI;AAC/B,SAAK,QAAQ;AACb,SAAK,UAAU;AACf,SAAK,aAAa;AAClB,SAAK,YAAY,CAAE;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAKE,QAAQ,QAAQ;AAEd,QAAI,OAAO,WAAW,eAAe,CAAC,QAAQ;AAC5C,aAAO,QAAQ,QAAQ,KAAK;AAAA,IAClC;AAGI,WAAO,gBAAgB,QAAQ,MAAM,EAA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BAAgB;AAAA,EAC1C,CAAG;AAGD,QAAM,sBAAsB;AAG5B,QAAM,WAAW,OAAO,WAAW;AACnC,QAAM,WAAW,CAAC,YAAY,QAAQ,aAAa;AAEnD,MAAI,UAAU;AAEZ,UAAM,kBAAkB,MAAM,KAAK,MAAM;AACzC,UAAM,UAAS,WAAM,KAAK,MAAM,SAAjB,mBAAuB;AAEtC,QAAI,mBAAmB,QAAQ;AAC7B,0BAAoB,WAAY;AAAA,IACtC;AAGI,UAAM,MAAM,MAAM,KAAK,MAAM,iBAAiB,CAACC,qBAAoB;AACjE,UAAIA,kBAAiB;AACnB,4BAAoB,WAAY;AAAA,MACxC,OAAa;AACL,4BAAoB,WAAY;AAChC,cAAM,cAAc,UAAU,mBAAoB;AAAA,MAC1D;AAAA,IACA,CAAK;AAAA,EACL;AAGE,MAAI,QAAQ,oBAAoB,MAAM;AACpC,WAAO;AAAA,MACL,GAAG,OAAO,MAAM,cAAc,KAAK;AAAA,MACnC,GAAG,MAAM,cAAc;AAAA,MACvB,GAAG,MAAM,cAAc;AAAA,MACvB,MAAM,oBAAoB,WAAW,KAAK,mBAAmB;AAAA,MAC7D,YAAY,oBAAoB,WAAW,KAAK,mBAAmB;AAAA,MACnE;AAAA,IACD;AAAA,EACL,CAAG;AAED,SAAO;AACT;AAGK,MAAC,sBAAsB;AAAA,EAC1B,YAAY;AAAA,EACZ,KAAK;AAAA;AAAA,EACL,OAAO;AAAA,IACL,OAAO;AAAA,MACX,oBAAMD;AAAAA,IACD;AAAA,IACD,QAAQ;AAAA,MACND,qBAAAA;AAAAA,IACD;AAAA,IACD,YAAY;AAAA;AAAA,MAEV;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA;AAAA,IACN;AAAA,EACA;AACA;"}
|
|
1
|
+
{"version":3,"file":"notifications.client.js","sources":["../../../../../src/modules/notifications/notifications.client.js"],"sourcesContent":["import { watch, toRefs } from \"vue\";\n// Router import \nimport routerNotifications from './router/notifications.router.js'; \n// Store \nimport * as storeNotifications from './store/notifications.store.js'; \n// Auth store import\nimport * as auth from '@martyrs/src/modules/auth/views/store/auth';\n// Global WebSocket import\nimport globalWebSocket from '@martyrs/src/modules/globals/views/classes/globals.websocket.js';\n// Layouts \nimport NotificationsLayout from './components/layouts/NotificationsLayout.vue'; \n// Sections \nimport NotificationsList from './components/sections/NotificationsList.vue'; \nimport NotificationPreferences from './components/sections/NotificationPreferences.vue'; \n// Pages \nimport Notifications from './components/pages/Notifications.vue'; \n// Components \nimport NotificationBadge from './components/elements/NotificationBadge.vue'; \nimport NotificationItem from './components/blocks/NotificationItem.vue'; \n\n/**\n * Capacitor Push Notification handler\n */\nclass CapacitorPushHandler {\n constructor(store) {\n this.store = store;\n this.pushNotifications = null;\n this.device = null;\n this.isInitialized = false;\n }\n\n /**\n * Initialize Capacitor plugins\n */\n async initialize() {\n // Skip if running in SSR\n if (typeof window === 'undefined') {\n return false;\n }\n\n try {\n // Dynamic imports to prevent errors in web environment\n const { Capacitor } = await import('@capacitor/core');\n const { PushNotifications } = await import('@capacitor/push-notifications');\n const { Device } = await import('@capacitor/device');\n \n this.capacitor = Capacitor;\n this.pushNotifications = PushNotifications;\n this.device = Device;\n \n // Only proceed if running on a native platform\n if (!this.capacitor.isNativePlatform()) {\n return false;\n }\n \n this.isInitialized = true;\n return true;\n } catch (error) {\n console.error('Error importing Capacitor plugins:', error);\n return false;\n }\n }\n\n /**\n * Request permission and register for push notifications\n */\n async requestPermissions() {\n // Skip if running in SSR\n if (typeof window === 'undefined') {\n return false;\n }\n\n if (!this.isInitialized) {\n const initialized = await this.initialize();\n if (!initialized) return false;\n }\n\n try {\n // Request permission\n const permissionResult = await this.pushNotifications.requestPermissions();\n if (permissionResult.receive !== 'granted') {\n console.log('Push notification permission denied');\n return false;\n }\n \n // Set up event listeners\n this._setupListeners();\n \n // Register with Apple/Google\n await this.pushNotifications.register();\n return true;\n } catch (error) {\n console.error('Error requesting push notification permissions:', error);\n return false;\n }\n }\n\n /**\n * Setup push notification event listeners\n */\n _setupListeners() {\n // Registration event\n this.pushNotifications.addListener('registration', \n this._handleRegistration.bind(this)\n );\n \n // Notification received event\n this.pushNotifications.addListener('pushNotificationReceived',\n this._handleNotificationReceived.bind(this)\n );\n \n // Notification action performed event\n this.pushNotifications.addListener('pushNotificationActionPerformed',\n this._handleNotificationAction.bind(this)\n );\n }\n\n /**\n * Handle registration token received\n */\n async _handleRegistration(token) {\n try {\n // Get device info\n const deviceInfo = await this.device.getInfo();\n const deviceId = await this.device.getId();\n \n // Prepare device data\n const deviceData = {\n deviceId: deviceId.uuid,\n deviceType: deviceInfo.platform.toLowerCase(),\n deviceToken: token.value\n };\n \n // Register device with backend\n await this.store.notifications.actions.registerDevice(deviceData);\n } catch (error) {\n console.error('Error handling push registration:', error);\n }\n }\n\n /**\n * Handle received notification\n */\n _handleNotificationReceived(notification) {\n // Add notification to store\n this.store.notifications.actions.addLocalNotification({\n title: notification.title,\n body: notification.body,\n data: notification.data || {}\n });\n }\n\n /**\n * Handle notification action (when user taps on notification)\n */\n _handleNotificationAction(actionData) {\n if (actionData.notification && actionData.notification.data) {\n this.store.notifications.actions.handleNotificationAction(\n actionData.notification.data\n );\n }\n }\n\n /**\n * Remove push notification listeners\n */\n removeListeners() {\n if (typeof window === 'undefined') {\n return;\n }\n \n if (this.pushNotifications) {\n this.pushNotifications.removeAllListeners();\n }\n }\n}\n\n/**\n * Notification Manager for coordinating WebSocket and Push notifications\n */\nclass NotificationManager {\n constructor(store, options = {}) {\n this.store = store;\n this.options = options;\n this.pushHandler = new CapacitorPushHandler(store);\n this.initialized = false;\n this.isServer = typeof window === 'undefined';\n }\n\n /**\n * Initialize notifications\n */\n async initialize() {\n if (this.initialized || this.isServer) return;\n \n // Get current user ID from auth store instead of localStorage\n const userId = this.store.auth.state.user?._id;\n if (!userId) {\n console.warn('Cannot initialize notifications: No user ID found in auth store');\n return;\n }\n \n // Initialize WebSocket for realtime notifications\n await globalWebSocket.connect(userId);\n \n // Initialize push notifications for mobile if enabled\n if (this.options.enablePush !== false) {\n await this.pushHandler.requestPermissions();\n }\n \n this.initialized = true;\n \n // Fetch existing notifications\n await this.store.notifications.actions.getNotifications(userId);\n }\n\n /**\n * Disconnect and clean up\n */\n disconnect() {\n if (this.isServer) return;\n \n globalWebSocket.removeModuleListeners('notifications');\n this.pushHandler.removeListeners();\n this.initialized = false;\n }\n}\n\n/**\n * Server-side utility for pre-fetching notification data\n */\nconst SSRUtils = {\n /**\n * Pre-fetch notifications for SSR\n * @param {Object} store - Store instance\n * @param {Object} context - SSR context\n */\n async prefetchNotifications(store, context) {\n try {\n const userId = store.auth.state.user?._id;\n if (userId) {\n // Fetch notifications without WebSocket or push setup\n await store.notifications.actions.getNotifications(userId);\n }\n } catch (error) {\n console.error('Error pre-fetching notifications for SSR:', error);\n }\n }\n};\n\n/**\n * Function to initialize the notifications module\n * @param {Object} app - Vue app instance\n * @param {Object} store - Vuex/Pinia store\n * @param {Object} router - Vue Router instance\n * @param {Object} options - Configuration options\n */\nfunction initializeNotifications(app, store, router, options = {}) {\n // Add routes and store\n const route = options.route || 'User Profile Root';\n router.addRoute(route, routerNotifications);\n store.addStore('notifications', storeNotifications);\n \n // Initialize global WebSocket if needed\n if (options.wsUrl) {\n globalWebSocket.initialize({ wsUrl: options.wsUrl });\n }\n \n // Create notification manager\n const notificationManager = new NotificationManager(store, {\n enablePush: options.enablePush !== false,\n maxReconnectAttempts: options.maxReconnectAttempts || 5,\n reconnectDelay: options.reconnectDelay || 3000,\n pingInterval: options.pingInterval || 30000\n });\n \n // Attach notification manager to store for access in components\n store.notificationManager = notificationManager;\n \n // Don't auto-initialize on server\n const isServer = typeof window === 'undefined';\n const autoInit = !isServer && options.autoInit !== false;\n \n if (autoInit) {\n // Initialize after auth is confirmed\n const isAuthenticated = store.auth.state.isAuthenticated;\n const userId = store.auth.state.user?._id;\n \n if (isAuthenticated && userId) {\n notificationManager.initialize();\n }\n \n // Watch for user login/logout using auth store\n watch(() => store.auth.state.isAuthenticated, (isAuthenticated) => {\n if (isAuthenticated) {\n notificationManager.initialize();\n } else {\n notificationManager.disconnect();\n store.notifications.mutations.resetNotifications();\n }\n });\n }\n \n // Provide composable for components to access notification functionality\n app.provide('useNotifications', () => {\n return {\n ...toRefs(store.notifications.state),\n ...store.notifications.actions,\n ...store.notifications.mutations,\n init: notificationManager.initialize.bind(notificationManager),\n disconnect: notificationManager.disconnect.bind(notificationManager),\n isServer\n };\n });\n \n return notificationManager;\n}\n\n// Module export\nconst ModuleNotifications = {\n initialize: initializeNotifications,\n SSR: SSRUtils, // Export SSR utilities\n views: {\n store: {\n storeNotifications,\n },\n router: {\n routerNotifications\n },\n components: {\n // Elements\n NotificationBadge,\n // Blocks\n NotificationItem,\n // Sections\n NotificationsList,\n NotificationPreferences,\n // Pages\n Notifications,\n // Layouts\n NotificationsLayout\n }\n }\n};\n\n// Component exports\nexport {\n // Elements\n NotificationBadge,\n // Blocks\n NotificationItem,\n // Sections\n NotificationsList,\n NotificationPreferences,\n // Pages\n Notifications,\n // Layouts\n NotificationsLayout,\n // SSR Utilities\n SSRUtils\n};\n\nexport default ModuleNotifications;\n"],"names":["routerNotifications","storeNotifications","isAuthenticated"],"mappings":";;;;;;;;;;;AAuBA,MAAM,qBAAqB;AAAA,EACzB,YAAY,OAAO;AACjB,SAAK,QAAQ;AACb,SAAK,oBAAoB;AACzB,SAAK,SAAS;AACd,SAAK,gBAAgB;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKE,MAAM,aAAa;AAEjB,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACb;AAEI,QAAI;AAEF,YAAM,EAAE,UAAS,IAAK,MAAM,OAAO,8FAAiB;AACpD,YAAM,EAAE,kBAAiB,IAAK,MAAM,OAAO,uJAA+B;AAC1E,YAAM,EAAE,OAAM,IAAK,MAAM,OAAO,+HAAmB;AAEnD,WAAK,YAAY;AACjB,WAAK,oBAAo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I,mBAAmB,QAAQ;AAC7B,0BAAoB,WAAY;AAAA,IACtC;AAGI,UAAM,MAAM,MAAM,KAAK,MAAM,iBAAiB,CAACC,qBAAoB;AACjE,UAAIA,kBAAiB;AACnB,4BAAoB,WAAY;AAAA,MACxC,OAAa;AACL,4BAAoB,WAAY;AAChC,cAAM,cAAc,UAAU,mBAAoB;AAAA,MAC1D;AAAA,IACA,CAAK;AAAA,EACL;AAGE,MAAI,QAAQ,oBAAoB,MAAM;AACpC,WAAO;AAAA,MACL,GAAG,OAAO,MAAM,cAAc,KAAK;AAAA,MACnC,GAAG,MAAM,cAAc;AAAA,MACvB,GAAG,MAAM,cAAc;AAAA,MACvB,MAAM,oBAAoB,WAAW,KAAK,mBAAmB;AAAA,MAC7D,YAAY,oBAAoB,WAAW,KAAK,mBAAmB;AAAA,MACnE;AAAA,IACD;AAAA,EACL,CAAG;AAED,SAAO;AACT;AAGK,MAAC,sBAAsB;AAAA,EAC1B,YAAY;AAAA,EACZ,KAAK;AAAA;AAAA,EACL,OAAO;AAAA,IACL,OAAO;AAAA,MACX,oBAAMD;AAAAA,IACD;AAAA,IACD,QAAQ;AAAA,MACND,qBAAAA;AAAAA,IACD;AAAA,IACD,YAAY;AAAA;AAAA,MAEV;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA;AAAA,MAEA;AAAA,IACN;AAAA,EACA;AACA;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const vueRouter = require("vue-router");
|
|
5
|
-
const Button = require("../../../../components/Button/Button.
|
|
5
|
+
const Button = require("../../../../components/Button/Button.vue.cjs");
|
|
6
6
|
const Select = require("../../../../components/Select/Select.vue.cjs");
|
|
7
7
|
const Popup = require("../../../../components/Popup/Popup.vue.cjs");
|
|
8
8
|
const IconTime = require("../../../icons/entities/IconTime.vue.cjs");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref, onMounted, computed, createElementBlock, createCommentVNode, openBlock, createVNode, createElementVNode, createTextVNode, toDisplayString, Fragment, renderList, normalizeClass, withCtx, createBlock, unref } from "vue";
|
|
2
2
|
import { useRouter, useRoute } from "vue-router";
|
|
3
|
-
import _sfc_main$2 from "../../../../components/Button/Button.
|
|
3
|
+
import _sfc_main$2 from "../../../../components/Button/Button.vue.js";
|
|
4
4
|
import Select from "../../../../components/Select/Select.vue.js";
|
|
5
5
|
import _sfc_main$1 from "../../../../components/Popup/Popup.vue.js";
|
|
6
6
|
import IconTime from "../../../icons/entities/IconTime.vue.js";
|
|
@@ -50,6 +50,7 @@ const _sfc_main = {
|
|
|
50
50
|
if (!globals.state.options.orders.allowUnauthenticatedOrders && !auth.state.user._id) {
|
|
51
51
|
router.push({ name: "Sign In" });
|
|
52
52
|
}
|
|
53
|
+
orders.mutations.resetOrder();
|
|
53
54
|
vue.onMounted(async () => {
|
|
54
55
|
var _a;
|
|
55
56
|
isLocationLoading.value = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderCreate.vue.cjs","sources":["../../../../../../../src/modules/orders/components/pages/OrderCreate.vue"],"sourcesContent":["<template>\n\n<section class=\"bg-white pd-thin\">\n\n\t<!-- Ask to login -->\n\t<AskToLogin class=\"mn-b-thin\" v-if=\"auth.state.access.status === false\" /> \n\n\t<!-- Order form -->\n\t<div class=\"gap-small mn-b-thin cols-2\">\n\t\t<!-- Empty State -->\n\t\t<EmptyState \n\t\t\tv-if=\"shopcart.state.positions < 1\" \n\t\t/>\t\n\n\t\t<Succes \n\t\t\tv-if=\"order.status === true && shopcart.state.positions.length > 0\" \n\t\t\t:order=\"order\" \n\t\t/>\n\t\t<!-- Order Form -->\n\t\t<div\n\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\" \n\t\t\tclass=\"rows-1 gap-thin\"\n\t\t>\n\t\t\t<FormCustomerDetails\n\t\t\t\t:customer=\"orders.state.current.customer\"\n\t\t\t/>\n\t\t\t<FormPayment \t\n\t\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t\t\t:order=\"orders.state.current\" \n\t\t\t\t:organization=\"orderOrganization[0]\" \n\t\t\t/>\n\t\t\t<FormDelivery \t\n\t\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t\t\t:order=\"orders.state.current\" \n\t\t\t\t:organization=\"orderOrganization[0]\" \n\t\t\t/>\n\t\t\t\n\t\t</div>\n\n\t\t<!-- Order positions -->\n\t\t<div \n\t\t\tv-if=\"shopcart.state.positions.length > 0\" \n\t\t\tclass=\"bg-white br-solid br-light br-1px pd-medium radius-medium\"\n\t\t>\n\t\t\t<h4 class=\"font-second mn-b-thin\">Your Order</h4>\n\n\t\t\t<ul class=\"flex gap-thin flex-wrap mn-b-thin\">\n\t\t\t\t<CardOrderItem \n\t\t\t\t\tv-for=\"product in shopcart.state.positions\" \n\t\t\t\t\t:key=\"product._id\" \n\t\t\t\t\t:editable=\"true\" \n\t\t\t\t\t:product=\"product\" \n\t :increase=\"product => shopcart.actions.incrementItemQuantity(product._id)\"\n\t :decrease=\"product => shopcart.actions.decrementItemQuantity(product._id)\"\n\t :remove=\"product => shopcart.actions.removeProduct(product._id)\"\n\t\t\t\t\t@updateRentDates=\"(product, dates) => shopcart.actions.updateRentDates({ productId: product._id, dates })\"\n\t class=\"w-100 bg-white \"\n\t />\n\t\t\t</ul>\n\n\t\t\t\t<div \n\t\t\t\tclass=\"mn-b-thin\"\n\t\t\t>\t\n\t\t\t\t<PriceTotal \n :totalPrice=\"cartTotalPrice\"\n :deliveryRate=\"deliveryCost\"\n :currency=\"returnCurrency()\"\n :showFees=\"globals.state.options?.orders.showFees\"\n :feesRate=\"globals.state.options?.orders.feesRate || 0\"\n :showVat=\"globals.state.options?.orders.showVat\"\n :vatRate=\"globals.state.options?.orders.vatRate || 0\"\n :showDeliveryFee=\"globals.state.options?.orders.showDeliveryFee\"\n />\n\t\t\t</div>\n\t\t\t<!-- Send order -->\n\t\t <button \n\t\t \tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t \t:disabled=\"\n\t\t errorName \n\t\t || errorPhoneOrMessenger \n\t\t || errorCity \n\t\t || errorAddress \n\t\t || errorDelivery \n\t\t || errorPayment\n\t\t || isLocationLoading\n\t\t \"\n\t\t @click=\"handleCreate()\" \n\t\t class=\"bg-main mn-b-small pd-small radius-big w-100 button\"\n\t\t >\n\t\t Place an Order\n\t\t </button>\n\n\t\t <p class='mn-b-thin'>\n\t\t\t\tI agree that placing the order places me under an obligation to make a payment in accordance with <a class=\"t-semi font-second t-second\" href=\"/legal/terms-of-use\" target=\"_blank\">Terms of Use.</a>\n\t\t\t</p>\n\t\t\t<p >\n\t\t\t\t\n\t\t\t</p>\n\t\t</div>\n\n\t</div>\n\n\t\n\t\n</section>\n\n</template>\n\n\n<script setup>\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Import components\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Block\nimport CardOrderItem from '@martyrs/src/modules/orders/components/blocks/CardOrderItem.vue'\n// Sections\nimport AskToLogin from '@martyrs/src/modules/orders/components/sections/AskToLogin.vue'\nimport Succes from '@martyrs/src/modules/orders/components/sections/Succes.vue'\nimport EmptyState from '@martyrs/src/modules/orders/components/sections/EmptyState.vue'\n\nimport PriceTotal from '@martyrs/src/modules/orders/components/elements/PriceTotal.vue';\n\nimport FormCustomerDetails from '@martyrs/src/modules/orders/components/sections/FormCustomerDetails.vue'\nimport FormDelivery from '@martyrs/src/modules/orders/components/sections/FormDelivery.vue'\nimport FormPayment from '@martyrs/src/modules/orders/components/sections/FormPayment.vue'\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Import libs\n///////////////////////////////////////////////////////////////////////////////////////////////////\nimport { ref, computed, onMounted, watch } from 'vue'\nimport { useRoute,useRouter } from 'vue-router'\n// Store\nimport * as globals from '@martyrs/src/modules/globals/views/store/globals';\nimport * as auth from '@martyrs/src/modules/auth/views/store/auth';\nimport * as shopcart from '@martyrs/src/modules/orders/store/shopcart';\nimport * as organizations from '@martyrs/src/modules/organizations/store/organizations';\nimport * as orders from '@martyrs/src/modules/orders/store/orders';\nimport * as users from '@martyrs/src/modules/auth/views/store/users';\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Variables and computed\n//////////////////////////////////////////////////////////////////////////////////////////////////\nconst isLocationLoading = ref(false)\n// Accessing router and store\nconst route = useRoute()\nconst router = useRouter()\n// COMPUTED\nconst order = computed(() => orders.state.current)\nconst user = computed(() => users.state.current)\n\nconst cartTotalPrice = shopcart.getters.cartTotalPrice\n\nconst deliveryCost = computed(() => {\n const type = orders.state.current.delivery.type\n const distance = orderOrganization.value[0]?.distance || 0\n const config = globals.state.options?.orders?.delivery_formula || {}\n\n return orders.getters.getDeliveryPrice(type, distance, config)\n})\n\n// Organization\nconst orderOrganization = ref({})\n\n\nif (!globals.state.options.orders.allowUnauthenticatedOrders && !auth.state.user._id) { \n\trouter.push({name: 'Sign In'})\t\n}\n\t\nonMounted(async()=> {\n\tisLocationLoading.value = true\n\n\tif (auth.state.user._id) {\n\t\tlet data = await users.actions.read({ _id:auth.state.user._id, user: auth.state.user._id });\n\t\torders.state.current.customer.profile.name = users.state.current.profile.name\n\t\torders.state.current.customer.phone = users.state.current.phone\n\t\torders.state.current.customer.phone = users.state.current.phone\n\t}\n\n\torders.state.current.organization = shopcart.state.organization\n\n\torderOrganization.value = await organizations.actions.read({\n\t _id: shopcart.state.organization,\n\t location: globals.state.position?.location,\n\t lookup: ['spots']\n\t})\n\t\n isLocationLoading.value = false\n})\n\n\nwatch(\n () => orders.state.current.delivery,\n async (newVal) => {\n if (newVal?.location) {\n \tisLocationLoading.value = true\n\n orderOrganization.value = await organizations.actions.read({\n _id: shopcart.state.organization,\n location: newVal.location,\n lookup: ['spots']\n })\n\n isLocationLoading.value = false\n }\n },\n { deep: true }\n)\n\n\n/////////////////////////////\n// Store Verification\n/////////////////////////////\nconst errorName = computed(() => {\n if (orders.state.current.customer.name?.length < 2) { return true } else { return false }\n});\n\nconst errorPhoneOrMessenger = computed(() => {\n const hasMessengerType = orders.state.current.customer.messenger?.type;\n const hasMessengerValue = orders.state.current.customer.messenger?.value?.length >\t 2;\n const hasPhone = orders.state.current.customer.number?.length > 0;\n // Ошибка, если нет ни номера телефона, ни корректного типа и значения мессенджера\n return !hasPhone && !(hasMessengerType && hasMessengerValue);\n});\n\nconst errorAddress = computed(() => {\n const type = orders.state.current.delivery.type;\n if (type === \"pickup\") {\n return !orders.state.current.delivery.spot;\n } else if (type === \"courier\" || type === \"mail\") {\n const address = orders.state.current.delivery.address;\n return !address || typeof address !== 'string' || address.length < 2;\n }\n return false;\n});\n\nconst errorDelivery = computed(() => {\n if (orders.state.current.delivery.type) {return false } else {return true } \n})\n\nconst errorPayment = computed(() => {\n if (orders.state.current.payment.type) { return false } else {return true } \n})\n/////////////////////////////\n// Methods\n/////////////////////////////\nasync function handleCreate() {\n\n\torders.state.current.status = 'created';\n\n\torders.state.current.owner = {\n\t\ttarget: shopcart.state.organization,\n\t\ttype: 'organization'\n\t}\n\n\tif (auth.state.user._id) {\n\t\torders.state.current.creator = {\n\t\t\ttarget: auth.state.user._id,\n\t\t\ttype: 'user'\n\t\t}\n\t}\n\n\tif (auth.state.user._id) {\n\t\torders.state.current.customer = {\n\t\t\ttarget: auth.state.user._id,\n\t\t\ttype: 'user'\n\t\t}\n\t}\n\n\torders.state.current.positions = shopcart.state.positions\n\n \tconst referralCode = localStorage.getItem('referalCode');\n \n if (referralCode) {\n orders.state.current.referralCode = referralCode;\n }\n\n let order = await orders.actions.create(orders.state.current);\n\n if (order) {\n \tawait router.push({\n \t\tname: 'Order',\n \t\tparams: {\n \t\t\torder: order._id\n \t\t}\n \t})\n \t\t\n \tshopcart.actions.resetShopcart()\n } else {\n \talert('something wrong')\n }\n}\n</script>\n\n<style lang=\"scss\">\n\n.round-wrapper {\n\tposition: relative;\n\n\t.round {\n\t\tmargin: 0;\n\t\tmargin-right: 1rem;\n\t}\n\n\tinput:checked {\n\t\tbackground: #00ff88;\n\t}\n\n\t.round-checkmark {\n\t\tposition: absolute;\n\t\twidth: 0.5rem;\n\t\theight: 0.5rem;\n\t\tbackground: white;\n\n\t\tleft: 0.5rem;\n\t\ttop: 0.5rem;\n\n\t\topacity: 1;\n\t}\n}\n</style>"],"names":["ref","useRoute","useRouter","computed","orders.state","users.state","shopcart.getters","globals.state","orders.getters","auth.state","onMounted","users.actions","shopcart.state","organizations.actions","watch","order","orders.actions","shopcart.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4IA,UAAM,oBAAoBA,IAAG,IAAC,KAAK;AAErBC,cAAQ,SAAA;AACtB,UAAM,SAASC,UAAS,UAAA;AAExB,UAAM,QAAQC,IAAAA,SAAS,MAAMC,OAAAA,MAAa,OAAO;AACpCD,QAAAA,SAAS,MAAME,MAAW,MAAC,OAAO;AAE/C,UAAM,iBAAiBC,SAAAA,QAAiB;AAExC,UAAM,eAAeH,IAAQ,SAAC,MAAM;;AAClC,YAAM,OAAOC,OAAAA,MAAa,QAAQ,SAAS;AAC3C,YAAM,aAAW,uBAAkB,MAAM,CAAC,MAAzB,mBAA4B,aAAY;AACzD,YAAM,WAASG,mBAAa,MAAC,YAAdA,mBAAuB,WAAvBA,mBAA+B,qBAAoB,CAAA;AAElE,aAAOC,eAAe,iBAAiB,MAAM,UAAU,MAAM;AAAA,IAC/D,CAAC;AAGD,UAAM,oBAAoBR,IAAG,IAAC,CAAE,CAAA;AAGhC,QAAI,CAACO,QAAAA,MAAc,QAAQ,OAAO,8BAA8B,CAACE,KAAU,MAAC,KAAK,KAAK;AACrF,aAAO,KAAK,EAAC,MAAM,UAAS,CAAC;AAAA,IAC9B;AAEAC,QAAAA,UAAU,YAAU;;AACnB,wBAAkB,QAAQ;AAE1B,UA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B,QAAQK,KAAAA,MAAW,KAAK;AAAA,UACxB,MAAM;AAAA,QACT;AAAA,MACA;AAECL,mBAAa,QAAQ,YAAYQ,eAAe;AAE/C,YAAM,eAAe,aAAa,QAAQ,aAAa;AAEvD,UAAI,cAAc;AAChBR,qBAAa,QAAQ,eAAe;AAAA,MACxC;AAEE,UAAIW,SAAQ,MAAMC,OAAAA,QAAe,OAAOZ,OAAAA,MAAa,OAAO;AAE5D,UAAIW,QAAO;AACV,cAAM,OAAO,KAAK;AAAA,UACjB,MAAM;AAAA,UACN,QAAQ;AAAA,YACP,OAAOA,OAAM;AAAA,UAClB;AAAA,QACI,CAAA;AAEDE,iBAAAA,QAAiB,cAAa;AAAA,MACjC,OAAS;AACN,cAAM,iBAAiB;AAAA,MAC1B;AAAA,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"OrderCreate.vue.cjs","sources":["../../../../../../../src/modules/orders/components/pages/OrderCreate.vue"],"sourcesContent":["<template>\n\n<section class=\"bg-white pd-thin\">\n\n\t<!-- Ask to login -->\n\t<AskToLogin class=\"mn-b-thin\" v-if=\"auth.state.access.status === false\" /> \n\n\t<!-- Order form -->\n\t<div class=\"gap-small mn-b-thin cols-2\">\n\t\t<!-- Empty State -->\n\t\t<EmptyState \n\t\t\tv-if=\"shopcart.state.positions < 1\" \n\t\t/>\t\n\n\t\t<Succes \n\t\t\tv-if=\"order.status === true && shopcart.state.positions.length > 0\" \n\t\t\t:order=\"order\" \n\t\t/>\n\t\t<!-- Order Form -->\n\t\t<div\n\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\" \n\t\t\tclass=\"rows-1 gap-thin\"\n\t\t>\n\t\t\t<FormCustomerDetails\n\t\t\t\t:customer=\"orders.state.current.customer\"\n\t\t\t/>\n\t\t\t<FormPayment \t\n\t\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t\t\t:order=\"orders.state.current\" \n\t\t\t\t:organization=\"orderOrganization[0]\" \n\t\t\t/>\n\t\t\t<FormDelivery \t\n\t\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t\t\t:order=\"orders.state.current\" \n\t\t\t\t:organization=\"orderOrganization[0]\" \n\t\t\t/>\n\t\t\t\n\t\t</div>\n\n\t\t<!-- Order positions -->\n\t\t<div \n\t\t\tv-if=\"shopcart.state.positions.length > 0\" \n\t\t\tclass=\"bg-white br-solid br-light br-1px pd-medium radius-medium\"\n\t\t>\n\t\t\t<h4 class=\"font-second mn-b-thin\">Your Order</h4>\n\n\t\t\t<ul class=\"flex gap-thin flex-wrap mn-b-thin\">\n\t\t\t\t<CardOrderItem \n\t\t\t\t\tv-for=\"product in shopcart.state.positions\" \n\t\t\t\t\t:key=\"product._id\" \n\t\t\t\t\t:editable=\"true\" \n\t\t\t\t\t:product=\"product\" \n\t :increase=\"product => shopcart.actions.incrementItemQuantity(product._id)\"\n\t :decrease=\"product => shopcart.actions.decrementItemQuantity(product._id)\"\n\t :remove=\"product => shopcart.actions.removeProduct(product._id)\"\n\t\t\t\t\t@updateRentDates=\"(product, dates) => shopcart.actions.updateRentDates({ productId: product._id, dates })\"\n\t class=\"w-100 bg-white \"\n\t />\n\t\t\t</ul>\n\n\t\t\t\t<div \n\t\t\t\tclass=\"mn-b-thin\"\n\t\t\t>\t\n\t\t\t\t<PriceTotal \n :totalPrice=\"cartTotalPrice\"\n :deliveryRate=\"deliveryCost\"\n :currency=\"returnCurrency()\"\n :showFees=\"globals.state.options?.orders.showFees\"\n :feesRate=\"globals.state.options?.orders.feesRate || 0\"\n :showVat=\"globals.state.options?.orders.showVat\"\n :vatRate=\"globals.state.options?.orders.vatRate || 0\"\n :showDeliveryFee=\"globals.state.options?.orders.showDeliveryFee\"\n />\n\t\t\t</div>\n\t\t\t<!-- Send order -->\n\t\t <button \n\t\t \tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t \t:disabled=\"\n\t\t errorName \n\t\t || errorPhoneOrMessenger \n\t\t || errorCity \n\t\t || errorAddress \n\t\t || errorDelivery \n\t\t || errorPayment\n\t\t || isLocationLoading\n\t\t \"\n\t\t @click=\"handleCreate()\" \n\t\t class=\"bg-main mn-b-small pd-small radius-big w-100 button\"\n\t\t >\n\t\t Place an Order\n\t\t </button>\n\n\t\t <p class='mn-b-thin'>\n\t\t\t\tI agree that placing the order places me under an obligation to make a payment in accordance with <a class=\"t-semi font-second t-second\" href=\"/legal/terms-of-use\" target=\"_blank\">Terms of Use.</a>\n\t\t\t</p>\n\t\t\t<p >\n\t\t\t\t\n\t\t\t</p>\n\t\t</div>\n\n\t</div>\n\n\t\n\t\n</section>\n\n</template>\n\n\n<script setup>\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Import components\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Block\nimport CardOrderItem from '@martyrs/src/modules/orders/components/blocks/CardOrderItem.vue'\n// Sections\nimport AskToLogin from '@martyrs/src/modules/orders/components/sections/AskToLogin.vue'\nimport Succes from '@martyrs/src/modules/orders/components/sections/Succes.vue'\nimport EmptyState from '@martyrs/src/modules/orders/components/sections/EmptyState.vue'\n\nimport PriceTotal from '@martyrs/src/modules/orders/components/elements/PriceTotal.vue';\n\nimport FormCustomerDetails from '@martyrs/src/modules/orders/components/sections/FormCustomerDetails.vue'\nimport FormDelivery from '@martyrs/src/modules/orders/components/sections/FormDelivery.vue'\nimport FormPayment from '@martyrs/src/modules/orders/components/sections/FormPayment.vue'\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Import libs\n///////////////////////////////////////////////////////////////////////////////////////////////////\nimport { ref, computed, onMounted, watch } from 'vue'\nimport { useRoute,useRouter } from 'vue-router'\n// Store\nimport * as globals from '@martyrs/src/modules/globals/views/store/globals';\nimport * as auth from '@martyrs/src/modules/auth/views/store/auth';\nimport * as shopcart from '@martyrs/src/modules/orders/store/shopcart';\nimport * as organizations from '@martyrs/src/modules/organizations/store/organizations';\nimport * as orders from '@martyrs/src/modules/orders/store/orders';\nimport * as users from '@martyrs/src/modules/auth/views/store/users';\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Variables and computed\n//////////////////////////////////////////////////////////////////////////////////////////////////\nconst isLocationLoading = ref(false)\n// Accessing router and store\nconst route = useRoute()\nconst router = useRouter()\n// COMPUTED\nconst order = computed(() => orders.state.current)\nconst user = computed(() => users.state.current)\n\nconst cartTotalPrice = shopcart.getters.cartTotalPrice\n\nconst deliveryCost = computed(() => {\n const type = orders.state.current.delivery.type\n const distance = orderOrganization.value[0]?.distance || 0\n const config = globals.state.options?.orders?.delivery_formula || {}\n\n return orders.getters.getDeliveryPrice(type, distance, config)\n})\n\n// Organization\nconst orderOrganization = ref({})\n\n\nif (!globals.state.options.orders.allowUnauthenticatedOrders && !auth.state.user._id) { \n\trouter.push({name: 'Sign In'})\t\n}\n\n\norders.mutations.resetOrder()\n\nonMounted(async()=> {\n\tisLocationLoading.value = true\n\n\n\tif (auth.state.user._id) {\n\t\tlet data = await users.actions.read({ _id:auth.state.user._id, user: auth.state.user._id });\n\t\torders.state.current.customer.profile.name = users.state.current.profile.name\n\t\torders.state.current.customer.phone = users.state.current.phone\n\t\torders.state.current.customer.phone = users.state.current.phone\n\t}\n\n\torders.state.current.organization = shopcart.state.organization\n\n\torderOrganization.value = await organizations.actions.read({\n\t _id: shopcart.state.organization,\n\t location: globals.state.position?.location,\n\t lookup: ['spots']\n\t})\n\t\n isLocationLoading.value = false\n})\n\n\nwatch(\n () => orders.state.current.delivery,\n async (newVal) => {\n if (newVal?.location) {\n \tisLocationLoading.value = true\n\n orderOrganization.value = await organizations.actions.read({\n _id: shopcart.state.organization,\n location: newVal.location,\n lookup: ['spots']\n })\n\n isLocationLoading.value = false\n }\n },\n { deep: true }\n)\n\n\n/////////////////////////////\n// Store Verification\n/////////////////////////////\nconst errorName = computed(() => {\n if (orders.state.current.customer.name?.length < 2) { return true } else { return false }\n});\n\nconst errorPhoneOrMessenger = computed(() => {\n const hasMessengerType = orders.state.current.customer.messenger?.type;\n const hasMessengerValue = orders.state.current.customer.messenger?.value?.length >\t 2;\n const hasPhone = orders.state.current.customer.number?.length > 0;\n // Ошибка, если нет ни номера телефона, ни корректного типа и значения мессенджера\n return !hasPhone && !(hasMessengerType && hasMessengerValue);\n});\n\nconst errorAddress = computed(() => {\n const type = orders.state.current.delivery.type;\n if (type === \"pickup\") {\n return !orders.state.current.delivery.spot;\n } else if (type === \"courier\" || type === \"mail\") {\n const address = orders.state.current.delivery.address;\n return !address || typeof address !== 'string' || address.length < 2;\n }\n return false;\n});\n\nconst errorDelivery = computed(() => {\n if (orders.state.current.delivery.type) {return false } else {return true } \n})\n\nconst errorPayment = computed(() => {\n if (orders.state.current.payment.type) { return false } else {return true } \n})\n/////////////////////////////\n// Methods\n/////////////////////////////\nasync function handleCreate() {\n\n\torders.state.current.status = 'created';\n\n\torders.state.current.owner = {\n\t\ttarget: shopcart.state.organization,\n\t\ttype: 'organization'\n\t}\n\n\tif (auth.state.user._id) {\n\t\torders.state.current.creator = {\n\t\t\ttarget: auth.state.user._id,\n\t\t\ttype: 'user'\n\t\t}\n\t}\n\n\tif (auth.state.user._id) {\n\t\torders.state.current.customer = {\n\t\t\ttarget: auth.state.user._id,\n\t\t\ttype: 'user'\n\t\t}\n\t}\n\n\torders.state.current.positions = shopcart.state.positions\n\n \tconst referralCode = localStorage.getItem('referalCode');\n \n if (referralCode) {\n orders.state.current.referralCode = referralCode;\n }\n\n let order = await orders.actions.create(orders.state.current);\n\n if (order) {\n \tawait router.push({\n \t\tname: 'Order',\n \t\tparams: {\n \t\t\torder: order._id\n \t\t}\n \t})\n \t\t\n \tshopcart.actions.resetShopcart()\n\n } else {\n \talert('something wrong')\n }\n}\n</script>\n\n<style lang=\"scss\">\n\n.round-wrapper {\n\tposition: relative;\n\n\t.round {\n\t\tmargin: 0;\n\t\tmargin-right: 1rem;\n\t}\n\n\tinput:checked {\n\t\tbackground: #00ff88;\n\t}\n\n\t.round-checkmark {\n\t\tposition: absolute;\n\t\twidth: 0.5rem;\n\t\theight: 0.5rem;\n\t\tbackground: white;\n\n\t\tleft: 0.5rem;\n\t\ttop: 0.5rem;\n\n\t\topacity: 1;\n\t}\n}\n</style>"],"names":["ref","useRoute","useRouter","computed","orders.state","users.state","shopcart.getters","globals.state","orders.getters","auth.state","orders.mutations","onMounted","users.actions","shopcart.state","organizations.actions","watch","order","orders.actions","shopcart.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4IA,UAAM,oBAAoBA,IAAG,IAAC,KAAK;AAErBC,cAAQ,SAAA;AACtB,UAAM,SAASC,UAAS,UAAA;AAExB,UAAM,QAAQC,IAAAA,SAAS,MAAMC,OAAAA,MAAa,OAAO;AACpCD,QAAAA,SAAS,MAAME,MAAW,MAAC,OAAO;AAE/C,UAAM,iBAAiBC,SAAAA,QAAiB;AAExC,UAAM,eAAeH,IAAQ,SAAC,MAAM;;AAClC,YAAM,OAAOC,OAAAA,MAAa,QAAQ,SAAS;AAC3C,YAAM,aAAW,uBAAkB,MAAM,CAAC,MAAzB,mBAA4B,aAAY;AACzD,YAAM,WAASG,mBAAa,MAAC,YAAdA,mBAAuB,WAAvBA,mBAA+B,qBAAoB,CAAA;AAElE,aAAOC,eAAe,iBAAiB,MAAM,UAAU,MAAM;AAAA,IAC/D,CAAC;AAGD,UAAM,oBAAoBR,IAAG,IAAC,CAAE,CAAA;AAGhC,QAAI,CAACO,QAAAA,MAAc,QAAQ,OAAO,8BAA8B,CAACE,KAAU,MAAC,KAAK,KAAK;AACrF,aAAO,KAAK,EAAC,MAAM,UAAS,CAAC;AAAA,IAC9B;AAGAC,WAAAA,UAAiB,WAAU;AAE3BC,QAAAA,UAAU,YAAU;;AACnB,wBAAkB,QAAQ;AAG1B,UAAIF,KAAU,MAAC,KAAK,KAAK;AACb,cAAMG,cAAc,K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;AAAA,QACT;AAAA,MACA;AAECL,mBAAa,QAAQ,YAAYS,eAAe;AAE/C,YAAM,eAAe,aAAa,QAAQ,aAAa;AAEvD,UAAI,cAAc;AAChBT,qBAAa,QAAQ,eAAe;AAAA,MACxC;AAEE,UAAIY,SAAQ,MAAMC,OAAAA,QAAe,OAAOb,OAAAA,MAAa,OAAO;AAE5D,UAAIY,QAAO;AACV,cAAM,OAAO,KAAK;AAAA,UACjB,MAAM;AAAA,UACN,QAAQ;AAAA,YACP,OAAOA,OAAM;AAAA,UAClB;AAAA,QACI,CAAA;AAEDE,iBAAAA,QAAiB,cAAa;AAAA,MAEjC,OAAS;AACN,cAAM,iBAAiB;AAAA,MAC1B;AAAA,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -12,7 +12,7 @@ import { state as state$2 } from "../../../globals/views/store/globals.js";
|
|
|
12
12
|
import { state as state$3 } from "../../../auth/views/store/auth.js";
|
|
13
13
|
import { getters, state as state$4, actions as actions$2 } from "../../store/shopcart.js";
|
|
14
14
|
import { actions as actions$1 } from "../../../organizations/store/organizations.js";
|
|
15
|
-
import { state, getters as getters$1, actions as actions$3 } from "../../store/orders.js";
|
|
15
|
+
import { state, getters as getters$1, mutations, actions as actions$3 } from "../../store/orders.js";
|
|
16
16
|
import { state as state$1, actions } from "../../../auth/views/store/users.js";
|
|
17
17
|
/* empty css */
|
|
18
18
|
const _hoisted_1 = { class: "bg-white pd-thin" };
|
|
@@ -48,6 +48,7 @@ const _sfc_main = {
|
|
|
48
48
|
if (!state$2.options.orders.allowUnauthenticatedOrders && !state$3.user._id) {
|
|
49
49
|
router.push({ name: "Sign In" });
|
|
50
50
|
}
|
|
51
|
+
mutations.resetOrder();
|
|
51
52
|
onMounted(async () => {
|
|
52
53
|
var _a;
|
|
53
54
|
isLocationLoading.value = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderCreate.vue.js","sources":["../../../../../../../src/modules/orders/components/pages/OrderCreate.vue"],"sourcesContent":["<template>\n\n<section class=\"bg-white pd-thin\">\n\n\t<!-- Ask to login -->\n\t<AskToLogin class=\"mn-b-thin\" v-if=\"auth.state.access.status === false\" /> \n\n\t<!-- Order form -->\n\t<div class=\"gap-small mn-b-thin cols-2\">\n\t\t<!-- Empty State -->\n\t\t<EmptyState \n\t\t\tv-if=\"shopcart.state.positions < 1\" \n\t\t/>\t\n\n\t\t<Succes \n\t\t\tv-if=\"order.status === true && shopcart.state.positions.length > 0\" \n\t\t\t:order=\"order\" \n\t\t/>\n\t\t<!-- Order Form -->\n\t\t<div\n\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\" \n\t\t\tclass=\"rows-1 gap-thin\"\n\t\t>\n\t\t\t<FormCustomerDetails\n\t\t\t\t:customer=\"orders.state.current.customer\"\n\t\t\t/>\n\t\t\t<FormPayment \t\n\t\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t\t\t:order=\"orders.state.current\" \n\t\t\t\t:organization=\"orderOrganization[0]\" \n\t\t\t/>\n\t\t\t<FormDelivery \t\n\t\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t\t\t:order=\"orders.state.current\" \n\t\t\t\t:organization=\"orderOrganization[0]\" \n\t\t\t/>\n\t\t\t\n\t\t</div>\n\n\t\t<!-- Order positions -->\n\t\t<div \n\t\t\tv-if=\"shopcart.state.positions.length > 0\" \n\t\t\tclass=\"bg-white br-solid br-light br-1px pd-medium radius-medium\"\n\t\t>\n\t\t\t<h4 class=\"font-second mn-b-thin\">Your Order</h4>\n\n\t\t\t<ul class=\"flex gap-thin flex-wrap mn-b-thin\">\n\t\t\t\t<CardOrderItem \n\t\t\t\t\tv-for=\"product in shopcart.state.positions\" \n\t\t\t\t\t:key=\"product._id\" \n\t\t\t\t\t:editable=\"true\" \n\t\t\t\t\t:product=\"product\" \n\t :increase=\"product => shopcart.actions.incrementItemQuantity(product._id)\"\n\t :decrease=\"product => shopcart.actions.decrementItemQuantity(product._id)\"\n\t :remove=\"product => shopcart.actions.removeProduct(product._id)\"\n\t\t\t\t\t@updateRentDates=\"(product, dates) => shopcart.actions.updateRentDates({ productId: product._id, dates })\"\n\t class=\"w-100 bg-white \"\n\t />\n\t\t\t</ul>\n\n\t\t\t\t<div \n\t\t\t\tclass=\"mn-b-thin\"\n\t\t\t>\t\n\t\t\t\t<PriceTotal \n :totalPrice=\"cartTotalPrice\"\n :deliveryRate=\"deliveryCost\"\n :currency=\"returnCurrency()\"\n :showFees=\"globals.state.options?.orders.showFees\"\n :feesRate=\"globals.state.options?.orders.feesRate || 0\"\n :showVat=\"globals.state.options?.orders.showVat\"\n :vatRate=\"globals.state.options?.orders.vatRate || 0\"\n :showDeliveryFee=\"globals.state.options?.orders.showDeliveryFee\"\n />\n\t\t\t</div>\n\t\t\t<!-- Send order -->\n\t\t <button \n\t\t \tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t \t:disabled=\"\n\t\t errorName \n\t\t || errorPhoneOrMessenger \n\t\t || errorCity \n\t\t || errorAddress \n\t\t || errorDelivery \n\t\t || errorPayment\n\t\t || isLocationLoading\n\t\t \"\n\t\t @click=\"handleCreate()\" \n\t\t class=\"bg-main mn-b-small pd-small radius-big w-100 button\"\n\t\t >\n\t\t Place an Order\n\t\t </button>\n\n\t\t <p class='mn-b-thin'>\n\t\t\t\tI agree that placing the order places me under an obligation to make a payment in accordance with <a class=\"t-semi font-second t-second\" href=\"/legal/terms-of-use\" target=\"_blank\">Terms of Use.</a>\n\t\t\t</p>\n\t\t\t<p >\n\t\t\t\t\n\t\t\t</p>\n\t\t</div>\n\n\t</div>\n\n\t\n\t\n</section>\n\n</template>\n\n\n<script setup>\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Import components\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Block\nimport CardOrderItem from '@martyrs/src/modules/orders/components/blocks/CardOrderItem.vue'\n// Sections\nimport AskToLogin from '@martyrs/src/modules/orders/components/sections/AskToLogin.vue'\nimport Succes from '@martyrs/src/modules/orders/components/sections/Succes.vue'\nimport EmptyState from '@martyrs/src/modules/orders/components/sections/EmptyState.vue'\n\nimport PriceTotal from '@martyrs/src/modules/orders/components/elements/PriceTotal.vue';\n\nimport FormCustomerDetails from '@martyrs/src/modules/orders/components/sections/FormCustomerDetails.vue'\nimport FormDelivery from '@martyrs/src/modules/orders/components/sections/FormDelivery.vue'\nimport FormPayment from '@martyrs/src/modules/orders/components/sections/FormPayment.vue'\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Import libs\n///////////////////////////////////////////////////////////////////////////////////////////////////\nimport { ref, computed, onMounted, watch } from 'vue'\nimport { useRoute,useRouter } from 'vue-router'\n// Store\nimport * as globals from '@martyrs/src/modules/globals/views/store/globals';\nimport * as auth from '@martyrs/src/modules/auth/views/store/auth';\nimport * as shopcart from '@martyrs/src/modules/orders/store/shopcart';\nimport * as organizations from '@martyrs/src/modules/organizations/store/organizations';\nimport * as orders from '@martyrs/src/modules/orders/store/orders';\nimport * as users from '@martyrs/src/modules/auth/views/store/users';\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Variables and computed\n//////////////////////////////////////////////////////////////////////////////////////////////////\nconst isLocationLoading = ref(false)\n// Accessing router and store\nconst route = useRoute()\nconst router = useRouter()\n// COMPUTED\nconst order = computed(() => orders.state.current)\nconst user = computed(() => users.state.current)\n\nconst cartTotalPrice = shopcart.getters.cartTotalPrice\n\nconst deliveryCost = computed(() => {\n const type = orders.state.current.delivery.type\n const distance = orderOrganization.value[0]?.distance || 0\n const config = globals.state.options?.orders?.delivery_formula || {}\n\n return orders.getters.getDeliveryPrice(type, distance, config)\n})\n\n// Organization\nconst orderOrganization = ref({})\n\n\nif (!globals.state.options.orders.allowUnauthenticatedOrders && !auth.state.user._id) { \n\trouter.push({name: 'Sign In'})\t\n}\n\t\nonMounted(async()=> {\n\tisLocationLoading.value = true\n\n\tif (auth.state.user._id) {\n\t\tlet data = await users.actions.read({ _id:auth.state.user._id, user: auth.state.user._id });\n\t\torders.state.current.customer.profile.name = users.state.current.profile.name\n\t\torders.state.current.customer.phone = users.state.current.phone\n\t\torders.state.current.customer.phone = users.state.current.phone\n\t}\n\n\torders.state.current.organization = shopcart.state.organization\n\n\torderOrganization.value = await organizations.actions.read({\n\t _id: shopcart.state.organization,\n\t location: globals.state.position?.location,\n\t lookup: ['spots']\n\t})\n\t\n isLocationLoading.value = false\n})\n\n\nwatch(\n () => orders.state.current.delivery,\n async (newVal) => {\n if (newVal?.location) {\n \tisLocationLoading.value = true\n\n orderOrganization.value = await organizations.actions.read({\n _id: shopcart.state.organization,\n location: newVal.location,\n lookup: ['spots']\n })\n\n isLocationLoading.value = false\n }\n },\n { deep: true }\n)\n\n\n/////////////////////////////\n// Store Verification\n/////////////////////////////\nconst errorName = computed(() => {\n if (orders.state.current.customer.name?.length < 2) { return true } else { return false }\n});\n\nconst errorPhoneOrMessenger = computed(() => {\n const hasMessengerType = orders.state.current.customer.messenger?.type;\n const hasMessengerValue = orders.state.current.customer.messenger?.value?.length >\t 2;\n const hasPhone = orders.state.current.customer.number?.length > 0;\n // Ошибка, если нет ни номера телефона, ни корректного типа и значения мессенджера\n return !hasPhone && !(hasMessengerType && hasMessengerValue);\n});\n\nconst errorAddress = computed(() => {\n const type = orders.state.current.delivery.type;\n if (type === \"pickup\") {\n return !orders.state.current.delivery.spot;\n } else if (type === \"courier\" || type === \"mail\") {\n const address = orders.state.current.delivery.address;\n return !address || typeof address !== 'string' || address.length < 2;\n }\n return false;\n});\n\nconst errorDelivery = computed(() => {\n if (orders.state.current.delivery.type) {return false } else {return true } \n})\n\nconst errorPayment = computed(() => {\n if (orders.state.current.payment.type) { return false } else {return true } \n})\n/////////////////////////////\n// Methods\n/////////////////////////////\nasync function handleCreate() {\n\n\torders.state.current.status = 'created';\n\n\torders.state.current.owner = {\n\t\ttarget: shopcart.state.organization,\n\t\ttype: 'organization'\n\t}\n\n\tif (auth.state.user._id) {\n\t\torders.state.current.creator = {\n\t\t\ttarget: auth.state.user._id,\n\t\t\ttype: 'user'\n\t\t}\n\t}\n\n\tif (auth.state.user._id) {\n\t\torders.state.current.customer = {\n\t\t\ttarget: auth.state.user._id,\n\t\t\ttype: 'user'\n\t\t}\n\t}\n\n\torders.state.current.positions = shopcart.state.positions\n\n \tconst referralCode = localStorage.getItem('referalCode');\n \n if (referralCode) {\n orders.state.current.referralCode = referralCode;\n }\n\n let order = await orders.actions.create(orders.state.current);\n\n if (order) {\n \tawait router.push({\n \t\tname: 'Order',\n \t\tparams: {\n \t\t\torder: order._id\n \t\t}\n \t})\n \t\t\n \tshopcart.actions.resetShopcart()\n } else {\n \talert('something wrong')\n }\n}\n</script>\n\n<style lang=\"scss\">\n\n.round-wrapper {\n\tposition: relative;\n\n\t.round {\n\t\tmargin: 0;\n\t\tmargin-right: 1rem;\n\t}\n\n\tinput:checked {\n\t\tbackground: #00ff88;\n\t}\n\n\t.round-checkmark {\n\t\tposition: absolute;\n\t\twidth: 0.5rem;\n\t\theight: 0.5rem;\n\t\tbackground: white;\n\n\t\tleft: 0.5rem;\n\t\ttop: 0.5rem;\n\n\t\topacity: 1;\n\t}\n}\n</style>"],"names":["orders.state","users.state","shopcart.getters","globals.state","orders.getters","auth.state","users.actions","shopcart.state","organizations.actions","order","orders.actions","shopcart.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4IA,UAAM,oBAAoB,IAAI,KAAK;AAErB,aAAQ;AACtB,UAAM,SAAS,UAAS;AAExB,UAAM,QAAQ,SAAS,MAAMA,MAAa,OAAO;AACpC,aAAS,MAAMC,QAAY,OAAO;AAE/C,UAAM,iBAAiBC,QAAiB;AAExC,UAAM,eAAe,SAAS,MAAM;;AAClC,YAAM,OAAOF,MAAa,QAAQ,SAAS;AAC3C,YAAM,aAAW,uBAAkB,MAAM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;AAAA,UAC9B,QAAQK,QAAW,KAAK;AAAA,UACxB,MAAM;AAAA,QACT;AAAA,MACA;AAEC,UAAIA,QAAW,KAAK,KAAK;AACxBL,cAAa,QAAQ,WAAW;AAAA,UAC/B,QAAQK,QAAW,KAAK;AAAA,UACxB,MAAM;AAAA,QACT;AAAA,MACA;AAECL,YAAa,QAAQ,YAAYO,QAAe;AAE/C,YAAM,eAAe,aAAa,QAAQ,aAAa;AAEvD,UAAI,cAAc;AAChBP,cAAa,QAAQ,eAAe;AAAA,MACxC;AAEE,UAAIS,SAAQ,MAAMC,UAAe,OAAOV,MAAa,OAAO;AAE5D,UAAIS,QAAO;AACV,cAAM,OAAO,KAAK;AAAA,UACjB,MAAM;AAAA,UACN,QAAQ;AAAA,YACP,OAAOA,OAAM;AAAA,UAClB;AAAA,QACI,CAAA;AAEDE,kBAAiB,cAAa;AAAA,MACjC,OAAS;AACN,cAAM,iBAAiB;AAAA,MAC1B;AAAA,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"OrderCreate.vue.js","sources":["../../../../../../../src/modules/orders/components/pages/OrderCreate.vue"],"sourcesContent":["<template>\n\n<section class=\"bg-white pd-thin\">\n\n\t<!-- Ask to login -->\n\t<AskToLogin class=\"mn-b-thin\" v-if=\"auth.state.access.status === false\" /> \n\n\t<!-- Order form -->\n\t<div class=\"gap-small mn-b-thin cols-2\">\n\t\t<!-- Empty State -->\n\t\t<EmptyState \n\t\t\tv-if=\"shopcart.state.positions < 1\" \n\t\t/>\t\n\n\t\t<Succes \n\t\t\tv-if=\"order.status === true && shopcart.state.positions.length > 0\" \n\t\t\t:order=\"order\" \n\t\t/>\n\t\t<!-- Order Form -->\n\t\t<div\n\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\" \n\t\t\tclass=\"rows-1 gap-thin\"\n\t\t>\n\t\t\t<FormCustomerDetails\n\t\t\t\t:customer=\"orders.state.current.customer\"\n\t\t\t/>\n\t\t\t<FormPayment \t\n\t\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t\t\t:order=\"orders.state.current\" \n\t\t\t\t:organization=\"orderOrganization[0]\" \n\t\t\t/>\n\t\t\t<FormDelivery \t\n\t\t\t\tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t\t\t:order=\"orders.state.current\" \n\t\t\t\t:organization=\"orderOrganization[0]\" \n\t\t\t/>\n\t\t\t\n\t\t</div>\n\n\t\t<!-- Order positions -->\n\t\t<div \n\t\t\tv-if=\"shopcart.state.positions.length > 0\" \n\t\t\tclass=\"bg-white br-solid br-light br-1px pd-medium radius-medium\"\n\t\t>\n\t\t\t<h4 class=\"font-second mn-b-thin\">Your Order</h4>\n\n\t\t\t<ul class=\"flex gap-thin flex-wrap mn-b-thin\">\n\t\t\t\t<CardOrderItem \n\t\t\t\t\tv-for=\"product in shopcart.state.positions\" \n\t\t\t\t\t:key=\"product._id\" \n\t\t\t\t\t:editable=\"true\" \n\t\t\t\t\t:product=\"product\" \n\t :increase=\"product => shopcart.actions.incrementItemQuantity(product._id)\"\n\t :decrease=\"product => shopcart.actions.decrementItemQuantity(product._id)\"\n\t :remove=\"product => shopcart.actions.removeProduct(product._id)\"\n\t\t\t\t\t@updateRentDates=\"(product, dates) => shopcart.actions.updateRentDates({ productId: product._id, dates })\"\n\t class=\"w-100 bg-white \"\n\t />\n\t\t\t</ul>\n\n\t\t\t\t<div \n\t\t\t\tclass=\"mn-b-thin\"\n\t\t\t>\t\n\t\t\t\t<PriceTotal \n :totalPrice=\"cartTotalPrice\"\n :deliveryRate=\"deliveryCost\"\n :currency=\"returnCurrency()\"\n :showFees=\"globals.state.options?.orders.showFees\"\n :feesRate=\"globals.state.options?.orders.feesRate || 0\"\n :showVat=\"globals.state.options?.orders.showVat\"\n :vatRate=\"globals.state.options?.orders.vatRate || 0\"\n :showDeliveryFee=\"globals.state.options?.orders.showDeliveryFee\"\n />\n\t\t\t</div>\n\t\t\t<!-- Send order -->\n\t\t <button \n\t\t \tv-if=\"orders.state.current.status !== true && shopcart.state.positions.length > 0\"\n\t\t \t:disabled=\"\n\t\t errorName \n\t\t || errorPhoneOrMessenger \n\t\t || errorCity \n\t\t || errorAddress \n\t\t || errorDelivery \n\t\t || errorPayment\n\t\t || isLocationLoading\n\t\t \"\n\t\t @click=\"handleCreate()\" \n\t\t class=\"bg-main mn-b-small pd-small radius-big w-100 button\"\n\t\t >\n\t\t Place an Order\n\t\t </button>\n\n\t\t <p class='mn-b-thin'>\n\t\t\t\tI agree that placing the order places me under an obligation to make a payment in accordance with <a class=\"t-semi font-second t-second\" href=\"/legal/terms-of-use\" target=\"_blank\">Terms of Use.</a>\n\t\t\t</p>\n\t\t\t<p >\n\t\t\t\t\n\t\t\t</p>\n\t\t</div>\n\n\t</div>\n\n\t\n\t\n</section>\n\n</template>\n\n\n<script setup>\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Import components\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Block\nimport CardOrderItem from '@martyrs/src/modules/orders/components/blocks/CardOrderItem.vue'\n// Sections\nimport AskToLogin from '@martyrs/src/modules/orders/components/sections/AskToLogin.vue'\nimport Succes from '@martyrs/src/modules/orders/components/sections/Succes.vue'\nimport EmptyState from '@martyrs/src/modules/orders/components/sections/EmptyState.vue'\n\nimport PriceTotal from '@martyrs/src/modules/orders/components/elements/PriceTotal.vue';\n\nimport FormCustomerDetails from '@martyrs/src/modules/orders/components/sections/FormCustomerDetails.vue'\nimport FormDelivery from '@martyrs/src/modules/orders/components/sections/FormDelivery.vue'\nimport FormPayment from '@martyrs/src/modules/orders/components/sections/FormPayment.vue'\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Import libs\n///////////////////////////////////////////////////////////////////////////////////////////////////\nimport { ref, computed, onMounted, watch } from 'vue'\nimport { useRoute,useRouter } from 'vue-router'\n// Store\nimport * as globals from '@martyrs/src/modules/globals/views/store/globals';\nimport * as auth from '@martyrs/src/modules/auth/views/store/auth';\nimport * as shopcart from '@martyrs/src/modules/orders/store/shopcart';\nimport * as organizations from '@martyrs/src/modules/organizations/store/organizations';\nimport * as orders from '@martyrs/src/modules/orders/store/orders';\nimport * as users from '@martyrs/src/modules/auth/views/store/users';\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Variables and computed\n//////////////////////////////////////////////////////////////////////////////////////////////////\nconst isLocationLoading = ref(false)\n// Accessing router and store\nconst route = useRoute()\nconst router = useRouter()\n// COMPUTED\nconst order = computed(() => orders.state.current)\nconst user = computed(() => users.state.current)\n\nconst cartTotalPrice = shopcart.getters.cartTotalPrice\n\nconst deliveryCost = computed(() => {\n const type = orders.state.current.delivery.type\n const distance = orderOrganization.value[0]?.distance || 0\n const config = globals.state.options?.orders?.delivery_formula || {}\n\n return orders.getters.getDeliveryPrice(type, distance, config)\n})\n\n// Organization\nconst orderOrganization = ref({})\n\n\nif (!globals.state.options.orders.allowUnauthenticatedOrders && !auth.state.user._id) { \n\trouter.push({name: 'Sign In'})\t\n}\n\n\norders.mutations.resetOrder()\n\nonMounted(async()=> {\n\tisLocationLoading.value = true\n\n\n\tif (auth.state.user._id) {\n\t\tlet data = await users.actions.read({ _id:auth.state.user._id, user: auth.state.user._id });\n\t\torders.state.current.customer.profile.name = users.state.current.profile.name\n\t\torders.state.current.customer.phone = users.state.current.phone\n\t\torders.state.current.customer.phone = users.state.current.phone\n\t}\n\n\torders.state.current.organization = shopcart.state.organization\n\n\torderOrganization.value = await organizations.actions.read({\n\t _id: shopcart.state.organization,\n\t location: globals.state.position?.location,\n\t lookup: ['spots']\n\t})\n\t\n isLocationLoading.value = false\n})\n\n\nwatch(\n () => orders.state.current.delivery,\n async (newVal) => {\n if (newVal?.location) {\n \tisLocationLoading.value = true\n\n orderOrganization.value = await organizations.actions.read({\n _id: shopcart.state.organization,\n location: newVal.location,\n lookup: ['spots']\n })\n\n isLocationLoading.value = false\n }\n },\n { deep: true }\n)\n\n\n/////////////////////////////\n// Store Verification\n/////////////////////////////\nconst errorName = computed(() => {\n if (orders.state.current.customer.name?.length < 2) { return true } else { return false }\n});\n\nconst errorPhoneOrMessenger = computed(() => {\n const hasMessengerType = orders.state.current.customer.messenger?.type;\n const hasMessengerValue = orders.state.current.customer.messenger?.value?.length >\t 2;\n const hasPhone = orders.state.current.customer.number?.length > 0;\n // Ошибка, если нет ни номера телефона, ни корректного типа и значения мессенджера\n return !hasPhone && !(hasMessengerType && hasMessengerValue);\n});\n\nconst errorAddress = computed(() => {\n const type = orders.state.current.delivery.type;\n if (type === \"pickup\") {\n return !orders.state.current.delivery.spot;\n } else if (type === \"courier\" || type === \"mail\") {\n const address = orders.state.current.delivery.address;\n return !address || typeof address !== 'string' || address.length < 2;\n }\n return false;\n});\n\nconst errorDelivery = computed(() => {\n if (orders.state.current.delivery.type) {return false } else {return true } \n})\n\nconst errorPayment = computed(() => {\n if (orders.state.current.payment.type) { return false } else {return true } \n})\n/////////////////////////////\n// Methods\n/////////////////////////////\nasync function handleCreate() {\n\n\torders.state.current.status = 'created';\n\n\torders.state.current.owner = {\n\t\ttarget: shopcart.state.organization,\n\t\ttype: 'organization'\n\t}\n\n\tif (auth.state.user._id) {\n\t\torders.state.current.creator = {\n\t\t\ttarget: auth.state.user._id,\n\t\t\ttype: 'user'\n\t\t}\n\t}\n\n\tif (auth.state.user._id) {\n\t\torders.state.current.customer = {\n\t\t\ttarget: auth.state.user._id,\n\t\t\ttype: 'user'\n\t\t}\n\t}\n\n\torders.state.current.positions = shopcart.state.positions\n\n \tconst referralCode = localStorage.getItem('referalCode');\n \n if (referralCode) {\n orders.state.current.referralCode = referralCode;\n }\n\n let order = await orders.actions.create(orders.state.current);\n\n if (order) {\n \tawait router.push({\n \t\tname: 'Order',\n \t\tparams: {\n \t\t\torder: order._id\n \t\t}\n \t})\n \t\t\n \tshopcart.actions.resetShopcart()\n\n } else {\n \talert('something wrong')\n }\n}\n</script>\n\n<style lang=\"scss\">\n\n.round-wrapper {\n\tposition: relative;\n\n\t.round {\n\t\tmargin: 0;\n\t\tmargin-right: 1rem;\n\t}\n\n\tinput:checked {\n\t\tbackground: #00ff88;\n\t}\n\n\t.round-checkmark {\n\t\tposition: absolute;\n\t\twidth: 0.5rem;\n\t\theight: 0.5rem;\n\t\tbackground: white;\n\n\t\tleft: 0.5rem;\n\t\ttop: 0.5rem;\n\n\t\topacity: 1;\n\t}\n}\n</style>"],"names":["orders.state","users.state","shopcart.getters","globals.state","orders.getters","auth.state","orders.mutations","users.actions","shopcart.state","organizations.actions","order","orders.actions","shopcart.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4IA,UAAM,oBAAoB,IAAI,KAAK;AAErB,aAAQ;AACtB,UAAM,SAAS,UAAS;AAExB,UAAM,QAAQ,SAAS,MAAMA,MAAa,OAAO;AACpC,aAAS,MAAMC,QAAY,OAAO;AAE/C,UAAM,iBAAiBC,QAAiB;AAExC,UAAM,eAAe,SAAS,MAAM;;AAClC,YAAM,OAAOF,MAAa,QAAQ,SAAS;AAC3C,YAAM,aAAW,uBAAkB,MAAM,CAAC,MAAzB,mBAA4B,aAAY;AACzD,YAAM,WAASG,mBAAc,YAAdA,mBAAuB,WAAvBA,mBAA+B,qBAAoB,CAAA;AAElE,aAAOC,UAAe,iBAAiB,MAAM,UAAU,MAAM;AAAA,IAC/D,CAAC;AAGD,UAAM,oBAAoB,IAAI,CAAE,CAAA;AAGhC,QAAI,CAACD,QAAc,QAAQ,OAAO,8BAA8B,CAACE,QAAW,KAAK,KAAK;AACrF,aAAO,KAAK,EAAC,MAAM,UAAS,CAAC;AAAA,IAC9B;AAGAC,cAAiB,WAAU;AAE3B,cAAU,YAAU;;AACnB,wBAAkB,QAAQ;AAG1B,UAAID,QAAW,KAAK,KAAK;AACb,cAAME,QAAc,KAAK,EAAE,KAAIF,QAAW,KAAK,KAAK,MAAMA,QAAW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,YACP,OAAOA,OAAM;AAAA,UAClB;AAAA,QACI,CAAA;AAEDE,kBAAiB,cAAa;AAAA,MAEjC,OAAS;AACN,cAAM,iBAAiB;AAAA,MAC1B;AAAA,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const vueRouter = require("vue-router");
|
|
5
|
-
const Button = require("../../../../components/Button/Button.
|
|
5
|
+
const Button = require("../../../../components/Button/Button.vue.cjs");
|
|
6
6
|
const Tab = require("../../../../components/Tab/Tab.vue2.cjs");
|
|
7
7
|
const Popup = require("../../../../components/Popup/Popup.vue.cjs");
|
|
8
8
|
const Block = require("../../../../components/Block/Block.vue.cjs");
|
|
9
9
|
const Feed = require("../../../../components/Feed/Feed.vue.cjs");
|
|
10
10
|
const CardOrderItem = require("../blocks/CardOrderItem.vue.cjs");
|
|
11
|
-
;/* empty css
|
|
11
|
+
;/* empty css */
|
|
12
12
|
;/* empty css */
|
|
13
13
|
const CardUser = require("../../../auth/views/components/blocks/CardUser.vue.cjs");
|
|
14
14
|
const FormAddCustomer = require("../sections/FormAddCustomer.vue.cjs");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { computed, ref, onMounted, createElementBlock, openBlock, createVNode, createBlock, createCommentVNode, withCtx, createElementVNode, createTextVNode, unref, Fragment, renderList, normalizeClass, toDisplayString } from "vue";
|
|
2
2
|
import { useRoute, useRouter } from "vue-router";
|
|
3
|
-
import _sfc_main$2 from "../../../../components/Button/Button.
|
|
3
|
+
import _sfc_main$2 from "../../../../components/Button/Button.vue.js";
|
|
4
4
|
import _sfc_main$3 from "../../../../components/Tab/Tab.vue2.js";
|
|
5
5
|
import _sfc_main$4 from "../../../../components/Popup/Popup.vue.js";
|
|
6
6
|
import _sfc_main$1 from "../../../../components/Block/Block.vue.js";
|
|
7
7
|
import _sfc_main$5 from "../../../../components/Feed/Feed.vue.js";
|
|
8
8
|
import _sfc_main$6 from "../blocks/CardOrderItem.vue.js";
|
|
9
|
-
/* empty css
|
|
9
|
+
/* empty css */
|
|
10
10
|
/* empty css */
|
|
11
11
|
import _sfc_main$7 from "../../../auth/views/components/blocks/CardUser.vue.js";
|
|
12
12
|
import _sfc_main$a from "../sections/FormAddCustomer.vue.js";
|
|
@@ -14,7 +14,7 @@ const _hoisted_1 = { class: "pd-big mobile:pd-medium pd-b-zero mobile:pd-b-zero
|
|
|
14
14
|
const _hoisted_2 = { class: "mn-b-medium w-100" };
|
|
15
15
|
const _hoisted_3 = { class: "mn-b-thin p-big" };
|
|
16
16
|
const _hoisted_4 = { class: "t-transp p-small" };
|
|
17
|
-
const _hoisted_5 = { class: "pd-big mobile:pd-medium h-70 flex flex-column w-100 pos-relative o-x-hidden o-y-scroll gap-small shopcart-content" };
|
|
17
|
+
const _hoisted_5 = { class: "pd-big pd-t-zero mobile:pd-t-zero mobile:pd-medium h-70 flex flex-column w-100 pos-relative o-x-hidden o-y-scroll gap-small shopcart-content" };
|
|
18
18
|
const _hoisted_6 = {
|
|
19
19
|
key: 0,
|
|
20
20
|
class: "mn-t-medium"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShopCart.vue.cjs","sources":["../../../../../../../src/modules/orders/components/partials/ShopCart.vue"],"sourcesContent":["<template>\n\t<section class=\"z-index-5 flex flex-column transition-ease-in-out bg-white shop-cart\" :class=\"{'shop-cart-active':shopcart.state.currentState === true}\">\n <!-- ---------------------------------------------------------------- -->\n <!-- 01. Popup Header -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"pd-big mobile:pd-medium pd-b-zero mobile:pd-b-zero flex-nowrap flex\">\n <div class=\"mn-b-medium w-100\">\n <h4 class=\"mn-b-thin p-big\">{{t('title')}}</h4>\n <p class=\"t-transp p-small\">{{t('subtitle')}} {{ t('positions', { count: StoreCartAmount }) }}</p>\n </div>\n <IconCross @click=\"shopcart.actions.toggleShopcart\" class=\"cursor-pointer i-medium button-icon\"/>\n </div>\n <!-- ---------------------------------------------------------------- -->\n <!-- 02. Popup Content -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"pd-big mobile:pd-medium h-70 flex flex-column w-100 pos-relative o-x-hidden o-y-scroll gap-small shopcart-content\">\n <!-- Empty State -->\n <p v-if=\"!(shopcart.state.positions.length > 0)\" class=\"mn-t-medium\"><i>{{t('emptystate')}}</i></p>\n <!-- Shopcart positions -->\n <CardOrderItem \n v-for=\"product in shopcart.state.positions\" \n :key=\"product._id\" \n :editable=\"true\" \n :product=\"product\" \n :increase=\"product => shopcart.actions.incrementItemQuantity(product._id)\"\n :decrease=\"product => shopcart.actions.decrementItemQuantity(product._id)\"\n :remove=\"product => shopcart.actions.removeProduct(product._id)\"\n @updateRentDates=\"(product, dates) => shopcart.actions.updateRentDates({ productId: product._id, dates })\"\n />\n </div>\n <!-- ---------------------------------------------------------------- -->\n <!-- 03. Footer -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"h-30 transition-ease-in-out pd-b-medium pd-t-medium pd-big transition-cubic bg-light t-black\">\n <div v-if=\"shopcart.state.positions.length > 0\" class=\"mn-b-small total-price\">\n <PriceTotal \n :totalPrice=\"cartTotalPrice\"\n :currency=\"returnCurrency()\"\n :showFees=\"globals.state.options?.orders.showFees\"\n :feesRate=\"globals.state.options?.orders.feesRate\"\n :showVat=\"globals.state.options?.orders.showVat\"\n :vatRate=\"globals.state.options?.orders.vatRate\"\n />\n </div>\n <button v-if=\"shopcart.state.positions.length > 0\" @click=\"openOrder()\" class=\"bg-main t-black w-100 button\">{{ t('fastorder') }}</button>\n </div> \n\n <!-- ---------------------------------------------------------------- -->\n <!-- 04. Color Overlay -->\n <!-- ---------------------------------------------------------------- -->\n <transition name=\"fade\">\n <teleport to=\"#app-wrapper\" v-if=\"shopcart.state.currentState\">\n\n <div \n v-if=\"shopcart.state.currentState\"\n @click=\"() => shopcart.state.currentState = false\"\n class=\"color-overlay z-index-3\"\n :class=\"{'active':shopcart.state.currentState === true}\"\n >\n </div>\n </teleport>\n </transition>\n </section>\n</template>\n\n\n<script setup>\n /////////////////////////////\n // COMPONENT DEPENDENCIES\n /////////////////////////////\n\timport { computed,onMounted } from 'vue'\n // Route\n import { useRouter,useRoute } from 'vue-router'\n // i18n\n import { useI18n } from 'vue-i18n'\n // Components\n import CardOrderItem from '@martyrs/src/modules/orders/components/blocks/CardOrderItem.vue';\n import PriceTotal from '@martyrs/src/modules/orders/components/elements/PriceTotal.vue';\n\n import IconCross from '@martyrs/src/modules/icons/navigation/IconCross.vue';\n\n import * as globals from '@martyrs/src/modules/globals/views/store/globals';\n import * as auth from '@martyrs/src/modules/auth/views/store/auth';\n import * as shopcart from '@martyrs/src/modules/orders/store/shopcart';\n /////////////////////////////\n // CREATED\n /////////////////////////////\n const route = useRoute()\n const router = useRouter()\n // Accessing state\n const cartTotalPrice = shopcart.getters.cartTotalPrice\n const StoreCartAmount = shopcart.getters.cartTotalAmount\n // \n // router.beforeEach((to, from, next) => {\n // if (shopcart.state.currentState === true) {\n // shopcart.actions.toggleShopcart();\n // }\n // next(); // Убедитесь, что вызываете next() для продолжения перехода по роуту\n // });\n\n /////////////////////////////\n // LOCALIZATION\n /////////////////////////////\n const text = {\n messages: {\n en: {\n title: 'Your order',\n subtitle: 'You have',\n positions: 'no products in shop cart | 1 product in shop cart | {count} products in shop card',\n emptystate: \"You don't have any positions in your shop cart yet. Maybe something needs to be added?\",\n intotal: 'In total',\n fastorder: 'Checkout'\n },\n ru: {\n title: 'Ваш заказ',\n subtitle: 'У вас',\n positions: 'нет товаров в корзине | 1 товар в корзине | {count} товаров в корзине',\n emptystate: \"У вас еще нет товаров в корзине. Может стоит что-нибудь добавить?\",\n intotal: 'Итого',\n fastorder: 'Подтвердить заказ'\n }\n }\n }\n\n const { t } = useI18n(text)\n /////////////////////////////\n // MOUNTED\n /////////////////////////////\n function openOrder() {\n // store.dispatch(\"shopcart/toggleShopCart\");\n // store.dispatch(\"shopcart/setSearch\");\n !globals.state.options.orders.allowUnauthenticatedOrders && !auth.state.user._id ? router.push({name: 'Sign In', query: { returnUrl: '/orders/form'}}) : router.push({name: 'CreateOrder'}) \n shopcart.actions.toggleShopcart();\n }\n</script>\n\n<style lang=\"scss\">\n.shop-cart {\n display: block;\n position: fixed;\n\n right: -33%;\n top: 0;\n\n height: 100%;\n width: 33%;\n\n overflow-y: scroll; \n}\n\n.shop-cart-active {\n right: 0;\n\n}\n\n@media screen and (max-width: 1025px) {\n .shop-cart {\n width: 100%;\n right: -100%;\n\n .shopcart-footer {\n width: 100%;\n right: -100%;\n }\n\n &-active {\n right: 0;\n\n .shopcart-footer {\n right: 0;\n }\n }\n }\n}\n</style>\n\n\n"],"names":["useRoute","useRouter","shopcart.getters","useI18n","globals.state","auth.state","shopcart.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFgBA,cAAQ,SAAA;AACtB,UAAM,SAASC,UAAS,UAAA;AAExB,UAAM,iBAAiBC,SAAAA,QAAiB;AACxC,UAAM,kBAAkBA,SAAAA,QAAiB;AAYzC,UAAM,OAAO;AAAA,MACX,UAAU;AAAA,QACR,IAAI;AAAA,UACF,OAAO;AAAA,UACP,UAAU;AAAA,UACV,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,WAAW;AAAA,QACZ;AAAA,QACD,IAAI;AAAA,UACF,OAAO;AAAA,UACP,UAAU;AAAA,UACV,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,WAAW;AAAA,QACnB;AAAA,MACA;AAAA,IACA;AAEE,UAAM,EAAE,MAAMC,QAAAA,QAAQ,IAAI;AAI1B,aAAS,YAAY;AAGnB,OAACC,cAAc,QAAQ,OAAO,8BAA8B,CAACC,WAAW,KAAK,MAAO,OAAO,KAAK,EAAC,MAAM,WAAW,OAAO,EAAE,WAAW,eAAc,EAAC,CAAC,IAAM,OAAO,KAAK,EAAC,MAAM,cAAa,CAAC;AAC7LC,eAAAA,QAAiB,eAAgB;AAAA,IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ShopCart.vue.cjs","sources":["../../../../../../../src/modules/orders/components/partials/ShopCart.vue"],"sourcesContent":["<template>\n\t<section class=\"z-index-5 flex flex-column transition-ease-in-out bg-white shop-cart\" :class=\"{'shop-cart-active':shopcart.state.currentState === true}\">\n <!-- ---------------------------------------------------------------- -->\n <!-- 01. Popup Header -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"pd-big mobile:pd-medium pd-b-zero mobile:pd-b-zero flex-nowrap flex\">\n <div class=\"mn-b-medium w-100\">\n <h4 class=\"mn-b-thin p-big\">{{t('title')}}</h4>\n <p class=\"t-transp p-small\">{{t('subtitle')}} {{ t('positions', { count: StoreCartAmount }) }}</p>\n </div>\n <IconCross @click=\"shopcart.actions.toggleShopcart\" class=\"cursor-pointer i-medium button-icon\"/>\n </div>\n <!-- ---------------------------------------------------------------- -->\n <!-- 02. Popup Content -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"pd-big pd-t-zero mobile:pd-t-zero mobile:pd-medium h-70 flex flex-column w-100 pos-relative o-x-hidden o-y-scroll gap-small shopcart-content\">\n <!-- Empty State -->\n <p v-if=\"!(shopcart.state.positions.length > 0)\" class=\"mn-t-medium\"><i>{{t('emptystate')}}</i></p>\n <!-- Shopcart positions -->\n <CardOrderItem \n v-for=\"product in shopcart.state.positions\" \n :key=\"product._id\" \n :editable=\"true\" \n :product=\"product\" \n :increase=\"product => shopcart.actions.incrementItemQuantity(product._id)\"\n :decrease=\"product => shopcart.actions.decrementItemQuantity(product._id)\"\n :remove=\"product => shopcart.actions.removeProduct(product._id)\"\n @updateRentDates=\"(product, dates) => shopcart.actions.updateRentDates({ productId: product._id, dates })\"\n />\n </div>\n <!-- ---------------------------------------------------------------- -->\n <!-- 03. Footer -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"h-30 transition-ease-in-out pd-b-medium pd-t-medium pd-big transition-cubic bg-light t-black\">\n <div v-if=\"shopcart.state.positions.length > 0\" class=\"mn-b-small total-price\">\n <PriceTotal \n :totalPrice=\"cartTotalPrice\"\n :currency=\"returnCurrency()\"\n :showFees=\"globals.state.options?.orders.showFees\"\n :feesRate=\"globals.state.options?.orders.feesRate\"\n :showVat=\"globals.state.options?.orders.showVat\"\n :vatRate=\"globals.state.options?.orders.vatRate\"\n />\n </div>\n <button v-if=\"shopcart.state.positions.length > 0\" @click=\"openOrder()\" class=\"bg-main t-black w-100 button\">{{ t('fastorder') }}</button>\n </div> \n\n <!-- ---------------------------------------------------------------- -->\n <!-- 04. Color Overlay -->\n <!-- ---------------------------------------------------------------- -->\n <transition name=\"fade\">\n <teleport to=\"#app-wrapper\" v-if=\"shopcart.state.currentState\">\n\n <div \n v-if=\"shopcart.state.currentState\"\n @click=\"() => shopcart.state.currentState = false\"\n class=\"color-overlay z-index-3\"\n :class=\"{'active':shopcart.state.currentState === true}\"\n >\n </div>\n </teleport>\n </transition>\n </section>\n</template>\n\n\n<script setup>\n /////////////////////////////\n // COMPONENT DEPENDENCIES\n /////////////////////////////\n\timport { computed,onMounted } from 'vue'\n // Route\n import { useRouter,useRoute } from 'vue-router'\n // i18n\n import { useI18n } from 'vue-i18n'\n // Components\n import CardOrderItem from '@martyrs/src/modules/orders/components/blocks/CardOrderItem.vue';\n import PriceTotal from '@martyrs/src/modules/orders/components/elements/PriceTotal.vue';\n\n import IconCross from '@martyrs/src/modules/icons/navigation/IconCross.vue';\n\n import * as globals from '@martyrs/src/modules/globals/views/store/globals';\n import * as auth from '@martyrs/src/modules/auth/views/store/auth';\n import * as shopcart from '@martyrs/src/modules/orders/store/shopcart';\n /////////////////////////////\n // CREATED\n /////////////////////////////\n const route = useRoute()\n const router = useRouter()\n // Accessing state\n const cartTotalPrice = shopcart.getters.cartTotalPrice\n const StoreCartAmount = shopcart.getters.cartTotalAmount\n // \n // router.beforeEach((to, from, next) => {\n // if (shopcart.state.currentState === true) {\n // shopcart.actions.toggleShopcart();\n // }\n // next(); // Убедитесь, что вызываете next() для продолжения перехода по роуту\n // });\n\n /////////////////////////////\n // LOCALIZATION\n /////////////////////////////\n const text = {\n messages: {\n en: {\n title: 'Your order',\n subtitle: 'You have',\n positions: 'no products in shop cart | 1 product in shop cart | {count} products in shop card',\n emptystate: \"You don't have any positions in your shop cart yet. Maybe something needs to be added?\",\n intotal: 'In total',\n fastorder: 'Checkout'\n },\n ru: {\n title: 'Ваш заказ',\n subtitle: 'У вас',\n positions: 'нет товаров в корзине | 1 товар в корзине | {count} товаров в корзине',\n emptystate: \"У вас еще нет товаров в корзине. Может стоит что-нибудь добавить?\",\n intotal: 'Итого',\n fastorder: 'Подтвердить заказ'\n }\n }\n }\n\n const { t } = useI18n(text)\n /////////////////////////////\n // MOUNTED\n /////////////////////////////\n function openOrder() {\n // store.dispatch(\"shopcart/toggleShopCart\");\n // store.dispatch(\"shopcart/setSearch\");\n !globals.state.options.orders.allowUnauthenticatedOrders && !auth.state.user._id ? router.push({name: 'Sign In', query: { returnUrl: '/orders/form'}}) : router.push({name: 'CreateOrder'}) \n shopcart.actions.toggleShopcart();\n }\n</script>\n\n<style lang=\"scss\">\n.shop-cart {\n display: block;\n position: fixed;\n\n right: -33%;\n top: 0;\n\n height: 100%;\n width: 33%;\n\n overflow-y: scroll; \n}\n\n.shop-cart-active {\n right: 0;\n\n}\n\n@media screen and (max-width: 1025px) {\n .shop-cart {\n width: 100%;\n right: -100%;\n\n .shopcart-footer {\n width: 100%;\n right: -100%;\n }\n\n &-active {\n right: 0;\n\n .shopcart-footer {\n right: 0;\n }\n }\n }\n}\n</style>\n\n\n"],"names":["useRoute","useRouter","shopcart.getters","useI18n","globals.state","auth.state","shopcart.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFgBA,cAAQ,SAAA;AACtB,UAAM,SAASC,UAAS,UAAA;AAExB,UAAM,iBAAiBC,SAAAA,QAAiB;AACxC,UAAM,kBAAkBA,SAAAA,QAAiB;AAYzC,UAAM,OAAO;AAAA,MACX,UAAU;AAAA,QACR,IAAI;AAAA,UACF,OAAO;AAAA,UACP,UAAU;AAAA,UACV,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,WAAW;AAAA,QACZ;AAAA,QACD,IAAI;AAAA,UACF,OAAO;AAAA,UACP,UAAU;AAAA,UACV,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,WAAW;AAAA,QACnB;AAAA,MACA;AAAA,IACA;AAEE,UAAM,EAAE,MAAMC,QAAAA,QAAQ,IAAI;AAI1B,aAAS,YAAY;AAGnB,OAACC,cAAc,QAAQ,OAAO,8BAA8B,CAACC,WAAW,KAAK,MAAO,OAAO,KAAK,EAAC,MAAM,WAAW,OAAO,EAAE,WAAW,eAAc,EAAC,CAAC,IAAM,OAAO,KAAK,EAAC,MAAM,cAAa,CAAC;AAC7LC,eAAAA,QAAiB,eAAgB;AAAA,IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -12,7 +12,7 @@ const _hoisted_1 = { class: "pd-big mobile:pd-medium pd-b-zero mobile:pd-b-zero
|
|
|
12
12
|
const _hoisted_2 = { class: "mn-b-medium w-100" };
|
|
13
13
|
const _hoisted_3 = { class: "mn-b-thin p-big" };
|
|
14
14
|
const _hoisted_4 = { class: "t-transp p-small" };
|
|
15
|
-
const _hoisted_5 = { class: "pd-big mobile:pd-medium h-70 flex flex-column w-100 pos-relative o-x-hidden o-y-scroll gap-small shopcart-content" };
|
|
15
|
+
const _hoisted_5 = { class: "pd-big pd-t-zero mobile:pd-t-zero mobile:pd-medium h-70 flex flex-column w-100 pos-relative o-x-hidden o-y-scroll gap-small shopcart-content" };
|
|
16
16
|
const _hoisted_6 = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "mn-t-medium"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShopCart.vue.js","sources":["../../../../../../../src/modules/orders/components/partials/ShopCart.vue"],"sourcesContent":["<template>\n\t<section class=\"z-index-5 flex flex-column transition-ease-in-out bg-white shop-cart\" :class=\"{'shop-cart-active':shopcart.state.currentState === true}\">\n <!-- ---------------------------------------------------------------- -->\n <!-- 01. Popup Header -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"pd-big mobile:pd-medium pd-b-zero mobile:pd-b-zero flex-nowrap flex\">\n <div class=\"mn-b-medium w-100\">\n <h4 class=\"mn-b-thin p-big\">{{t('title')}}</h4>\n <p class=\"t-transp p-small\">{{t('subtitle')}} {{ t('positions', { count: StoreCartAmount }) }}</p>\n </div>\n <IconCross @click=\"shopcart.actions.toggleShopcart\" class=\"cursor-pointer i-medium button-icon\"/>\n </div>\n <!-- ---------------------------------------------------------------- -->\n <!-- 02. Popup Content -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"pd-big mobile:pd-medium h-70 flex flex-column w-100 pos-relative o-x-hidden o-y-scroll gap-small shopcart-content\">\n <!-- Empty State -->\n <p v-if=\"!(shopcart.state.positions.length > 0)\" class=\"mn-t-medium\"><i>{{t('emptystate')}}</i></p>\n <!-- Shopcart positions -->\n <CardOrderItem \n v-for=\"product in shopcart.state.positions\" \n :key=\"product._id\" \n :editable=\"true\" \n :product=\"product\" \n :increase=\"product => shopcart.actions.incrementItemQuantity(product._id)\"\n :decrease=\"product => shopcart.actions.decrementItemQuantity(product._id)\"\n :remove=\"product => shopcart.actions.removeProduct(product._id)\"\n @updateRentDates=\"(product, dates) => shopcart.actions.updateRentDates({ productId: product._id, dates })\"\n />\n </div>\n <!-- ---------------------------------------------------------------- -->\n <!-- 03. Footer -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"h-30 transition-ease-in-out pd-b-medium pd-t-medium pd-big transition-cubic bg-light t-black\">\n <div v-if=\"shopcart.state.positions.length > 0\" class=\"mn-b-small total-price\">\n <PriceTotal \n :totalPrice=\"cartTotalPrice\"\n :currency=\"returnCurrency()\"\n :showFees=\"globals.state.options?.orders.showFees\"\n :feesRate=\"globals.state.options?.orders.feesRate\"\n :showVat=\"globals.state.options?.orders.showVat\"\n :vatRate=\"globals.state.options?.orders.vatRate\"\n />\n </div>\n <button v-if=\"shopcart.state.positions.length > 0\" @click=\"openOrder()\" class=\"bg-main t-black w-100 button\">{{ t('fastorder') }}</button>\n </div> \n\n <!-- ---------------------------------------------------------------- -->\n <!-- 04. Color Overlay -->\n <!-- ---------------------------------------------------------------- -->\n <transition name=\"fade\">\n <teleport to=\"#app-wrapper\" v-if=\"shopcart.state.currentState\">\n\n <div \n v-if=\"shopcart.state.currentState\"\n @click=\"() => shopcart.state.currentState = false\"\n class=\"color-overlay z-index-3\"\n :class=\"{'active':shopcart.state.currentState === true}\"\n >\n </div>\n </teleport>\n </transition>\n </section>\n</template>\n\n\n<script setup>\n /////////////////////////////\n // COMPONENT DEPENDENCIES\n /////////////////////////////\n\timport { computed,onMounted } from 'vue'\n // Route\n import { useRouter,useRoute } from 'vue-router'\n // i18n\n import { useI18n } from 'vue-i18n'\n // Components\n import CardOrderItem from '@martyrs/src/modules/orders/components/blocks/CardOrderItem.vue';\n import PriceTotal from '@martyrs/src/modules/orders/components/elements/PriceTotal.vue';\n\n import IconCross from '@martyrs/src/modules/icons/navigation/IconCross.vue';\n\n import * as globals from '@martyrs/src/modules/globals/views/store/globals';\n import * as auth from '@martyrs/src/modules/auth/views/store/auth';\n import * as shopcart from '@martyrs/src/modules/orders/store/shopcart';\n /////////////////////////////\n // CREATED\n /////////////////////////////\n const route = useRoute()\n const router = useRouter()\n // Accessing state\n const cartTotalPrice = shopcart.getters.cartTotalPrice\n const StoreCartAmount = shopcart.getters.cartTotalAmount\n // \n // router.beforeEach((to, from, next) => {\n // if (shopcart.state.currentState === true) {\n // shopcart.actions.toggleShopcart();\n // }\n // next(); // Убедитесь, что вызываете next() для продолжения перехода по роуту\n // });\n\n /////////////////////////////\n // LOCALIZATION\n /////////////////////////////\n const text = {\n messages: {\n en: {\n title: 'Your order',\n subtitle: 'You have',\n positions: 'no products in shop cart | 1 product in shop cart | {count} products in shop card',\n emptystate: \"You don't have any positions in your shop cart yet. Maybe something needs to be added?\",\n intotal: 'In total',\n fastorder: 'Checkout'\n },\n ru: {\n title: 'Ваш заказ',\n subtitle: 'У вас',\n positions: 'нет товаров в корзине | 1 товар в корзине | {count} товаров в корзине',\n emptystate: \"У вас еще нет товаров в корзине. Может стоит что-нибудь добавить?\",\n intotal: 'Итого',\n fastorder: 'Подтвердить заказ'\n }\n }\n }\n\n const { t } = useI18n(text)\n /////////////////////////////\n // MOUNTED\n /////////////////////////////\n function openOrder() {\n // store.dispatch(\"shopcart/toggleShopCart\");\n // store.dispatch(\"shopcart/setSearch\");\n !globals.state.options.orders.allowUnauthenticatedOrders && !auth.state.user._id ? router.push({name: 'Sign In', query: { returnUrl: '/orders/form'}}) : router.push({name: 'CreateOrder'}) \n shopcart.actions.toggleShopcart();\n }\n</script>\n\n<style lang=\"scss\">\n.shop-cart {\n display: block;\n position: fixed;\n\n right: -33%;\n top: 0;\n\n height: 100%;\n width: 33%;\n\n overflow-y: scroll; \n}\n\n.shop-cart-active {\n right: 0;\n\n}\n\n@media screen and (max-width: 1025px) {\n .shop-cart {\n width: 100%;\n right: -100%;\n\n .shopcart-footer {\n width: 100%;\n right: -100%;\n }\n\n &-active {\n right: 0;\n\n .shopcart-footer {\n right: 0;\n }\n }\n }\n}\n</style>\n\n\n"],"names":["shopcart.getters","globals.state","auth.state","shopcart.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFgB,aAAQ;AACtB,UAAM,SAAS,UAAS;AAExB,UAAM,iBAAiBA,QAAiB;AACxC,UAAM,kBAAkBA,QAAiB;AAYzC,UAAM,OAAO;AAAA,MACX,UAAU;AAAA,QACR,IAAI;AAAA,UACF,OAAO;AAAA,UACP,UAAU;AAAA,UACV,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,WAAW;AAAA,QACZ;AAAA,QACD,IAAI;AAAA,UACF,OAAO;AAAA,UACP,UAAU;AAAA,UACV,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,WAAW;AAAA,QACnB;AAAA,MACA;AAAA,IACA;AAEE,UAAM,EAAE,MAAM,QAAQ,IAAI;AAI1B,aAAS,YAAY;AAGnB,OAACC,QAAc,QAAQ,OAAO,8BAA8B,CAACC,QAAW,KAAK,MAAO,OAAO,KAAK,EAAC,MAAM,WAAW,OAAO,EAAE,WAAW,eAAc,EAAC,CAAC,IAAM,OAAO,KAAK,EAAC,MAAM,cAAa,CAAC;AAC7LC,cAAiB,eAAgB;AAAA,IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ShopCart.vue.js","sources":["../../../../../../../src/modules/orders/components/partials/ShopCart.vue"],"sourcesContent":["<template>\n\t<section class=\"z-index-5 flex flex-column transition-ease-in-out bg-white shop-cart\" :class=\"{'shop-cart-active':shopcart.state.currentState === true}\">\n <!-- ---------------------------------------------------------------- -->\n <!-- 01. Popup Header -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"pd-big mobile:pd-medium pd-b-zero mobile:pd-b-zero flex-nowrap flex\">\n <div class=\"mn-b-medium w-100\">\n <h4 class=\"mn-b-thin p-big\">{{t('title')}}</h4>\n <p class=\"t-transp p-small\">{{t('subtitle')}} {{ t('positions', { count: StoreCartAmount }) }}</p>\n </div>\n <IconCross @click=\"shopcart.actions.toggleShopcart\" class=\"cursor-pointer i-medium button-icon\"/>\n </div>\n <!-- ---------------------------------------------------------------- -->\n <!-- 02. Popup Content -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"pd-big pd-t-zero mobile:pd-t-zero mobile:pd-medium h-70 flex flex-column w-100 pos-relative o-x-hidden o-y-scroll gap-small shopcart-content\">\n <!-- Empty State -->\n <p v-if=\"!(shopcart.state.positions.length > 0)\" class=\"mn-t-medium\"><i>{{t('emptystate')}}</i></p>\n <!-- Shopcart positions -->\n <CardOrderItem \n v-for=\"product in shopcart.state.positions\" \n :key=\"product._id\" \n :editable=\"true\" \n :product=\"product\" \n :increase=\"product => shopcart.actions.incrementItemQuantity(product._id)\"\n :decrease=\"product => shopcart.actions.decrementItemQuantity(product._id)\"\n :remove=\"product => shopcart.actions.removeProduct(product._id)\"\n @updateRentDates=\"(product, dates) => shopcart.actions.updateRentDates({ productId: product._id, dates })\"\n />\n </div>\n <!-- ---------------------------------------------------------------- -->\n <!-- 03. Footer -->\n <!-- ---------------------------------------------------------------- -->\n <div class=\"h-30 transition-ease-in-out pd-b-medium pd-t-medium pd-big transition-cubic bg-light t-black\">\n <div v-if=\"shopcart.state.positions.length > 0\" class=\"mn-b-small total-price\">\n <PriceTotal \n :totalPrice=\"cartTotalPrice\"\n :currency=\"returnCurrency()\"\n :showFees=\"globals.state.options?.orders.showFees\"\n :feesRate=\"globals.state.options?.orders.feesRate\"\n :showVat=\"globals.state.options?.orders.showVat\"\n :vatRate=\"globals.state.options?.orders.vatRate\"\n />\n </div>\n <button v-if=\"shopcart.state.positions.length > 0\" @click=\"openOrder()\" class=\"bg-main t-black w-100 button\">{{ t('fastorder') }}</button>\n </div> \n\n <!-- ---------------------------------------------------------------- -->\n <!-- 04. Color Overlay -->\n <!-- ---------------------------------------------------------------- -->\n <transition name=\"fade\">\n <teleport to=\"#app-wrapper\" v-if=\"shopcart.state.currentState\">\n\n <div \n v-if=\"shopcart.state.currentState\"\n @click=\"() => shopcart.state.currentState = false\"\n class=\"color-overlay z-index-3\"\n :class=\"{'active':shopcart.state.currentState === true}\"\n >\n </div>\n </teleport>\n </transition>\n </section>\n</template>\n\n\n<script setup>\n /////////////////////////////\n // COMPONENT DEPENDENCIES\n /////////////////////////////\n\timport { computed,onMounted } from 'vue'\n // Route\n import { useRouter,useRoute } from 'vue-router'\n // i18n\n import { useI18n } from 'vue-i18n'\n // Components\n import CardOrderItem from '@martyrs/src/modules/orders/components/blocks/CardOrderItem.vue';\n import PriceTotal from '@martyrs/src/modules/orders/components/elements/PriceTotal.vue';\n\n import IconCross from '@martyrs/src/modules/icons/navigation/IconCross.vue';\n\n import * as globals from '@martyrs/src/modules/globals/views/store/globals';\n import * as auth from '@martyrs/src/modules/auth/views/store/auth';\n import * as shopcart from '@martyrs/src/modules/orders/store/shopcart';\n /////////////////////////////\n // CREATED\n /////////////////////////////\n const route = useRoute()\n const router = useRouter()\n // Accessing state\n const cartTotalPrice = shopcart.getters.cartTotalPrice\n const StoreCartAmount = shopcart.getters.cartTotalAmount\n // \n // router.beforeEach((to, from, next) => {\n // if (shopcart.state.currentState === true) {\n // shopcart.actions.toggleShopcart();\n // }\n // next(); // Убедитесь, что вызываете next() для продолжения перехода по роуту\n // });\n\n /////////////////////////////\n // LOCALIZATION\n /////////////////////////////\n const text = {\n messages: {\n en: {\n title: 'Your order',\n subtitle: 'You have',\n positions: 'no products in shop cart | 1 product in shop cart | {count} products in shop card',\n emptystate: \"You don't have any positions in your shop cart yet. Maybe something needs to be added?\",\n intotal: 'In total',\n fastorder: 'Checkout'\n },\n ru: {\n title: 'Ваш заказ',\n subtitle: 'У вас',\n positions: 'нет товаров в корзине | 1 товар в корзине | {count} товаров в корзине',\n emptystate: \"У вас еще нет товаров в корзине. Может стоит что-нибудь добавить?\",\n intotal: 'Итого',\n fastorder: 'Подтвердить заказ'\n }\n }\n }\n\n const { t } = useI18n(text)\n /////////////////////////////\n // MOUNTED\n /////////////////////////////\n function openOrder() {\n // store.dispatch(\"shopcart/toggleShopCart\");\n // store.dispatch(\"shopcart/setSearch\");\n !globals.state.options.orders.allowUnauthenticatedOrders && !auth.state.user._id ? router.push({name: 'Sign In', query: { returnUrl: '/orders/form'}}) : router.push({name: 'CreateOrder'}) \n shopcart.actions.toggleShopcart();\n }\n</script>\n\n<style lang=\"scss\">\n.shop-cart {\n display: block;\n position: fixed;\n\n right: -33%;\n top: 0;\n\n height: 100%;\n width: 33%;\n\n overflow-y: scroll; \n}\n\n.shop-cart-active {\n right: 0;\n\n}\n\n@media screen and (max-width: 1025px) {\n .shop-cart {\n width: 100%;\n right: -100%;\n\n .shopcart-footer {\n width: 100%;\n right: -100%;\n }\n\n &-active {\n right: 0;\n\n .shopcart-footer {\n right: 0;\n }\n }\n }\n}\n</style>\n\n\n"],"names":["shopcart.getters","globals.state","auth.state","shopcart.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFgB,aAAQ;AACtB,UAAM,SAAS,UAAS;AAExB,UAAM,iBAAiBA,QAAiB;AACxC,UAAM,kBAAkBA,QAAiB;AAYzC,UAAM,OAAO;AAAA,MACX,UAAU;AAAA,QACR,IAAI;AAAA,UACF,OAAO;AAAA,UACP,UAAU;AAAA,UACV,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,WAAW;AAAA,QACZ;AAAA,QACD,IAAI;AAAA,UACF,OAAO;AAAA,UACP,UAAU;AAAA,UACV,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,WAAW;AAAA,QACnB;AAAA,MACA;AAAA,IACA;AAEE,UAAM,EAAE,MAAM,QAAQ,IAAI;AAI1B,aAAS,YAAY;AAGnB,OAACC,QAAc,QAAQ,OAAO,8BAA8B,CAACC,QAAW,KAAK,MAAO,OAAO,KAAK,EAAC,MAAM,WAAW,OAAO,EAAE,WAAW,eAAc,EAAC,CAAC,IAAM,OAAO,KAAK,EAAC,MAAM,cAAa,CAAC;AAC7LC,cAAiB,eAAgB;AAAA,IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const _hoisted_1 = {
|
|
5
5
|
key: 0,
|
|
6
|
-
class: "bg-black t-white pd-big radius-big flex-v-center flex-nowrap flex"
|
|
6
|
+
class: "bg-black t-white pd-big radius-big flex-v-center flex-nowrap flex mobile:flex-column"
|
|
7
7
|
};
|
|
8
8
|
const _sfc_main = {
|
|
9
9
|
__name: "AskToLogin",
|
|
@@ -17,7 +17,7 @@ const _sfc_main = {
|
|
|
17
17
|
], -1)),
|
|
18
18
|
vue.createElementVNode("button", {
|
|
19
19
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.toggleSignInPopup()),
|
|
20
|
-
class: "button h-4r bg-main"
|
|
20
|
+
class: "button mobile:w-100 mobile:mn-t-small h-4r bg-main"
|
|
21
21
|
}, " Sign In ")
|
|
22
22
|
])) : vue.createCommentVNode("", true);
|
|
23
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AskToLogin.vue.cjs","sources":["../../../../../../../src/modules/orders/components/sections/AskToLogin.vue"],"sourcesContent":["<template>\n\t<div \n v-if=\"isOpen === true\" \n class=\"\n bg-black \n t-white \n pd-big \n radius-big\n flex-v-center\n flex-nowrap \n flex\n \"\n >\n <!-- <img loading=\"lazy\" \n @click=\"isOpen = false\" \n class=\"\n i-base \n button-close-popup \n button\n \"\n src=\"@/assets/icons/cross-white.svg\"\n > -->\n\n <div class=\"mn-r-auto\">\n <h3 class=\"t-semi mn-b-small\">Already registered?</h3>\n <span class=\"p-medium t-transp\">Sign in to your account to checkout faster.</span>\n </div>\n\n <button \n @click=\"toggleSignInPopup()\" \n class=\"button h-4r bg-main\"\n >\n Sign In\n </button>\n </div>\n</template>\n\n\n<script setup>\n\timport { ref } from 'vue'\n\n\tlet isOpen = ref(true);\n</script>\n\n<style lang=\"scss\">\n</style>\n\n\n"],"names":["ref"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"AskToLogin.vue.cjs","sources":["../../../../../../../src/modules/orders/components/sections/AskToLogin.vue"],"sourcesContent":["<template>\n\t<div \n v-if=\"isOpen === true\" \n class=\"\n bg-black \n t-white \n pd-big \n radius-big\n flex-v-center\n flex-nowrap \n flex\n mobile:flex-column\n \"\n >\n <!-- <img loading=\"lazy\" \n @click=\"isOpen = false\" \n class=\"\n i-base \n button-close-popup \n button\n \"\n src=\"@/assets/icons/cross-white.svg\"\n > -->\n\n <div class=\"mn-r-auto\">\n <h3 class=\"t-semi mn-b-small\">Already registered?</h3>\n <span class=\"p-medium t-transp\">Sign in to your account to checkout faster.</span>\n </div>\n\n <button \n @click=\"toggleSignInPopup()\" \n class=\"button mobile:w-100 mobile:mn-t-small h-4r bg-main\"\n >\n Sign In\n </button>\n </div>\n</template>\n\n\n<script setup>\n\timport { ref } from 'vue'\n\n\tlet isOpen = ref(true);\n</script>\n\n<style lang=\"scss\">\n</style>\n\n\n"],"names":["ref"],"mappings":";;;;;;;;;;AA0CC,QAAI,SAASA,IAAG,IAAC,IAAI;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref, createElementBlock, createCommentVNode, unref, openBlock, createElementVNode } from "vue";
|
|
2
2
|
const _hoisted_1 = {
|
|
3
3
|
key: 0,
|
|
4
|
-
class: "bg-black t-white pd-big radius-big flex-v-center flex-nowrap flex"
|
|
4
|
+
class: "bg-black t-white pd-big radius-big flex-v-center flex-nowrap flex mobile:flex-column"
|
|
5
5
|
};
|
|
6
6
|
const _sfc_main = {
|
|
7
7
|
__name: "AskToLogin",
|
|
@@ -15,7 +15,7 @@ const _sfc_main = {
|
|
|
15
15
|
], -1)),
|
|
16
16
|
createElementVNode("button", {
|
|
17
17
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.toggleSignInPopup()),
|
|
18
|
-
class: "button h-4r bg-main"
|
|
18
|
+
class: "button mobile:w-100 mobile:mn-t-small h-4r bg-main"
|
|
19
19
|
}, " Sign In ")
|
|
20
20
|
])) : createCommentVNode("", true);
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AskToLogin.vue.js","sources":["../../../../../../../src/modules/orders/components/sections/AskToLogin.vue"],"sourcesContent":["<template>\n\t<div \n v-if=\"isOpen === true\" \n class=\"\n bg-black \n t-white \n pd-big \n radius-big\n flex-v-center\n flex-nowrap \n flex\n \"\n >\n <!-- <img loading=\"lazy\" \n @click=\"isOpen = false\" \n class=\"\n i-base \n button-close-popup \n button\n \"\n src=\"@/assets/icons/cross-white.svg\"\n > -->\n\n <div class=\"mn-r-auto\">\n <h3 class=\"t-semi mn-b-small\">Already registered?</h3>\n <span class=\"p-medium t-transp\">Sign in to your account to checkout faster.</span>\n </div>\n\n <button \n @click=\"toggleSignInPopup()\" \n class=\"button h-4r bg-main\"\n >\n Sign In\n </button>\n </div>\n</template>\n\n\n<script setup>\n\timport { ref } from 'vue'\n\n\tlet isOpen = ref(true);\n</script>\n\n<style lang=\"scss\">\n</style>\n\n\n"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"AskToLogin.vue.js","sources":["../../../../../../../src/modules/orders/components/sections/AskToLogin.vue"],"sourcesContent":["<template>\n\t<div \n v-if=\"isOpen === true\" \n class=\"\n bg-black \n t-white \n pd-big \n radius-big\n flex-v-center\n flex-nowrap \n flex\n mobile:flex-column\n \"\n >\n <!-- <img loading=\"lazy\" \n @click=\"isOpen = false\" \n class=\"\n i-base \n button-close-popup \n button\n \"\n src=\"@/assets/icons/cross-white.svg\"\n > -->\n\n <div class=\"mn-r-auto\">\n <h3 class=\"t-semi mn-b-small\">Already registered?</h3>\n <span class=\"p-medium t-transp\">Sign in to your account to checkout faster.</span>\n </div>\n\n <button \n @click=\"toggleSignInPopup()\" \n class=\"button mobile:w-100 mobile:mn-t-small h-4r bg-main\"\n >\n Sign In\n </button>\n </div>\n</template>\n\n\n<script setup>\n\timport { ref } from 'vue'\n\n\tlet isOpen = ref(true);\n</script>\n\n<style lang=\"scss\">\n</style>\n\n\n"],"names":[],"mappings":";;;;;;;;AA0CC,QAAI,SAAS,IAAI,IAAI;;;;;;;;;;;;;;;"}
|
|
@@ -5,7 +5,7 @@ const vueRouter = require("vue-router");
|
|
|
5
5
|
const Block = require("../../../../components/Block/Block.vue.cjs");
|
|
6
6
|
const clickOutside = require("../../../../components/FieldPhone/click-outside.cjs");
|
|
7
7
|
const Feed = require("../../../../components/Feed/Feed.vue.cjs");
|
|
8
|
-
const Button = require("../../../../components/Button/Button.
|
|
8
|
+
const Button = require("../../../../components/Button/Button.vue.cjs");
|
|
9
9
|
const BlockSearch = require("../../../globals/views/components/blocks/BlockSearch.vue.cjs");
|
|
10
10
|
const CardUser = require("../../../auth/views/components/blocks/CardUser.vue.cjs");
|
|
11
11
|
const FormCustomerDetails = require("./FormCustomerDetails.vue.cjs");
|
|
@@ -3,7 +3,7 @@ import { useRoute } from "vue-router";
|
|
|
3
3
|
import _sfc_main$1 from "../../../../components/Block/Block.vue.js";
|
|
4
4
|
import clickOutside from "../../../../components/FieldPhone/click-outside.js";
|
|
5
5
|
import _sfc_main$4 from "../../../../components/Feed/Feed.vue.js";
|
|
6
|
-
import _sfc_main$6 from "../../../../components/Button/Button.
|
|
6
|
+
import _sfc_main$6 from "../../../../components/Button/Button.vue.js";
|
|
7
7
|
import _sfc_main$2 from "../../../globals/views/components/blocks/BlockSearch.vue.js";
|
|
8
8
|
import _sfc_main$3 from "../../../auth/views/components/blocks/CardUser.vue.js";
|
|
9
9
|
import _sfc_main$5 from "./FormCustomerDetails.vue.js";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const vueRouter = require("vue-router");
|
|
5
5
|
;/* empty css */
|
|
6
|
-
;/* empty css
|
|
6
|
+
;/* empty css */
|
|
7
7
|
const Field = require("../../../../components/Field/Field.vue.cjs");
|
|
8
8
|
const Radio = require("../../../../components/Radio/Radio.vue.cjs");
|
|
9
9
|
;/* empty css */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { watch, onMounted, computed, createBlock, openBlock, withCtx, createElementVNode, createElementBlock, createCommentVNode, createVNode, Fragment, renderList } from "vue";
|
|
2
2
|
import { useRoute } from "vue-router";
|
|
3
3
|
/* empty css */
|
|
4
|
-
/* empty css
|
|
4
|
+
/* empty css */
|
|
5
5
|
import Field from "../../../../components/Field/Field.vue.js";
|
|
6
6
|
import _sfc_main$2 from "../../../../components/Radio/Radio.vue.js";
|
|
7
7
|
/* empty css */
|