@cling-se/widget 0.17.3 → 0.18.1

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 (232) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/AddClientCallout-CCt78VvH.js +101 -0
  3. package/dist/AnswerModal-B4LwVv2N.js +3371 -0
  4. package/dist/AttachmentItem-DnvYffKP.js +171 -0
  5. package/dist/BaseUpload-DFoV0ZLe.js +6503 -0
  6. package/dist/BlockMedia-Amo_kdHo.js +103 -0
  7. package/dist/CCallout-Gd06ds6O.js +104 -0
  8. package/dist/{CCurrencyDropdown-CXXQu8th.js → CCurrencyDropdown-B4GNmOGA.js} +91 -53
  9. package/dist/CDropdownItem-BUNVCpSR.js +749 -0
  10. package/dist/CFormField.vue_vue_type_script_setup_true_lang-Bo2J0c4G.js +292 -0
  11. package/dist/{CPhoneFormat-BtBGl8b4.js → CPhoneFormat-DmN5r9Ci.js} +13 -21
  12. package/dist/CPhoneInput-B6iyhsOG.js +207 -0
  13. package/dist/CPriceInput-BLQaNu1d.js +142 -0
  14. package/dist/CSelect-BVO9iO9L.js +98 -0
  15. package/dist/CSkeleton.vue_vue_type_script_setup_true_lang-C9loRtrk.js +51 -0
  16. package/dist/ClientAutocomplete-C__yUaxD.js +532 -0
  17. package/dist/ClientModal-B9cbuEiC.js +1188 -0
  18. package/dist/ColorPicker-G2kkxL7_.js +1408 -0
  19. package/dist/CompanyModal-por9AG4P.js +250 -0
  20. package/dist/ContentWrapper-CQtaGA2u.js +265 -0
  21. package/dist/CoverBlockSettings-BCBDouyl.js +861 -0
  22. package/dist/DocAnswer-BrKctwrY.js +33 -0
  23. package/dist/DocDetails-B_LWVHGt.js +452 -0
  24. package/dist/DocForm-D6T7NmfO.js +6772 -0
  25. package/dist/DocFormSend-COYPrhl7.js +171 -0
  26. package/dist/DocLinks-B0LjxXIk.js +36 -0
  27. package/dist/DocModalBase-DObZHuYr.js +29 -0
  28. package/dist/DocPrint-CkDq78fB.js +399 -0
  29. package/dist/DocReceipt-CYBPyePC.js +341 -0
  30. package/dist/DocSendReminder-Dau6s43e.js +181 -0
  31. package/dist/{DocTextEditor-yD9Dt_um.js → DocTextEditor-CVn6gE1i.js} +7907 -5579
  32. package/dist/DocTimeline-ChBDPOfd.js +537 -0
  33. package/dist/DocumentClient-MLXzzXLb.js +90 -0
  34. package/dist/DocumentLayout-BMHOt380.js +1434 -0
  35. package/dist/DocumentLogotype-Clj3fopX.js +162 -0
  36. package/dist/DocumentVoided-B5_MSBbC.js +33 -0
  37. package/dist/EmbedInput-CzkOa02p.js +156 -0
  38. package/dist/EmbedSettings-Cf_F3KrM.js +103 -0
  39. package/dist/ErrorCallout-CJn6NCse.js +34 -0
  40. package/dist/FilePreviewModal-Di1VnPNY.js +202 -0
  41. package/dist/Flag-C4_G5IY1.js +41 -0
  42. package/dist/HeaderSettings-DWN0TjVD.js +720 -0
  43. package/dist/ImageSelectModal-DmAJ9PrN.js +119 -0
  44. package/dist/ImageUploadWrapper-QLEhA_dI.js +1585 -0
  45. package/dist/Index-B06eCuBA.js +76 -0
  46. package/dist/Index-B8Zj0-MX.js +87 -0
  47. package/dist/{Index-C_aIQ908.js → Index-BBBXL4zh.js} +319 -214
  48. package/dist/Index-BCHLxp7B.js +21 -0
  49. package/dist/Index-BDAp1CwZ.js +363 -0
  50. package/dist/Index-BFbcjFo4.js +16 -0
  51. package/dist/{Index-CRiATiQn.js → Index-BODJXJNp.js} +10 -18
  52. package/dist/Index-BOx_9tTM.js +136 -0
  53. package/dist/Index-BgZNiD7A.js +47 -0
  54. package/dist/Index-Bt97lEsI.js +228 -0
  55. package/dist/Index-C9aBeBBk.js +70 -0
  56. package/dist/Index-CE3pWPzp.js +49 -0
  57. package/dist/Index-CMdPSsp4.js +38 -0
  58. package/dist/Index-CNhBDG2e.js +126 -0
  59. package/dist/Index-CdsOdgG2.js +28 -0
  60. package/dist/{Index-Ch9r5yhG.js → Index-CmxFh3dW.js} +9 -17
  61. package/dist/Index-CpxzwwQS.js +52 -0
  62. package/dist/Index-CxTwWRD9.js +93 -0
  63. package/dist/Index-D9WFWlE6.js +140 -0
  64. package/dist/Index-D9bulLeI.js +39 -0
  65. package/dist/{Index-RWMPRDAE.js → Index-DL_9LzoR.js} +10 -18
  66. package/dist/Index-DR-sGE3Y.js +25 -0
  67. package/dist/Index-DRoOW5Pn.js +163 -0
  68. package/dist/Index-DTn47-hP.js +74 -0
  69. package/dist/Index-DeGDlj0B.js +68 -0
  70. package/dist/Index-DhYYK4bK.js +28 -0
  71. package/dist/Index-Dssdb-0Z.js +629 -0
  72. package/dist/Index-OcBnU480.js +200 -0
  73. package/dist/Index-Qh_8JqAv.js +3477 -0
  74. package/dist/Index-W10PQb8i.js +102 -0
  75. package/dist/Index-lbWFEELM.js +4 -0
  76. package/dist/Index-qFAg7VVU.js +1098 -0
  77. package/dist/Index-rDndJKo1.js +160 -0
  78. package/dist/{Index-Dfq7egc1.js → Index-s-6Qh_NE.js} +47 -60
  79. package/dist/Index.vue_vue_type_script_lang-CriDqp1F.js +671 -0
  80. package/dist/InputToggleRow-DJarYsVL.js +99 -0
  81. package/dist/ManualPopover-BMrkEHtV.js +65 -0
  82. package/dist/MediaWrapper-BYdVpmov.js +18 -0
  83. package/dist/{NotBindingText-CC7TxUqg.js → NotBindingText-DGjJoN8-.js} +13 -17
  84. package/dist/PackageGroup-q7_oBOqw.js +1060 -0
  85. package/dist/PdfTerms-DBEClYQ5.js +34 -0
  86. package/dist/PdfViewer-C_y5sqXB.js +392 -0
  87. package/dist/PlainHtml.vue_vue_type_script_setup_true_lang-D5ZLw34T.js +17 -0
  88. package/dist/PriceHeader-BSwv3mzc.js +488 -0
  89. package/dist/{SearchApi-G2Hvp0Dd.js → SearchApi-BM6TTqxW.js} +37 -49
  90. package/dist/SendForm-DfmBbhp9.js +6689 -0
  91. package/dist/Setup-BC1feKr_.js +47 -0
  92. package/dist/{SmartList-BynTuXtB.js → SmartList-B3pgsg4S.js} +16 -24
  93. package/dist/Sortable.vue_vue_type_script_setup_true_lang-YOP-Y07m.js +1349 -0
  94. package/dist/{TermsSettings-cA5YAO77.js → TermsSettings-DEkACrRU.js} +169 -56
  95. package/dist/ThemeColorRow-qG8Dkkyj.js +105 -0
  96. package/dist/ToggleBinding-Cdtl_-1s.js +44 -0
  97. package/dist/UploadModal-1OWPRxA5.js +134 -0
  98. package/dist/VideoPlayerInput-DgFNjiKK.js +134 -0
  99. package/dist/VideoPlayerSettings-CFuA-7RC.js +78 -0
  100. package/dist/VideoSelectModal-CSv67eA8.js +217 -0
  101. package/dist/{anime.es-BrPTThYb.js → anime.es-4wvNItHq.js} +205 -201
  102. package/dist/{color-TdtKxwVa.js → color-HetJPhlA.js} +1 -2
  103. package/dist/{dom-Ds4ypDrd.js → dom-CkTGWrfu.js} +3 -6
  104. package/dist/{focusDrawerMixin-CximZA1J.js → focusDrawerMixin-r-OZchfV.js} +1 -1
  105. package/dist/{formDrawerState-CkNGdxn5.js → formDrawerState-COVczNhJ.js} +2 -2
  106. package/dist/helpers-ChwW54Ex.js +46 -0
  107. package/dist/index-BMZle8Ew.js +513 -0
  108. package/dist/index-Bf-fiKJf.js +268 -0
  109. package/dist/index-Bg4JRi5S.js +125 -0
  110. package/dist/index-C7chK2UD.js +3525 -0
  111. package/dist/index-CR52qIBO.js +149 -0
  112. package/dist/index-D1x9O_nJ.js +188 -0
  113. package/dist/index-YFcPqc9m.js +508 -0
  114. package/dist/index.es.js +2 -5
  115. package/dist/index.umd.js +303 -1486
  116. package/dist/main-DI0diChK.js +57570 -0
  117. package/dist/mapFormMixin-Cgvwie9a.js +1528 -0
  118. package/dist/omit-DpjD7Dj9.js +56 -0
  119. package/dist/{publicSenderState-CGEm9EYe.js → publicSenderState-BcjNldje.js} +4 -4
  120. package/dist/splitpanes-BypKTSRL.js +342 -0
  121. package/dist/template-Dzexob5I.js +1572 -0
  122. package/dist/tippy.esm-0UMN6kWf.js +1994 -0
  123. package/dist/useTermsModal-DzH_PDFP.js +87 -0
  124. package/dist/{utils-Dr4AcaE9.js → utils--kBYCNZD.js} +8 -11
  125. package/dist/validation-B-omH73u.js +40 -0
  126. package/dist/widget.css +1 -0
  127. package/package.json +20 -25
  128. package/dist/AddClientCallout-Br6IhwGH.js +0 -48
  129. package/dist/AnswerModal-CsWltR6j.js +0 -3879
  130. package/dist/AttachmentItem-BG7FuSCD.js +0 -85
  131. package/dist/BaseDatePicker-PSNBtUIh.js +0 -3187
  132. package/dist/BaseUpload-BfEurAAV.js +0 -1977
  133. package/dist/BlockMedia-Bo3OfNSU.js +0 -76
  134. package/dist/CCallout-CAjM8-1X.js +0 -58
  135. package/dist/CDropdownItem-CN7gSfgY.js +0 -640
  136. package/dist/CFormField-Clvcf2Jh.js +0 -240
  137. package/dist/CPhoneInput-CEHXh5jM.js +0 -138
  138. package/dist/CPriceInput-D2c07SXp.js +0 -116
  139. package/dist/CSelect-Cz2IPzxS.js +0 -91
  140. package/dist/CSkeleton-AsnvnD-m.js +0 -55
  141. package/dist/ClientAutocomplete-CZ55-DKe.js +0 -438
  142. package/dist/ClientModal-CgUhWZ5L.js +0 -666
  143. package/dist/ColorPicker-IFGHqH-u.js +0 -2879
  144. package/dist/CompanyModal-TLSBFo3U.js +0 -147
  145. package/dist/ContentWrapper-HClxKPuT.js +0 -190
  146. package/dist/CoverBlockSettings-D99hAa6e.js +0 -659
  147. package/dist/DocAnswer-CTV_Bpt7.js +0 -36
  148. package/dist/DocDetails-CQe5htXj.js +0 -263
  149. package/dist/DocForm-6Efv5_oz.js +0 -5017
  150. package/dist/DocFormSend-DbXcklxU.js +0 -146
  151. package/dist/DocLinks-BO545zbL.js +0 -38
  152. package/dist/DocModalBase-DXHNJ-6i.js +0 -28
  153. package/dist/DocPrint-Bf2U4FQN.js +0 -240
  154. package/dist/DocReceipt-CWXvC7bY.js +0 -217
  155. package/dist/DocSendReminder-CRzBM2NJ.js +0 -140
  156. package/dist/DocTimeline-DGVOk8-2.js +0 -485
  157. package/dist/DocumentClient-Das9BaJ7.js +0 -136
  158. package/dist/DocumentLayout-4q8rmTVT.js +0 -4880
  159. package/dist/DocumentLogotype-DLncJJAB.js +0 -92
  160. package/dist/DocumentVoided-CcI9lX27.js +0 -25
  161. package/dist/EmbedInput-BPdy0lGS.js +0 -117
  162. package/dist/EmbedSettings-L2iwYLQK.js +0 -74
  163. package/dist/ErrorCallout-Ds_tBT02.js +0 -27
  164. package/dist/FilePreviewModal-hxUu330p.js +0 -81
  165. package/dist/Flag-1-HcT5Dz.js +0 -46
  166. package/dist/HeaderSettings-C27fMugK.js +0 -440
  167. package/dist/ImageSelectModal-BKDIyxF4.js +0 -86
  168. package/dist/ImageUploadWrapper-BiYzUQur.js +0 -1604
  169. package/dist/Index-5BOWxcPG.js +0 -26
  170. package/dist/Index-B1Odktov.js +0 -754
  171. package/dist/Index-B3d5BjEn.js +0 -25
  172. package/dist/Index-B3sSU_4X.js +0 -54
  173. package/dist/Index-B5Dqsh3K.js +0 -150
  174. package/dist/Index-B6aO1c_w.js +0 -62
  175. package/dist/Index-BGfICxJQ.js +0 -643
  176. package/dist/Index-BHopC0hv.js +0 -24
  177. package/dist/Index-BJXcSmp_.js +0 -55
  178. package/dist/Index-BQe6QjQZ.js +0 -25
  179. package/dist/Index-BmXx_x6t.js +0 -77
  180. package/dist/Index-C692qMTG.js +0 -294
  181. package/dist/Index-CEvbw-3i.js +0 -41
  182. package/dist/Index-CYSULnpn.js +0 -32
  183. package/dist/Index-CdtYzwAM.js +0 -107
  184. package/dist/Index-CetF2FW0.js +0 -230
  185. package/dist/Index-Cv6XLM20.js +0 -73
  186. package/dist/Index-Cwy8ff76.js +0 -154
  187. package/dist/Index-D34z4UEY.js +0 -84
  188. package/dist/Index-DNCei-lp.js +0 -56
  189. package/dist/Index-DUbxgIYB.js +0 -2445
  190. package/dist/Index-DVwn_LLf.js +0 -28
  191. package/dist/Index-Dla-mesV.js +0 -146
  192. package/dist/Index-KtUkOPI2.js +0 -58
  193. package/dist/Index-LjnOTVJk.js +0 -66
  194. package/dist/Index-ky1SRtfY.js +0 -94
  195. package/dist/Index-mceZW2NX.js +0 -41
  196. package/dist/Index-tD3hZjh8.js +0 -144
  197. package/dist/Index-vM5kDtC2.js +0 -33
  198. package/dist/InputToggleRow-BmDuSbE2.js +0 -57
  199. package/dist/ManualPopover-CQfjPvFe.js +0 -60
  200. package/dist/MediaWrapper-DDzcjR6V.js +0 -23
  201. package/dist/PackageGroup-mAGXfZDv.js +0 -704
  202. package/dist/PdfTerms-BH_Nwf2h.js +0 -31
  203. package/dist/PdfViewer-mBLxI8bA.js +0 -383
  204. package/dist/PlainHtml-B7gUNNZd.js +0 -27
  205. package/dist/PriceHeader-DClYMPcq.js +0 -338
  206. package/dist/SendForm-Cxv_m8Rq.js +0 -1023
  207. package/dist/Setup-B90VDZTG.js +0 -50
  208. package/dist/ThemeColorRow-D-Z7w4Wk.js +0 -69
  209. package/dist/ToggleBinding-DOeTcWzi.js +0 -42
  210. package/dist/UploadModal-DOPLVEpV.js +0 -95
  211. package/dist/VideoPlayerInput-1zG06elO.js +0 -97
  212. package/dist/VideoPlayerSettings-O-4rAYYh.js +0 -61
  213. package/dist/VideoSelectModal-DzqFrqCg.js +0 -104
  214. package/dist/answerDocumentMixin-HBiNWYCH.js +0 -51
  215. package/dist/debounce-Ch1d3526.js +0 -84
  216. package/dist/formValidationMixin-D_MzsHsR.js +0 -49
  217. package/dist/index-BNdbPq4J.js +0 -492
  218. package/dist/index-BXzugeJ6.js +0 -81
  219. package/dist/index-C5wcxrC6.js +0 -167
  220. package/dist/index-CgDOs7t4.js +0 -2700
  221. package/dist/index-Cj-_2coz.js +0 -351
  222. package/dist/index-DpqV5y0K.js +0 -102
  223. package/dist/main-BL_yzf2r.js +0 -57357
  224. package/dist/mapFormMixin-Cu_vkTP-.js +0 -3028
  225. package/dist/omit-Dfe_H1Ft.js +0 -31
  226. package/dist/simplebar.min-CRlLD1Oz.js +0 -71
  227. package/dist/splitpanes-BHUVsCZF.js +0 -382
  228. package/dist/style.css +0 -4
  229. package/dist/throttle-BX_w77tW.js +0 -18
  230. package/dist/tippy.esm-n4arfVzA.js +0 -1805
  231. package/dist/vuedraggable.umd-DW4PJoZ3.js +0 -3161
  232. package/dist/vuex.esm-DKGl8mcw.js +0 -467
