@lancom/shared 0.0.456 → 0.0.458

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.
Files changed (61) hide show
  1. package/assets/js/api/admin.js +12 -0
  2. package/components/products/products_aside/products-aside.vue +5 -0
  3. package/components/products/products_color_groups/products-color-groups.scss +69 -0
  4. package/components/products/products_color_groups/products-color-groups.vue +101 -0
  5. package/components/products/products_link/products-link.vue +4 -0
  6. package/components/quotes/quote_view/quote-view.scss +76 -22
  7. package/components/quotes/quote_view/quote-view.vue +79 -91
  8. package/components/quotes/quote_view/quote_option_view/quote-option-view.scss +103 -4
  9. package/components/quotes/quote_view/quote_option_view/quote-option-view.vue +202 -26
  10. package/components/quotes/quote_view/quote_view_accept/quote-view-accept.scss +33 -0
  11. package/components/quotes/quote_view/quote_view_accept/quote-view-accept.vue +85 -0
  12. package/components/quotes/quote_view/quote_view_address_form/quote-view-address-form.scss +17 -0
  13. package/components/quotes/quote_view/quote_view_address_form/quote-view-address-form.vue +259 -0
  14. package/components/quotes/quote_view/quote_view_banner/quote-view-banner.scss +67 -0
  15. package/components/quotes/quote_view/quote_view_banner/quote-view-banner.vue +69 -0
  16. package/components/quotes/quote_view/quote_view_billing_information/quote-view-billing-information.scss +5 -0
  17. package/components/quotes/quote_view/quote_view_billing_information/quote-view-billing-information.vue +108 -0
  18. package/components/quotes/quote_view/quote_view_header/quote-view-header.scss +65 -0
  19. package/components/quotes/quote_view/quote_view_header/quote-view-header.vue +69 -0
  20. package/components/quotes/quote_view/quote_view_info/quote-view-info.scss +36 -0
  21. package/components/quotes/quote_view/quote_view_info/quote-view-info.vue +42 -0
  22. package/components/quotes/quote_view/quote_view_invalid_stock_modal/quote-view-invalid-stock-modal.scss +17 -0
  23. package/components/quotes/quote_view/quote_view_invalid_stock_modal/quote-view-invalid-stock-modal.vue +29 -0
  24. package/components/quotes/quote_view/quote_view_menu/quote-view-menu.scss +74 -0
  25. package/components/quotes/quote_view/quote_view_menu/quote-view-menu.vue +102 -0
  26. package/components/quotes/quote_view/quote_view_message/quote-view-message.scss +53 -0
  27. package/components/quotes/quote_view/quote_view_message/quote-view-message.vue +40 -0
  28. package/components/quotes/quote_view/quote_view_mobile_menu/quote-view-mobile-menu.scss +1 -0
  29. package/components/quotes/quote_view/quote_view_mobile_menu/quote-view-mobile-menu.vue +23 -0
  30. package/components/quotes/quote_view/quote_view_payment/quote-view-payment.scss +58 -0
  31. package/components/quotes/quote_view/quote_view_payment/quote-view-payment.vue +191 -0
  32. package/components/quotes/quote_view/quote_view_payment/quote_payment_success/quote-payment-success.scss +40 -0
  33. package/components/quotes/quote_view/quote_view_payment/quote_payment_success/quote-payment-success.vue +50 -0
  34. package/components/quotes/quote_view/quote_view_payment_modal/quote-view-payment-modal.scss +10 -0
  35. package/components/quotes/quote_view/quote_view_payment_modal/quote-view-payment-modal.vue +49 -0
  36. package/components/quotes/quote_view/quote_view_print/quote-view-print.scss +54 -0
  37. package/components/quotes/quote_view/quote_view_print/quote-view-print.vue +74 -0
  38. package/components/quotes/quote_view/quote_view_question/quote-view-question.scss +84 -0
  39. package/components/quotes/quote_view/quote_view_question/quote-view-question.vue +203 -0
  40. package/components/quotes/quote_view/quote_view_questions/quote-view-questions.scss +39 -0
  41. package/components/quotes/quote_view/quote_view_questions/quote-view-questions.vue +50 -0
  42. package/components/quotes/quote_view_preview/quote-view.scss +29 -0
  43. package/components/quotes/quote_view_preview/quote-view.vue +121 -0
  44. package/components/quotes/quote_view_preview/quote_option_view/quote-option-view.scss +10 -0
  45. package/components/quotes/quote_view_preview/quote_option_view/quote-option-view.vue +73 -0
  46. package/package.json +1 -1
  47. package/pages/quotes/view/_id/option/_option.vue +1 -1
  48. package/plugins/crisp.js +13 -0
  49. package/store/products.js +11 -2
  50. /package/components/quotes/{quote_view → quote_view_preview}/quote-view.mixin.js +0 -0
  51. /package/components/quotes/{quote_view → quote_view_preview}/quote_product_color_simple_products/quote-product-color-simple-products.mixin.js +0 -0
  52. /package/components/quotes/{quote_view → quote_view_preview}/quote_product_color_simple_products/quote-product-color-simple-products.scss +0 -0
  53. /package/components/quotes/{quote_view → quote_view_preview}/quote_product_color_simple_products/quote-product-color-simple-products.vue +0 -0
  54. /package/components/quotes/{quote_view → quote_view_preview}/quote_product_color_simple_products/quote_product_color_simple_product/quote-product-color-simple-product.scss +0 -0
  55. /package/components/quotes/{quote_view → quote_view_preview}/quote_product_color_simple_products/quote_product_color_simple_product/quote-product-color-simple-product.vue +0 -0
  56. /package/components/quotes/{quote_view → quote_view_preview}/quote_product_prints/quote-product-prints.scss +0 -0
  57. /package/components/quotes/{quote_view → quote_view_preview}/quote_product_prints/quote-product-prints.vue +0 -0
  58. /package/components/quotes/{quote_view → quote_view_preview}/quote_product_prints/quote_product_print/quote-product-print.scss +0 -0
  59. /package/components/quotes/{quote_view → quote_view_preview}/quote_product_prints/quote_product_print/quote-product-print.vue +0 -0
  60. /package/components/quotes/{quote_view → quote_view_preview}/quote_view_product/quote-view-product.scss +0 -0
  61. /package/components/quotes/{quote_view → quote_view_preview}/quote_view_product/quote-view-product.vue +0 -0