@@ -1,2445 +0,0 @@
1
- import { m as y } from "./mapFormMixin-Cu_vkTP-.js";
2
- import { C as W } from "./CCallout-CAjM8-1X.js";
3
- import { C as x, a as b, w as B } from "./CDropdownItem-CN7gSfgY.js";
4
- import { E as V } from "./ErrorCallout-Ds_tBT02.js";
5
- import { aT as F, aU as D, aV as j, aW as N, aX as H, aY as q, l as U, aZ as G, n as u, g as p, D as k, aF as K, a_ as T, aM as Y, r as I, av as f, $ as Z, a$ as J, aw as X, b0 as Q, b1 as ee, b2 as A, p as te, b as o, v as ie, Z as g, H as se, K as ae, b3 as ne, z as re, ae as oe } from "./main-BL_yzf2r.js";
6
- import { m as h, a as v } from "./vuex.esm-DKGl8mcw.js";
7
- import { T as ce } from "./DocTextEditor-yD9Dt_um.js";
8
- import { W as le } from "./DocumentLayout-4q8rmTVT.js";
9
- import { o as R } from "./omit-Dfe_H1Ft.js";
10
- import { d as ue } from "./vuedraggable.umd-DW4PJoZ3.js";
11
- import { C as w } from "./CPriceInput-D2c07SXp.js";
12
- import { S as de } from "./SearchApi-G2Hvp0Dd.js";
13
- import { v as pe } from "./index-BNdbPq4J.js";
14
- import { C as O } from "./CFormField-Clvcf2Jh.js";
15
- const he = [
16
- "unit",
17
- "m2",
18
- "hour",
19
- "m",
20
- "m3",
21
- "day",
22
- "kg",
23
- "litre",
24
- "km",
25
- "mile",
26
- "month",
27
- "week",
28
- "ton",
29
- "year",
30
- "kWh"
31
- ];
32
- function me() {
33
- }
34
- var fe = me, C = F, ve = fe, ge = D, ye = 1 / 0, _e = C && 1 / ge(new C([, -0]))[1] == ye ? function(s) {
35
- return new C(s);
36
- } : ve, ke = _e, $e = j, xe = N, be = H, we = q, Ce = ke, Te = D, Ie = 200;
37
- function Ae(s, e, t) {
38
- var i = -1, n = xe, a = s.length, r = !0, c = [], l = c;
39
- if (t)
40
- r = !1, n = be;
41
- else if (a >= Ie) {
42
- var _ = e ? null : Ce(s);
43
- if (_)
44
- return Te(_);
45
- r = !1, n = we, l = new $e();
46
- } else
47
- l = e ? [] : c;
48
- e:
49
- for (; ++i < a; ) {
50
- var d = s[i], m = e ? e(d) : d;
51
- if (d = t || d !== 0 ? d : 0, r && m === m) {
52
- for (var S = l.length; S--; )
53
- if (l[S] === m)
54
- continue e;
55
- e && l.push(m), c.push(d);
56
- } else
57
- n(l, m, t) || (l !== c && l.push(m), c.push(d));
58
- }
59
- return c;
60
- }
61
- var Se = Ae, Pe = G, Ve = Se;
62
- function De(s, e) {
63
- return s && s.length ? Ve(s, Pe(e)) : [];
64
- }
65
- var Re = De;
66
- const Oe = /* @__PURE__ */ U(Re), Me = {
67
- name: "PackageGroupSelect",
68
- i18nOptions: {
69
- namespaces: "PackageGroupSelect",
70
- messages: {
71
- en: {
72
- title: "What do you want to offer?",
73
- typeOptions: {
74
- single: {
75
- title: "Single Option",
76
- subTitle: "Offer one package."
77
- },
78
- radio: {
79
- title: "Packages",
80
- subTitle: "Offer several packages and let your client choose <strong>one<strong>."
81
- },
82
- checkbox: {
83
- title: "Multi Options",
84
- subTitle: "Offer many packages and let your client select <strong>multiple</strong> ones."
85
- }
86
- }
87
- },
88
- sv: {
89
- title: "Vad vill du erbjuda för prisförslag?",
90
- typeOptions: {
91
- single: {
92
- title: "Ett alternativ",
93
- subTitle: "Erbjud ett paket."
94
- },
95
- radio: {
96
- title: "Paket",
97
- subTitle: "Erbjud flera paket och låt din kund välja <strong>ett</strong> av paketen."
98
- },
99
- checkbox: {
100
- title: "Flera val",
101
- subTitle: "Erbjud många paket som din kund välja <strong>flera</strong> utav."
102
- }
103
- }
104
- }
105
- }
106
- },
107
- inject: ["parentSize"],
108
- data() {
109
- return {
110
- options: [
111
- {
112
- value: "single",
113
- background: "hsl(209, 94%, 73%)",
114
- title: this.$t("typeOptions.single.title"),
115
- subTitle: this.$t("typeOptions.single.subTitle")
116
- },
117
- {
118
- value: "radio",
119
- background: "hsl(222, 96%, 73%)",
120
- title: this.$t("typeOptions.radio.title"),
121
- subTitle: this.$t("typeOptions.radio.subTitle")
122
- },
123
- {
124
- value: "checkbox",
125
- background: "hsl(241, 95%, 73%)",
126
- title: this.$t("typeOptions.checkbox.title"),
127
- subTitle: this.$t("typeOptions.checkbox.subTitle")
128
- }
129
- ]
130
- };
131
- }
132
- };
133
- var Le = function() {
134
- var e = this, t = e._self._c;
135
- return t("div", { staticClass: "font-inter", staticStyle: { padding: "calc(2 * var(--rem)) 0 calc(1 * var(--rem)) 0", color: "#111" } }, [t("div", { staticStyle: { "font-size": "18px", "font-weight": "600", "text-align": "center", "margin-bottom": "calc(1.5 * var(--rem))" } }, [e._v(" " + e._s(e.$t("title")) + " ")]), t("div", [t("div", { staticClass: "options", class: { "is-700-or-less": e.parentSize.width <= 700 } }, e._l(e.options, function(i, n) {
136
- return t("div", { key: n, staticClass: "package-group-option", style: { backgroundColor: i.background }, on: { click: function(a) {
137
- return e.$emit("input", i.value);
138
- } } }, [t("div", { staticClass: "package-group-option__illustration" }, [i.value === "single" ? t("div", { staticClass: "package-group-option__illustration-card animate" }, [e._m(0, !0)]) : e._e(), i.value === "radio" ? e._l(3, function(a) {
139
- return t("div", { key: a, staticClass: "package-group-option__illustration-card", class: { animate: a === 2 } }, [t("div", { staticStyle: { width: "8px", height: "8px", "border-radius": "50%", "margin-right": "10px" }, style: a === 2 && {
140
- boxShadow: `0 0 0 1px white, 0 0 0 2px ${i.background}`,
141
- backgroundColor: i.background
142
- } }), e._m(1, !0)]);
143
- }) : e._e(), i.value === "checkbox" ? e._l(3, function(a) {
144
- return t("div", { key: a, staticClass: "package-group-option__illustration-card", class: { animate: a !== 3 } }, [t("div", { staticStyle: { height: "12px", width: "12px", "border-radius": "2px", "background-color": "hsl(0, 0%, 76%)", "margin-right": "10px", color: "white", padding: "1px", display: "inline-flex", "align-items": "center", "justify-content": "center" }, style: a !== 3 && { backgroundColor: i.background } }, [t("CIcon", { attrs: { type: a !== 3 ? "check" : "empty", "stroke-width": "5", size: "8" } })], 1), e._m(2, !0)]);
145
- }) : e._e()], 2), t("div", [t("div", { staticClass: "package-group-option__title" }, [e._v(" " + e._s(i.title) + " ")]), t("div", { staticClass: "package-group-option__subtitle", domProps: { innerHTML: e._s(i.subTitle) } })])]);
146
- }), 0)])]);
147
- }, Ee = [function() {
148
- var s = this, e = s._self._c;
149
- return e("div", { staticStyle: { flex: "1 1 auto" } }, [e("div", { staticClass: "bg-gray-100", staticStyle: { width: "40%", height: "10px", "margin-bottom": "8px" } }), e("div", { staticClass: "bg-gray-100", staticStyle: { width: "80%", height: "10px" } })]);
150
- }, function() {
151
- var s = this, e = s._self._c;
152
- return e("div", { staticStyle: { flex: "1 1 auto" } }, [e("div", { staticClass: "bg-gray-100", staticStyle: { width: "40%", height: "10px", "margin-bottom": "8px" } }), e("div", { staticClass: "bg-gray-100", staticStyle: { width: "80%", height: "10px" } })]);
153
- }, function() {
154
- var s = this, e = s._self._c;
155
- return e("div", { staticStyle: { flex: "1 1 auto" } }, [e("div", { staticClass: "bg-gray-100", staticStyle: { width: "40%", height: "10px", "margin-bottom": "8px" } }), e("div", { staticClass: "bg-gray-100", staticStyle: { width: "80%", height: "10px" } })]);
156
- }], ze = /* @__PURE__ */ u(
157
- Me,
158
- Le,
159
- Ee,
160
- !1,
161
- null,
162
- "b67c5afd"
163
- );
164
- const We = ze.exports, Be = {
165
- name: "ArticleAutocomplete",
166
- components: {
167
- SearchApi: de
168
- },
169
- mixins: [y([])],
170
- props: {
171
- tag: {
172
- type: String,
173
- default: null
174
- },
175
- value: {
176
- type: String,
177
- required: !0
178
- },
179
- placement: {
180
- type: String,
181
- default: "bottom-start"
182
- }
183
- },
184
- data() {
185
- return {
186
- isFocus: !1,
187
- isOpen: !1,
188
- selectedIndex: 0,
189
- searchResults: []
190
- };
191
- },
192
- computed: {
193
- ...h({
194
- articleData: "articles/articles",
195
- ids: "articles/articleIdList"
196
- }),
197
- whiteList() {
198
- const s = [];
199
- if (this.$refs.dropdown !== void 0) {
200
- const e = this.$refs.dropdown.querySelectorAll("*");
201
- for (const t of e)
202
- s.push(t);
203
- }
204
- if (this.$refs.input !== void 0) {
205
- const e = this.$refs.input.$el.querySelectorAll("*");
206
- for (const t of e)
207
- s.push(t);
208
- }
209
- return s;
210
- }
211
- },
212
- watch: {
213
- searchResults(s, e) {
214
- s.length !== e.length && (this.selectedIndex = 0);
215
- }
216
- },
217
- created() {
218
- document.addEventListener("click", this.onClickOutside, { passive: !0 });
219
- },
220
- beforeDestroy() {
221
- document.removeEventListener("click", this.onClickOutside, {
222
- passive: !0
223
- });
224
- },
225
- methods: {
226
- ...v({
227
- loadArticles: p.LOAD_ARTICLES
228
- }),
229
- priceFormat: k,
230
- search(s, e) {
231
- this.$emit("input", e), !this.viewSettings.isPublicForm && s({
232
- q: e,
233
- cb: ({ article: t = [], extensionArticle: i = [] }) => {
234
- this.searchResults = [
235
- ...t.sort((n, a) => n.usedTimes > a.usedTimes ? -1 : 1),
236
- ...i
237
- ], !this.isOpen && this.searchResults.length && this.showResults();
238
- }
239
- });
240
- },
241
- // Function consumed by parent
242
- focus() {
243
- this.$refs.input.focus();
244
- },
245
- onFocus(s) {
246
- this.isFocus = !0, this.$emit("focus", s);
247
- },
248
- onBlur(s) {
249
- this.isFocus = !1, this.$emit("blur", s);
250
- },
251
- showResults() {
252
- this.isOpen = !0;
253
- },
254
- hideResults() {
255
- this.isOpen = !1;
256
- },
257
- onSelect(s) {
258
- this.$emit("select", s), this.hideResults(), this.$refs.input && this.$refs.input.blur();
259
- },
260
- onClickOutside(s) {
261
- this.whiteList.indexOf(s.target) < 0 && this.hideResults();
262
- },
263
- onKeydown({ keyCode: s }) {
264
- if (this.isOpen) {
265
- switch (s) {
266
- case 38:
267
- this.selectedIndex > 0 && this.selectedIndex--;
268
- break;
269
- case 40:
270
- this.selectedIndex < this.searchResults.length - 1 && this.selectedIndex++;
271
- break;
272
- case 13:
273
- this.searchResults[this.selectedIndex] && (this.onSelect(this.searchResults[this.selectedIndex]), this.searchResults = []);
274
- break;
275
- }
276
- this.scrollToHighlighted();
277
- }
278
- },
279
- scrollToHighlighted() {
280
- !this.$refs.dropdown || !this.$refs.dropdown.children || !this.$refs.dropdown.children[this.selectedIndex] || this.$refs.dropdown.children[this.selectedIndex].scrollIntoView({
281
- block: "nearest"
282
- });
283
- }
284
- }
285
- };
286
- var Fe = function() {
287
- var e = this, t = e._self._c;
288
- return t("div", { class: { "is-open": e.isOpen }, staticStyle: { position: "relative" }, on: { "&keydown": function(i) {
289
- return e.onKeydown.apply(null, arguments);
290
- } } }, [t("SearchApi", { attrs: { "custom-search": {
291
- article: !0,
292
- extensionArticle: !0,
293
- project: !1
294
- } }, scopedSlots: e._u([{ key: "default", fn: function({ fetch: i }) {
295
- return [t("CInput", e._b({ ref: "input", staticClass: "r-input", attrs: { value: e.value, type: e.tag, "auto-resize": !0 }, on: { input: function(n) {
296
- return e.search(i, n);
297
- }, focus: e.onFocus, blur: e.onBlur }, nativeOn: { keydown: [function(n) {
298
- return !n.type.indexOf("key") && e._k(n.keyCode, "tab", 9, n.key, "Tab") ? null : e.hideResults.apply(null, arguments);
299
- }, function(n) {
300
- return !n.type.indexOf("key") && e._k(n.keyCode, "escape", void 0, n.key, void 0) ? null : e.hideResults.apply(null, arguments);
301
- }] }, scopedSlots: e._u([{ key: "prefix", fn: function() {
302
- return [e._t("prefix")];
303
- }, proxy: !0 }, { key: "suffix", fn: function() {
304
- return [e._t("suffix")];
305
- }, proxy: !0 }], null, !0) }, "CInput", {
306
- ...e.$attrs,
307
- ...e.$props
308
- }, !1))];
309
- } }]) }), e.isOpen ? t("div", { ref: "dropdown", staticClass: "r-container" }, e._l(e.searchResults, function(i, n) {
310
- return t("div", { key: n, staticClass: "r-item", class: { active: e.selectedIndex === n }, on: { "!click": function(a) {
311
- return a.stopPropagation(), e.onSelect(i);
312
- } } }, [t("div", { staticClass: "r-item-title truncate-text" }, [e._v(e._s(i.name))]), t("div", { staticClass: "r-item-details" }, [i.externalReference && i.externalReference.service ? t("div", { staticStyle: { width: "18px", height: "18px", "border-radius": "2px", "background-color": "hsl(0, 0%, 60%)", display: "inline-flex", "justify-content": "center", "align-items": "center" } }, [t("CIcon", { staticStyle: { color: "white" }, attrs: { type: i.externalReference.service, size: "14" } })], 1) : e._e(), i.article_no ? t("div", [e._v(e._s(i.article_no))]) : e._e(), i.price ? t("div", [e._v(" " + e._s(e.priceFormat(i.price, { currency: i.currency })) + " ")]) : e._e(), i.vat ? t("div", [e._v(" " + e._s(e.$t("vat.sharedTitle").capitalize()) + " " + e._s(i.vat) + "% ")]) : e._e()]), e.selectedIndex === n ? t("div", { staticClass: "r-item-icon" }, [t("CIcon", { attrs: { type: "corner-down-left", size: "16" } })], 1) : e._e()]);
313
- }), 0) : e._e()], 1);
314
- }, je = [], Ne = /* @__PURE__ */ u(
315
- Be,
316
- Fe,
317
- je,
318
- !1,
319
- null,
320
- "d1cfa974"
321
- );
322
- const M = Ne.exports, P = {
323
- isDeductable: !1,
324
- isRut: !1,
325
- greenRot15: !1,
326
- greenRot20: !1,
327
- greenRot50: !1
328
- }, $ = (s, e = "", t) => {
329
- let i = {
330
- ...s,
331
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
332
- // Trigger updatedAt as it us used to decide which houseWork to prioritize
333
- };
334
- return typeof t < "u" && (i[t] = e), Object.keys(P).includes(t) && e && (i = {
335
- ...i,
336
- ...P,
337
- [t]: !0
338
- }), K(i.quantity) !== "number" && (i.quantity = 0), T(i);
339
- }, L = ({
340
- stored: s,
341
- current: e,
342
- hidePrice: t = !1,
343
- activeHouseWorkType: i
344
- }) => {
345
- let n = Y({
346
- ...s,
347
- quantity: 1,
348
- showPrice: !t,
349
- id: null,
350
- ArticleId: s.id,
351
- packageId: e.packageId
352
- });
353
- if (i) {
354
- const a = (l = []) => l.reduce((_, d) => ({ ..._, [d]: !1 }), {}), c = Object.values(
355
- R({
356
- rot: "isDeductable",
357
- rut: "isRut",
358
- greenRot15: "greenRot15",
359
- greenRot20: "greenRot20",
360
- greenRot50: "greenRot50"
361
- }, [i])
362
- );
363
- c.some((l) => !!n[l]) && (n = { ...n, ...a(c) });
364
- }
365
- return n;
366
- }, He = (s, e = null) => {
367
- const t = I(s.currency, e);
368
- switch (s.priceType) {
369
- case "approx":
370
- return `${Z.t("_common:approx")} ${t}`;
371
- case "openAcc":
372
- return `${t}/${f(s.unitType)}`;
373
- case "markup":
374
- return "%";
375
- default:
376
- return t;
377
- }
378
- }, E = {
379
- en: {
380
- namePlaceholder: "Service or product name",
381
- openModalTooltip: "Edit amount and unit",
382
- hidePriceLabel: "Hide price for client",
383
- saveAndAddTooltip: "Save and quick-add",
384
- priceTypeTooltips: {
385
- fixed: "The service / product is offered at a fixed price",
386
- approx: "Show that the price is approximate",
387
- openAcc: "Pricing on demand. E.g. charging per hour",
388
- markup: "Show that you take a percentage markup"
389
- },
390
- priceTypeShort: {
391
- approx: "Approximate price",
392
- markup: "Markup",
393
- openAcc: "Open Account"
394
- },
395
- validations: {
396
- name: {
397
- maxLength: "Max length of name is 255 characters"
398
- }
399
- }
400
- },
401
- sv: {
402
- namePlaceholder: "T.ex. arbete & material",
403
- openModalTooltip: "Justera antal / enhet",
404
- hidePriceLabel: "Dölj pris för kund",
405
- saveAndAddTooltip: "Spara och lägg till ny",
406
- priceTypeTooltips: {
407
- fixed: "Tjänsten/varan erbjuds till fast pris",
408
- approx: "Markera att priset är ungefärligt",
409
- openAcc: "Tjänsten / varan erbjuds löpandes",
410
- markup: "Markera att du tar ett procentuellt påslag"
411
- },
412
- priceTypeShort: {
413
- approx: "Ca. pris",
414
- markup: "Påslag",
415
- openAcc: "Löp. pris"
416
- },
417
- validations: {
418
- name: {
419
- maxLength: "Namnet får vara max 255 tecken långt"
420
- }
421
- }
422
- }
423
- }, z = {
424
- article: {
425
- name: {
426
- maxLength: pe.maxLength(255)
427
- }
428
- }
429
- }, qe = {
430
- // eslint-disable-next-line vue/no-reserved-component-names
431
- name: "Article",
432
- i18nOptions: {
433
- namespaces: "Article",
434
- messages: E
435
- },
436
- components: {
437
- ErrorCallout: V,
438
- ArticleAutocomplete: M,
439
- CPriceInput: w
440
- },
441
- props: {
442
- // Article object
443
- value: {
444
- type: Object,
445
- required: !0
446
- },
447
- // If remove button is visible
448
- enableRemove: {
449
- type: Boolean,
450
- default: !0
451
- },
452
- width: {
453
- type: Number,
454
- default: 1e3
455
- },
456
- hidePriceInput: {
457
- type: Boolean,
458
- default: !1
459
- },
460
- hidePriceOnNew: {
461
- type: Boolean,
462
- default: !1
463
- },
464
- isIncVat: {
465
- type: Boolean,
466
- default: !1
467
- },
468
- hideControls: {
469
- type: Boolean,
470
- default: !1
471
- },
472
- rootPriceType: {
473
- type: String,
474
- default: null
475
- },
476
- // The current active houseWorkType allowed when adding new articles from search
477
- activeHouseWorkType: {
478
- type: String,
479
- default: null
480
- }
481
- },
482
- validations: z,
483
- data() {
484
- return {
485
- updateData: $,
486
- addSavedArticle: L,
487
- articleUnitLabel: f,
488
- widthCompact: 580,
489
- visualDisable: !1
490
- };
491
- },
492
- computed: {
493
- article: {
494
- get() {
495
- return this.value || {};
496
- },
497
- set(s) {
498
- this.$emit("input", s);
499
- }
500
- },
501
- details() {
502
- const s = [], {
503
- priceType: e,
504
- quantity: t,
505
- unitType: i,
506
- price: n,
507
- vat: a,
508
- discount: r,
509
- discountType: c
510
- } = this.article;
511
- if (e !== "fixed" && s.push({ title: this.$t(`priceTypeShort.${e}`) }), J(this.article)) {
512
- const l = X(this.article);
513
- s.push({
514
- title: this.$t(`_common:deduction.${l}_percentage`)
515
- });
516
- }
517
- return t && ["fixed", "approx"].includes(e) && (i !== "unit" || t > 1) && s.push({
518
- title: f(this.article.unitType, {
519
- count: t,
520
- includeCount: !0
521
- }),
522
- ...!this.hidePriceInput && {
523
- icon: '<svg style="margin: 0 4px;" width="6" height="6" viewBox="0 0 148 141" xmlns="http://www.w3.org/2000/svg"><path d="M73.742787 92.65535l-34.444359 47.40859-18.607391-13.51906 34.060775-46.88064L0 61.8743 7.107391 40 62 57.83569V0h23v57.99346L140.378182 40l7.107391 21.8743-54.751812 17.78994 34.060775 46.88064-18.607391 13.51906-34.444358-47.40859z" fill="currentColor" fill-rule="evenodd"/></svg>',
524
- subTitle: k(n, {
525
- showZero: !0,
526
- withVat: this.isIncVat ? a : !1,
527
- currency: this.article.currency,
528
- decimals: 2,
529
- hideZeroDecimals: !0
530
- })
531
- }
532
- }), r && s.push({
533
- title: "-" + (c === "fixed" ? k(r, {
534
- withVat: this.isIncVat ? a : !1,
535
- currency: this.article.currency
536
- }) : `${r / 100} %`),
537
- detailClass: "discount"
538
- }), s;
539
- }
540
- },
541
- methods: {
542
- updateArticle(s, e) {
543
- this.article = $(this.article, s, e);
544
- },
545
- onTotalPriceInputFocus() {
546
- (this.article.discount || this.article.quantity !== 1) && this.$emit("open-modal", { focusEl: "priceInput" });
547
- },
548
- focusName() {
549
- this.$refs.name.focus();
550
- },
551
- errorMessage(s) {
552
- return s.$error && s.article.name.$error && !s.article.name.maxLength ? this.$t("validations.name.maxLength") : null;
553
- }
554
- }
555
- };
556
- var Ue = function() {
557
- var e = this, t = e._self._c;
558
- return t("div", { staticClass: "article-wrapper", class: {
559
- "has-details": e.details.length,
560
- compact: e.width <= e.widthCompact,
561
- "show-controls": !e.hideControls
562
- }, on: { keydown: function(i) {
563
- return !i.type.indexOf("key") && e._k(i.keyCode, "esc", 27, i.key, ["Esc", "Escape"]) ? null : e.$emit("esc");
564
- } } }, [t("div", { staticClass: "top-row flex w-full" }, [t("ArticleAutocomplete", { ref: "name", staticClass: "article-name-wrapper article-input-wrapper form-control form-control-left", attrs: { value: e.article.name, placeholder: e.$t("namePlaceholder"), size: "large" }, on: { input: function(i) {
565
- return e.updateArticle(i, "name");
566
- }, focus: function(i) {
567
- return e.$emit("focus");
568
- }, select: function(i) {
569
- e.$emit(
570
- "input",
571
- e.addSavedArticle({
572
- stored: i,
573
- current: e.article,
574
- hidePrice: e.hidePriceOnNew,
575
- activeHouseWorkType: e.activeHouseWorkType
576
- })
577
- ), e.$emit("select");
578
- } }, scopedSlots: e._u([{ key: "suffix", fn: function() {
579
- return [e.hideControls ? e._e() : t("div", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: {
580
- content: e.$t("openModalTooltip"),
581
- delay: { show: 300, hide: 0 }
582
- }, expression: `{
583
- content: $t('openModalTooltip'),
584
- delay: { show: 300, hide: 0 }
585
- }` }], staticClass: "article-button fade-in", on: { click: function(i) {
586
- return e.$emit("open-modal");
587
- } } }, [t("CIcon", { attrs: { type: "cog", size: "18" } })], 1)];
588
- }, proxy: !0 }]) }), e.hidePriceInput ? e._e() : t("CPriceInput", { key: e.rootPriceType + e.article.priceType + e.article.unitType, staticClass: "form-control form-control-right", staticStyle: { flex: "1 1", "min-width": "200px" }, attrs: { value: e.article.totalAmount, currency: e.article.currency, "is-inc-vat": e.article.priceType !== "markup" && e.isIncVat, vat: e.article.vat, placeholder: e.$t("_common:price.price").capitalize(), "price-type": e.article.priceType, "unit-label": e.articleUnitLabel(e.article.unitType) }, on: { input: function(i) {
589
- return e.updateArticle(i, "price");
590
- }, "update:currency": function(i) {
591
- return e.$emit("update:currency", i);
592
- }, focus: function(i) {
593
- e.onTotalPriceInputFocus(), e.$emit("focus");
594
- } }, nativeOn: { keydown: function(i) {
595
- return !i.type.indexOf("key") && e._k(i.keyCode, "enter", 13, i.key, "Enter") ? null : e.$emit("add");
596
- } } }), e.hideControls ? e._e() : [t("CIcon", { staticClass: "a-control-button close-button fade-in", attrs: { circle: "", type: "x", size: "18" }, nativeOn: { click: function(i) {
597
- e.enableRemove && e.$emit("remove");
598
- } } }), t("CIcon", { staticClass: "a-control-button fade-in move-button article-draggable-handle", class: { "c-hidden": !e.enableRemove }, attrs: { circle: "", type: "handle", size: "18" } })]], 2), e.details.length ? t("div", { staticClass: "article-details-wrapper", staticStyle: { cursor: "pointer" }, on: { click: function(i) {
599
- return e.$emit("open-modal");
600
- } } }, e._l(e.details, function({ title: i, icon: n, subTitle: a = "", detailClass: r = "" }, c) {
601
- return t("div", { key: c, staticClass: "article-details-item", class: [r] }, [e._v(" " + e._s(i) + " "), n ? t("div", { domProps: { innerHTML: e._s(n) } }) : e._e(), e._v(" " + e._s(a) + " ")]);
602
- }), 0) : e._e(), e.$v.$invalid && e.$v.$dirty ? t("ErrorCallout", { attrs: { message: e.errorMessage(e.$v) } }) : e._e()], 1);
603
- }, Ge = [], Ke = /* @__PURE__ */ u(
604
- qe,
605
- Ue,
606
- Ge,
607
- !1,
608
- null,
609
- "417bbfef"
610
- );
611
- const Ye = Ke.exports, Ze = {
612
- props: {
613
- canForward: {
614
- type: Boolean,
615
- default: !1
616
- },
617
- canBackward: {
618
- type: Boolean,
619
- default: !1
620
- }
621
- },
622
- created() {
623
- document.addEventListener("keyup", this.onKeyUp);
624
- },
625
- beforeDestroy() {
626
- this.removeKeyHandler();
627
- },
628
- methods: {
629
- getNavTooltip(s) {
630
- return s === -1 ? {
631
- content: `
632
- <div style='margin-bottom: 0.6em;'>
633
- ${this.$t("show", { thing: this.$t("previous") })}
634
- </div>
635
- <div class='flex items-center justify-center w-full' style='padding-bottom: 0.5em;'>
636
- <div style='text-align: center; background-color: hsl(0, 0%, 40%); line-height: 1; border-radius: 0.5em; display: inline-flex; align-items: center; justify-content: center; padding: 0.5em;'>
637
- <svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M19 12H6M12 5l-7 7 7 7'></path></svg>
638
- </div>
639
- </div>
640
- `,
641
- html: !0
642
- } : s === 1 ? {
643
- content: `
644
- <div style='margin-bottom: 0.6em;'>
645
- ${this.$t("show", { thing: this.$t("next") })}
646
- </div>
647
- <div class='flex items-center justify-center w-full' style='padding-bottom: 0.5em;'>
648
- <div style='text-align: center; background-color: hsl(0, 0%, 40%); line-height: 1; border-radius: 0.5em; display: inline-flex; align-items: center; justify-content: center; padding: 0.5em;'>
649
- <svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h13M12 5l7 7-7 7'/></svg>
650
- </div>
651
- </div>
652
- `,
653
- html: !0
654
- } : s === "close" ? {
655
- content: '<div style="margin-bottom: 0.6em;">Stäng</div><div style="text-align: center; opacity: 0.85;"><svg width="30" height="20" xmlns="http://www.w3.org/2000/svg" viewBox="17 0 105.5 72" style="enable-background:new 17 0 105.5 72"><path d="M103.3 70.3H36.2c-9.6 0-17.5-7.9-17.5-17.5V19.2c0-9.6 7.9-17.5 17.5-17.5h67.1c9.6 0 17.5 7.9 17.5 17.5v33.6c0 9.6-7.9 17.5-17.5 17.5z" style="fill:none;stroke:currentColor;stroke-width:3;stroke-miterlimit:10"/><path style="fill:none" d="M17 17.8h105.5V49H17z"/><path fill="currentColor" d="M46.6 38.2c.1 5 3.3 7.1 7 7.1 2.6 0 4.2-.5 5.6-1l.6 2.6c-1.3.6-3.5 1.3-6.8 1.3-6.3 0-10-4.1-10-10.2s3.6-11 9.5-11c6.6 0 8.4 5.8 8.4 9.6 0 .8-.1 1.3-.1 1.7l-14.2-.1zm10.9-2.7c0-2.4-1-6-5.1-6-3.7 0-5.4 3.4-5.7 6h10.8zM65.1 43.9c1.1.7 3 1.5 4.9 1.5 2.7 0 3.9-1.3 3.9-3 0-1.8-1-2.7-3.8-3.7-3.7-1.3-5.4-3.3-5.4-5.8 0-3.3 2.6-6 7-6 2.1 0 3.9.6 5 1.3l-.9 2.7c-.8-.5-2.3-1.2-4.2-1.2-2.2 0-3.4 1.3-3.4 2.8 0 1.7 1.2 2.4 3.9 3.4 3.5 1.3 5.3 3.1 5.3 6.1 0 3.6-2.8 6.1-7.6 6.1-2.2 0-4.3-.5-5.7-1.4l1-2.8zM96.7 46.9c-1 .5-3.1 1.2-5.8 1.2-6.1 0-10.1-4.2-10.1-10.4 0-6.3 4.3-10.8 10.9-10.8 2.2 0 4.1.5 5.1 1l-.8 2.9c-.9-.5-2.3-1-4.3-1-4.7 0-7.2 3.4-7.2 7.7 0 4.7 3 7.6 7.1 7.6 2.1 0 3.5-.5 4.5-1l.6 2.8z"/></svg></div>',
656
- html: !0
657
- } : null;
658
- },
659
- onKeyUp(s) {
660
- const e = document.activeElement;
661
- !(e.hasAttribute("contenteditable") || ["input", "textarea"].includes(e.tagName.toLowerCase())) && (parseInt(s.keyCode, 10) === 37 && this.$emit("go", -1), parseInt(s.keyCode, 10) === 39 && this.$emit("go", 1));
662
- const i = s.key || s.keyCode;
663
- if (i === "Escape" || i === "Esc" || i === 27) {
664
- const n = this.$modal.getOpenInstances();
665
- if (s.defaultPrevented || n.length)
666
- return;
667
- this.$emit("close");
668
- }
669
- },
670
- removeKeyHandler() {
671
- document.removeEventListener("keyup", this.onKeyUp);
672
- }
673
- },
674
- render() {
675
- return this.$scopedSlots.default({
676
- leftTooltip: this.getNavTooltip(-1),
677
- rightTooltip: this.getNavTooltip(1),
678
- closeTooltip: this.getNavTooltip("close")
679
- });
680
- }
681
- };
682
- var Je = function() {
683
- var e = this, t = e._self._c;
684
- return t("div", { staticClass: "l-root" }, [t("div", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: e.getNavTooltip(-1), expression: "getNavTooltip(-1)" }], staticClass: "l-button", class: { disabled: !e.canBackward }, staticStyle: { left: "calc(-4 * var(--rem))" }, on: { click: function(i) {
685
- return e.$emit("go", -1);
686
- } } }, [t("svg", { attrs: { xmlns: "http://www.w3.org/2000/svg", width: "35", height: "35", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" } }, [t("path", { attrs: { d: "M15 18l-6-6 6-6" } })])]), t("div", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: e.getNavTooltip(1), expression: "getNavTooltip(1)" }], staticClass: "l-button", class: { disabled: !e.canForward }, staticStyle: { right: "calc(-4 * var(--rem))" }, on: { click: function(i) {
687
- return e.$emit("go", 1);
688
- } } }, [t("svg", { attrs: { xmlns: "http://www.w3.org/2000/svg", width: "35", height: "35", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" } }, [t("path", { attrs: { d: "M9 18l6-6-6-6" } })])])]);
689
- }, Xe = [], Qe = /* @__PURE__ */ u(
690
- Ze,
691
- Je,
692
- Xe,
693
- !1,
694
- null,
695
- "226f5608"
696
- );
697
- const et = Qe.exports, tt = {
698
- name: "ArticleUnitEditModal",
699
- i18nOptions: {
700
- namespaces: "ArticleUnitEditModal",
701
- messages: {
702
- en: {
703
- tooltip: `
704
- <div>
705
- Tip: If you'd like for the unit type to pluralize automatically. Use the following format - <span style="padding: 3px; background-color: hsla(0, 0%, 100%, 0.1); border-radius: 4px;">single:plural</span>.
706
- </div>
707
- <div style="margin-top: 0.5em;">For example:</div>
708
- <div style="margin-left: 0.25em;">- image:images</div>
709
- <div style="margin-left: 0.25em;">- phone:phones</div>
710
- `
711
- },
712
- sv: {
713
- tooltip: `
714
- <div>
715
- Tips: Om du vill att enheten ska ta hänsyn till antalet så kan du skriva det i följande format - <span style="padding: 3px; background-color: hsla(0, 0%, 100%, 0.1); border-radius: 4px;">singular:plural</span>.
716
- </div>
717
- <div style="margin-top: 0.5em;">Till exempel:</div>
718
- <div style="margin-left: 0.25em;">- bild:bilder</div>
719
- <div style="margin-left: 0.25em;">- telefon:telefoner</div>
720
- `
721
- }
722
- }
723
- },
724
- components: {
725
- DragList: Q,
726
- DragItem: ee,
727
- CField: O
728
- },
729
- data() {
730
- return {
731
- hoverIndex: null,
732
- removeConfirmIndex: null,
733
- selectedValue: {
734
- id: null,
735
- value: ""
736
- },
737
- idList: []
738
- };
739
- },
740
- computed: {
741
- ...h({
742
- isPosting: "unitTypes/isPosting",
743
- stateUnitIds: "unitTypes/ids",
744
- unitById: "unitTypes/byId"
745
- }),
746
- unitItems() {
747
- return (this.idList || []).map((s) => {
748
- const e = this.unitById(s), t = f(e.value);
749
- return {
750
- ...e,
751
- label: t,
752
- value: e.value.startsWith("$") ? e.value.replace(/^[$]/, "") : t,
753
- raw: e.value.replace(/^[$]/, "")
754
- // replace only first occurance of '$'
755
- };
756
- });
757
- }
758
- },
759
- watch: {
760
- stateUnitIds: {
761
- immediate: !0,
762
- handler(s) {
763
- this.idList = s || [];
764
- }
765
- }
766
- },
767
- methods: {
768
- ...v({
769
- loadUnits: p.LOAD_UNIT_TYPES,
770
- createUnit: p.CREATE_UNIT_TYPE,
771
- updateUnit: p.UPDATE_UNIT_TYPE,
772
- deleteUnit: p.DELETE_UNIT_TYPE
773
- }),
774
- onEdit(s) {
775
- this.selectedValue = { ...s }, this.$refs.unitInput && this.$refs.unitInput.focus();
776
- },
777
- async submit() {
778
- const { id: s, value: e } = this.selectedValue || {};
779
- if (!e)
780
- throw new Error("New unitTypes need truthy value!");
781
- const t = `$${e}`;
782
- s ? await this.updateUnit({ id: s, body: { value: t } }) : await this.createUnit({ body: { value: t } }), this.reset(), this.$parent.$emit("select", t), this.close();
783
- },
784
- async remove(s, e) {
785
- if (this.removeConfirmIndex !== e) {
786
- this.removeConfirmIndex = e;
787
- return;
788
- }
789
- await this.deleteUnit({ id: s }), this.reset(), this.removeConfirmIndex = null;
790
- },
791
- reset() {
792
- this.selectedValue = { id: null, value: "" };
793
- },
794
- close() {
795
- this.$emit("close");
796
- },
797
- async onDrop({ removedIndex: s, addedIndex: e }) {
798
- s === null && e === null || s !== e && (this.idList = A(this.idList, s, e), await te(
799
- "/unitType/setPositions",
800
- { ids: this.idList },
801
- { invalidateCache: { type: "unitType" } }
802
- ), this.reset(), await this.loadUnits());
803
- }
804
- }
805
- };
806
- var it = function() {
807
- var e = this, t = e._self._c;
808
- return t("div", { staticClass: "modal-overlay font-inter", on: { "&click": function(i) {
809
- return i.target !== i.currentTarget ? null : e.close.apply(null, arguments);
810
- } } }, [t("div", { staticClass: "unit-modal-root font-inter", staticStyle: { position: "relative" } }, [t("div", { staticStyle: { padding: "calc(1.5 * var(--rem))" } }, [t("div", { staticStyle: { "font-weight": "600", "font-size": "18px", "margin-bottom": "calc(1.5 * var(--rem))" } }, [t("span", [e._v(e._s(e.$t("_common:add", { thing: e.$t("_common:unitType.unitType_plural") })))]), t("CIcon", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: { content: e.$t("tooltip"), html: !0 }, expression: "{ content: $t('tooltip'), html: true }" }], staticClass: "text-gray-400", staticStyle: { "margin-left": "0.5em" }, attrs: { type: "info", size: "15" } })], 1), t("CField", { staticStyle: { margin: "0" }, attrs: { grouped: "" } }, [t("CInput", { ref: "unitInput", staticClass: "unit-input", attrs: { placeholder: e.$t("_common:name").capitalize(), expanded: "", filled: "" }, scopedSlots: e._u([e.selectedValue.id ? { key: "suffix", fn: function() {
811
- return [t("CButton", { staticStyle: { "border-radius": "4px" }, attrs: { icon: "x", type: "none", pattern: "tertiary", size: "small" }, on: { click: e.reset } })];
812
- }, proxy: !0 } : null], null, !0), model: { value: e.selectedValue.value, callback: function(i) {
813
- e.$set(e.selectedValue, "value", typeof i == "string" ? i.trim() : i);
814
- }, expression: "selectedValue.value" } }), t("div", { staticClass: "control" }, [t("CButton", { attrs: { loading: e.isPosting, disabled: !e.selectedValue.value, type: "secondary" }, on: { click: e.submit } }, [e._v(" " + e._s(e.selectedValue.id ? e.$t("_common:save") : e.$t("_common:add")) + " ")])], 1)], 1)], 1), t("div", { staticStyle: { "border-top": "1px solid hsl(0, 0%, 88%)", overflow: "auto", "max-height": "360px" } }, [t("div", { staticClass: "text-gray-400", staticStyle: { "font-size": "14px", padding: "calc(1 * var(--rem)) calc(1.5 * var(--rem)) 0", "font-weight": "500" } }, [e._v(" " + e._s(e.$t("_common:unit_plural").capitalize()) + " ")]), t("div", { staticClass: "unit-modal-list" }, [e.unitItems.length ? e._e() : t("div", { staticClass: "unit-modal-list-empty" }, [e._v(" " + e._s(e.$t("_common:add", { thing: e.$t("_common:unit_plural") })) + " ")]), t("DragList", { attrs: { "drop-placeholder": { className: "drag-drop-placeholder" }, "drag-class": "is-dragged", "lock-axis": "y", "drag-handle-selector": ".drag-handle" }, on: { drop: e.onDrop } }, e._l(e.unitItems, function(i, n) {
815
- return t("DragItem", { key: i.id }, [t("div", { staticClass: "unit-modal-list-item", class: { "is-editing": e.selectedValue.id === i.id }, on: { "&mouseover": function(a) {
816
- e.hoverIndex = n;
817
- }, "&mouseleave": function(a) {
818
- e.hoverIndex = null;
819
- }, click: function(a) {
820
- return e.onEdit(i);
821
- } } }, [t("div", { staticClass: "drag-handle" }, [t("CIcon", { staticClass: "text-gray-300", attrs: { type: "handle", size: "16" } })], 1), t("div", { staticStyle: { "padding-left": "0.5em" } }, [e._v(" " + e._s(i.label) + " ")]), t("span", { directives: [{ name: "show", rawName: "v-show", value: e.removeConfirmIndex === n, expression: "removeConfirmIndex === i" }], staticClass: "delete-confirm" }, [e._v(" " + e._s(e.$t("_common:remove")) + "? ")]), t("div", { staticClass: "unittype-buttons" }, [e.hoverIndex === n || e.removeConfirmIndex === n ? t("CButton", { attrs: { type: e.removeConfirmIndex === n ? "danger" : "none", pattern: e.removeConfirmIndex === n ? "primary" : "tertiary", circle: "", icon: "x", size: "small" }, on: { click: function(a) {
822
- return a.stopPropagation(), a.preventDefault(), e.remove(i.id, n);
823
- }, blur: function(a) {
824
- e.removeConfirmIndex = null;
825
- } } }) : e._e(), t("CButton", { attrs: { icon: "edit", size: "small", type: "none", pattern: "tertiary", circle: "" } })], 1)])]);
826
- }), 1)], 1)])])]);
827
- }, st = [], at = /* @__PURE__ */ u(
828
- tt,
829
- it,
830
- st,
831
- !1,
832
- null,
833
- "ae81b7f5"
834
- );
835
- const nt = at.exports, rt = {
836
- name: "ArticleUnitSelect",
837
- components: {
838
- CDropdown: x,
839
- CDropdownItem: b
840
- },
841
- props: {
842
- value: {
843
- type: String,
844
- required: !0
845
- },
846
- isPublicForm: {
847
- type: Boolean,
848
- default: !1
849
- },
850
- // Optional param for plural translations
851
- count: {
852
- type: Number,
853
- default: 1
854
- }
855
- },
856
- computed: {
857
- ...h({
858
- unitIds: "unitTypes/ids",
859
- unitById: "unitTypes/byId"
860
- }),
861
- unitItems() {
862
- return this.isPublicForm ? he : (this.unitIds || []).map((s) => this.unitById(s)).map(({ value: s }) => s);
863
- }
864
- },
865
- created() {
866
- this.isPublicForm || this.loadUnits();
867
- },
868
- methods: {
869
- articleUnitLabel: f,
870
- ...v({
871
- loadUnits: p.LOAD_UNIT_TYPES
872
- }),
873
- openEditModal() {
874
- this.$modal.show(
875
- nt,
876
- {},
877
- {},
878
- {
879
- select: (s) => this.$emit("input", s)
880
- }
881
- );
882
- }
883
- }
884
- };
885
- var ot = function() {
886
- var e = this, t = e._self._c;
887
- return t("CDropdown", e._b({ attrs: { value: e.value, scrollable: "" }, on: { input: function(i) {
888
- return e.$emit("input", i);
889
- } }, scopedSlots: e._u([{ key: "trigger", fn: function() {
890
- return [e._t("default", function() {
891
- return [t("CButton", { attrs: { type: "none", pattern: "tertiary" } }, [e._v(" " + e._s(e.articleUnitLabel(e.value)) + " ")])];
892
- })];
893
- }, proxy: !0 }, { key: "footer", fn: function() {
894
- return [e.isPublicForm ? e._e() : t("CButton", { staticClass: "edit-button", attrs: { type: "none", pattern: "secondary", size: "small" }, on: { click: e.openEditModal } }, [e._v(" " + e._s(e.$t("_common:edit", { thing: e.$t("_common:unit_plural") })) + " ")])];
895
- }, proxy: !0 }], null, !0) }, "CDropdown", {
896
- position: "is-bottom-left",
897
- maxHeight: "240px",
898
- ...e.$attrs
899
- }, !1), e._l(e.unitItems, function(i, n) {
900
- return t("CDropdownItem", { key: `${i}-${n}`, attrs: { value: i } }, [e._v(" " + e._s(e.articleUnitLabel(i)) + " ")]);
901
- }), 1);
902
- }, ct = [], lt = /* @__PURE__ */ u(
903
- rt,
904
- ot,
905
- ct,
906
- !1,
907
- null,
908
- "70333fd5"
909
- );
910
- const ut = lt.exports, dt = {
911
- name: "ArticleModal",
912
- i18nOptions: {
913
- namespaces: "ArticleModal",
914
- messages: E
915
- },
916
- components: {
917
- ArticleAutocomplete: M,
918
- ArticleUnitSelect: ut,
919
- ListModalButtons: et,
920
- CPriceInput: w,
921
- CField: O
922
- },
923
- mixins: [B],
924
- props: {
925
- _document: {
926
- type: Object,
927
- default: () => ({})
928
- },
929
- // Article object
930
- index: {
931
- type: Number,
932
- required: !0
933
- },
934
- articleList: {
935
- type: Array,
936
- required: !0
937
- },
938
- // If priceType checkboxes should be visible
939
- enablePriceTypes: {
940
- type: Boolean,
941
- default: !0
942
- },
943
- hidePriceInput: {
944
- type: Boolean,
945
- default: !1
946
- },
947
- hidePriceOnNew: {
948
- type: Boolean,
949
- default: !1
950
- },
951
- isIncVat: {
952
- type: Boolean,
953
- default: !1
954
- },
955
- rootPriceType: {
956
- type: String,
957
- default: "fixed"
958
- },
959
- currency: {
960
- type: String,
961
- required: !0
962
- },
963
- activeHouseWorkType: {
964
- type: String,
965
- default: null
966
- },
967
- // Mixin props are not injected when rendered within a portal
968
- viewSettings: {
969
- type: Object,
970
- default: () => ({
971
- canEdit: !1,
972
- isForm: !1,
973
- setFormValue: null,
974
- isPublicForm: !1
975
- })
976
- }
977
- },
978
- validations: z,
979
- data() {
980
- return {
981
- priceSuffix: He,
982
- updateData: $,
983
- addSavedArticle: L,
984
- vatOptions: [
985
- { value: 25, translation: "25%" },
986
- { value: 12, translation: "12%" },
987
- { value: 6, translation: "6%" },
988
- { value: 0, translation: "0%" }
989
- ],
990
- showDiscountInput: !1,
991
- setPricesIncVat: !1,
992
- getCurrencySymbol: I,
993
- articleUnitLabel: f
994
- };
995
- },
996
- computed: {
997
- ...h({
998
- allowHidePrice: "settings/allowHidePrice",
999
- getCompanySetting: "settings/getCompanySetting",
1000
- feature: "application/feature"
1001
- }),
1002
- article: {
1003
- get() {
1004
- return this.articleList[this.index] || {};
1005
- },
1006
- set(s) {
1007
- this.$emit("input", s);
1008
- }
1009
- },
1010
- useVat() {
1011
- return o(this, "_document.useVat") || "";
1012
- },
1013
- vatType() {
1014
- return o(this, "_document.vatType") || "";
1015
- },
1016
- checkboxItems() {
1017
- const { article: s } = this || {}, { priceType: e } = this.article || {}, t = [
1018
- ...e !== "markup" ? [
1019
- {
1020
- label: this.$t("discount").capitalize(),
1021
- value: s.discount || this.showDiscountInput,
1022
- onClick: () => {
1023
- this.showDiscountInput || this.focusEl("discountInput"), this.showDiscountInput = !this.showDiscountInput;
1024
- }
1025
- }
1026
- ] : [],
1027
- ...this.getCompanySetting("showRot") || s.isDeductable ? [
1028
- {
1029
- label: this.$t("_common:deduction.rot"),
1030
- value: this.article.isDeductable,
1031
- onClick: () => this.updateArticle(!s.isDeductable, "isDeductable")
1032
- }
1033
- ] : [],
1034
- ...this.getCompanySetting("showRut") || s.isRut ? [
1035
- {
1036
- label: this.$t("_common:deduction.rut"),
1037
- value: s.isRut,
1038
- onClick: () => this.updateArticle(!s.isRut, "isRut")
1039
- }
1040
- ] : [],
1041
- ...s.greenRot15 ? [
1042
- {
1043
- label: this.$t("_common:deduction.greenRot15_percentage"),
1044
- value: s.greenRot15,
1045
- onClick: () => this.updateArticle(!s.greenRot15, "greenRot15")
1046
- }
1047
- ] : [],
1048
- ...this.getCompanySetting("showGreenRot") || s.greenRot20 || s.greenRot50 ? [
1049
- {
1050
- label: this.$t("_common:deduction.greenRot20_percentage"),
1051
- value: s.greenRot20,
1052
- onClick: () => this.updateArticle(!s.greenRot20, "greenRot20")
1053
- },
1054
- {
1055
- label: this.$t("_common:deduction.greenRot50_percentage"),
1056
- value: s.greenRot50,
1057
- onClick: () => this.updateArticle(!s.greenRot50, "greenRot50")
1058
- }
1059
- ] : []
1060
- ];
1061
- if (this.allowHidePrice) {
1062
- const { showPrice: i } = s || {};
1063
- t.push({
1064
- label: this.$t("hidePriceLabel"),
1065
- value: !i,
1066
- onClick: () => this.updateArticle(!i, "showPrice")
1067
- });
1068
- }
1069
- return t;
1070
- },
1071
- priceTypeOptions() {
1072
- if (!this.enablePriceTypes || this.rootPriceType === "fixed")
1073
- return [];
1074
- const { priceType: s } = this.article, e = (i) => this.$t(`priceTypeTooltips.${i}`), t = [
1075
- {
1076
- label: this.$t("price.fixed"),
1077
- tooltip: e("fixed"),
1078
- value: s === "fixed",
1079
- onClick: () => this.updateArticle("fixed", "priceType")
1080
- }
1081
- ];
1082
- return this.rootPriceType === "approx" && t.push({
1083
- label: this.$t("price.approx"),
1084
- tooltip: e("approx"),
1085
- value: s === "approx",
1086
- onClick: () => this.updateArticle("approx", "priceType")
1087
- }), this.rootPriceType.startsWith("openAcc") && (t.push({
1088
- label: this.$t("price.openAcc"),
1089
- tooltip: e("openAcc"),
1090
- value: s === "openAcc",
1091
- onClick: () => this.updateArticle("openAcc", "priceType")
1092
- }), t.push({
1093
- label: this.$t("price.markup"),
1094
- tooltip: e("markup"),
1095
- value: s === "markup",
1096
- onClick: () => this.updateArticle("markup", "priceType")
1097
- })), t;
1098
- }
1099
- },
1100
- watch: {
1101
- index: {
1102
- immediate: !0,
1103
- handler(s, e) {
1104
- s !== e && (this.showDiscountInput = !1);
1105
- }
1106
- },
1107
- isIncVat: {
1108
- immediate: !0,
1109
- handler(s) {
1110
- this.setPricesIncVat = !!s;
1111
- }
1112
- },
1113
- "article.discount": {
1114
- immediate: !0,
1115
- handler(s) {
1116
- s && (this.showDiscountInput = !0);
1117
- }
1118
- },
1119
- "article.priceType": {
1120
- handler(s) {
1121
- s === "markup" && (this.showDiscountInput = !1), ["openAcc", "markup"].includes(s) && this.updateArticle(1, "quantity");
1122
- }
1123
- },
1124
- showDiscountInput(s) {
1125
- s || this.updateArticle(0, "discount");
1126
- }
1127
- },
1128
- mounted() {
1129
- !this.article.name && this.$refs.nameInput && this.$refs.nameInput.focus(), document.addEventListener("keydown", this.onKeydown);
1130
- },
1131
- beforeDestroy() {
1132
- document.removeEventListener("keydown", this.onKeydown);
1133
- },
1134
- methods: {
1135
- ...v({
1136
- createArticle: p.DO_CREATE_ARTICLE
1137
- }),
1138
- onCustomVatBlur(s) {
1139
- o(s, "target.value") || "" || this.updateArticle(0, "vat");
1140
- },
1141
- onCustomVatInput(s) {
1142
- const e = o(s, "target.value") || "";
1143
- if (!e)
1144
- return;
1145
- let t = e > 100 ? e.slice(0, e.length - 1) : e;
1146
- t < 0 && (t = 0), this.updateArticle(Number.parseFloat(t), "vat");
1147
- },
1148
- updateArticle(s, e) {
1149
- this.article = $(this.article, s, e);
1150
- },
1151
- close() {
1152
- this.$emit("close");
1153
- },
1154
- onKeydown(s) {
1155
- s.keyCode === 13 && s.shiftKey && (s.preventDefault(), this.addNewArticle());
1156
- },
1157
- onGo(s) {
1158
- const e = this.index + s;
1159
- this.articleList[e] && (this.close(), this.$emit("open-modal", e));
1160
- },
1161
- async addNewArticle() {
1162
- this.$v.$invalid || await this.saveArticle(), this.$emit("add", { openModal: !0 }), this.close();
1163
- },
1164
- focusEl(s) {
1165
- this.$nextTick(() => {
1166
- this.$nextTick(() => {
1167
- this.$refs[s] && this.$refs[s].focus && this.$refs[s].focus();
1168
- });
1169
- });
1170
- },
1171
- onTotalPriceInputFocus() {
1172
- this.article.quantity > 1 && this.$nextTick(() => {
1173
- this.$refs.priceInput && this.$refs.priceInput.focus();
1174
- });
1175
- },
1176
- toggleDiscountType() {
1177
- let s = "fixed";
1178
- this.article.discountType === "fixed" && (s = "percentage"), this.updateArticle(s, "discountType");
1179
- },
1180
- async onSaveArticle() {
1181
- if (this.$v.$invalid) {
1182
- this.$v.$touch();
1183
- return;
1184
- }
1185
- await this.saveArticle(), this.close();
1186
- },
1187
- async saveArticle() {
1188
- if (this.viewSettings.isPublicForm)
1189
- return;
1190
- let { ArticleId: s } = this.article;
1191
- !s && ((t) => typeof t == "string" && !!t.trim())(this.article.name) && (s = await this.createArticle({
1192
- body: this.article,
1193
- showMessage: !1
1194
- }), this.article = { ...this.article, ArticleId: s });
1195
- }
1196
- }
1197
- };
1198
- var pt = function() {
1199
- var e = this, t = e._self._c;
1200
- return t("div", { staticClass: "font-inter", class: {
1201
- "full-screen": e.mq === "sm",
1202
- "modal-overlay": !0
1203
- }, on: { "&click": function(i) {
1204
- return i.target !== i.currentTarget ? null : e.close.apply(null, arguments);
1205
- } } }, [t("div", { staticClass: "modal-container" }, [e.mq !== "sm" ? t("ListModalButtons", { attrs: { "can-forward": !!e.articleList[e.index + 1], "can-backward": !!e.articleList[e.index - 1] }, on: { close: e.close, go: function(i) {
1206
- return e.onGo(i);
1207
- } } }) : t("div", { staticClass: "modal-close", on: { click: e.close } }, [t("CIcon", { attrs: { type: "x" } })], 1), t("transition", { attrs: { name: "slide" } }, [t("div", { key: e.article._uniqueId, staticClass: "modal-main" }, [t("CField", { staticClass: "label-selector", staticStyle: { "margin-bottom": "1.5em" }, attrs: { validator: e.$v.article.name, messages: { maxLength: e.$t("validations.name.maxLength") }, label: e.$t("name").capitalize(), "label-position": "inside" } }, [t("ArticleAutocomplete", { ref: "nameInput", staticClass: "input-selector", attrs: { value: e.article.name, autosize: !0, tag: "textarea", placeholder: "", size: "large" }, on: { input: function(i) {
1208
- return e.updateArticle(i, "name");
1209
- }, select: function(i) {
1210
- e.$emit(
1211
- "input",
1212
- e.addSavedArticle({
1213
- stored: i,
1214
- current: e.article,
1215
- hidePrice: e.hidePriceOnNew,
1216
- activeHouseWorkType: e.activeHouseWorkType
1217
- })
1218
- );
1219
- } } })], 1), t("div", { staticClass: "flex w-full", staticStyle: { "margin-bottom": "1.5em" } }, [t("CField", { staticClass: "label-selector form-control form-control-left flex-grow", staticStyle: { "margin-bottom": "0" }, attrs: { label: e.$t("quantity").capitalize(), "label-position": "inside" } }, [t("CInput", { staticClass: "input-selector", attrs: { value: e.article.quantity, disabled: ["openAcc", "markup"].includes(e.article.priceType), placeholder: "", type: "number", size: "large" }, on: { input: function(i) {
1220
- e.updateArticle(Number.parseFloat(i), "quantity");
1221
- } } })], 1), t("ArticleUnitSelect", { attrs: { value: e.article.unitType, "is-public-form": e.viewSettings.isPublicForm }, on: { input: function(i) {
1222
- return e.updateArticle(i, "unitType");
1223
- } } }, [t("CButton", { staticClass: "select-css form-control form-control-right", staticStyle: { width: "8em", "box-shadow": "none" } }, [e._v(" " + e._s(e.articleUnitLabel(e.article.unitType, { count: e.article.quantity })) + " ")])], 1)], 1), e.hidePriceInput ? e._e() : [t("div", { staticClass: "flex", staticStyle: { "margin-bottom": "1.5em" } }, [t("CField", { staticClass: "label-selector form-control form-control-left flex-1", staticStyle: { "margin-bottom": "0" }, attrs: { label: e.$t("price.price").capitalize(), "label-position": "inside" } }, [t("CPriceInput", { key: e.priceSuffix(e.article), ref: "priceInput", staticClass: "input-selector", attrs: { value: e.article.price, currency: e.article.currency, "is-inc-vat": e.article.priceType !== "markup" && e.setPricesIncVat, vat: e.article.vat, "price-type": e.article.priceType, "unit-label": e.articleUnitLabel(e.article.unitType) }, on: { input: function(i) {
1224
- return e.updateArticle(i, "price");
1225
- }, "update:currency": function(i) {
1226
- return e.$emit("update:currency", i);
1227
- }, focus: function(i) {
1228
- return e.$emit("focus");
1229
- } } })], 1), e.useVat ? t("div", { staticClass: "select-css form-control form-control-right", staticStyle: { width: "8em" }, on: { click: function(i) {
1230
- e.setPricesIncVat = !e.setPricesIncVat;
1231
- } } }, [e._v(" " + e._s(e._document.$t(`vat.${e.setPricesIncVat ? "incVat" : "exVat"}`)) + " ")]) : e._e()], 1), e.showDiscountInput ? t("div", { staticClass: "flex", staticStyle: { "margin-bottom": "1.5em" } }, [t("CField", { staticClass: "label-selector form-control form-control-left flex-grow", staticStyle: { "margin-bottom": "0" }, attrs: { label: e.$t("discount").capitalize(), "label-position": "inside" } }, [t("CPriceInput", { ref: "discountInput", staticClass: "input-selector", attrs: { value: e.article.discount, currency: e.article.currency, "is-inc-vat": e.article.discountType !== "percentage" && e.setPricesIncVat, vat: e.article.vat, "suffix-class": "text-gray-400" }, on: { input: function(i) {
1232
- e.updateArticle(Math.abs(i), "discount");
1233
- } }, scopedSlots: e._u([e.article.discountType === "fixed" ? { key: "suffix", fn: function() {
1234
- return [e._v(" " + e._s(e._document.$t(`vat.${e.setPricesIncVat ? "incVat" : "exVat"}`)) + " ")];
1235
- }, proxy: !0 } : { key: "suffix", fn: function() {
1236
- return [e._v(" " + e._s(e.getCurrencySymbol(e.article.currency)) + " ")];
1237
- }, proxy: !0 }], null, !0) })], 1), t("div", { staticClass: "select-css form-control form-control-right", staticStyle: { width: "5em" }, on: { click: function(i) {
1238
- return e.updateArticle(
1239
- e.article.discountType === "percentage" ? "fixed" : "percentage",
1240
- "discountType"
1241
- );
1242
- } } }, [e._v(" " + e._s(e.article.discountType === "percentage" ? "%" : e.getCurrencySymbol(e.article.currency)) + " ")])], 1) : e._e()], t("div", { staticStyle: { margin: "calc(1 * var(--rem)) calc(-0.5 * var(--rem))" } }, [e.useVat ? [e.feature("regionSE") && Number.isInteger(e.article.vat) ? t("select", { staticClass: "select-css tag-item no-chevron", staticStyle: { display: "inline", "min-height": "initial", background: "hsl(0, 0%, 94%)", "border-color": "hsl(0, 0%, 94%)", color: "hsl(0, 0%, 30%)" }, domProps: { value: e.article.vat }, on: { input: function(i) {
1243
- e.updateArticle(Number.parseFloat(i.target.value), "vat");
1244
- } } }, e._l(e.vatOptions, function({ translation: i, value: n }, a) {
1245
- return t("option", { key: a, domProps: { value: n } }, [e._v(" " + e._s(e.$t(`vat.${e.vatType}`)) + " " + e._s(i) + " ")]);
1246
- }), 0) : t("span", { staticClass: "select-css tag-item no-chevron", staticStyle: { display: "inline", "min-height": "initial", background: "hsl(0, 0%, 94%)", "border-color": "hsl(0, 0%, 94%)", color: "hsl(0, 0%, 30%)" } }, [e._v(" " + e._s(e._document.$t("vat").capitalize()) + " "), t("input", { staticStyle: { width: "calc(2.5 * var(--rem))", display: "inline", background: "hsl(0, 0%, 94%)", "border-color": "hsl(0, 0%, 94%)", color: "hsl(0, 0%, 30%)" }, attrs: { type: "number" }, domProps: { value: e.article.vat || 0 }, on: { blur: e.onCustomVatBlur, input: e.onCustomVatInput } }), e._v(" % ")])] : e._e(), e.priceTypeOptions.length ? t("div", { staticClass: "tag-group", staticStyle: { display: "flex", "flex-direction": "row", "flex-wrap": "wrap", "margin-top": "1em" } }, e._l(e.priceTypeOptions, function({ label: i, value: n, onClick: a, tooltip: r }, c) {
1247
- return t("div", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: {
1248
- content: r,
1249
- delay: { show: 300, hide: 0 }
1250
- }, expression: `{
1251
- content: tooltip,
1252
- delay: { show: 300, hide: 0 }
1253
- }` }], key: i + c, staticClass: "tag-item", class: { active: n }, on: { click: a } }, [e._v(" " + e._s(i) + " ")]);
1254
- }), 0) : e._e(), t("div", { staticStyle: { display: "flex", "flex-direction": "row", "flex-wrap": "wrap", "margin-top": "1em" } }, e._l(e.checkboxItems, function({ label: i, value: n, onClick: a }, r) {
1255
- return t("div", { key: i + r, staticClass: "tag-item", class: { active: n }, on: { click: a } }, [e._v(" " + e._s(i) + " ")]);
1256
- }), 0)], 2)], 2)]), t("div", { staticClass: "flex space-x-4 overflow-hidden p-4 md:p-9" }, [t("CButton", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: {
1257
- offset: 7,
1258
- html: !0,
1259
- content: `
1260
- <div style='margin-bottom: 0.6em;'>
1261
- ${e.$t("saveAndAddTooltip")}
1262
- </div>
1263
- <div class='flex items-center justify-center' style='padding-bottom: 0.5em;'>
1264
- <div style='text-align: center; background-color: hsl(0, 0%, 40%); line-height: 1; border-radius: 0.5em; display: inline-flex; align-items: center; justify-content: center; padding: 0.5em;'>
1265
- <svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 35 35'><path fill='none' stroke='#ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M11.208 31h12.584V15.895h8.732L17.5 1.39 2.476 15.895h8.732V31z'/></svg>
1266
- </div>
1267
- <div style='text-align: center; background-color: hsl(0, 0%, 40%); line-height: 1; border-radius: 0.5em; display: inline-flex; align-items: center; justify-content: center; padding: 0.5em; margin-left: 0.5em;'>
1268
- <svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 -12 50 50'><path fill='none' stroke='#ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' stroke d='M45.706.897c.55.002.994.458.993.994l-.036 18.01c0 .55-.44.996-1.008.996H5.12l10.568 8.886-1.467 1.738L0 19.758 14.22 8l1.468 1.738L5.12 18.624h38.987c.162 0 .293-.134.293-.296V3.445c0-.163-.144-.295-.292-.295H32.054c-.278 0-.504-.23-.504-.5v-1.3c0-.277.214-.5.504-.498l13.652.045z'/></svg>
1269
- </div>
1270
- </div>
1271
- `
1272
- }, expression: `{
1273
- offset: 7,
1274
- html: true,
1275
- content: \`
1276
- <div style='margin-bottom: 0.6em;'>
1277
- \${$t('saveAndAddTooltip')}
1278
- </div>
1279
- <div class='flex items-center justify-center' style='padding-bottom: 0.5em;'>
1280
- <div style='text-align: center; background-color: hsl(0, 0%, 40%); line-height: 1; border-radius: 0.5em; display: inline-flex; align-items: center; justify-content: center; padding: 0.5em;'>
1281
- <svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 35 35'><path fill='none' stroke='#ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M11.208 31h12.584V15.895h8.732L17.5 1.39 2.476 15.895h8.732V31z'/></svg>
1282
- </div>
1283
- <div style='text-align: center; background-color: hsl(0, 0%, 40%); line-height: 1; border-radius: 0.5em; display: inline-flex; align-items: center; justify-content: center; padding: 0.5em; margin-left: 0.5em;'>
1284
- <svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 -12 50 50'><path fill='none' stroke='#ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' stroke d='M45.706.897c.55.002.994.458.993.994l-.036 18.01c0 .55-.44.996-1.008.996H5.12l10.568 8.886-1.467 1.738L0 19.758 14.22 8l1.468 1.738L5.12 18.624h38.987c.162 0 .293-.134.293-.296V3.445c0-.163-.144-.295-.292-.295H32.054c-.278 0-.504-.23-.504-.5v-1.3c0-.277.214-.5.504-.498l13.652.045z'/></svg>
1285
- </div>
1286
- </div>
1287
- \`
1288
- }` }], staticStyle: { padding: "1.75em", height: "4em", "font-size": "16px", "background-color": "hsl(231, 4%, 20%)", "border-color": "hsl(231, 4%, 20%)" }, attrs: { type: "primary", tabindex: "0", size: "large" }, on: { click: e.addNewArticle } }, [t("CIcon", { staticStyle: { margin: "-3px" }, attrs: { type: "zap", size: "21" } })], 1), t("CButton", { staticClass: "flex-grow", staticStyle: { padding: "1.75em", height: "4em", "font-size": "16px" }, attrs: { size: "large", type: "secondary", "full-width": "", tabindex: "0" }, on: { click: e.onSaveArticle } }, [e._v(" " + e._s(e.$t("save")) + " ")])], 1)], 1)]);
1289
- }, ht = [], mt = /* @__PURE__ */ u(
1290
- dt,
1291
- pt,
1292
- ht,
1293
- !1,
1294
- null,
1295
- "87105822"
1296
- );
1297
- const ft = mt.exports, vt = {
1298
- i18nOptions: {
1299
- name: "ArticleListEdit",
1300
- namespaces: "ArticleListEdit",
1301
- messages: {
1302
- en: {
1303
- vatOption: {
1304
- label: "Enter",
1305
- message: "You are now entering prices {{- vatOption}}."
1306
- }
1307
- },
1308
- sv: {
1309
- vatOption: {
1310
- label: "Ange",
1311
- message: "Du anger priser {{- vatOption}} nu"
1312
- }
1313
- }
1314
- }
1315
- },
1316
- components: {
1317
- // eslint-disable-next-line vue/no-reserved-component-names
1318
- Article: Ye,
1319
- ArticleModal: ft,
1320
- WithDimensions: le,
1321
- draggable: ue
1322
- },
1323
- mixins: [y([])],
1324
- props: {
1325
- _document: {
1326
- type: Object,
1327
- default: () => ({})
1328
- },
1329
- articles: {
1330
- type: Array,
1331
- required: !0
1332
- },
1333
- activeHouseWorkType: {
1334
- type: String,
1335
- default: null
1336
- },
1337
- rootPriceType: {
1338
- type: String,
1339
- default: "fixed"
1340
- },
1341
- hideControls: {
1342
- type: Boolean,
1343
- default: !1
1344
- }
1345
- },
1346
- data() {
1347
- return {
1348
- selectedIndex: null,
1349
- showModal: !1
1350
- };
1351
- },
1352
- computed: {
1353
- ...h({
1354
- hidePriceInput: "settings/allowHideDocArticlePriceInput",
1355
- hidePriceOnNew: "settings/hidePriceOnNewlyAddedArticles"
1356
- }),
1357
- articlesWithTotal() {
1358
- return T(this.articles);
1359
- },
1360
- isIndivid() {
1361
- return o(this._document, "prices.helpers.isIndivid", !0);
1362
- },
1363
- setPricesIncVat() {
1364
- return o(this, "_document.setPricesIncVat", null);
1365
- },
1366
- currency() {
1367
- return o(this._document, "currency");
1368
- },
1369
- useVat() {
1370
- return o(this, "_document.useVat");
1371
- },
1372
- vatType() {
1373
- return o(this, "_document.vatType");
1374
- },
1375
- showVatToggle() {
1376
- return this.useVat && (this.setPricesIncVat || (this.articles || []).some(({ vat: s }) => s !== null));
1377
- }
1378
- },
1379
- watch: {
1380
- activeHouseWorkType: {
1381
- immediate: !0,
1382
- handler(s) {
1383
- this.toggleDeductions(s);
1384
- }
1385
- },
1386
- isIndivid(s) {
1387
- s || this.toggleDeductions(!1);
1388
- },
1389
- setPricesIncVat(s) {
1390
- this.updateArticlesVatOption(), ["extension", "widget"].includes(ie.value) || this.showMessage({
1391
- type: "info",
1392
- message: this.$t("vatOption.message", {
1393
- vatOption: this.$t(`_common:vat.${s ? "incVat" : "exVat"}`, {
1394
- thing: this.$t("_common:vat.sharedTitle")
1395
- })
1396
- })
1397
- });
1398
- }
1399
- },
1400
- methods: {
1401
- ...v({
1402
- showMessage: p.SHOW_MESSAGE
1403
- }),
1404
- openModal(s, { focusEl: e = "" } = {}) {
1405
- this.selectedIndex = s, this.showModal = !0, e && this.$nextTick(() => {
1406
- this.$nextTick(() => {
1407
- this.$refs.articleModal && this.$refs.articleModal.focusEl(e);
1408
- });
1409
- });
1410
- },
1411
- updateArticleObject(s, e) {
1412
- const t = e;
1413
- this.isIndivid || (t.isDeductable = !1, t.isRut = !1, t.greenRot15 = !1, t.greenRot20 = !1, t.greenRot50 = !1), this.$emit("input", { index: s, value: t });
1414
- },
1415
- onRemoveArticle(s) {
1416
- this.$emit("remove", s);
1417
- },
1418
- onEsc(s, e) {
1419
- s === this.articles.length - 1 && ["name", "price", "discount"].every((t) => !e[t]) && this.onRemoveArticle(s);
1420
- },
1421
- changeVat() {
1422
- this.$emit("update:setPricesIncVat", !this.setPricesIncVat);
1423
- },
1424
- updateArticlesVatOption() {
1425
- this.articles.forEach((s, e) => {
1426
- if (s.priceType === "markup")
1427
- return;
1428
- let t = g({ amount: s.price }).divide(
1429
- (100 + s.vat) * 0.01
1430
- );
1431
- this.setPricesIncVat || (t = g({ amount: s.price }).multiply(
1432
- (100 + s.vat) * 0.01
1433
- )), this.updateArticleObject(
1434
- e,
1435
- T({ ...s, price: t.getAmount() })
1436
- );
1437
- });
1438
- },
1439
- // Method used by parent component
1440
- focusLastArticle() {
1441
- this.$nextTick(
1442
- () => this.$refs.articleItem[this.articles.length - 1].focusName()
1443
- );
1444
- },
1445
- openLastArticle() {
1446
- this.$nextTick(() => this.openModal(this.articles.length - 1));
1447
- },
1448
- toggleDeductions(s) {
1449
- const e = {
1450
- rot: "isDeductable",
1451
- rut: "isRut",
1452
- greenRot15: "greenRot15",
1453
- greenRot20: "greenRot20",
1454
- greenRot50: "greenRot50"
1455
- }, t = (i = []) => i.reduce((n, a) => ({ ...n, [a]: !1 }), {});
1456
- e[s] ? this.articles.forEach((i, n) => {
1457
- const a = Object.values(R(e, [s]));
1458
- if (a.some((r) => !!i[r])) {
1459
- const r = { ...i, ...t(a) };
1460
- this.$emit("input", { index: n, value: r });
1461
- }
1462
- }) : s === !1 && this.articles.forEach((i, n) => {
1463
- const a = Object.values(e);
1464
- if (a.some((r) => !!i[r])) {
1465
- const r = { ...i, ...t(a) };
1466
- this.$emit("input", { index: n, value: r });
1467
- }
1468
- });
1469
- },
1470
- onChange(s) {
1471
- const { added: e, moved: t, removed: i } = s;
1472
- if (e) {
1473
- const { newIndex: n, element: a } = e;
1474
- this.$emit("insert", { index: n, value: a });
1475
- } else if (t) {
1476
- const n = A(
1477
- this.articles,
1478
- t.oldIndex,
1479
- t.newIndex
1480
- );
1481
- this.$emit("move", n);
1482
- } else if (i) {
1483
- const { oldIndex: n } = i;
1484
- this.$emit("remove", n);
1485
- }
1486
- }
1487
- }
1488
- };
1489
- var gt = function() {
1490
- var e = this, t = e._self._c;
1491
- return t("div", [e.showVatToggle ? t("div", { staticClass: "label-text" }, [e._v(" " + e._s(e.$t("vatOption.label")) + " "), t("span", { on: { click: function(i) {
1492
- return e.changeVat();
1493
- } } }, [e._v(" " + e._s(e._document.$t(`vat.${e.setPricesIncVat ? "incVat" : "exVat"}`)) + " ")])]) : e._e(), t("WithDimensions", { scopedSlots: e._u([{ key: "default", fn: function({ width: i }) {
1494
- return [t("draggable", e._b({ staticStyle: { "min-height": "calc(3 * var(--rem))" }, attrs: { value: e.articles, group: "articles" }, on: { change: e.onChange } }, "draggable", {
1495
- sort: !0,
1496
- animation: 150,
1497
- ghostClass: "article-ghost",
1498
- handle: ".article-draggable-handle"
1499
- }, !1), [t("transition-group", { staticStyle: { position: "relative", transition: "100ms" }, attrs: { name: "article-list" } }, e._l(e.articlesWithTotal, function(n, a) {
1500
- return t("Article", { key: n._uniqueId || 0, ref: "articleItem", refInFor: !0, staticClass: "article-item", attrs: { value: n, width: i, "hide-price-input": e.hidePriceInput, "hide-price-on-new": e.hidePriceOnNew, "is-inc-vat": e.setPricesIncVat, "hide-controls": e.hideControls, "root-price-type": e.rootPriceType, "active-house-work-type": e.activeHouseWorkType }, on: { "update:currency": function(r) {
1501
- return e.$emit("update:currency", r);
1502
- }, input: function(r) {
1503
- return e.updateArticleObject(a, r);
1504
- }, focus: function(r) {
1505
- return e.$emit("focus");
1506
- }, remove: function(r) {
1507
- return e.onRemoveArticle(a);
1508
- }, "open-modal": function(r) {
1509
- return e.openModal(a, r);
1510
- }, add: function(r) {
1511
- a === e.articlesWithTotal.length - 1 && e.$emit("add");
1512
- }, select: function(r) {
1513
- a === e.articlesWithTotal.length - 1 && e.$emit("add");
1514
- }, esc: function(r) {
1515
- return e.onEsc(a, n);
1516
- } } });
1517
- }), 1)], 1)];
1518
- } }]) }), t("Portal", { attrs: { to: "modal" } }, [e.showModal && e.articlesWithTotal[e.selectedIndex] ? t("ArticleModal", { ref: "articleModal", attrs: { _document: e._document, index: e.selectedIndex, "article-list": e.articlesWithTotal, "hide-price-input": e.hidePriceInput, "hide-price-on-new": e.hidePriceOnNew, "is-inc-vat": e.setPricesIncVat, "root-price-type": e.rootPriceType, currency: e.currency, "active-house-work-type": e.activeHouseWorkType, "view-settings": e.viewSettings }, on: { "update:currency": function(i) {
1519
- return e.$emit("update:currency", i);
1520
- }, input: function(i) {
1521
- return e.updateArticleObject(e.selectedIndex, i);
1522
- }, add: function(i) {
1523
- return e.$emit("add", i);
1524
- }, "open-modal": e.openModal, close: function(i) {
1525
- e.showModal = !1;
1526
- } } }) : e._e()], 1)], 1);
1527
- }, yt = [], _t = /* @__PURE__ */ u(
1528
- vt,
1529
- gt,
1530
- yt,
1531
- !1,
1532
- null,
1533
- "ca68ac6a"
1534
- );
1535
- const kt = _t.exports, $t = {
1536
- name: "MaxTotalInput",
1537
- i18nOptions: {
1538
- namespaces: "MaxTotalInput",
1539
- messages: {
1540
- en: {
1541
- maxTotalLabel: "Add a price"
1542
- },
1543
- sv: {
1544
- maxTotalLabel: "Ange ett pris"
1545
- }
1546
- }
1547
- },
1548
- components: {
1549
- CPriceInput: w
1550
- },
1551
- props: {
1552
- value: {
1553
- type: Number,
1554
- default: null
1555
- },
1556
- currency: {
1557
- type: String,
1558
- required: !0
1559
- },
1560
- vatType: {
1561
- type: String,
1562
- required: !0
1563
- }
1564
- },
1565
- data() {
1566
- return {
1567
- getCurrencySymbol: I
1568
- };
1569
- },
1570
- computed: {
1571
- ...h({
1572
- isIncVat: "application/isIncVat"
1573
- })
1574
- },
1575
- watch: {
1576
- isIncVat(s) {
1577
- let e = g({ amount: this.value }).divide(1.25);
1578
- s || (e = g({ amount: this.value }).multiply(125 * 0.01)), this.$emit("input", e.getAmount());
1579
- }
1580
- }
1581
- };
1582
- var xt = function() {
1583
- var e = this, t = e._self._c;
1584
- return t("div", { staticClass: "flex w-full justify-end" }, [t("CPriceInput", { staticClass: "mt-4 max-w-[275px] text-sm", attrs: { value: e.value, currency: e.currency, "is-inc-vat": e.isIncVat, vat: 25, placeholder: e.$t("maxTotalLabel"), min: "0", "prefix-class": "text-gray-400", "suffix-class": "text-gray-400" }, on: { input: function(i) {
1585
- return e.$emit("input", i);
1586
- } }, scopedSlots: e._u([{ key: "prefix", fn: function() {
1587
- return [e._v(e._s(e.$t("price.maxPrice").capitalize()))];
1588
- }, proxy: !0 }, { key: "suffix", fn: function() {
1589
- return [t("span", [e._v(" " + e._s(e.getCurrencySymbol(e.currency)) + " " + e._s(e.$t(`vat.${e.isIncVat ? "incVat" : "exVat"}`, { thing: e.$t(`vat.${e.vatType}`) })) + " ")])];
1590
- }, proxy: !0 }]) })], 1);
1591
- }, bt = [], wt = /* @__PURE__ */ u(
1592
- $t,
1593
- xt,
1594
- bt,
1595
- !1,
1596
- null,
1597
- null
1598
- );
1599
- const Ct = wt.exports, Tt = {
1600
- components: {
1601
- CDropdown: x,
1602
- CDropdownItem: b
1603
- },
1604
- props: {
1605
- value: {
1606
- type: String,
1607
- default: "fixed"
1608
- }
1609
- },
1610
- data() {
1611
- return {
1612
- priceTypeOptions: ["fixed", "approx", "openAcc", "openAccMaxPrice"]
1613
- };
1614
- }
1615
- };
1616
- var It = function() {
1617
- var e = this, t = e._self._c;
1618
- return t("div", { staticClass: "flex justify-end" }, [t("CDropdown", { attrs: { value: e.value }, scopedSlots: e._u([{ key: "trigger", fn: function() {
1619
- return [t("CButton", { staticClass: "price-type-button" }, [e._v(" " + e._s(e.$t("price.pricing").capitalize()) + ": "), t("span", [e._v(e._s(e.$t(`price.${e.value}`)))])])];
1620
- }, proxy: !0 }]) }, e._l(e.priceTypeOptions, function(i) {
1621
- return t("CDropdownItem", { key: i, staticClass: "text-right", attrs: { value: i }, on: { click: function(n) {
1622
- return e.$emit("input", i);
1623
- } } }, [e._v(" " + e._s(e.$t(`price.${i}`)) + " ")]);
1624
- }), 1)], 1);
1625
- }, At = [], St = /* @__PURE__ */ u(
1626
- Tt,
1627
- It,
1628
- At,
1629
- !1,
1630
- null,
1631
- "06e47e62"
1632
- );
1633
- const Pt = St.exports, Vt = {
1634
- name: "EditDeduction",
1635
- components: {
1636
- CPriceInput: w
1637
- },
1638
- mixins: [y(["houseWorkManualAmount"])],
1639
- props: {
1640
- disabled: {
1641
- type: Boolean,
1642
- default: !1
1643
- },
1644
- total: {
1645
- type: Number,
1646
- required: !0
1647
- },
1648
- houseWorkType: {
1649
- type: String,
1650
- default: "rot"
1651
- },
1652
- houseWorkAmount: {
1653
- type: Number,
1654
- default: 0
1655
- }
1656
- },
1657
- data() {
1658
- return {
1659
- amountUnit: "fixed",
1660
- internalValue: null
1661
- };
1662
- },
1663
- watch: {
1664
- houseWorkType(s) {
1665
- s || (this.houseWorkManualAmount = null);
1666
- }
1667
- },
1668
- methods: {
1669
- setDeduction(s) {
1670
- this.internalValue = g({ amount: this.total }).multiply(s).getAmount();
1671
- },
1672
- showModal() {
1673
- this.internalValue = this.houseWorkAmount, this.$modal.show(`deduction-modal-${this._uid}`);
1674
- }
1675
- }
1676
- };
1677
- var Dt = function() {
1678
- var e = this, t = e._self._c;
1679
- return t("div", [t("modal", e._b({ attrs: { name: `deduction-modal-${e._uid}` } }, "modal", {
1680
- adaptive: !0,
1681
- height: "auto",
1682
- width: "90%",
1683
- maxWidth: 420,
1684
- classes: "primary"
1685
- }, !1), [t("div", { staticClass: "deduction-modal flex w-full flex-col items-center justify-between rounded-lg" }, [t("div", { staticStyle: { "font-size": "calc(calc(1 * var(--rem)) + 2px)", "font-weight": "800", "text-align": "center", "margin-bottom": "calc(1.5 * var(--rem))" } }, [e._v(" " + e._s(e.$t("deduction.manualType", { type: e.$t(`deduction.${e.houseWorkType}`) })) + " ")]), t("div", { staticStyle: { "margin-bottom": "calc(1 * var(--rem))", width: "100%" } }, [t("CPriceInput", { attrs: { currency: "SEK", placeholder: e.$t("enterThing", { thing: e.$t("deduction.deduction") }), min: "0", size: "medium", "suffix-class": "text-gray-400" }, scopedSlots: e._u([{ key: "suffix", fn: function() {
1686
- return [e._v(e._s(e.$t("currency.SEK")))];
1687
- }, proxy: !0 }]), model: { value: e.internalValue, callback: function(i) {
1688
- e.internalValue = e._n(i);
1689
- }, expression: "internalValue" } })], 1), t("div", { staticClass: "flex w-full flex-wrap justify-center gap-2" }, e._l([
1690
- { v: 0.09, l: "9%" },
1691
- { v: 0.105, l: "10.5%" },
1692
- { v: 0.1455, l: "14.55%" },
1693
- { v: 0.194, l: "19.4%" },
1694
- { v: 0.21, l: "21%" },
1695
- { v: 0.485, l: "48.5%" },
1696
- { v: 0.5, l: "50%" }
1697
- ], function(i) {
1698
- return t("div", { key: i.l, staticClass: "deduction-button", class: {
1699
- active: Math.round(e.total * i.v * 0.01) * 100 === e.internalValue
1700
- }, on: { click: function(n) {
1701
- return e.setDeduction(i.v);
1702
- } } }, [e._v(" " + e._s(i.l) + " ")]);
1703
- }), 0), t("CButton", { staticClass: "mt-8", attrs: { type: "secondary", wide: "" }, on: { click: function(i) {
1704
- e.houseWorkManualAmount = e.internalValue, e.$modal.hide(`deduction-modal-${e._uid}`);
1705
- } } }, [e._v(" " + e._s(e.$t("save")) + " ")]), t("CButton", { staticClass: "mt-2", attrs: { type: "secondary", pattern: "tertiary", wide: "" }, on: { click: function(i) {
1706
- e.houseWorkManualAmount = null, e.$modal.hide(`deduction-modal-${e._uid}`);
1707
- } } }, [e._v(" " + e._s(e.$t("reset")) + " ")])], 1)]), e.houseWorkManualAmount ? t("portal", { attrs: { order: 2, to: "document-nav-bottom" } }, [t("div", { staticClass: "housework-manual-nav", on: { click: function(i) {
1708
- return e.$modal.show(`deduction-modal-${e._uid}`);
1709
- } } }, [t("svg", { staticClass: "css-i6dzq1", staticStyle: { "margin-right": "0.5em" }, attrs: { viewBox: "0 0 24 24", width: "12", height: "12", stroke: "currentColor", "stroke-width": "2", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" } }, [t("path", { attrs: { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" } }), t("line", { attrs: { x1: "12", y1: "9", x2: "12", y2: "13" } }), t("line", { attrs: { x1: "12", y1: "17", x2: "12.01", y2: "17" } })]), e._v(" " + e._s(e.$t("deduction.manualType", { type: e.$t(`deduction.${e.houseWorkType}`) })) + " " + e._s(e.$t("using")) + " ")])]) : e._e()], 1);
1710
- }, Rt = [], Ot = /* @__PURE__ */ u(
1711
- Vt,
1712
- Dt,
1713
- Rt,
1714
- !1,
1715
- null,
1716
- "cff30915"
1717
- );
1718
- const Mt = Ot.exports, Lt = {
1719
- name: "Pricing",
1720
- components: {
1721
- EditDeduction: Mt
1722
- },
1723
- props: {
1724
- _document: {
1725
- type: Object,
1726
- default: () => ({})
1727
- },
1728
- basePath: {
1729
- type: String,
1730
- default: "data.prices"
1731
- },
1732
- packageId: {
1733
- type: String,
1734
- default: null
1735
- }
1736
- },
1737
- data() {
1738
- return {
1739
- get: o
1740
- };
1741
- },
1742
- computed: {
1743
- vatType() {
1744
- return o(this, "_document.vatType");
1745
- },
1746
- priceArray() {
1747
- return [
1748
- {
1749
- label: this._document.$t("price.net"),
1750
- value: this.prices.subTotal
1751
- },
1752
- ...this.prices.useVat ? [
1753
- {
1754
- label: this._document.$t(`vat.${this.vatType}`),
1755
- value: this.prices.taxAmount
1756
- }
1757
- ] : [],
1758
- ...this.showHouseWork ? [
1759
- {
1760
- label: this._document.$t("deduction.type", {
1761
- type: this._document.$t(
1762
- `deduction.${this.prices.region.houseWorkType}${this.prices.region.houseWorkManualAmount === null ? "_percentage" : ""}`
1763
- )
1764
- }),
1765
- value: -this.prices.region.houseWorkAmount,
1766
- action: () => this.$refs.deduction.showModal()
1767
- }
1768
- ] : [],
1769
- ...this.prices.rounding.enabled && this.prices.rounding.show ? [
1770
- {
1771
- label: this._document.$t(
1772
- "chapters.pricingSummary.blocks.rounding"
1773
- ),
1774
- value: this.prices.roundingAmount
1775
- }
1776
- ] : [],
1777
- ...this.prices.helpers.discount ? [
1778
- {
1779
- label: this._document.$t("price.discount"),
1780
- value: -this.prices.helpers.discount
1781
- }
1782
- ] : [],
1783
- {
1784
- classList: "main",
1785
- label: this._document.$t("total"),
1786
- subLabel: this.prices.useVat ? this._document.$t("vat.incVat") : "",
1787
- prefix: this.prices.type === "approx" ? `${this._document.$t("approx")} ` : "",
1788
- value: this.prices.total
1789
- },
1790
- ...typeof this.prices.maxTotal == "number" ? [
1791
- {
1792
- classList: "main",
1793
- label: this._document.$t("price.maxPrice"),
1794
- subLabel: this.prices.useVat ? this._document.$t("vat.incVat") : "",
1795
- value: Math.round(this.prices.maxTotal * 1.25 || 0)
1796
- // ! Hard coded swedish VAT
1797
- }
1798
- ] : []
1799
- ].map((e) => ({
1800
- ...e,
1801
- value: k(e.value, {
1802
- showZero: !0,
1803
- decimals: 2,
1804
- currency: this.prices.currency
1805
- })
1806
- }));
1807
- },
1808
- prices() {
1809
- const { prices: s } = this._document.packageGroups.getPackageById(
1810
- this.packageId
1811
- );
1812
- return s;
1813
- },
1814
- showHouseWork() {
1815
- return !!o(this.prices, "region.houseWorkType", !1) || !!o(this.prices, "region.houseWorkManualAmount", !1);
1816
- }
1817
- }
1818
- };
1819
- var Et = function() {
1820
- var e = this, t = e._self._c;
1821
- return t("div", { staticClass: "price-bubble" }, [t("div", { staticClass: "flex w-full items-center justify-between" }, [e.showHouseWork ? t("EditDeduction", e._g({ ref: "deduction", attrs: { disabled: !e.get(e.prices, "region.houseWorkType", !1), _document: e._document, _value: {
1822
- houseWorkManualAmount: `${e.basePath}.data.prices.region.houseWorkManualAmount`
1823
- }, "house-work-type": e.prices.region.houseWorkType, "house-work-amount": e.prices.region.houseWorkAmount, total: e.prices.subTotal + e.prices.taxAmount } }, e.$listeners)) : e._e()], 1), t("div", e._l(e.priceArray, function(i, n) {
1824
- return t("div", { key: n, staticClass: "price-row flex w-full justify-between", class: [i.classList || ""] }, [t("div", { staticClass: "price-label" }, [e._v(" " + e._s(i.label.capitalize()) + " "), i.subLabel ? t("span", { staticClass: "pricing-sub-label" }, [e._v(" " + e._s(i.subLabel) + " ")]) : e._e(), i.action ? t("span", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: e.$t("edit", { thing: e.$t("deduction.deduction") }), expression: "$t('edit', { thing: $t('deduction.deduction') })" }], staticClass: "pricing-action", on: { click: function(a) {
1825
- i.action && i.action();
1826
- } } }, [t("svg", { attrs: { viewBox: "0 0 24 24", width: "15", height: "15", stroke: "currentColor", "stroke-width": "2.5", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" } }, [t("path", { attrs: { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" } }), t("path", { attrs: { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" } })])]) : e._e()]), t("div", { staticClass: "price-value" }, [e._v(" " + e._s(i.prefix) + " " + e._s(i.value) + " ")])]);
1827
- }), 0)]);
1828
- }, zt = [], Wt = /* @__PURE__ */ u(
1829
- Lt,
1830
- Et,
1831
- zt,
1832
- !1,
1833
- null,
1834
- "b501fae0"
1835
- );
1836
- const Bt = Wt.exports, Ft = {
1837
- name: "PackageItemEdit",
1838
- i18nOptions: {
1839
- namespaces: "PackageItemEdit",
1840
- messages: {
1841
- en: {
1842
- base: "Default package",
1843
- single: "Single option",
1844
- option: "Selectable package",
1845
- namePlaceholder: "Package name",
1846
- textPlaceholder: "Package description",
1847
- selected: "Pre selected",
1848
- addButton: "Product / service",
1849
- advancedButtonTooltip: "Open advanced settings"
1850
- },
1851
- sv: {
1852
- base: "Grundpaket",
1853
- single: "Ett alternativ",
1854
- option: "Valbart alternativ",
1855
- namePlaceholder: "Paketets namn",
1856
- textPlaceholder: "Beskrivning av paketet",
1857
- selected: "Förvald",
1858
- addButton: "Vara / tjänst",
1859
- advancedButtonTooltip: "Öppna avancerat läge"
1860
- }
1861
- }
1862
- },
1863
- components: {
1864
- ArticleList: kt,
1865
- PriceFormAlternatives: Pt,
1866
- MaxTotalInput: Ct,
1867
- Pricing: Bt,
1868
- TextEditor: ce,
1869
- CDropdown: x,
1870
- CDropdownItem: b
1871
- },
1872
- mixins: [
1873
- y([
1874
- "isSelectedDefault",
1875
- "isSelected",
1876
- "name",
1877
- "description",
1878
- "priceType",
1879
- "maxTotal",
1880
- "currency"
1881
- ])
1882
- ],
1883
- props: {
1884
- packageId: {
1885
- type: String,
1886
- required: !0
1887
- },
1888
- type: {
1889
- type: String,
1890
- required: !0
1891
- },
1892
- activeHouseWorkType: {
1893
- type: String,
1894
- default: null
1895
- },
1896
- toggable: {
1897
- type: Boolean,
1898
- default: !0
1899
- },
1900
- moveOptions: {
1901
- type: Object,
1902
- default: () => ({})
1903
- }
1904
- },
1905
- data() {
1906
- return {
1907
- isFocus: !1,
1908
- isHover: !1
1909
- };
1910
- },
1911
- computed: {
1912
- ...h({
1913
- newArticle: "articles/getNewArticle"
1914
- }),
1915
- // keep info on original article array indices for updates
1916
- articles() {
1917
- return this._document.allArticles;
1918
- },
1919
- mappedPackageArticles() {
1920
- return (this.articles || []).map((s, e) => ({ ...s, i: e })).filter(({ packageId: s }) => s === this.packageId);
1921
- },
1922
- internalDescription: {
1923
- get() {
1924
- return se(
1925
- this.description,
1926
- this._document.textTemplateMap,
1927
- this._document._doc
1928
- );
1929
- },
1930
- set(s) {
1931
- this.description = ae(s);
1932
- }
1933
- }
1934
- },
1935
- watch: {
1936
- priceType(s, e) {
1937
- if (!(s && s.startsWith("open") && e && e.startsWith("open"))) {
1938
- if (s) {
1939
- const t = s.startsWith("open") ? "openAcc" : s;
1940
- this.mappedPackageArticles.forEach((i, n) => {
1941
- this.onArticleInput({
1942
- index: n,
1943
- value: {
1944
- ...i,
1945
- priceType: t,
1946
- ...t === "openAcc" && { quantity: 1 }
1947
- }
1948
- });
1949
- });
1950
- }
1951
- }
1952
- s !== "openAccMaxPrice" && (this.maxTotal = null);
1953
- }
1954
- },
1955
- methods: {
1956
- onRemove() {
1957
- this.$emit("remove-package");
1958
- },
1959
- // Article Methods
1960
- createEmptyArticle() {
1961
- const s = this.newArticle({
1962
- priceType: this.priceType.startsWith("open") ? "openAcc" : this.priceType,
1963
- packageId: this.packageId,
1964
- currency: this.currency
1965
- });
1966
- this.$emit("input", {
1967
- key: "articles",
1968
- value: [...this.articles, s]
1969
- });
1970
- },
1971
- onArticleInput({ index: s, value: e }) {
1972
- const { i: t } = this.mappedPackageArticles[s], i = ne(e, [
1973
- "allowRot",
1974
- "allowRut",
1975
- "isIncVat",
1976
- "rootPriceType",
1977
- "hideControls"
1978
- ]);
1979
- i.currency = this.currency, this.$emit("input", { key: `articles[${[t]}]`, value: i });
1980
- },
1981
- onArticleAdd({ openModal: s = !1 } = {}) {
1982
- this.createEmptyArticle(), s ? this.$refs.articleList.openLastArticle() : this.$refs.articleList.focusLastArticle();
1983
- },
1984
- onInsert({ index: s, value: e }) {
1985
- const t = re(this.mappedPackageArticles).add(
1986
- { ...e, packageId: this.packageId },
1987
- s
1988
- );
1989
- this.$emit("input", {
1990
- key: "articles",
1991
- value: [
1992
- ...this.articles.filter(
1993
- ({ packageId: i }) => i !== this.packageId
1994
- ),
1995
- ...t
1996
- ]
1997
- });
1998
- },
1999
- onArticleRemove(s) {
2000
- const { i: e } = this.mappedPackageArticles[s];
2001
- this.$emit("remove", { key: `articles[${[e]}]` });
2002
- },
2003
- onArticleMove(s) {
2004
- this.$emit("input", {
2005
- key: "articles",
2006
- value: [
2007
- ...this.articles.filter(
2008
- ({ packageId: e }) => e !== this.packageId
2009
- ),
2010
- ...s
2011
- ]
2012
- });
2013
- }
2014
- }
2015
- };
2016
- var jt = function() {
2017
- var e = this, t = e._self._c;
2018
- return t("div", { staticClass: "min-h-0 rounded-md border border-gray-200 bg-white text-black" }, [t("div", { staticClass: "flex w-full items-center justify-between bg-gray-100 py-1 pl-4 pr-1 text-sm font-medium text-gray-600" }, [t("div", [e._v(" " + e._s(e.type === "single" ? e.$t("single") : e.type === "radio" || e.toggable ? e.$t("option") : e.$t("base")) + " ")]), e.type !== "single" ? t("CDropdown", { staticClass: "ml-4", scopedSlots: e._u([{ key: "trigger", fn: function() {
2019
- return [t("CButton", { staticClass: "is-thinner opacity-70", attrs: { size: "small", type: "text", pattern: "secondary" } }, [e._v(" " + e._s(e.$t("_common:change")) + " ")])];
2020
- }, proxy: !0 }], null, !1, 3891513618) }, [e.toggable ? [t("CDropdownItem", { attrs: { value: e.isSelectedDefault, toggle: !0, "close-on-click": !1 }, on: { click: function(i) {
2021
- return e.$emit("update:isSelectedDefault", !e.isSelectedDefault);
2022
- } } }, [e._v(" " + e._s(e.$t("selected")) + " ")]), t("CDropdownItem", { attrs: { separator: "" } })] : e._e(), t("CDropdownItem", { attrs: { "icon-left": "arrow-up", disabled: !e.moveOptions.up }, on: { click: function(i) {
2023
- return e.$emit("move", -1);
2024
- } } }, [e._v(" " + e._s(e.$t("_common:move", { thing: e.$t("_common:up") })) + " ")]), t("CDropdownItem", { attrs: { "icon-left": "arrow-down", disabled: !e.moveOptions.down }, on: { click: function(i) {
2025
- return e.$emit("move", 1);
2026
- } } }, [e._v(" " + e._s(e.$t("_common:move", { thing: e.$t("_common:down") })) + " ")]), t("CDropdownItem", { attrs: { "icon-props": {
2027
- stroke: "red"
2028
- }, "icon-left": "trash" }, on: { click: e.onRemove } }, [e._v(" " + e._s(e.$t("_common:remove")) + " ")])], 2) : e._e()], 1), t("div", { staticClass: "p-4" }, [t("div", { staticClass: "mb-0.5 flex items-center" }, [t("input", { directives: [{ name: "model", rawName: "v-model", value: e.name, expression: "name" }], staticClass: "block w-full rounded-lg p-0 text-xl font-bold leading-loose placeholder:text-gray-400", attrs: { id: `package-name-${e.packageId}`, placeholder: e.$t("namePlaceholder") }, domProps: { value: e.name }, on: { keyup: function(i) {
2029
- return !i.type.indexOf("key") && e._k(i.keyCode, "enter", 13, i.key, "Enter") ? null : e.$refs.editor.focus();
2030
- }, input: function(i) {
2031
- i.target.composing || (e.name = i.target.value);
2032
- } } })]), t("TextEditor", { ref: "editor", staticClass: "text-editor mb-4", attrs: { placeholder: e.$t("textPlaceholder"), mentions: () => e._document.textTemplateItems, snippets: !0 }, model: { value: e.internalDescription, callback: function(i) {
2033
- e.internalDescription = i;
2034
- }, expression: "internalDescription" } }), t("div", { directives: [{ name: "click-outside", rawName: "v-click-outside", value: () => {
2035
- e.isFocus = !1, e.isHover = !1;
2036
- }, expression: `
2037
- () => {
2038
- isFocus = false
2039
- isHover = false
2040
- }
2041
- ` }], on: { "&mouseover": function(i) {
2042
- e.isHover = !0;
2043
- }, "&mouseleave": function(i) {
2044
- e.isHover = !1;
2045
- } } }, [e.priceType === "openAccMaxPrice" ? t("MaxTotalInput", { staticClass: "mb-4", attrs: { currency: e.currency, "vat-type": e._document.vatType }, model: { value: e.maxTotal, callback: function(i) {
2046
- e.maxTotal = i;
2047
- }, expression: "maxTotal" } }) : e._e(), t("PriceFormAlternatives", { on: { input: function(i) {
2048
- return e.$emit("update:priceType", i);
2049
- } }, model: { value: e.priceType, callback: function(i) {
2050
- e.priceType = i;
2051
- }, expression: "priceType" } }), t("ArticleList", { ref: "articleList", attrs: { _document: e._document, articles: e.mappedPackageArticles, "root-price-type": e.priceType, "active-house-work-type": e.activeHouseWorkType, "hide-controls": !e.isFocus && !e.isHover }, on: { input: e.onArticleInput, "update:setPricesIncVat": function(i) {
2052
- return e.$emit("update:setPricesIncVat", i);
2053
- }, "update:currency": function(i) {
2054
- return e.$emit("update:currency", i);
2055
- }, move: e.onArticleMove, remove: e.onArticleRemove, add: e.onArticleAdd, focus: function(i) {
2056
- e.isFocus = !0;
2057
- }, insert: e.onInsert } }), t("div", { staticClass: "mt-2 flex gap-2" }, [t("div", { staticClass: "cursor-pointer rounded-md border border-gray-200 bg-gray-100 p-2.5 text-center text-sm font-medium leading-none text-gray-500 transition-colors hover:border-gray-400 hover:bg-gray-500 hover:text-white", on: { click: function(i) {
2058
- return e.onArticleAdd();
2059
- } } }, [t("CIcon", { staticClass: "mr-1", attrs: { type: "plus", size: "16", "stroke-width": "3" } }), e._v(" " + e._s(e.$t("addButton")) + " ")], 1), t("div", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: {
2060
- content: e.$t("advancedButtonTooltip"),
2061
- offset: 6
2062
- }, expression: `{
2063
- content: $t('advancedButtonTooltip'),
2064
- offset: 6
2065
- }` }], staticClass: "cursor-pointer rounded-md border border-gray-200 bg-gray-100 p-2.5 text-center text-sm font-medium leading-none text-gray-500 transition-colors hover:border-gray-400 hover:bg-gray-500 hover:text-white", on: { click: function(i) {
2066
- return e.onArticleAdd({ openModal: !0 });
2067
- } } }, [t("CIcon", { attrs: { type: "zap", size: "16", "stroke-width": "2.5" } })], 1)]), t("Pricing", e._g({ attrs: { _document: e._document, "base-path": `${e._value.basePath}`, "package-id": e.packageId } }, e.$listeners))], 1)], 1)]);
2068
- }, Nt = [], Ht = /* @__PURE__ */ u(
2069
- Ft,
2070
- jt,
2071
- Nt,
2072
- !1,
2073
- null,
2074
- "8c34e2f0"
2075
- );
2076
- const qt = Ht.exports, Ut = (s) => (s || []).slice(0, 1).map((e) => ({
2077
- ...e,
2078
- isSelected: !0,
2079
- isSelectedDefault: !0,
2080
- toggable: !1
2081
- })), Gt = (s) => {
2082
- const e = o(s, "0.data.prices.type") || "fixed";
2083
- return (s || []).map((t, i) => ({
2084
- ...t,
2085
- toggable: !0,
2086
- ...i === 0 ? {
2087
- isSelected: !0,
2088
- isSelectedDefault: !0,
2089
- toggable: !1
2090
- } : null,
2091
- data: {
2092
- ...t.data,
2093
- prices: {
2094
- ...t.data ? t.data.prices : null,
2095
- type: e
2096
- }
2097
- }
2098
- }));
2099
- }, Kt = (s = []) => {
2100
- let e = !1;
2101
- return s.map((t) => {
2102
- const i = {
2103
- ...t,
2104
- // if any earlier pkg is selected, deselect pkg, otherwise keep as is
2105
- ...e ? {
2106
- isSelected: !1,
2107
- isSelectedDefault: !1
2108
- } : null,
2109
- toggable: !0
2110
- };
2111
- return (i.isSelected || i.isSelectedDefault) && (e = !0), i;
2112
- }, []);
2113
- };
2114
- function Yt(s, ...e) {
2115
- if (s === "single")
2116
- return Ut(...e);
2117
- if (s === "checkbox")
2118
- return Gt(...e);
2119
- if (s === "radio")
2120
- return Kt(...e);
2121
- throw new Error(`Package filter type '${s}' is not implemented`);
2122
- }
2123
- const Zt = {
2124
- name: "PackageGroupEdit",
2125
- i18nOptions: {
2126
- namespaces: "PackageGroupEdit",
2127
- messages: {
2128
- en: {
2129
- base: "Default package",
2130
- add: "Add package",
2131
- basePlaceholder: "Add a default package that's always included.",
2132
- selectablePlaceholder: "Add packages your client can choose between.",
2133
- hideGroupPrice: "Hide summary for block",
2134
- reset: {
2135
- message: "Package type changed",
2136
- button: "Revert"
2137
- },
2138
- error: {
2139
- selectType: "Choose price type",
2140
- minOnePackage: "Add at least 1 package"
2141
- }
2142
- },
2143
- sv: {
2144
- base: "Grundpaket",
2145
- add: "Valbart alternativ",
2146
- basePlaceholder: "Lägg till ett baspaket som alltid ingår.",
2147
- selectablePlaceholder: "Lägg till valbara paket som din kund kan välja mellan.",
2148
- hideGroupPrice: "Dölj summering för block",
2149
- reset: {
2150
- message: "Pakettyp har ändrats",
2151
- button: "Återställ"
2152
- },
2153
- error: {
2154
- selectType: "Välj ett prisförslag",
2155
- minOnePackage: "Lägg till minst 1 paket"
2156
- }
2157
- }
2158
- }
2159
- },
2160
- components: {
2161
- ErrorCallout: V,
2162
- PackageItem: qt,
2163
- PackageGroupSelect: We,
2164
- CCallout: W,
2165
- CDropdown: x,
2166
- CDropdownItem: b
2167
- },
2168
- mixins: [
2169
- y([
2170
- "type",
2171
- // 'title',
2172
- "packages",
2173
- "articles",
2174
- "hideGroupPrice"
2175
- ])
2176
- ],
2177
- props: {
2178
- persistedGroup: {
2179
- type: Object,
2180
- default: () => ({})
2181
- },
2182
- validator: {
2183
- type: Object,
2184
- default: () => ({})
2185
- }
2186
- },
2187
- data() {
2188
- return {
2189
- setPricesDirty: !1
2190
- };
2191
- },
2192
- computed: {
2193
- ...h({
2194
- getSetting: ["settings/getCompanySetting"],
2195
- defaultCurrency: "settings/defaultCurrency",
2196
- newArticle: "articles/getNewArticle"
2197
- }),
2198
- internalPackages() {
2199
- return this.packages.map((s, e) => ({ ...s, index: e }));
2200
- },
2201
- topRowPackages() {
2202
- return this.type === "checkbox" ? this.internalPackages.filter(({ toggable: s }) => s === !1) : this.internalPackages;
2203
- },
2204
- bottomRowPackages() {
2205
- return this.type === "checkbox" ? this.internalPackages.filter(({ toggable: s }) => s === !0) : [];
2206
- },
2207
- group() {
2208
- return this._document.packageGroups.getPackageGroupUniqId(
2209
- this._value.groupId
2210
- ) || {};
2211
- },
2212
- houseWorkType() {
2213
- return o(this.group, "prices.region.houseWorkType", null);
2214
- },
2215
- isIndivid() {
2216
- return o(this, "_document.prices.helpers.isIndivid", !0);
2217
- },
2218
- setPricesIncVat() {
2219
- return this._document.setPricesIncVat;
2220
- },
2221
- defaultVatInput() {
2222
- return this.isIndivid ? this.getSetting("priceInputDefault") : this.getSetting("priceInputCompany");
2223
- },
2224
- currency() {
2225
- return this._document.currency;
2226
- }
2227
- },
2228
- watch: {
2229
- isIndivid() {
2230
- this.setPricesDirty || this.setPricesIncVatAsDefault();
2231
- }
2232
- },
2233
- created() {
2234
- this.setPricesIncVat === null && this.setPricesIncVatAsDefault({ ignoreChanges: !0 });
2235
- },
2236
- methods: {
2237
- ...v({
2238
- showMessage: p.SHOW_MESSAGE
2239
- }),
2240
- setPricesIncVatAsDefault(s = {}) {
2241
- this.$emit("input", {
2242
- key: "data.formSettings.setPricesIncVat",
2243
- value: this.defaultVatInput === "incVat",
2244
- options: s
2245
- });
2246
- },
2247
- onSelectType(s) {
2248
- this.type = s;
2249
- const { type: e, packages: t } = this.persistedGroup || {};
2250
- if (e && t && t.length)
2251
- this.addPersistedGroup(s), s !== e && this.showMessage({
2252
- type: "info",
2253
- message: this.$t("reset.message"),
2254
- actions: {
2255
- undo: {
2256
- text: this.$t("reset.button"),
2257
- callback: () => {
2258
- this.addPersistedGroup(e), this.type = e;
2259
- }
2260
- }
2261
- }
2262
- });
2263
- else {
2264
- if (s === "checkbox")
2265
- return;
2266
- this.addPackage({});
2267
- }
2268
- },
2269
- addPersistedGroup(s) {
2270
- if (!this.persistedGroup || !this.persistedGroup.type)
2271
- return;
2272
- let { packages: e, articles: t } = this.persistedGroup;
2273
- if (!e.length)
2274
- return;
2275
- if (s !== this.persistedGroup.type && (e = Yt(s, e)), s === "single" && t.length) {
2276
- const [{ packageId: n }] = e;
2277
- t = t.filter((a) => a.packageId === n);
2278
- }
2279
- const i = Oe(
2280
- [...this._document.allArticles || [], ...t || []],
2281
- (n) => n._uniqueId
2282
- );
2283
- this.$emit("input", { key: "articles", value: i }), this.$emit("input", { key: `${[this._value.packages]}`, value: e });
2284
- },
2285
- addPackage(s = {}) {
2286
- const e = oe(), t = this.type === "checkbox" && this.packages.length ? this.packages[0].data.prices.type : "fixed", i = this.currency || this.defaultCurrency, n = {
2287
- isSelected: this.type === "single",
2288
- isSelectedDefault: this.type === "single",
2289
- toggable: !0,
2290
- packageId: e,
2291
- data: {
2292
- name: "",
2293
- description: "",
2294
- prices: {
2295
- type: t,
2296
- currency: i
2297
- }
2298
- },
2299
- ...s
2300
- };
2301
- this.$emit("input", { key: this._value.packages, value: n }), this.$emit("input", {
2302
- key: "articles",
2303
- value: this.newArticle({
2304
- priceType: t.startsWith("open") ? "openAcc" : t,
2305
- packageId: e,
2306
- currency: i
2307
- })
2308
- }), this.$nextTick(() => {
2309
- const a = document.getElementById(`package-name-${e}`);
2310
- a && a.focus();
2311
- });
2312
- },
2313
- onInputPriceType(s, e) {
2314
- this.type === "checkbox" && this.packages.forEach((t, i) => {
2315
- i !== s && this.$emit("input", {
2316
- key: `${[this._value.packages]}[${[i]}].data.prices.type`,
2317
- value: e
2318
- });
2319
- });
2320
- },
2321
- onInputSelectedDefault(s, e) {
2322
- this.type === "radio" && !e || (this.type === "radio" && e && this.packages.forEach((t, i) => {
2323
- i !== s && (this.$emit("input", {
2324
- key: `${[this._value.packages]}[${[i]}].isSelectedDefault`,
2325
- value: !1
2326
- }), this.$emit("input", {
2327
- key: `${[this._value.packages]}[${[i]}].isSelected`,
2328
- value: !1
2329
- }));
2330
- }), this.$emit("input", {
2331
- key: `${[this._value.packages]}[${[s]}].isSelectedDefault`,
2332
- value: e
2333
- }), this.$emit("input", {
2334
- key: `${[this._value.packages]}[${[s]}].isSelected`,
2335
- value: e
2336
- }));
2337
- },
2338
- removeByIndex(s) {
2339
- const { packageId: e } = this.packages[s], t = this._document.allArticles.filter(
2340
- ({ packageId: i }) => i !== e
2341
- );
2342
- this.$emit("input", { key: "articles", value: t }), this.$emit("remove", { key: `${[this._value.packages]}[${[s]}]` });
2343
- },
2344
- async onResetType() {
2345
- const s = this.packages.map((i) => i.packageId), [e, t] = this._document.allArticles.reduce(
2346
- ([i, n], a) => s.includes(a.packageId) ? [[...i, a], n] : [i, [...n, a]],
2347
- [[], []]
2348
- );
2349
- this.$emit("update:persisted-group", {
2350
- type: this.type,
2351
- packages: this.packages,
2352
- articles: e
2353
- }), this.$emit("input", { key: "articles", value: t }), this.$emit("input", { key: `${[this._value.packages]}`, value: [] }), this.type = "";
2354
- },
2355
- moveOptions(s, e) {
2356
- const t = { up: !1, down: !1 };
2357
- return s > 0 && (t.up = !0), s < e - 1 && (t.down = !0), t;
2358
- },
2359
- moveItem(s, e) {
2360
- const t = A(this.packages, s, e);
2361
- this.$emit("input", { key: this._value.packages, value: t });
2362
- }
2363
- }
2364
- };
2365
- var Jt = function() {
2366
- var e = this, t = e._self._c;
2367
- return t("div", { staticClass: "package-group-root font-inter" }, [e.type ? [t("div", { staticStyle: { position: "absolute", right: "0", top: "-10px", transform: "translateY(-100%)", "z-index": "2" } }, [t("CDropdown", { scopedSlots: e._u([{ key: "trigger", fn: function() {
2368
- return [t("CButton", { attrs: { type: "none", size: "normal", pattern: "secondary", icon: "more-horizontal", circle: "" } })];
2369
- }, proxy: !0 }]) }, [t("CDropdownItem", { on: { click: e.onResetType } }, [e._v(e._s(e.$t("_common:change", { thing: e.$t("_common:price.proposal").toLowerCase() })))]), t("CDropdownItem", { attrs: { value: !!e.hideGroupPrice, "close-on-click": !1, toggle: "" }, on: { input: function(i) {
2370
- e.hideGroupPrice = i;
2371
- } } }, [e._v(" " + e._s(e.$t("hideGroupPrice")) + " ")])], 1)], 1), e.type === "checkbox" && !e.internalPackages.find((i) => i.toggable === !1) ? t("CCallout", { staticClass: "w-full", attrs: { title: e.$t("base") } }, [t("div", { staticClass: "pb-4" }, [e._v(" " + e._s(e.$t("basePlaceholder")) + " ")]), t("CButton", { staticStyle: { "font-weight": "600" }, attrs: { type: "secondary", size: "small" }, on: { click: function(i) {
2372
- return e.addPackage({
2373
- isSelected: !0,
2374
- isSelectedDefault: !0,
2375
- toggable: !1
2376
- });
2377
- } } }, [e._v(" " + e._s(e.$t("_common:add", { thing: e.$t("base").toLowerCase() })) + " ")])], 1) : t("transition-group", { attrs: { name: "section-list", tag: "div" } }, e._l(e.topRowPackages, function(i, n) {
2378
- return t("div", { key: i.packageId, staticClass: "section-item pb-4" }, [t("PackageItem", { attrs: { _document: e._document, _value: {
2379
- isSelectedDefault: `${e._value.packages}[${i.index}].isSelectedDefault`,
2380
- isSelected: `${e._value.packages}[${i.index}].isSelected`,
2381
- name: `${e._value.packages}[${i.index}].data.name`,
2382
- description: `${e._value.packages}[${i.index}].data.description`,
2383
- priceType: `${e._value.packages}[${i.index}].data.prices.type`,
2384
- maxTotal: `${e._value.packages}[${i.index}].data.prices.maxTotal`,
2385
- basePath: `${e._value.packages}[${i.index}]`,
2386
- currency: `${e._value.packages}[${i.index}].data.prices.currency`
2387
- }, type: e.type, "active-house-work-type": e.houseWorkType, toggable: i.toggable, "package-id": i.packageId, "move-options": e.moveOptions(n, e.topRowPackages.length) }, on: { input: function(a) {
2388
- return e.$emit("input", a);
2389
- }, add: function(a) {
2390
- return e.$emit("add", a);
2391
- }, "update:isSelectedDefault": (a) => e.onInputSelectedDefault(i.index, a), "update:priceType": (a) => e.onInputPriceType(i.index, a), "update:setPricesIncVat": (a) => {
2392
- e.$emit("input", {
2393
- key: "data.formSettings.setPricesIncVat",
2394
- value: a
2395
- }), e.setPricesDirty = !0;
2396
- }, "update:currency": (a) => e.$emit("input", { key: "currency", value: a }), remove: function(a) {
2397
- return e.$emit("remove", a);
2398
- }, "remove-package": function(a) {
2399
- return e.removeByIndex(i.index);
2400
- }, move: function(a) {
2401
- return e.moveItem(i.index, e.topRowPackages[n + a].index);
2402
- } } })], 1);
2403
- }), 0), e.type === "checkbox" && e.topRowPackages.length && e.bottomRowPackages.length ? t("div", { staticStyle: { width: "calc(5 * var(--rem))", height: "1px", "margin-left": "calc(50% - calc(2.5 * var(--rem)))", "border-top": "2px dashed hsl(0, 0%, 85%)" } }) : e._e(), e.type === "checkbox" ? [t("transition-group", { staticStyle: { "margin-bottom": "calc(1 * var(--rem))" }, attrs: { name: "section-list", tag: "div" } }, e._l(e.bottomRowPackages, function(i, n) {
2404
- return t("div", { key: i.packageId, staticClass: "section-item", staticStyle: { padding: "calc(1 * var(--rem)) 0" } }, [t("PackageItem", { staticClass: "package-item", attrs: { _document: e._document, _value: {
2405
- isSelectedDefault: `${e._value.packages}[${i.index}].isSelectedDefault`,
2406
- isSelected: `${e._value.packages}[${i.index}].isSelected`,
2407
- name: `${e._value.packages}[${i.index}].data.name`,
2408
- description: `${e._value.packages}[${i.index}].data.description`,
2409
- priceType: `${e._value.packages}[${i.index}].data.prices.type`,
2410
- maxTotal: `${e._value.packages}[${i.index}].data.prices.maxTotal`,
2411
- basePath: `${e._value.packages}[${i.index}]`,
2412
- currency: `${e._value.packages}[${i.index}].data.prices.currency`
2413
- }, type: e.type, "active-house-work-type": e.houseWorkType, "package-id": i.packageId, "move-options": e.moveOptions(n, e.bottomRowPackages.length) }, on: { input: function(a) {
2414
- return e.$emit("input", a);
2415
- }, add: function(a) {
2416
- return e.$emit("add", a);
2417
- }, "update:isSelectedDefault": (a) => e.onInputSelectedDefault(i.index, a), "update:priceType": (a) => e.onInputPriceType(i.index, a), "update:setPricesIncVat": (a) => {
2418
- e.$emit("input", {
2419
- key: "data.formSettings.setPricesIncVat",
2420
- value: a
2421
- }), e.setPricesDirty = !0;
2422
- }, remove: function(a) {
2423
- return e.$emit("remove", a);
2424
- }, "remove-package": function(a) {
2425
- return e.removeByIndex(i.index);
2426
- }, move: function(a) {
2427
- return e.moveItem(i.index, e.bottomRowPackages[n + a].index);
2428
- } } })], 1);
2429
- }), 0)] : e._e(), e.type !== "single" || !e.packages.length ? t("div", { staticClass: "flex w-full flex-col items-center justify-center" }, [t("div", { staticStyle: { width: "100%" } }, [e.type === "radio" && !e.packages.length ? t("div", { staticClass: "package-placeholder bg-gray-100", staticStyle: { color: "hsl(0, 0%, 24%)", "font-weight": "500" } }, [t("svg", { staticStyle: { "vertical-align": "text-bottom", "margin-right": "3px" }, attrs: { width: "16", height: "16", viewBox: "0 0 18 14", xmlns: "http://www.w3.org/2000/svg" } }, [t("path", { attrs: { d: "M8.03.22c.3.3.3.77 0 1.06L5.56 3.75h6.88L9.97 1.28A.75.75 0 1111.03.21l3.53 3.54h2.69a.75.75 0 010 1.5h-.12l-1.17 6.4a2.25 2.25 0 01-2.21 1.85h-9.5a2.25 2.25 0 01-2.21-1.84L.87 5.26H.75a.75.75 0 010-1.5h2.69L6.97.21c.3-.3.77-.3 1.06 0zM2.4 5.25L3.5 11.4c.07.35.38.61.74.61h9.5c.36 0 .67-.26.74-.61l1.11-6.14H2.4zm3.1 1.5c.41-.06.8.22.86.63l.38 2.25a.75.75 0 11-1.48.24l-.37-2.25c-.07-.4.2-.8.61-.86zm7 0c.4.08.68.47.61.87l-.37 2.25a.75.75 0 11-1.48-.24l.38-2.25a.75.75 0 01.86-.62zm-3.5 0c.41 0 .75.34.75.75v2.25a.75.75 0 01-1.5 0V7.5c0-.41.34-.75.75-.75z", fill: "#000", "fill-rule": "evenodd" } })]), e._v(" " + e._s(e.$t("selectablePlaceholder")) + " ")]) : e._e()]), e.validator.$invalid && e.validator.$dirty ? t("ErrorCallout", { staticStyle: { margin: "calc(1 * var(--rem)) 0 calc(1 * var(--rem)) 0" }, attrs: { message: e.$t("error.minOnePackage") } }) : e._e(), t("div", { staticClass: "flex w-full" }, [t("CButton", { staticStyle: { "border-color": "hsl(0, 0%, 82%)" }, attrs: { type: "secondary", outlined: "", "icon-left": "plus" }, on: { click: function(i) {
2430
- return e.addPackage();
2431
- } } }, [e._v(" " + e._s(e.$t("add")) + " ")])], 1)], 1) : e._e()] : t("div", [t("PackageGroupSelect", { on: { input: function(i) {
2432
- return e.onSelectType(i);
2433
- } } }), e.validator.$invalid && e.validator.$dirty ? t("ErrorCallout", { staticStyle: { "padding-bottom": "calc(1.5 * var(--rem))" }, attrs: { message: e.$t("error.selectType") } }) : e._e()], 1)], 2);
2434
- }, Xt = [], Qt = /* @__PURE__ */ u(
2435
- Zt,
2436
- Jt,
2437
- Xt,
2438
- !1,
2439
- null,
2440
- "2a8fb7bc"
2441
- );
2442
- const mi = Qt.exports;
2443
- export {
2444
- mi as default
2445
- };