@@ -0,0 +1,67 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .QuoteViewBanner {
4
+ &__wrapper {
5
+ background-image: url(~/static/images/quote_header_bg.png);
6
+ background-position: center center;
7
+ background-repeat: no-repeat;
8
+ background-size: cover;
9
+ height: 584px;
10
+ position: relative;
11
+ @media (max-width: $bp-extra-small-max) {
12
+ height: 400px;
13
+ }
14
+ }
15
+ &__info {
16
+ position: absolute;
17
+ top: 111px;
18
+ left: 86px;
19
+ color: $white;
20
+ @media (max-width: $bp-extra-small-max) {
21
+ left: 30px;
22
+ top: 30px;
23
+ right: 0;
24
+ }
25
+ &-text {
26
+ font-weight: 600;
27
+ font-size: 18px;
28
+ line-height: 25px;
29
+ margin-top: 8px;
30
+ }
31
+ }
32
+ &__title {
33
+ font-weight: 800;
34
+ font-size: 60px;
35
+ line-height: 82px;
36
+ text-transform: uppercase;
37
+ @media (max-width: $bp-extra-small-max) {
38
+ font-size: 40px;
39
+ line-height: 62px;
40
+ }
41
+ }
42
+ &__fields {
43
+ margin-bottom: 20px;
44
+ }
45
+ &__field {
46
+ margin-top: 21px;
47
+ &-name {
48
+ font-weight: bold;
49
+ font-size: 14px;
50
+ line-height: 19px;
51
+ text-transform: uppercase;
52
+ @media (max-width: $bp-extra-small-max) {
53
+ font-size: 12px;
54
+ line-height: 16px;
55
+ }
56
+ }
57
+ &-text {
58
+ font-weight: 800;
59
+ font-size: 26px;
60
+ line-height: 35px;
61
+ @media (max-width: $bp-extra-small-max) {
62
+ font-size: 20px;
63
+ line-height: 25px;
64
+ }
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <div
3
+ class="QuoteViewBanner__wrapper"
4
+ :style="{
5
+ 'background-image': backgroundImage
6
+ }">
7
+ <div class="QuoteViewBanner__info">
8
+ <div class="QuoteViewBanner__title">
9
+ Proposal
10
+ </div>
11
+ <div
12
+ v-if="address"
13
+ class="QuoteViewBanner__fields">
14
+ <div class="QuoteViewBanner__field">
15
+ <div class="QuoteViewBanner__field-name">
16
+ customer name
17
+ </div>
18
+ <div class="QuoteViewBanner__field-text">
19
+ {{ address.fullName }}
20
+ </div>
21
+ </div>
22
+ <div class="QuoteViewBanner__field">
23
+ <div class="QuoteViewBanner__field-name">
24
+ company name
25
+ </div>
26
+ <div class="QuoteViewBanner__field-text">
27
+ {{ address.company }}
28
+ </div>
29
+ </div>
30
+ </div>
31
+ <div class="QuoteViewBanner__info-text">
32
+ {{ quote.createdAt | shortDate }}
33
+ </div>
34
+ <div class="QuoteViewBanner__info-text">
35
+ Custom uniforms
36
+ </div>
37
+ <div
38
+ v-if="quote.user"
39
+ class="QuoteViewBanner__info-text">
40
+ Prepared by {{ quote.user.fullName }}
41
+ </div>
42
+ </div>
43
+ </div>
44
+ </template>
45
+
46
+ <script>
47
+ import { mapGetters } from 'vuex';
48
+ import { shortDate } from '@lancom/shared/assets/js/utils/filters';
49
+
50
+ export default {
51
+ name: 'QuoteViewBanner',
52
+ filters: {
53
+ shortDate
54
+ },
55
+ computed: {
56
+ ...mapGetters('quote', ['quote']),
57
+ address() {
58
+ return this.quote.billingAddress || this.quote.address;
59
+ },
60
+ backgroundImage() {
61
+ return this.quote.image ? `url(${this.quote.image.large})` : null;
62
+ }
63
+ }
64
+ };
65
+ </script>
66
+
67
+ <style lang="scss" scoped>
68
+ @import 'quote-view-banner.scss';
69
+ </style>
@@ -0,0 +1,5 @@
1
+ .QuoteBillingInformation {
2
+ &__form {
3
+ margin-top: 14px;
4
+ }
5
+ }
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <div class="QuoteBillingInformation__wrapper">
3
+ <div class="lc_h3 lc_uppercase lc_bold">
4
+ Delivery Address
5
+ </div>
6
+ <div class="QuoteBillingInformation__form">
7
+ <validation-observer ref="form">
8
+ <div class="QuoteBillingInformation__content">
9
+ <address-form
10
+ :address="quote.address"
11
+ :postcodes-range="quote.address.postcode"
12
+ :without-additional-info="true" />
13
+ <div class="mt-20 mb-20">
14
+ <checkbox
15
+ v-model="copyToBillingAddress"
16
+ :dark="true">
17
+ <div class="ml-5">Use same address as the billing address</div>
18
+ </checkbox>
19
+ </div>
20
+ <div
21
+ v-if="!copyToBillingAddress"
22
+ class="mt-15">
23
+ <h5 class="lc_h3 lc_uppercase lc_bold mt-10 mb-15">Billing Address</h5>
24
+ <address-form
25
+ :address="quote.billingAddress"
26
+ :copy-from="quote.address"
27
+ :without-additional-info="true" />
28
+ </div>
29
+ </div>
30
+ <div style="margin-top: 30px;">
31
+ <btn
32
+ :btn-block="true"
33
+ btn-class="green"
34
+ btn-label="NEXT"
35
+ @onclick="goToPayment">
36
+ <i
37
+ slot="icon-after"
38
+ class="icon-arrow-right"></i>
39
+ </btn>
40
+ </div>
41
+ </validation-observer>
42
+ </div>
43
+ </div>
44
+ </template>
45
+
46
+ <script>
47
+ import AddressForm from '@/components/checkout/order/address-form/address-form';
48
+ import { isSameAddresses } from '@lancom/shared/assets/js/utils/address';
49
+
50
+ export default {
51
+ name: 'QuoteViewBillingInformation',
52
+ components: {
53
+ AddressForm
54
+ },
55
+ props: {
56
+ quote: {
57
+ type: Object,
58
+ required: true
59
+ }
60
+ },
61
+ data() {
62
+ return {
63
+ copyToBillingAddress: isSameAddresses(this.quote?.address, this.quote?.billingAddress)
64
+ };
65
+ },
66
+ created() {
67
+ if (!this.quote.billingAddress) {
68
+ this.quote.billingAddress = {
69
+ city: null,
70
+ phone: null,
71
+ addressLine1: null,
72
+ addressLine2: null,
73
+ email: null,
74
+ fullName: null,
75
+ company: null,
76
+ additionalInfo: null,
77
+ suburb: null,
78
+ country: this.country?.name,
79
+ state: null,
80
+ postcode: null
81
+ };
82
+ }
83
+ if (!this.quote.address) {
84
+ this.quote.address = {
85
+ ...this.quote.billingAddress
86
+ };
87
+ }
88
+ },
89
+ methods: {
90
+ async goToPayment() {
91
+ const isValid = await this.$refs.form.validate();
92
+ if (!isValid) {
93
+ return;
94
+ }
95
+
96
+ if (this.copyToBillingAddress) {
97
+ this.quote.billingAddress = { ...this.quote.address };
98
+ }
99
+
100
+ this.$emit('submit');
101
+ }
102
+ }
103
+ };
104
+ </script>
105
+
106
+ <style lang="scss" scoped>
107
+ @import 'quote-view-billing-information.scss';
108
+ </style>
@@ -0,0 +1,65 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .QuoteViewHeader {
4
+ &__wrapper {
5
+ display: flex;
6
+ justify-content: space-between;
7
+ padding: 19px 0;
8
+ }
9
+ &__info {
10
+ display: flex;
11
+ align-items: center;
12
+ @media (max-width: $bp-extra-small-max) {
13
+ flex-direction: column;
14
+ align-items: flex-end;
15
+ justify-content: space-between;
16
+ }
17
+ }
18
+ &__left-logo {
19
+ display: flex;
20
+ align-items: center;
21
+ flex-grow: 1;
22
+ }
23
+ &__mobile-menu {
24
+ margin-right: 20px;
25
+ }
26
+ &__print {
27
+ margin-top: 10px;
28
+ margin-right: 10px;
29
+ display: none;
30
+ @media (max-width: $bp-small-max) {
31
+ display: block;
32
+ }
33
+ }
34
+ &__phone {
35
+ font-weight: bold;
36
+ font-size: 14px;
37
+ line-height: 19px;
38
+ text-transform: uppercase;
39
+ margin-right: 36px;
40
+ @media (max-width: $bp-extra-small-max) {
41
+ margin-right: 0px;
42
+ }
43
+ }
44
+ &__socials {
45
+ display: flex;
46
+ a {
47
+ display: flex;
48
+ width: 40px;
49
+ height: 40px;
50
+ @media (max-width: $bp-extra-small-max) {
51
+ width: 20px;
52
+ height: 20px;
53
+ }
54
+ margin-right: 10px;
55
+ background-color: $green;
56
+ color: $black;
57
+ font-size: 22px;
58
+ @media (max-width: $bp-extra-small-max) {
59
+ font-size: 12px;
60
+ }
61
+ align-items: center;
62
+ justify-content: center;
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <div class="QuoteViewHeader__wrapper">
3
+ <div class="QuoteViewHeader__left-logo">
4
+ <div class="hidden-md-and-up">
5
+ <div
6
+ class="QuoteViewHeader__mobile-menu"
7
+ @click="showMenu()">
8
+ <i class="icon-menu"></i>
9
+ </div>
10
+ </div>
11
+ <div class="QuoteViewHeader__logo">
12
+ <a href="/">
13
+ <logo />
14
+ </a>
15
+ </div>
16
+ </div>
17
+ <div class="QuoteViewHeader__print">
18
+ <quote-view-print />
19
+ </div>
20
+ <div class="QuoteViewHeader__info">
21
+ <div class="QuoteViewHeader__phone">
22
+ <i class="icon-smartphone"></i>
23
+ <a :href="`tel:${contacts.phone}`" style="color: #303030;">{{contacts.phone}}</a>
24
+ </div>
25
+ <!-- <div class="QuoteViewHeader__socials">
26
+ <a href="/">
27
+ <i class="icon-facebook"></i>
28
+ </a>
29
+ <a href="/">
30
+ <i class="icon-twitter"></i>
31
+ </a>
32
+ <a href="/">
33
+ <i class="icon-instagram"></i>
34
+ </a>
35
+ </div> -->
36
+ </div>
37
+ </div>
38
+ </template>
39
+
40
+ <script>
41
+ import { mapGetters } from 'vuex';
42
+ import modals from '@lancom/shared/mixins/modals';
43
+ import Logo from '@/components/common/logo/logo';
44
+ import QuoteViewMobileMenu from './../quote_view_mobile_menu/quote-view-mobile-menu';
45
+ import QuoteViewPrint from './../quote_view_print/quote-view-print';
46
+
47
+ export default {
48
+ name: 'QuoteViewHeader',
49
+ components: {
50
+ Logo,
51
+ QuoteViewPrint
52
+ },
53
+ mixins: [
54
+ modals
55
+ ],
56
+ computed: {
57
+ ...mapGetters(['contacts'])
58
+ },
59
+ methods: {
60
+ showMenu() {
61
+ this.$aside.show(QuoteViewMobileMenu);
62
+ }
63
+ }
64
+ };
65
+ </script>
66
+
67
+ <style lang="scss" scoped>
68
+ @import 'quote-view-header.scss';
69
+ </style>
@@ -0,0 +1,36 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .QuoteViewInfo {
4
+ &__code {
5
+ font-weight: 800;
6
+ font-size: 20px;
7
+ line-height: 27px;
8
+ text-transform: uppercase;
9
+ }
10
+ &__author {
11
+ font-weight: 600;
12
+ font-size: 18px;
13
+ line-height: 25px;
14
+ margin-top: 6px;
15
+ }
16
+ &__state-wrapper {
17
+ margin-top: 15px;
18
+ display: flex;
19
+ }
20
+ &__state {
21
+ font-weight: 800;
22
+ font-size: 14px;
23
+ line-height: 19px;
24
+ text-align: center;
25
+ text-transform: uppercase;
26
+ padding: 5px;
27
+
28
+ &--current {
29
+ background-color: $green;
30
+ }
31
+ &--expired {
32
+ background-color: #EA3434;
33
+ color: $white;
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div class="QuoteViewInfo__wrapper">
3
+ <div class="QuoteViewInfo__code">
4
+ Quote ID: {{ quoteId }}
5
+ </div>
6
+ <div
7
+ v-if="quote.user"
8
+ class="QuoteViewInfo__author">
9
+ By {{ quote.user.fullName }}
10
+ </div>
11
+ <div class="QuoteViewInfo__state-wrapper">
12
+ <span
13
+ class="QuoteViewInfo__state"
14
+ :class="stateClassname">
15
+ {{ isExpiredQuote ? 'expired' : 'current' }}
16
+ </span>
17
+ <quote-view-print />
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import { mapGetters } from 'vuex';
24
+ import QuoteViewPrint from './../quote_view_print/quote-view-print';
25
+
26
+ export default {
27
+ name: 'QuoteViewInfo',
28
+ components: {
29
+ QuoteViewPrint
30
+ },
31
+ computed: {
32
+ ...mapGetters('quote', ['quoteId', 'quote', 'isExpiredQuote']),
33
+ stateClassname() {
34
+ return this.isExpiredQuote ? 'QuoteViewInfo__state--expired' : 'QuoteViewInfo__state--current';
35
+ }
36
+ }
37
+ };
38
+ </script>
39
+
40
+ <style lang="scss" scoped>
41
+ @import 'quote-view-info.scss';
42
+ </style>
@@ -0,0 +1,17 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .QuoteViewInvalidStockModal {
4
+ &__wrapper {
5
+ border-radius: 0px;
6
+ @media (max-width: $bp-extra-small-max) {
7
+ min-height: 100vh;
8
+ }
9
+ }
10
+ &__message {
11
+ font-weight: 600;
12
+ font-size: 20px;
13
+ line-height: 31px;
14
+ text-align: center;
15
+ color: #303030;
16
+ }
17
+ }
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <div class="lc_modal__wrapper QuoteViewInvalidStockModal__wrapper">
3
+ <div class="lc_modal__header pull-left">
4
+ <i
5
+ class="icon-cancel lc_modal__close--dark"
6
+ @click="$emit('close')"></i>
7
+ </div>
8
+ <div class="lc_modal__content">
9
+ <div class="QuoteViewInvalidStockModal__message">
10
+ There has been an issue with approval processing. we will contact you to confirm the order details. You can also contact us on <a :href="`tel:${contacts.phone}`" style="color: #303030;">{{contacts.phone}}</a>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import { mapGetters } from 'vuex';
18
+
19
+ export default {
20
+ name: 'QuoteViewInvalidStockModal',
21
+ computed: {
22
+ ...mapGetters(['contacts'])
23
+ }
24
+ };
25
+ </script>
26
+
27
+ <style lang="scss" scoped>
28
+ @import 'quote-view-invalid-stock-modal.scss';
29
+ </style>
@@ -0,0 +1,74 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .QuoteViewMenu {
4
+ &__wrapper {
5
+ margin-top: 38px;
6
+ border-top: 2px solid $gray;
7
+ padding-right: 38px;
8
+ padding-left: 25px;
9
+ }
10
+ &__header {
11
+ display: flex;
12
+ justify-content: space-between;
13
+ align-items: center;
14
+ margin-top: 32px;
15
+ margin-bottom: 45px;
16
+ cursor: pointer;
17
+ &-icon {
18
+ transform: rotate(0deg);
19
+ transform-origin: center center;
20
+ transition: transform 0.2s linear;
21
+ width: 20px;
22
+ height: 20px;
23
+ display: block;
24
+ &--opened {
25
+ transform: rotate(-90deg);
26
+ }
27
+ }
28
+ &-label {
29
+ font-weight: 800;
30
+ font-size: 22px;
31
+ line-height: 30px;
32
+ text-transform: uppercase;
33
+ }
34
+ }
35
+ &__item {
36
+ font-weight: 800;
37
+ font-size: 18px;
38
+ line-height: 25px;
39
+ text-transform: uppercase;
40
+ margin-top: 6px;
41
+ a {
42
+ display: block;
43
+ padding: 12px 16px;
44
+ color: $black;
45
+ cursor: pointer;
46
+ }
47
+ span {
48
+ background: #F38320;
49
+ padding: 1px 7px;
50
+ font-weight: bold;
51
+ font-size: 16.25px;
52
+ line-height: 22px;
53
+ color: $white;
54
+ text-decoration: none;
55
+ display: inline-block;
56
+ margin-left: 9px;
57
+ }
58
+ &--active,
59
+ &:hover {
60
+ background-color: $black;
61
+ a {
62
+ color: $white;
63
+ }
64
+ }
65
+ &--light {
66
+ a {
67
+ color: $gray_main;
68
+ }
69
+ }
70
+ &--bottom {
71
+ margin-top: 95px;
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div class="QuoteViewMenu__wrapper">
3
+ <div
4
+ class="QuoteViewMenu__header"
5
+ @click="toggleMenu()">
6
+ <span class="QuoteViewMenu__header-label">Menu</span>
7
+ <span
8
+ class="QuoteViewMenu__header-icon"
9
+ :class="{
10
+ 'QuoteViewMenu__header-icon--opened': opened
11
+ }">
12
+ <i class="icon-arrow-left"></i>
13
+ </span>
14
+ </div>
15
+ <div
16
+ v-if="opened"
17
+ class="QuoteViewMenu__items-wrapper">
18
+ <ul class="QuoteViewMenu__items">
19
+ <li
20
+ class="QuoteViewMenu__item"
21
+ :class="{
22
+ 'QuoteViewMenu__item--active': !currentOption,
23
+ 'QuoteViewMenu__item--light': !!currentOption
24
+ }">
25
+ <a @click="goToIntro()">
26
+ Intro
27
+ </a>
28
+ </li>
29
+
30
+ <li
31
+ v-for="option in options"
32
+ :key="option._id"
33
+ class="QuoteViewMenu__item"
34
+ :class="{
35
+ 'QuoteViewMenu__item--active': currentOption === option,
36
+ 'QuoteViewMenu__item--light': currentOption !== option
37
+ }">
38
+ <a @click="goToOption(option)">
39
+ Option {{ option.index }}
40
+ <span v-if="viewedOptionsMap && !viewedOptionsMap[option._id]">
41
+ NEW
42
+ </span>
43
+ </a>
44
+ </li>
45
+ </ul>
46
+ </div>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import { mapGetters } from 'vuex';
52
+
53
+ export default {
54
+ name: 'QuoteViewMenu',
55
+ data() {
56
+ return {
57
+ opened: true,
58
+ currentOption: null
59
+ };
60
+ },
61
+ computed: {
62
+ ...mapGetters('quote', ['options', 'viewedOptionsMap'])
63
+ },
64
+ mounted() {
65
+ if (this.$route.query.option) {
66
+ const option = this.options[this.$route.query.option - 1];
67
+ if (option) {
68
+ setTimeout(() => this.goToOption(option), 200);
69
+ }
70
+ }
71
+ },
72
+ methods: {
73
+ toggleMenu() {
74
+ this.opened = !this.opened;
75
+ },
76
+ goToIntro() {
77
+ this.currentOption = null;
78
+ this.goToElement('quote-intro');
79
+ this.onSelected();
80
+ },
81
+ goToOption(option) {
82
+ this.currentOption = option;
83
+ const { _id } = option;
84
+ this.goToElement(`option-${_id}`);
85
+ this.onSelected();
86
+ },
87
+ goToElement(selector) {
88
+ const $el = document.getElementById(selector);
89
+ if ($el?.scrollIntoView) {
90
+ $el.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
91
+ }
92
+ },
93
+ onSelected() {
94
+ this.$emit('selected');
95
+ }
96
+ }
97
+ };
98
+ </script>
99
+
100
+ <style lang="scss" scoped>
101
+ @import 'quote-view-menu.scss';
102
+ </style>