@cling-se/widget 0.17.0 → 1.0.0-beta.2

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/dist/AddClientCallout-e8d19R3f.js +101 -0
  2. package/dist/AnswerModal-BGvB8IVV.js +3291 -0
  3. package/dist/AttachmentItem-CkHbAm4l.js +171 -0
  4. package/dist/BaseUpload-BiJBcWRu.js +2472 -0
  5. package/dist/BlockMedia-CW5wgipC.js +103 -0
  6. package/dist/CCallout-Cy2eeIYd.js +104 -0
  7. package/dist/{CCurrencyDropdown-C2rXt2cJ.js → CCurrencyDropdown-DE_3CTjm.js} +91 -53
  8. package/dist/CDropdownItem-Dmq5gYzA.js +751 -0
  9. package/dist/CFormField.vue_vue_type_script_setup_true_lang-D_U9coAY.js +292 -0
  10. package/dist/{CPhoneFormat-C8VPsiK6.js → CPhoneFormat-BS2nP9kc.js} +13 -21
  11. package/dist/CPhoneInput-Bf6329PO.js +207 -0
  12. package/dist/CPriceInput-d1yjuMQr.js +140 -0
  13. package/dist/CSelect-DgnT07Hk.js +98 -0
  14. package/dist/CSkeleton.vue_vue_type_script_setup_true_lang-Ckl--dyv.js +51 -0
  15. package/dist/ClientAutocomplete-9JzGcO9O.js +532 -0
  16. package/dist/ClientModal-BzWQtWSZ.js +1181 -0
  17. package/dist/ColorPicker-BvoFN8nu.js +1408 -0
  18. package/dist/CompanyModal-Bp4V_az9.js +250 -0
  19. package/dist/ContentWrapper-CuH6xKmo.js +265 -0
  20. package/dist/CoverBlockSettings-BA5L0Zee.js +861 -0
  21. package/dist/DocAnswer-BcNA_KEg.js +33 -0
  22. package/dist/DocDetails-CStEwWnU.js +448 -0
  23. package/dist/DocForm-BOoILf5E.js +6748 -0
  24. package/dist/DocFormSend-CQIf-HJY.js +171 -0
  25. package/dist/DocLinks-BRX5QzNe.js +36 -0
  26. package/dist/DocModalBase-D72yWj-x.js +29 -0
  27. package/dist/DocPrint-BI1LXUPE.js +399 -0
  28. package/dist/DocReceipt-DaZ4V76p.js +341 -0
  29. package/dist/DocSendReminder-DKGZlo7s.js +181 -0
  30. package/dist/DocTextEditor-Dm-cTZpA.js +19413 -0
  31. package/dist/DocTimeline-DCwofzuk.js +537 -0
  32. package/dist/DocumentClient-vJdxCB53.js +90 -0
  33. package/dist/DocumentLayout-CKSi42ev.js +1368 -0
  34. package/dist/DocumentLogotype-DbQlvQ-y.js +162 -0
  35. package/dist/DocumentVoided-CRX2WxWO.js +33 -0
  36. package/dist/EmbedInput-B-oeC4Wy.js +157 -0
  37. package/dist/EmbedSettings-B9Yka2yB.js +103 -0
  38. package/dist/ErrorCallout-B_ygH33E.js +34 -0
  39. package/dist/FilePreviewModal-Bf3ELTow.js +202 -0
  40. package/dist/Flag-BwTgCNHO.js +41 -0
  41. package/dist/HeaderSettings-DvC7nlyY.js +720 -0
  42. package/dist/ImageSelectModal-D3sP3lhR.js +119 -0
  43. package/dist/ImageUploadWrapper-RWNa-yIq.js +1585 -0
  44. package/dist/Index-0_3ULrWX.js +126 -0
  45. package/dist/Index-4NPe0sfX.js +629 -0
  46. package/dist/Index-B1uA0FF6.js +4 -0
  47. package/dist/Index-BBkCYm2q.js +201 -0
  48. package/dist/{Index-LzN6dktq.js → Index-BBwvo7S9.js} +10 -18
  49. package/dist/Index-BEMlsYwJ.js +68 -0
  50. package/dist/Index-BRBhJ6kz.js +21 -0
  51. package/dist/{Index-BPUYpfLJ.js → Index-BTFmHjUt.js} +47 -60
  52. package/dist/Index-BcUNnxLC.js +1098 -0
  53. package/dist/Index-Bo6ExBUL.js +93 -0
  54. package/dist/Index-BvMPCgdH.js +102 -0
  55. package/dist/Index-Bx5TOI9k.js +74 -0
  56. package/dist/Index-C7GZS8EI.js +16 -0
  57. package/dist/Index-CNWhm07R.js +25 -0
  58. package/dist/{Index-BUK-1yVR.js → Index-CQpznMKV.js} +9 -17
  59. package/dist/Index-CRzsnIij.js +159 -0
  60. package/dist/Index-CeSG1C41.js +140 -0
  61. package/dist/Index-CjfjdZj5.js +52 -0
  62. package/dist/Index-CskKmZpd.js +363 -0
  63. package/dist/Index-D5qwbCo1.js +28 -0
  64. package/dist/Index-D8Ae1Txt.js +228 -0
  65. package/dist/Index-DE8aenDB.js +3452 -0
  66. package/dist/Index-DI5EB5Rt.js +39 -0
  67. package/dist/Index-DaV57YPP.js +163 -0
  68. package/dist/Index-DbwkmoyM.js +38 -0
  69. package/dist/Index-Df9skok6.js +70 -0
  70. package/dist/{Index-BHJGfHm9.js → Index-DfLLA0ij.js} +313 -206
  71. package/dist/Index-Dw1CO5F9.js +76 -0
  72. package/dist/Index-PZXyOoVb.js +87 -0
  73. package/dist/{Index-BioOegOO.js → Index-ZUnH-BHj.js} +10 -18
  74. package/dist/Index-cjKGSiDi.js +136 -0
  75. package/dist/Index-m-goRuKD.js +49 -0
  76. package/dist/Index-rGeWbLcB.js +47 -0
  77. package/dist/Index-vrljNp6G.js +28 -0
  78. package/dist/Index.vue_vue_type_script_lang-aeVuChGF.js +671 -0
  79. package/dist/InputToggleRow-v6qAWPg6.js +99 -0
  80. package/dist/ManualPopover-BONBJIUA.js +57 -0
  81. package/dist/MediaWrapper-CXb2UGd9.js +18 -0
  82. package/dist/{NotBindingText-CM3FN0A6.js → NotBindingText-BqESO13N.js} +13 -17
  83. package/dist/PackageGroup-AIysVmyh.js +1058 -0
  84. package/dist/PdfTerms-BlhHdTu3.js +34 -0
  85. package/dist/PdfViewer-DwZ1rwlN.js +392 -0
  86. package/dist/PlainHtml.vue_vue_type_script_setup_true_lang-D6NNUTz0.js +17 -0
  87. package/dist/PriceHeader-C4XhnoA3.js +488 -0
  88. package/dist/SearchApi-B7lXgUY6.js +137 -0
  89. package/dist/SendForm-BcD0xSvB.js +7031 -0
  90. package/dist/Setup-C2qaYDei.js +47 -0
  91. package/dist/{SmartList-DhhjSWLO.js → SmartList-DqG7Q5t7.js} +16 -24
  92. package/dist/Sortable.vue_vue_type_script_setup_true_lang-CzMbr8AX.js +1303 -0
  93. package/dist/{TermsSettings-BEQwmkFH.js → TermsSettings-BOCONyM4.js} +169 -56
  94. package/dist/ThemeColorRow-sjGdMzGN.js +108 -0
  95. package/dist/ToggleBinding-7oq_oXPt.js +44 -0
  96. package/dist/UploadModal-C_X2NjVY.js +134 -0
  97. package/dist/VideoPlayerInput-BsUcmpl4.js +135 -0
  98. package/dist/VideoPlayerSettings-BXMmxaZQ.js +78 -0
  99. package/dist/VideoSelectModal-CW0OweCw.js +217 -0
  100. package/dist/{anime.es-BrPTThYb.js → anime.es-gdcpA-eY.js} +1 -2
  101. package/dist/{color-TdtKxwVa.js → color-HetJPhlA.js} +1 -2
  102. package/dist/{debounce-D0hKNU85.js → debounce-DNl99Gyo.js} +10 -10
  103. package/dist/dom-CkTGWrfu.js +69 -0
  104. package/dist/{focusDrawerMixin-C_aTLmK0.js → focusDrawerMixin-BwcErMDY.js} +1 -1
  105. package/dist/{formDrawerState-Da4mcbab.js → formDrawerState-DaurePnd.js} +2 -2
  106. package/dist/helpers-CPW--XIz.js +44 -0
  107. package/dist/index-BjiGCJPI.js +149 -0
  108. package/dist/index-CFNv6OvX.js +188 -0
  109. package/dist/index-Cx71On5Z.js +508 -0
  110. package/dist/index-DKMxIBz_.js +270 -0
  111. package/dist/index-DKf5SGLD.js +125 -0
  112. package/dist/index-E32WgUp9.js +3525 -0
  113. package/dist/index-kp-GC5I0.js +513 -0
  114. package/dist/index.es.js +2 -5
  115. package/dist/index.umd.js +285 -1485
  116. package/dist/{main-BgzLHIoo.js → main-Cb-nyil1.js} +41414 -42507
  117. package/dist/mapFormMixin-D3BihYWW.js +1544 -0
  118. package/dist/omit--YYr41Xp.js +31 -0
  119. package/dist/{publicSenderState-DB4BHByV.js → publicSenderState-CdRW_Wwp.js} +4 -4
  120. package/dist/splitpanes-D-ThFkeR.js +342 -0
  121. package/dist/style.css +1 -4
  122. package/dist/template-BvaNnq-g.js +1493 -0
  123. package/dist/{throttle-DT2UVOqm.js → throttle-D-bUGaVh.js} +2 -2
  124. package/dist/tippy.esm-BmKNqohP.js +1994 -0
  125. package/dist/useTermsModal-Dhf6_eYb.js +87 -0
  126. package/dist/{utils-nos8CB1L.js → utils-CBPcYdLv.js} +8 -11
  127. package/dist/validation-DOcUOoMe.js +40 -0
  128. package/package.json +18 -21
  129. package/dist/AddClientCallout-BJzBdba1.js +0 -48
  130. package/dist/AnswerModal-frHq1g4s.js +0 -3874
  131. package/dist/AttachmentItem-BaN0OrEV.js +0 -85
  132. package/dist/BaseDatePicker-B-AfdrSb.js +0 -3187
  133. package/dist/BaseUpload-CY3lTcte.js +0 -1977
  134. package/dist/BlockMedia-Bb5wQIDg.js +0 -76
  135. package/dist/CCallout-5quI6yyk.js +0 -58
  136. package/dist/CDropdownItem-CaoSQX6X.js +0 -640
  137. package/dist/CFormField-Dd2Y71JG.js +0 -240
  138. package/dist/CPhoneInput-BU1t6eo_.js +0 -138
  139. package/dist/CPriceInput-pv2aIVkH.js +0 -116
  140. package/dist/CSelect-CrM45B7V.js +0 -91
  141. package/dist/CSkeleton-BkvONMqL.js +0 -55
  142. package/dist/ClientAutocomplete-BRXIKQSk.js +0 -438
  143. package/dist/ClientModal-CvHAptV2.js +0 -666
  144. package/dist/ColorPicker-RgoXRrud.js +0 -2879
  145. package/dist/CompanyModal-OL4bD9Gk.js +0 -147
  146. package/dist/ContentWrapper-8HduCnR4.js +0 -190
  147. package/dist/CoverBlockSettings-DUv8AcdX.js +0 -659
  148. package/dist/DocAnswer-DiyFfpT2.js +0 -36
  149. package/dist/DocDetails-BxNRfBnK.js +0 -263
  150. package/dist/DocForm-MGp-o0pu.js +0 -5017
  151. package/dist/DocFormSend-q_QuVCqh.js +0 -146
  152. package/dist/DocLinks-DGDdp30U.js +0 -38
  153. package/dist/DocModalBase-qG4RqwBn.js +0 -28
  154. package/dist/DocPrint-Cln3kt0g.js +0 -240
  155. package/dist/DocReceipt-nbsJ-ukZ.js +0 -217
  156. package/dist/DocSendReminder-B3qdqduf.js +0 -140
  157. package/dist/DocTextEditor-CQDnjnRY.js +0 -17193
  158. package/dist/DocTimeline-CgKHoDcG.js +0 -485
  159. package/dist/DocumentClient-UZlnIlz5.js +0 -136
  160. package/dist/DocumentLayout-Dvr4zgyF.js +0 -4880
  161. package/dist/DocumentLogotype-mAVgMRHr.js +0 -92
  162. package/dist/DocumentVoided-BXYNrf_6.js +0 -25
  163. package/dist/EmbedInput-YRUrw3c6.js +0 -117
  164. package/dist/EmbedSettings-DvRreF7H.js +0 -74
  165. package/dist/ErrorCallout-DVknpLVY.js +0 -27
  166. package/dist/FilePreviewModal-DC56FaGy.js +0 -81
  167. package/dist/Flag-D5iZLESg.js +0 -46
  168. package/dist/HeaderSettings-DXZnZL7A.js +0 -440
  169. package/dist/ImageSelectModal-Bu4_xZga.js +0 -86
  170. package/dist/ImageUploadWrapper-CtZhkAm1.js +0 -1604
  171. package/dist/Index-B1dJO6Bk.js +0 -54
  172. package/dist/Index-B3pz1coY.js +0 -150
  173. package/dist/Index-BHgW8EHW.js +0 -2446
  174. package/dist/Index-BNucs2O-.js +0 -154
  175. package/dist/Index-BW-EtZ1z.js +0 -55
  176. package/dist/Index-BjKACpun.js +0 -66
  177. package/dist/Index-C94BL4uU.js +0 -294
  178. package/dist/Index-CB57haU8.js +0 -58
  179. package/dist/Index-CP17iXT6.js +0 -25
  180. package/dist/Index-CUSbvjoD.js +0 -62
  181. package/dist/Index-CVnD6jo5.js +0 -25
  182. package/dist/Index-Ci5zdPeT.js +0 -28
  183. package/dist/Index-CikqSMjb.js +0 -41
  184. package/dist/Index-CxO4tJ3U.js +0 -26
  185. package/dist/Index-D4J4BpHd.js +0 -230
  186. package/dist/Index-DAQQQlut.js +0 -754
  187. package/dist/Index-DNxSR72J.js +0 -73
  188. package/dist/Index-DPuKRwmu.js +0 -41
  189. package/dist/Index-DSy8QG8T.js +0 -32
  190. package/dist/Index-DX6_D-J-.js +0 -77
  191. package/dist/Index-Dk0KaIKg.js +0 -643
  192. package/dist/Index-Hkzoh9QR.js +0 -24
  193. package/dist/Index-KsHJxWAa.js +0 -94
  194. package/dist/Index-TtItTuv6.js +0 -33
  195. package/dist/Index-YAD39Qvg.js +0 -146
  196. package/dist/Index-eh909lAz.js +0 -107
  197. package/dist/Index-otowKI_C.js +0 -56
  198. package/dist/Index-t_oVV8Rc.js +0 -84
  199. package/dist/Index-vG96oEXZ.js +0 -144
  200. package/dist/InputToggleRow-CcqJDguN.js +0 -57
  201. package/dist/ManualPopover-BE2IN-XU.js +0 -60
  202. package/dist/MediaWrapper-lnGUFiyc.js +0 -23
  203. package/dist/PackageGroup-BsmxOMLW.js +0 -704
  204. package/dist/PdfTerms-BgYwZoAZ.js +0 -31
  205. package/dist/PdfViewer-C0lDpjte.js +0 -383
  206. package/dist/PlainHtml-5YwYVj1v.js +0 -27
  207. package/dist/PriceHeader-CxqhpGS-.js +0 -338
  208. package/dist/SearchApi-BndaIbri.js +0 -161
  209. package/dist/SendForm-D7U9fG-5.js +0 -1023
  210. package/dist/Setup-CmAK2_ZT.js +0 -50
  211. package/dist/ThemeColorRow-BlnhzebY.js +0 -69
  212. package/dist/ToggleBinding-t_58JFya.js +0 -42
  213. package/dist/UploadModal-T-WpYNsN.js +0 -95
  214. package/dist/VideoPlayerInput-DKHKjMgX.js +0 -97
  215. package/dist/VideoPlayerSettings-DDMlUvSt.js +0 -61
  216. package/dist/VideoSelectModal-B9bbP0dd.js +0 -104
  217. package/dist/answerDocumentMixin-DXI_E5Kx.js +0 -51
  218. package/dist/dom-CWsqMElk.js +0 -71
  219. package/dist/formValidationMixin-WZ2lGndu.js +0 -49
  220. package/dist/index-B2l57ilt.js +0 -102
  221. package/dist/index-COKDjmM2.js +0 -167
  222. package/dist/index-HtKGcIng.js +0 -2700
  223. package/dist/index-LQ7NztTt.js +0 -81
  224. package/dist/index-fx5gR8fM.js +0 -351
  225. package/dist/index-zXXJrTvv.js +0 -492
  226. package/dist/mapFormMixin-CQgSN7dv.js +0 -3028
  227. package/dist/omit-ScS7B6c5.js +0 -31
  228. package/dist/simplebar.min-B0cB_p8g.js +0 -71
  229. package/dist/splitpanes-BHUVsCZF.js +0 -382
  230. package/dist/tippy.esm-CR89mtdY.js +0 -1805
  231. package/dist/vuedraggable.umd-CkXXkt1b.js +0 -3161
  232. package/dist/vuex.esm-DKGl8mcw.js +0 -467
@@ -1,2446 +0,0 @@
1
- import { m as y } from "./mapFormMixin-CQgSN7dv.js";
2
- import { C as W } from "./CCallout-5quI6yyk.js";
3
- import { C as x, a as b, w as B } from "./CDropdownItem-CaoSQX6X.js";
4
- import { E as V } from "./ErrorCallout-DVknpLVY.js";
5
- import { aS as F, aT as D, aU as j, aV as N, aW as H, aX as q, l as U, aY as G, n as u, g as p, D as k, aE as K, aZ as T, aL as Y, r as I, av as f, $ as Z, a_ as J, aw as X, a$ as Q, b0 as ee, b1 as A, p as te, b as o, v as ie, Z as g, H as se, K as ae, b2 as ne, z as re, ae as oe } from "./main-BgzLHIoo.js";
6
- import { m as h, a as v } from "./vuex.esm-DKGl8mcw.js";
7
- import { T as ce } from "./DocTextEditor-CQDnjnRY.js";
8
- import { W as le } from "./DocumentLayout-Dvr4zgyF.js";
9
- import { o as R } from "./omit-ScS7B6c5.js";
10
- import { d as ue } from "./vuedraggable.umd-CkXXkt1b.js";
11
- import { C as w } from "./CPriceInput-pv2aIVkH.js";
12
- import { S as de } from "./SearchApi-BndaIbri.js";
13
- import { v as pe } from "./index-zXXJrTvv.js";
14
- import { C as O } from "./CFormField-Dd2Y71JG.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), Le = {
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 Me = 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
- Le,
158
- Me,
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
- user: !1
295
- } }, scopedSlots: e._u([{ key: "default", fn: function({ fetch: i }) {
296
- return [t("CInput", e._b({ ref: "input", staticClass: "r-input", attrs: { value: e.value, type: e.tag, "auto-resize": !0 }, on: { input: function(n) {
297
- return e.search(i, n);
298
- }, focus: e.onFocus, blur: e.onBlur }, nativeOn: { keydown: [function(n) {
299
- return !n.type.indexOf("key") && e._k(n.keyCode, "tab", 9, n.key, "Tab") ? null : e.hideResults.apply(null, arguments);
300
- }, function(n) {
301
- return !n.type.indexOf("key") && e._k(n.keyCode, "escape", void 0, n.key, void 0) ? null : e.hideResults.apply(null, arguments);
302
- }] }, scopedSlots: e._u([{ key: "prefix", fn: function() {
303
- return [e._t("prefix")];
304
- }, proxy: !0 }, { key: "suffix", fn: function() {
305
- return [e._t("suffix")];
306
- }, proxy: !0 }], null, !0) }, "CInput", {
307
- ...e.$attrs,
308
- ...e.$props
309
- }, !1))];
310
- } }]) }), e.isOpen ? t("div", { ref: "dropdown", staticClass: "r-container" }, e._l(e.searchResults, function(i, n) {
311
- return t("div", { key: n, staticClass: "r-item", class: { active: e.selectedIndex === n }, on: { "!click": function(a) {
312
- return a.stopPropagation(), e.onSelect(i);
313
- } } }, [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()]);
314
- }), 0) : e._e()], 1);
315
- }, je = [], Ne = /* @__PURE__ */ u(
316
- Be,
317
- Fe,
318
- je,
319
- !1,
320
- null,
321
- "aa485cb9"
322
- );
323
- const L = Ne.exports, P = {
324
- isDeductable: !1,
325
- isRut: !1,
326
- greenRot15: !1,
327
- greenRot20: !1,
328
- greenRot50: !1
329
- }, $ = (s, e = "", t) => {
330
- let i = {
331
- ...s,
332
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
333
- // Trigger updatedAt as it us used to decide which houseWork to prioritize
334
- };
335
- return typeof t < "u" && (i[t] = e), Object.keys(P).includes(t) && e && (i = {
336
- ...i,
337
- ...P,
338
- [t]: !0
339
- }), K(i.quantity) !== "number" && (i.quantity = 0), T(i);
340
- }, M = ({
341
- stored: s,
342
- current: e,
343
- hidePrice: t = !1,
344
- activeHouseWorkType: i
345
- }) => {
346
- let n = Y({
347
- ...s,
348
- quantity: 1,
349
- showPrice: !t,
350
- id: null,
351
- ArticleId: s.id,
352
- packageId: e.packageId
353
- });
354
- if (i) {
355
- const a = (l = []) => l.reduce((_, d) => ({ ..._, [d]: !1 }), {}), c = Object.values(
356
- R({
357
- rot: "isDeductable",
358
- rut: "isRut",
359
- greenRot15: "greenRot15",
360
- greenRot20: "greenRot20",
361
- greenRot50: "greenRot50"
362
- }, [i])
363
- );
364
- c.some((l) => !!n[l]) && (n = { ...n, ...a(c) });
365
- }
366
- return n;
367
- }, He = (s, e = null) => {
368
- const t = I(s.currency, e);
369
- switch (s.priceType) {
370
- case "approx":
371
- return `${Z.t("_common:approx")} ${t}`;
372
- case "openAcc":
373
- return `${t}/${f(s.unitType)}`;
374
- case "markup":
375
- return "%";
376
- default:
377
- return t;
378
- }
379
- }, E = {
380
- en: {
381
- namePlaceholder: "Service or product name",
382
- openModalTooltip: "Edit amount and unit",
383
- hidePriceLabel: "Hide price for client",
384
- saveAndAddTooltip: "Save and quick-add",
385
- priceTypeTooltips: {
386
- fixed: "The service / product is offered at a fixed price",
387
- approx: "Show that the price is approximate",
388
- openAcc: "Pricing on demand. E.g. charging per hour",
389
- markup: "Show that you take a percentage markup"
390
- },
391
- priceTypeShort: {
392
- approx: "Approximate price",
393
- markup: "Markup",
394
- openAcc: "Open Account"
395
- },
396
- validations: {
397
- name: {
398
- maxLength: "Max length of name is 255 characters"
399
- }
400
- }
401
- },
402
- sv: {
403
- namePlaceholder: "T.ex. arbete & material",
404
- openModalTooltip: "Justera antal / enhet",
405
- hidePriceLabel: "Dölj pris för kund",
406
- saveAndAddTooltip: "Spara och lägg till ny",
407
- priceTypeTooltips: {
408
- fixed: "Tjänsten/varan erbjuds till fast pris",
409
- approx: "Markera att priset är ungefärligt",
410
- openAcc: "Tjänsten / varan erbjuds löpandes",
411
- markup: "Markera att du tar ett procentuellt påslag"
412
- },
413
- priceTypeShort: {
414
- approx: "Ca. pris",
415
- markup: "Påslag",
416
- openAcc: "Löp. pris"
417
- },
418
- validations: {
419
- name: {
420
- maxLength: "Namnet får vara max 255 tecken långt"
421
- }
422
- }
423
- }
424
- }, z = {
425
- article: {
426
- name: {
427
- maxLength: pe.maxLength(255)
428
- }
429
- }
430
- }, qe = {
431
- // eslint-disable-next-line vue/no-reserved-component-names
432
- name: "Article",
433
- i18nOptions: {
434
- namespaces: "Article",
435
- messages: E
436
- },
437
- components: {
438
- ErrorCallout: V,
439
- ArticleAutocomplete: L,
440
- CPriceInput: w
441
- },
442
- props: {
443
- // Article object
444
- value: {
445
- type: Object,
446
- required: !0
447
- },
448
- // If remove button is visible
449
- enableRemove: {
450
- type: Boolean,
451
- default: !0
452
- },
453
- width: {
454
- type: Number,
455
- default: 1e3
456
- },
457
- hidePriceInput: {
458
- type: Boolean,
459
- default: !1
460
- },
461
- hidePriceOnNew: {
462
- type: Boolean,
463
- default: !1
464
- },
465
- isIncVat: {
466
- type: Boolean,
467
- default: !1
468
- },
469
- hideControls: {
470
- type: Boolean,
471
- default: !1
472
- },
473
- rootPriceType: {
474
- type: String,
475
- default: null
476
- },
477
- // The current active houseWorkType allowed when adding new articles from search
478
- activeHouseWorkType: {
479
- type: String,
480
- default: null
481
- }
482
- },
483
- validations: z,
484
- data() {
485
- return {
486
- updateData: $,
487
- addSavedArticle: M,
488
- articleUnitLabel: f,
489
- widthCompact: 580,
490
- visualDisable: !1
491
- };
492
- },
493
- computed: {
494
- article: {
495
- get() {
496
- return this.value || {};
497
- },
498
- set(s) {
499
- this.$emit("input", s);
500
- }
501
- },
502
- details() {
503
- const s = [], {
504
- priceType: e,
505
- quantity: t,
506
- unitType: i,
507
- price: n,
508
- vat: a,
509
- discount: r,
510
- discountType: c
511
- } = this.article;
512
- if (e !== "fixed" && s.push({ title: this.$t(`priceTypeShort.${e}`) }), J(this.article)) {
513
- const l = X(this.article);
514
- s.push({
515
- title: this.$t(`_common:deduction.${l}_percentage`)
516
- });
517
- }
518
- return t && ["fixed", "approx"].includes(e) && (i !== "unit" || t > 1) && s.push({
519
- title: f(this.article.unitType, {
520
- count: t,
521
- includeCount: !0
522
- }),
523
- ...!this.hidePriceInput && {
524
- 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>',
525
- subTitle: k(n, {
526
- showZero: !0,
527
- withVat: this.isIncVat ? a : !1,
528
- currency: this.article.currency,
529
- decimals: 2,
530
- hideZeroDecimals: !0
531
- })
532
- }
533
- }), r && s.push({
534
- title: "-" + (c === "fixed" ? k(r, {
535
- withVat: this.isIncVat ? a : !1,
536
- currency: this.article.currency
537
- }) : `${r / 100} %`),
538
- detailClass: "discount"
539
- }), s;
540
- }
541
- },
542
- methods: {
543
- updateArticle(s, e) {
544
- this.article = $(this.article, s, e);
545
- },
546
- onTotalPriceInputFocus() {
547
- (this.article.discount || this.article.quantity !== 1) && this.$emit("open-modal", { focusEl: "priceInput" });
548
- },
549
- focusName() {
550
- this.$refs.name.focus();
551
- },
552
- errorMessage(s) {
553
- return s.$error && s.article.name.$error && !s.article.name.maxLength ? this.$t("validations.name.maxLength") : null;
554
- }
555
- }
556
- };
557
- var Ue = function() {
558
- var e = this, t = e._self._c;
559
- return t("div", { staticClass: "article-wrapper", class: {
560
- "has-details": e.details.length,
561
- compact: e.width <= e.widthCompact,
562
- "show-controls": !e.hideControls
563
- }, on: { keydown: function(i) {
564
- return !i.type.indexOf("key") && e._k(i.keyCode, "esc", 27, i.key, ["Esc", "Escape"]) ? null : e.$emit("esc");
565
- } } }, [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) {
566
- return e.updateArticle(i, "name");
567
- }, focus: function(i) {
568
- return e.$emit("focus");
569
- }, select: function(i) {
570
- e.$emit(
571
- "input",
572
- e.addSavedArticle({
573
- stored: i,
574
- current: e.article,
575
- hidePrice: e.hidePriceOnNew,
576
- activeHouseWorkType: e.activeHouseWorkType
577
- })
578
- ), e.$emit("select");
579
- } }, scopedSlots: e._u([{ key: "suffix", fn: function() {
580
- return [e.hideControls ? e._e() : t("div", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: {
581
- content: e.$t("openModalTooltip"),
582
- delay: { show: 300, hide: 0 }
583
- }, expression: `{
584
- content: $t('openModalTooltip'),
585
- delay: { show: 300, hide: 0 }
586
- }` }], staticClass: "article-button fade-in", on: { click: function(i) {
587
- return e.$emit("open-modal");
588
- } } }, [t("CIcon", { attrs: { type: "cog", size: "18" } })], 1)];
589
- }, 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) {
590
- return e.updateArticle(i, "price");
591
- }, "update:currency": function(i) {
592
- return e.$emit("update:currency", i);
593
- }, focus: function(i) {
594
- e.onTotalPriceInputFocus(), e.$emit("focus");
595
- } }, nativeOn: { keydown: function(i) {
596
- return !i.type.indexOf("key") && e._k(i.keyCode, "enter", 13, i.key, "Enter") ? null : e.$emit("add");
597
- } } }), e.hideControls ? e._e() : [t("CIcon", { staticClass: "a-control-button close-button fade-in", attrs: { circle: "", type: "x", size: "18" }, nativeOn: { click: function(i) {
598
- e.enableRemove && e.$emit("remove");
599
- } } }), 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) {
600
- return e.$emit("open-modal");
601
- } } }, e._l(e.details, function({ title: i, icon: n, subTitle: a = "", detailClass: r = "" }, c) {
602
- 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) + " ")]);
603
- }), 0) : e._e(), e.$v.$invalid && e.$v.$dirty ? t("ErrorCallout", { attrs: { message: e.errorMessage(e.$v) } }) : e._e()], 1);
604
- }, Ge = [], Ke = /* @__PURE__ */ u(
605
- qe,
606
- Ue,
607
- Ge,
608
- !1,
609
- null,
610
- "417bbfef"
611
- );
612
- const Ye = Ke.exports, Ze = {
613
- props: {
614
- canForward: {
615
- type: Boolean,
616
- default: !1
617
- },
618
- canBackward: {
619
- type: Boolean,
620
- default: !1
621
- }
622
- },
623
- created() {
624
- document.addEventListener("keyup", this.onKeyUp);
625
- },
626
- beforeDestroy() {
627
- this.removeKeyHandler();
628
- },
629
- methods: {
630
- getNavTooltip(s) {
631
- return s === -1 ? {
632
- content: `
633
- <div style='margin-bottom: 0.6em;'>
634
- ${this.$t("show", { thing: this.$t("previous") })}
635
- </div>
636
- <div class='flex items-center justify-center w-full' style='padding-bottom: 0.5em;'>
637
- <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;'>
638
- <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>
639
- </div>
640
- </div>
641
- `,
642
- html: !0
643
- } : s === 1 ? {
644
- content: `
645
- <div style='margin-bottom: 0.6em;'>
646
- ${this.$t("show", { thing: this.$t("next") })}
647
- </div>
648
- <div class='flex items-center justify-center w-full' style='padding-bottom: 0.5em;'>
649
- <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;'>
650
- <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>
651
- </div>
652
- </div>
653
- `,
654
- html: !0
655
- } : s === "close" ? {
656
- 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>',
657
- html: !0
658
- } : null;
659
- },
660
- onKeyUp(s) {
661
- const e = document.activeElement;
662
- !(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));
663
- const i = s.key || s.keyCode;
664
- if (i === "Escape" || i === "Esc" || i === 27) {
665
- const n = this.$modal.getOpenInstances();
666
- if (s.defaultPrevented || n.length)
667
- return;
668
- this.$emit("close");
669
- }
670
- },
671
- removeKeyHandler() {
672
- document.removeEventListener("keyup", this.onKeyUp);
673
- }
674
- },
675
- render() {
676
- return this.$scopedSlots.default({
677
- leftTooltip: this.getNavTooltip(-1),
678
- rightTooltip: this.getNavTooltip(1),
679
- closeTooltip: this.getNavTooltip("close")
680
- });
681
- }
682
- };
683
- var Je = function() {
684
- var e = this, t = e._self._c;
685
- 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) {
686
- return e.$emit("go", -1);
687
- } } }, [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) {
688
- return e.$emit("go", 1);
689
- } } }, [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" } })])])]);
690
- }, Xe = [], Qe = /* @__PURE__ */ u(
691
- Ze,
692
- Je,
693
- Xe,
694
- !1,
695
- null,
696
- "226f5608"
697
- );
698
- const et = Qe.exports, tt = {
699
- name: "ArticleUnitEditModal",
700
- i18nOptions: {
701
- namespaces: "ArticleUnitEditModal",
702
- messages: {
703
- en: {
704
- tooltip: `
705
- <div>
706
- 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>.
707
- </div>
708
- <div style="margin-top: 0.5em;">For example:</div>
709
- <div style="margin-left: 0.25em;">- image:images</div>
710
- <div style="margin-left: 0.25em;">- phone:phones</div>
711
- `
712
- },
713
- sv: {
714
- tooltip: `
715
- <div>
716
- 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>.
717
- </div>
718
- <div style="margin-top: 0.5em;">Till exempel:</div>
719
- <div style="margin-left: 0.25em;">- bild:bilder</div>
720
- <div style="margin-left: 0.25em;">- telefon:telefoner</div>
721
- `
722
- }
723
- }
724
- },
725
- components: {
726
- DragList: Q,
727
- DragItem: ee,
728
- CField: O
729
- },
730
- data() {
731
- return {
732
- hoverIndex: null,
733
- removeConfirmIndex: null,
734
- selectedValue: {
735
- id: null,
736
- value: ""
737
- },
738
- idList: []
739
- };
740
- },
741
- computed: {
742
- ...h({
743
- isPosting: "unitTypes/isPosting",
744
- stateUnitIds: "unitTypes/ids",
745
- unitById: "unitTypes/byId"
746
- }),
747
- unitItems() {
748
- return (this.idList || []).map((s) => {
749
- const e = this.unitById(s), t = f(e.value);
750
- return {
751
- ...e,
752
- label: t,
753
- value: e.value.startsWith("$") ? e.value.replace(/^[$]/, "") : t,
754
- raw: e.value.replace(/^[$]/, "")
755
- // replace only first occurance of '$'
756
- };
757
- });
758
- }
759
- },
760
- watch: {
761
- stateUnitIds: {
762
- immediate: !0,
763
- handler(s) {
764
- this.idList = s || [];
765
- }
766
- }
767
- },
768
- methods: {
769
- ...v({
770
- loadUnits: p.LOAD_UNIT_TYPES,
771
- createUnit: p.CREATE_UNIT_TYPE,
772
- updateUnit: p.UPDATE_UNIT_TYPE,
773
- deleteUnit: p.DELETE_UNIT_TYPE
774
- }),
775
- onEdit(s) {
776
- this.selectedValue = { ...s }, this.$refs.unitInput && this.$refs.unitInput.focus();
777
- },
778
- async submit() {
779
- const { id: s, value: e } = this.selectedValue || {};
780
- if (!e)
781
- throw new Error("New unitTypes need truthy value!");
782
- const t = `$${e}`;
783
- s ? await this.updateUnit({ id: s, body: { value: t } }) : await this.createUnit({ body: { value: t } }), this.reset(), this.$parent.$emit("select", t), this.close();
784
- },
785
- async remove(s, e) {
786
- if (this.removeConfirmIndex !== e) {
787
- this.removeConfirmIndex = e;
788
- return;
789
- }
790
- await this.deleteUnit({ id: s }), this.reset(), this.removeConfirmIndex = null;
791
- },
792
- reset() {
793
- this.selectedValue = { id: null, value: "" };
794
- },
795
- close() {
796
- this.$emit("close");
797
- },
798
- async onDrop({ removedIndex: s, addedIndex: e }) {
799
- s === null && e === null || s !== e && (this.idList = A(this.idList, s, e), await te(
800
- "/unitType/setPositions",
801
- { ids: this.idList },
802
- { invalidateCache: { type: "unitType" } }
803
- ), this.reset(), await this.loadUnits());
804
- }
805
- }
806
- };
807
- var it = function() {
808
- var e = this, t = e._self._c;
809
- return t("div", { staticClass: "modal-overlay font-inter", on: { "&click": function(i) {
810
- return i.target !== i.currentTarget ? null : e.close.apply(null, arguments);
811
- } } }, [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() {
812
- return [t("CButton", { staticStyle: { "border-radius": "4px" }, attrs: { icon: "x", type: "none", pattern: "tertiary", size: "small" }, on: { click: e.reset } })];
813
- }, proxy: !0 } : null], null, !0), model: { value: e.selectedValue.value, callback: function(i) {
814
- e.$set(e.selectedValue, "value", typeof i == "string" ? i.trim() : i);
815
- }, 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) {
816
- 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) {
817
- e.hoverIndex = n;
818
- }, "&mouseleave": function(a) {
819
- e.hoverIndex = null;
820
- }, click: function(a) {
821
- return e.onEdit(i);
822
- } } }, [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) {
823
- return a.stopPropagation(), a.preventDefault(), e.remove(i.id, n);
824
- }, blur: function(a) {
825
- e.removeConfirmIndex = null;
826
- } } }) : e._e(), t("CButton", { attrs: { icon: "edit", size: "small", type: "none", pattern: "tertiary", circle: "" } })], 1)])]);
827
- }), 1)], 1)])])]);
828
- }, st = [], at = /* @__PURE__ */ u(
829
- tt,
830
- it,
831
- st,
832
- !1,
833
- null,
834
- "ae81b7f5"
835
- );
836
- const nt = at.exports, rt = {
837
- name: "ArticleUnitSelect",
838
- components: {
839
- CDropdown: x,
840
- CDropdownItem: b
841
- },
842
- props: {
843
- value: {
844
- type: String,
845
- required: !0
846
- },
847
- isPublicForm: {
848
- type: Boolean,
849
- default: !1
850
- },
851
- // Optional param for plural translations
852
- count: {
853
- type: Number,
854
- default: 1
855
- }
856
- },
857
- computed: {
858
- ...h({
859
- unitIds: "unitTypes/ids",
860
- unitById: "unitTypes/byId"
861
- }),
862
- unitItems() {
863
- return this.isPublicForm ? he : (this.unitIds || []).map((s) => this.unitById(s)).map(({ value: s }) => s);
864
- }
865
- },
866
- created() {
867
- this.isPublicForm || this.loadUnits();
868
- },
869
- methods: {
870
- articleUnitLabel: f,
871
- ...v({
872
- loadUnits: p.LOAD_UNIT_TYPES
873
- }),
874
- openEditModal() {
875
- this.$modal.show(
876
- nt,
877
- {},
878
- {},
879
- {
880
- select: (s) => this.$emit("input", s)
881
- }
882
- );
883
- }
884
- }
885
- };
886
- var ot = function() {
887
- var e = this, t = e._self._c;
888
- return t("CDropdown", e._b({ attrs: { value: e.value, scrollable: "" }, on: { input: function(i) {
889
- return e.$emit("input", i);
890
- } }, scopedSlots: e._u([{ key: "trigger", fn: function() {
891
- return [e._t("default", function() {
892
- return [t("CButton", { attrs: { type: "none", pattern: "tertiary" } }, [e._v(" " + e._s(e.articleUnitLabel(e.value)) + " ")])];
893
- })];
894
- }, proxy: !0 }, { key: "footer", fn: function() {
895
- 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") })) + " ")])];
896
- }, proxy: !0 }], null, !0) }, "CDropdown", {
897
- position: "is-bottom-left",
898
- maxHeight: "240px",
899
- ...e.$attrs
900
- }, !1), e._l(e.unitItems, function(i, n) {
901
- return t("CDropdownItem", { key: `${i}-${n}`, attrs: { value: i } }, [e._v(" " + e._s(e.articleUnitLabel(i)) + " ")]);
902
- }), 1);
903
- }, ct = [], lt = /* @__PURE__ */ u(
904
- rt,
905
- ot,
906
- ct,
907
- !1,
908
- null,
909
- "70333fd5"
910
- );
911
- const ut = lt.exports, dt = {
912
- name: "ArticleModal",
913
- i18nOptions: {
914
- namespaces: "ArticleModal",
915
- messages: E
916
- },
917
- components: {
918
- ArticleAutocomplete: L,
919
- ArticleUnitSelect: ut,
920
- ListModalButtons: et,
921
- CPriceInput: w,
922
- CField: O
923
- },
924
- mixins: [B],
925
- props: {
926
- _document: {
927
- type: Object,
928
- default: () => ({})
929
- },
930
- // Article object
931
- index: {
932
- type: Number,
933
- required: !0
934
- },
935
- articleList: {
936
- type: Array,
937
- required: !0
938
- },
939
- // If priceType checkboxes should be visible
940
- enablePriceTypes: {
941
- type: Boolean,
942
- default: !0
943
- },
944
- hidePriceInput: {
945
- type: Boolean,
946
- default: !1
947
- },
948
- hidePriceOnNew: {
949
- type: Boolean,
950
- default: !1
951
- },
952
- isIncVat: {
953
- type: Boolean,
954
- default: !1
955
- },
956
- rootPriceType: {
957
- type: String,
958
- default: "fixed"
959
- },
960
- currency: {
961
- type: String,
962
- required: !0
963
- },
964
- activeHouseWorkType: {
965
- type: String,
966
- default: null
967
- },
968
- // Mixin props are not injected when rendered within a portal
969
- viewSettings: {
970
- type: Object,
971
- default: () => ({
972
- canEdit: !1,
973
- isForm: !1,
974
- setFormValue: null,
975
- isPublicForm: !1
976
- })
977
- }
978
- },
979
- validations: z,
980
- data() {
981
- return {
982
- priceSuffix: He,
983
- updateData: $,
984
- addSavedArticle: M,
985
- vatOptions: [
986
- { value: 25, translation: "25%" },
987
- { value: 12, translation: "12%" },
988
- { value: 6, translation: "6%" },
989
- { value: 0, translation: "0%" }
990
- ],
991
- showDiscountInput: !1,
992
- setPricesIncVat: !1,
993
- getCurrencySymbol: I,
994
- articleUnitLabel: f
995
- };
996
- },
997
- computed: {
998
- ...h({
999
- allowHidePrice: "settings/allowHidePrice",
1000
- getCompanySetting: "settings/getCompanySetting",
1001
- feature: "application/feature"
1002
- }),
1003
- article: {
1004
- get() {
1005
- return this.articleList[this.index] || {};
1006
- },
1007
- set(s) {
1008
- this.$emit("input", s);
1009
- }
1010
- },
1011
- useVat() {
1012
- return o(this, "_document.useVat") || "";
1013
- },
1014
- vatType() {
1015
- return o(this, "_document.vatType") || "";
1016
- },
1017
- checkboxItems() {
1018
- const { article: s } = this || {}, { priceType: e } = this.article || {}, t = [
1019
- ...e !== "markup" ? [
1020
- {
1021
- label: this.$t("discount").capitalize(),
1022
- value: s.discount || this.showDiscountInput,
1023
- onClick: () => {
1024
- this.showDiscountInput || this.focusEl("discountInput"), this.showDiscountInput = !this.showDiscountInput;
1025
- }
1026
- }
1027
- ] : [],
1028
- ...this.getCompanySetting("showRot") || s.isDeductable ? [
1029
- {
1030
- label: this.$t("_common:deduction.rot"),
1031
- value: this.article.isDeductable,
1032
- onClick: () => this.updateArticle(!s.isDeductable, "isDeductable")
1033
- }
1034
- ] : [],
1035
- ...this.getCompanySetting("showRut") || s.isRut ? [
1036
- {
1037
- label: this.$t("_common:deduction.rut"),
1038
- value: s.isRut,
1039
- onClick: () => this.updateArticle(!s.isRut, "isRut")
1040
- }
1041
- ] : [],
1042
- ...s.greenRot15 ? [
1043
- {
1044
- label: this.$t("_common:deduction.greenRot15_percentage"),
1045
- value: s.greenRot15,
1046
- onClick: () => this.updateArticle(!s.greenRot15, "greenRot15")
1047
- }
1048
- ] : [],
1049
- ...this.getCompanySetting("showGreenRot") || s.greenRot20 || s.greenRot50 ? [
1050
- {
1051
- label: this.$t("_common:deduction.greenRot20_percentage"),
1052
- value: s.greenRot20,
1053
- onClick: () => this.updateArticle(!s.greenRot20, "greenRot20")
1054
- },
1055
- {
1056
- label: this.$t("_common:deduction.greenRot50_percentage"),
1057
- value: s.greenRot50,
1058
- onClick: () => this.updateArticle(!s.greenRot50, "greenRot50")
1059
- }
1060
- ] : []
1061
- ];
1062
- if (this.allowHidePrice) {
1063
- const { showPrice: i } = s || {};
1064
- t.push({
1065
- label: this.$t("hidePriceLabel"),
1066
- value: !i,
1067
- onClick: () => this.updateArticle(!i, "showPrice")
1068
- });
1069
- }
1070
- return t;
1071
- },
1072
- priceTypeOptions() {
1073
- if (!this.enablePriceTypes || this.rootPriceType === "fixed")
1074
- return [];
1075
- const { priceType: s } = this.article, e = (i) => this.$t(`priceTypeTooltips.${i}`), t = [
1076
- {
1077
- label: this.$t("price.fixed"),
1078
- tooltip: e("fixed"),
1079
- value: s === "fixed",
1080
- onClick: () => this.updateArticle("fixed", "priceType")
1081
- }
1082
- ];
1083
- return this.rootPriceType === "approx" && t.push({
1084
- label: this.$t("price.approx"),
1085
- tooltip: e("approx"),
1086
- value: s === "approx",
1087
- onClick: () => this.updateArticle("approx", "priceType")
1088
- }), this.rootPriceType.startsWith("openAcc") && (t.push({
1089
- label: this.$t("price.openAcc"),
1090
- tooltip: e("openAcc"),
1091
- value: s === "openAcc",
1092
- onClick: () => this.updateArticle("openAcc", "priceType")
1093
- }), t.push({
1094
- label: this.$t("price.markup"),
1095
- tooltip: e("markup"),
1096
- value: s === "markup",
1097
- onClick: () => this.updateArticle("markup", "priceType")
1098
- })), t;
1099
- }
1100
- },
1101
- watch: {
1102
- index: {
1103
- immediate: !0,
1104
- handler(s, e) {
1105
- s !== e && (this.showDiscountInput = !1);
1106
- }
1107
- },
1108
- isIncVat: {
1109
- immediate: !0,
1110
- handler(s) {
1111
- this.setPricesIncVat = !!s;
1112
- }
1113
- },
1114
- "article.discount": {
1115
- immediate: !0,
1116
- handler(s) {
1117
- s && (this.showDiscountInput = !0);
1118
- }
1119
- },
1120
- "article.priceType": {
1121
- handler(s) {
1122
- s === "markup" && (this.showDiscountInput = !1), ["openAcc", "markup"].includes(s) && this.updateArticle(1, "quantity");
1123
- }
1124
- },
1125
- showDiscountInput(s) {
1126
- s || this.updateArticle(0, "discount");
1127
- }
1128
- },
1129
- mounted() {
1130
- !this.article.name && this.$refs.nameInput && this.$refs.nameInput.focus(), document.addEventListener("keydown", this.onKeydown);
1131
- },
1132
- beforeDestroy() {
1133
- document.removeEventListener("keydown", this.onKeydown);
1134
- },
1135
- methods: {
1136
- ...v({
1137
- createArticle: p.DO_CREATE_ARTICLE
1138
- }),
1139
- onCustomVatBlur(s) {
1140
- o(s, "target.value") || "" || this.updateArticle(0, "vat");
1141
- },
1142
- onCustomVatInput(s) {
1143
- const e = o(s, "target.value") || "";
1144
- if (!e)
1145
- return;
1146
- let t = e > 100 ? e.slice(0, e.length - 1) : e;
1147
- t < 0 && (t = 0), this.updateArticle(Number.parseFloat(t), "vat");
1148
- },
1149
- updateArticle(s, e) {
1150
- this.article = $(this.article, s, e);
1151
- },
1152
- close() {
1153
- this.$emit("close");
1154
- },
1155
- onKeydown(s) {
1156
- s.keyCode === 13 && s.shiftKey && (s.preventDefault(), this.addNewArticle());
1157
- },
1158
- onGo(s) {
1159
- const e = this.index + s;
1160
- this.articleList[e] && (this.close(), this.$emit("open-modal", e));
1161
- },
1162
- async addNewArticle() {
1163
- this.$v.$invalid || await this.saveArticle(), this.$emit("add", { openModal: !0 }), this.close();
1164
- },
1165
- focusEl(s) {
1166
- this.$nextTick(() => {
1167
- this.$nextTick(() => {
1168
- this.$refs[s] && this.$refs[s].focus && this.$refs[s].focus();
1169
- });
1170
- });
1171
- },
1172
- onTotalPriceInputFocus() {
1173
- this.article.quantity > 1 && this.$nextTick(() => {
1174
- this.$refs.priceInput && this.$refs.priceInput.focus();
1175
- });
1176
- },
1177
- toggleDiscountType() {
1178
- let s = "fixed";
1179
- this.article.discountType === "fixed" && (s = "percentage"), this.updateArticle(s, "discountType");
1180
- },
1181
- async onSaveArticle() {
1182
- if (this.$v.$invalid) {
1183
- this.$v.$touch();
1184
- return;
1185
- }
1186
- await this.saveArticle(), this.close();
1187
- },
1188
- async saveArticle() {
1189
- if (this.viewSettings.isPublicForm)
1190
- return;
1191
- let { ArticleId: s } = this.article;
1192
- !s && ((t) => typeof t == "string" && !!t.trim())(this.article.name) && (s = await this.createArticle({
1193
- body: this.article,
1194
- showMessage: !1
1195
- }), this.article = { ...this.article, ArticleId: s });
1196
- }
1197
- }
1198
- };
1199
- var pt = function() {
1200
- var e = this, t = e._self._c;
1201
- return t("div", { staticClass: "font-inter", class: {
1202
- "full-screen": e.mq === "sm",
1203
- "modal-overlay": !0
1204
- }, on: { "&click": function(i) {
1205
- return i.target !== i.currentTarget ? null : e.close.apply(null, arguments);
1206
- } } }, [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) {
1207
- return e.onGo(i);
1208
- } } }) : 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) {
1209
- return e.updateArticle(i, "name");
1210
- }, select: function(i) {
1211
- e.$emit(
1212
- "input",
1213
- e.addSavedArticle({
1214
- stored: i,
1215
- current: e.article,
1216
- hidePrice: e.hidePriceOnNew,
1217
- activeHouseWorkType: e.activeHouseWorkType
1218
- })
1219
- );
1220
- } } })], 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) {
1221
- e.updateArticle(Number.parseFloat(i), "quantity");
1222
- } } })], 1), t("ArticleUnitSelect", { attrs: { value: e.article.unitType, "is-public-form": e.viewSettings.isPublicForm }, on: { input: function(i) {
1223
- return e.updateArticle(i, "unitType");
1224
- } } }, [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) {
1225
- return e.updateArticle(i, "price");
1226
- }, "update:currency": function(i) {
1227
- return e.$emit("update:currency", i);
1228
- }, focus: function(i) {
1229
- return e.$emit("focus");
1230
- } } })], 1), e.useVat ? t("div", { staticClass: "select-css form-control form-control-right", staticStyle: { width: "8em" }, on: { click: function(i) {
1231
- e.setPricesIncVat = !e.setPricesIncVat;
1232
- } } }, [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) {
1233
- e.updateArticle(Math.abs(i), "discount");
1234
- } }, scopedSlots: e._u([e.article.discountType === "fixed" ? { key: "suffix", fn: function() {
1235
- return [e._v(" " + e._s(e._document.$t(`vat.${e.setPricesIncVat ? "incVat" : "exVat"}`)) + " ")];
1236
- }, proxy: !0 } : { key: "suffix", fn: function() {
1237
- return [e._v(" " + e._s(e.getCurrencySymbol(e.article.currency)) + " ")];
1238
- }, proxy: !0 }], null, !0) })], 1), t("div", { staticClass: "select-css form-control form-control-right", staticStyle: { width: "5em" }, on: { click: function(i) {
1239
- return e.updateArticle(
1240
- e.article.discountType === "percentage" ? "fixed" : "percentage",
1241
- "discountType"
1242
- );
1243
- } } }, [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) {
1244
- e.updateArticle(Number.parseFloat(i.target.value), "vat");
1245
- } } }, e._l(e.vatOptions, function({ translation: i, value: n }, a) {
1246
- return t("option", { key: a, domProps: { value: n } }, [e._v(" " + e._s(e.$t(`vat.${e.vatType}`)) + " " + e._s(i) + " ")]);
1247
- }), 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) {
1248
- return t("div", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: {
1249
- content: r,
1250
- delay: { show: 300, hide: 0 }
1251
- }, expression: `{
1252
- content: tooltip,
1253
- delay: { show: 300, hide: 0 }
1254
- }` }], key: i + c, staticClass: "tag-item", class: { active: n }, on: { click: a } }, [e._v(" " + e._s(i) + " ")]);
1255
- }), 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) {
1256
- return t("div", { key: i + r, staticClass: "tag-item", class: { active: n }, on: { click: a } }, [e._v(" " + e._s(i) + " ")]);
1257
- }), 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: {
1258
- offset: 7,
1259
- html: !0,
1260
- content: `
1261
- <div style='margin-bottom: 0.6em;'>
1262
- ${e.$t("saveAndAddTooltip")}
1263
- </div>
1264
- <div class='flex items-center justify-center' style='padding-bottom: 0.5em;'>
1265
- <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;'>
1266
- <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>
1267
- </div>
1268
- <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;'>
1269
- <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>
1270
- </div>
1271
- </div>
1272
- `
1273
- }, expression: `{
1274
- offset: 7,
1275
- html: true,
1276
- content: \`
1277
- <div style='margin-bottom: 0.6em;'>
1278
- \${$t('saveAndAddTooltip')}
1279
- </div>
1280
- <div class='flex items-center justify-center' style='padding-bottom: 0.5em;'>
1281
- <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;'>
1282
- <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>
1283
- </div>
1284
- <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;'>
1285
- <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>
1286
- </div>
1287
- </div>
1288
- \`
1289
- }` }], 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)]);
1290
- }, ht = [], mt = /* @__PURE__ */ u(
1291
- dt,
1292
- pt,
1293
- ht,
1294
- !1,
1295
- null,
1296
- "87105822"
1297
- );
1298
- const ft = mt.exports, vt = {
1299
- i18nOptions: {
1300
- name: "ArticleListEdit",
1301
- namespaces: "ArticleListEdit",
1302
- messages: {
1303
- en: {
1304
- vatOption: {
1305
- label: "Enter",
1306
- message: "You are now entering prices {{- vatOption}}."
1307
- }
1308
- },
1309
- sv: {
1310
- vatOption: {
1311
- label: "Ange",
1312
- message: "Du anger priser {{- vatOption}} nu"
1313
- }
1314
- }
1315
- }
1316
- },
1317
- components: {
1318
- // eslint-disable-next-line vue/no-reserved-component-names
1319
- Article: Ye,
1320
- ArticleModal: ft,
1321
- WithDimensions: le,
1322
- draggable: ue
1323
- },
1324
- mixins: [y([])],
1325
- props: {
1326
- _document: {
1327
- type: Object,
1328
- default: () => ({})
1329
- },
1330
- articles: {
1331
- type: Array,
1332
- required: !0
1333
- },
1334
- activeHouseWorkType: {
1335
- type: String,
1336
- default: null
1337
- },
1338
- rootPriceType: {
1339
- type: String,
1340
- default: "fixed"
1341
- },
1342
- hideControls: {
1343
- type: Boolean,
1344
- default: !1
1345
- }
1346
- },
1347
- data() {
1348
- return {
1349
- selectedIndex: null,
1350
- showModal: !1
1351
- };
1352
- },
1353
- computed: {
1354
- ...h({
1355
- hidePriceInput: "settings/allowHideDocArticlePriceInput",
1356
- hidePriceOnNew: "settings/hidePriceOnNewlyAddedArticles"
1357
- }),
1358
- articlesWithTotal() {
1359
- return T(this.articles);
1360
- },
1361
- isIndivid() {
1362
- return o(this._document, "prices.helpers.isIndivid", !0);
1363
- },
1364
- setPricesIncVat() {
1365
- return o(this, "_document.setPricesIncVat", null);
1366
- },
1367
- currency() {
1368
- return o(this._document, "currency");
1369
- },
1370
- useVat() {
1371
- return o(this, "_document.useVat");
1372
- },
1373
- vatType() {
1374
- return o(this, "_document.vatType");
1375
- },
1376
- showVatToggle() {
1377
- return this.useVat && (this.setPricesIncVat || (this.articles || []).some(({ vat: s }) => s !== null));
1378
- }
1379
- },
1380
- watch: {
1381
- activeHouseWorkType: {
1382
- immediate: !0,
1383
- handler(s) {
1384
- this.toggleDeductions(s);
1385
- }
1386
- },
1387
- isIndivid(s) {
1388
- s || this.toggleDeductions(!1);
1389
- },
1390
- setPricesIncVat(s) {
1391
- this.updateArticlesVatOption(), ["extension", "widget"].includes(ie.value) || this.showMessage({
1392
- type: "info",
1393
- message: this.$t("vatOption.message", {
1394
- vatOption: this.$t(`_common:vat.${s ? "incVat" : "exVat"}`, {
1395
- thing: this.$t("_common:vat.sharedTitle")
1396
- })
1397
- })
1398
- });
1399
- }
1400
- },
1401
- methods: {
1402
- ...v({
1403
- showMessage: p.SHOW_MESSAGE
1404
- }),
1405
- openModal(s, { focusEl: e = "" } = {}) {
1406
- this.selectedIndex = s, this.showModal = !0, e && this.$nextTick(() => {
1407
- this.$nextTick(() => {
1408
- this.$refs.articleModal && this.$refs.articleModal.focusEl(e);
1409
- });
1410
- });
1411
- },
1412
- updateArticleObject(s, e) {
1413
- const t = e;
1414
- this.isIndivid || (t.isDeductable = !1, t.isRut = !1, t.greenRot15 = !1, t.greenRot20 = !1, t.greenRot50 = !1), this.$emit("input", { index: s, value: t });
1415
- },
1416
- onRemoveArticle(s) {
1417
- this.$emit("remove", s);
1418
- },
1419
- onEsc(s, e) {
1420
- s === this.articles.length - 1 && ["name", "price", "discount"].every((t) => !e[t]) && this.onRemoveArticle(s);
1421
- },
1422
- changeVat() {
1423
- this.$emit("update:setPricesIncVat", !this.setPricesIncVat);
1424
- },
1425
- updateArticlesVatOption() {
1426
- this.articles.forEach((s, e) => {
1427
- if (s.priceType === "markup")
1428
- return;
1429
- let t = g({ amount: s.price }).divide(
1430
- (100 + s.vat) * 0.01
1431
- );
1432
- this.setPricesIncVat || (t = g({ amount: s.price }).multiply(
1433
- (100 + s.vat) * 0.01
1434
- )), this.updateArticleObject(
1435
- e,
1436
- T({ ...s, price: t.getAmount() })
1437
- );
1438
- });
1439
- },
1440
- // Method used by parent component
1441
- focusLastArticle() {
1442
- this.$nextTick(
1443
- () => this.$refs.articleItem[this.articles.length - 1].focusName()
1444
- );
1445
- },
1446
- openLastArticle() {
1447
- this.$nextTick(() => this.openModal(this.articles.length - 1));
1448
- },
1449
- toggleDeductions(s) {
1450
- const e = {
1451
- rot: "isDeductable",
1452
- rut: "isRut",
1453
- greenRot15: "greenRot15",
1454
- greenRot20: "greenRot20",
1455
- greenRot50: "greenRot50"
1456
- }, t = (i = []) => i.reduce((n, a) => ({ ...n, [a]: !1 }), {});
1457
- e[s] ? this.articles.forEach((i, n) => {
1458
- const a = Object.values(R(e, [s]));
1459
- if (a.some((r) => !!i[r])) {
1460
- const r = { ...i, ...t(a) };
1461
- this.$emit("input", { index: n, value: r });
1462
- }
1463
- }) : s === !1 && this.articles.forEach((i, n) => {
1464
- const a = Object.values(e);
1465
- if (a.some((r) => !!i[r])) {
1466
- const r = { ...i, ...t(a) };
1467
- this.$emit("input", { index: n, value: r });
1468
- }
1469
- });
1470
- },
1471
- onChange(s) {
1472
- const { added: e, moved: t, removed: i } = s;
1473
- if (e) {
1474
- const { newIndex: n, element: a } = e;
1475
- this.$emit("insert", { index: n, value: a });
1476
- } else if (t) {
1477
- const n = A(
1478
- this.articles,
1479
- t.oldIndex,
1480
- t.newIndex
1481
- );
1482
- this.$emit("move", n);
1483
- } else if (i) {
1484
- const { oldIndex: n } = i;
1485
- this.$emit("remove", n);
1486
- }
1487
- }
1488
- }
1489
- };
1490
- var gt = function() {
1491
- var e = this, t = e._self._c;
1492
- return t("div", [e.showVatToggle ? t("div", { staticClass: "label-text" }, [e._v(" " + e._s(e.$t("vatOption.label")) + " "), t("span", { on: { click: function(i) {
1493
- return e.changeVat();
1494
- } } }, [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 }) {
1495
- return [t("draggable", e._b({ staticStyle: { "min-height": "calc(3 * var(--rem))" }, attrs: { value: e.articles, group: "articles" }, on: { change: e.onChange } }, "draggable", {
1496
- sort: !0,
1497
- animation: 150,
1498
- ghostClass: "article-ghost",
1499
- handle: ".article-draggable-handle"
1500
- }, !1), [t("transition-group", { staticStyle: { position: "relative", transition: "100ms" }, attrs: { name: "article-list" } }, e._l(e.articlesWithTotal, function(n, a) {
1501
- 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) {
1502
- return e.$emit("update:currency", r);
1503
- }, input: function(r) {
1504
- return e.updateArticleObject(a, r);
1505
- }, focus: function(r) {
1506
- return e.$emit("focus");
1507
- }, remove: function(r) {
1508
- return e.onRemoveArticle(a);
1509
- }, "open-modal": function(r) {
1510
- return e.openModal(a, r);
1511
- }, add: function(r) {
1512
- a === e.articlesWithTotal.length - 1 && e.$emit("add");
1513
- }, select: function(r) {
1514
- a === e.articlesWithTotal.length - 1 && e.$emit("add");
1515
- }, esc: function(r) {
1516
- return e.onEsc(a, n);
1517
- } } });
1518
- }), 1)], 1)];
1519
- } }]) }), 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) {
1520
- return e.$emit("update:currency", i);
1521
- }, input: function(i) {
1522
- return e.updateArticleObject(e.selectedIndex, i);
1523
- }, add: function(i) {
1524
- return e.$emit("add", i);
1525
- }, "open-modal": e.openModal, close: function(i) {
1526
- e.showModal = !1;
1527
- } } }) : e._e()], 1)], 1);
1528
- }, yt = [], _t = /* @__PURE__ */ u(
1529
- vt,
1530
- gt,
1531
- yt,
1532
- !1,
1533
- null,
1534
- "ca68ac6a"
1535
- );
1536
- const kt = _t.exports, $t = {
1537
- name: "MaxTotalInput",
1538
- i18nOptions: {
1539
- namespaces: "MaxTotalInput",
1540
- messages: {
1541
- en: {
1542
- maxTotalLabel: "Add a price"
1543
- },
1544
- sv: {
1545
- maxTotalLabel: "Ange ett pris"
1546
- }
1547
- }
1548
- },
1549
- components: {
1550
- CPriceInput: w
1551
- },
1552
- props: {
1553
- value: {
1554
- type: Number,
1555
- default: null
1556
- },
1557
- currency: {
1558
- type: String,
1559
- required: !0
1560
- },
1561
- vatType: {
1562
- type: String,
1563
- required: !0
1564
- }
1565
- },
1566
- data() {
1567
- return {
1568
- getCurrencySymbol: I
1569
- };
1570
- },
1571
- computed: {
1572
- ...h({
1573
- isIncVat: "application/isIncVat"
1574
- })
1575
- },
1576
- watch: {
1577
- isIncVat(s) {
1578
- let e = g({ amount: this.value }).divide(1.25);
1579
- s || (e = g({ amount: this.value }).multiply(125 * 0.01)), this.$emit("input", e.getAmount());
1580
- }
1581
- }
1582
- };
1583
- var xt = function() {
1584
- var e = this, t = e._self._c;
1585
- 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) {
1586
- return e.$emit("input", i);
1587
- } }, scopedSlots: e._u([{ key: "prefix", fn: function() {
1588
- return [e._v(e._s(e.$t("price.maxPrice").capitalize()))];
1589
- }, proxy: !0 }, { key: "suffix", fn: function() {
1590
- 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}`) })) + " ")])];
1591
- }, proxy: !0 }]) })], 1);
1592
- }, bt = [], wt = /* @__PURE__ */ u(
1593
- $t,
1594
- xt,
1595
- bt,
1596
- !1,
1597
- null,
1598
- null
1599
- );
1600
- const Ct = wt.exports, Tt = {
1601
- components: {
1602
- CDropdown: x,
1603
- CDropdownItem: b
1604
- },
1605
- props: {
1606
- value: {
1607
- type: String,
1608
- default: "fixed"
1609
- }
1610
- },
1611
- data() {
1612
- return {
1613
- priceTypeOptions: ["fixed", "approx", "openAcc", "openAccMaxPrice"]
1614
- };
1615
- }
1616
- };
1617
- var It = function() {
1618
- var e = this, t = e._self._c;
1619
- return t("div", { staticClass: "flex justify-end" }, [t("CDropdown", { attrs: { value: e.value }, scopedSlots: e._u([{ key: "trigger", fn: function() {
1620
- 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}`)))])])];
1621
- }, proxy: !0 }]) }, e._l(e.priceTypeOptions, function(i) {
1622
- return t("CDropdownItem", { key: i, staticClass: "text-right", attrs: { value: i }, on: { click: function(n) {
1623
- return e.$emit("input", i);
1624
- } } }, [e._v(" " + e._s(e.$t(`price.${i}`)) + " ")]);
1625
- }), 1)], 1);
1626
- }, At = [], St = /* @__PURE__ */ u(
1627
- Tt,
1628
- It,
1629
- At,
1630
- !1,
1631
- null,
1632
- "06e47e62"
1633
- );
1634
- const Pt = St.exports, Vt = {
1635
- name: "EditDeduction",
1636
- components: {
1637
- CPriceInput: w
1638
- },
1639
- mixins: [y(["houseWorkManualAmount"])],
1640
- props: {
1641
- disabled: {
1642
- type: Boolean,
1643
- default: !1
1644
- },
1645
- total: {
1646
- type: Number,
1647
- required: !0
1648
- },
1649
- houseWorkType: {
1650
- type: String,
1651
- default: "rot"
1652
- },
1653
- houseWorkAmount: {
1654
- type: Number,
1655
- default: 0
1656
- }
1657
- },
1658
- data() {
1659
- return {
1660
- amountUnit: "fixed",
1661
- internalValue: null
1662
- };
1663
- },
1664
- watch: {
1665
- houseWorkType(s) {
1666
- s || (this.houseWorkManualAmount = null);
1667
- }
1668
- },
1669
- methods: {
1670
- setDeduction(s) {
1671
- this.internalValue = g({ amount: this.total }).multiply(s).getAmount();
1672
- },
1673
- showModal() {
1674
- this.internalValue = this.houseWorkAmount, this.$modal.show(`deduction-modal-${this._uid}`);
1675
- }
1676
- }
1677
- };
1678
- var Dt = function() {
1679
- var e = this, t = e._self._c;
1680
- return t("div", [t("modal", e._b({ attrs: { name: `deduction-modal-${e._uid}` } }, "modal", {
1681
- adaptive: !0,
1682
- height: "auto",
1683
- width: "90%",
1684
- maxWidth: 420,
1685
- classes: "primary"
1686
- }, !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() {
1687
- return [e._v(e._s(e.$t("currency.SEK")))];
1688
- }, proxy: !0 }]), model: { value: e.internalValue, callback: function(i) {
1689
- e.internalValue = e._n(i);
1690
- }, expression: "internalValue" } })], 1), t("div", { staticClass: "flex w-full flex-wrap justify-center gap-2" }, e._l([
1691
- { v: 0.09, l: "9%" },
1692
- { v: 0.105, l: "10.5%" },
1693
- { v: 0.1455, l: "14.55%" },
1694
- { v: 0.194, l: "19.4%" },
1695
- { v: 0.21, l: "21%" },
1696
- { v: 0.485, l: "48.5%" },
1697
- { v: 0.5, l: "50%" }
1698
- ], function(i) {
1699
- return t("div", { key: i.l, staticClass: "deduction-button", class: {
1700
- active: Math.round(e.total * i.v * 0.01) * 100 === e.internalValue
1701
- }, on: { click: function(n) {
1702
- return e.setDeduction(i.v);
1703
- } } }, [e._v(" " + e._s(i.l) + " ")]);
1704
- }), 0), t("CButton", { staticClass: "mt-8", attrs: { type: "secondary", wide: "" }, on: { click: function(i) {
1705
- e.houseWorkManualAmount = e.internalValue, e.$modal.hide(`deduction-modal-${e._uid}`);
1706
- } } }, [e._v(" " + e._s(e.$t("save")) + " ")]), t("CButton", { staticClass: "mt-2", attrs: { type: "secondary", pattern: "tertiary", wide: "" }, on: { click: function(i) {
1707
- e.houseWorkManualAmount = null, e.$modal.hide(`deduction-modal-${e._uid}`);
1708
- } } }, [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) {
1709
- return e.$modal.show(`deduction-modal-${e._uid}`);
1710
- } } }, [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);
1711
- }, Rt = [], Ot = /* @__PURE__ */ u(
1712
- Vt,
1713
- Dt,
1714
- Rt,
1715
- !1,
1716
- null,
1717
- "cff30915"
1718
- );
1719
- const Lt = Ot.exports, Mt = {
1720
- name: "Pricing",
1721
- components: {
1722
- EditDeduction: Lt
1723
- },
1724
- props: {
1725
- _document: {
1726
- type: Object,
1727
- default: () => ({})
1728
- },
1729
- basePath: {
1730
- type: String,
1731
- default: "data.prices"
1732
- },
1733
- packageId: {
1734
- type: String,
1735
- default: null
1736
- }
1737
- },
1738
- data() {
1739
- return {
1740
- get: o
1741
- };
1742
- },
1743
- computed: {
1744
- vatType() {
1745
- return o(this, "_document.vatType");
1746
- },
1747
- priceArray() {
1748
- return [
1749
- {
1750
- label: this._document.$t("price.net"),
1751
- value: this.prices.subTotal
1752
- },
1753
- ...this.prices.useVat ? [
1754
- {
1755
- label: this._document.$t(`vat.${this.vatType}`),
1756
- value: this.prices.taxAmount
1757
- }
1758
- ] : [],
1759
- ...this.showHouseWork ? [
1760
- {
1761
- label: this._document.$t("deduction.type", {
1762
- type: this._document.$t(
1763
- `deduction.${this.prices.region.houseWorkType}${this.prices.region.houseWorkManualAmount === null ? "_percentage" : ""}`
1764
- )
1765
- }),
1766
- value: -this.prices.region.houseWorkAmount,
1767
- action: () => this.$refs.deduction.showModal()
1768
- }
1769
- ] : [],
1770
- ...this.prices.rounding.enabled && this.prices.rounding.show ? [
1771
- {
1772
- label: this._document.$t(
1773
- "chapters.pricingSummary.blocks.rounding"
1774
- ),
1775
- value: this.prices.roundingAmount
1776
- }
1777
- ] : [],
1778
- ...this.prices.helpers.discount ? [
1779
- {
1780
- label: this._document.$t("price.discount"),
1781
- value: -this.prices.helpers.discount
1782
- }
1783
- ] : [],
1784
- {
1785
- classList: "main",
1786
- label: this._document.$t("total"),
1787
- subLabel: this.prices.useVat ? this._document.$t("vat.incVat") : "",
1788
- prefix: this.prices.type === "approx" ? `${this._document.$t("approx")} ` : "",
1789
- value: this.prices.total
1790
- },
1791
- ...typeof this.prices.maxTotal == "number" ? [
1792
- {
1793
- classList: "main",
1794
- label: this._document.$t("price.maxPrice"),
1795
- subLabel: this.prices.useVat ? this._document.$t("vat.incVat") : "",
1796
- value: Math.round(this.prices.maxTotal * 1.25 || 0)
1797
- // ! Hard coded swedish VAT
1798
- }
1799
- ] : []
1800
- ].map((e) => ({
1801
- ...e,
1802
- value: k(e.value, {
1803
- showZero: !0,
1804
- decimals: 2,
1805
- currency: this.prices.currency
1806
- })
1807
- }));
1808
- },
1809
- prices() {
1810
- const { prices: s } = this._document.packageGroups.getPackageById(
1811
- this.packageId
1812
- );
1813
- return s;
1814
- },
1815
- showHouseWork() {
1816
- return !!o(this.prices, "region.houseWorkType", !1) || !!o(this.prices, "region.houseWorkManualAmount", !1);
1817
- }
1818
- }
1819
- };
1820
- var Et = function() {
1821
- var e = this, t = e._self._c;
1822
- 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: {
1823
- houseWorkManualAmount: `${e.basePath}.data.prices.region.houseWorkManualAmount`
1824
- }, "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) {
1825
- 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) {
1826
- i.action && i.action();
1827
- } } }, [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) + " ")])]);
1828
- }), 0)]);
1829
- }, zt = [], Wt = /* @__PURE__ */ u(
1830
- Mt,
1831
- Et,
1832
- zt,
1833
- !1,
1834
- null,
1835
- "b501fae0"
1836
- );
1837
- const Bt = Wt.exports, Ft = {
1838
- name: "PackageItemEdit",
1839
- i18nOptions: {
1840
- namespaces: "PackageItemEdit",
1841
- messages: {
1842
- en: {
1843
- base: "Default package",
1844
- single: "Single option",
1845
- option: "Selectable package",
1846
- namePlaceholder: "Package name",
1847
- textPlaceholder: "Package description",
1848
- selected: "Pre selected",
1849
- addButton: "Product / service",
1850
- advancedButtonTooltip: "Open advanced settings"
1851
- },
1852
- sv: {
1853
- base: "Grundpaket",
1854
- single: "Ett alternativ",
1855
- option: "Valbart alternativ",
1856
- namePlaceholder: "Paketets namn",
1857
- textPlaceholder: "Beskrivning av paketet",
1858
- selected: "Förvald",
1859
- addButton: "Vara / tjänst",
1860
- advancedButtonTooltip: "Öppna avancerat läge"
1861
- }
1862
- }
1863
- },
1864
- components: {
1865
- ArticleList: kt,
1866
- PriceFormAlternatives: Pt,
1867
- MaxTotalInput: Ct,
1868
- Pricing: Bt,
1869
- TextEditor: ce,
1870
- CDropdown: x,
1871
- CDropdownItem: b
1872
- },
1873
- mixins: [
1874
- y([
1875
- "isSelectedDefault",
1876
- "isSelected",
1877
- "name",
1878
- "description",
1879
- "priceType",
1880
- "maxTotal",
1881
- "currency"
1882
- ])
1883
- ],
1884
- props: {
1885
- packageId: {
1886
- type: String,
1887
- required: !0
1888
- },
1889
- type: {
1890
- type: String,
1891
- required: !0
1892
- },
1893
- activeHouseWorkType: {
1894
- type: String,
1895
- default: null
1896
- },
1897
- toggable: {
1898
- type: Boolean,
1899
- default: !0
1900
- },
1901
- moveOptions: {
1902
- type: Object,
1903
- default: () => ({})
1904
- }
1905
- },
1906
- data() {
1907
- return {
1908
- isFocus: !1,
1909
- isHover: !1
1910
- };
1911
- },
1912
- computed: {
1913
- ...h({
1914
- newArticle: "articles/getNewArticle"
1915
- }),
1916
- // keep info on original article array indices for updates
1917
- articles() {
1918
- return this._document.allArticles;
1919
- },
1920
- mappedPackageArticles() {
1921
- return (this.articles || []).map((s, e) => ({ ...s, i: e })).filter(({ packageId: s }) => s === this.packageId);
1922
- },
1923
- internalDescription: {
1924
- get() {
1925
- return se(
1926
- this.description,
1927
- this._document.textTemplateMap,
1928
- this._document._doc
1929
- );
1930
- },
1931
- set(s) {
1932
- this.description = ae(s);
1933
- }
1934
- }
1935
- },
1936
- watch: {
1937
- priceType(s, e) {
1938
- if (!(s && s.startsWith("open") && e && e.startsWith("open"))) {
1939
- if (s) {
1940
- const t = s.startsWith("open") ? "openAcc" : s;
1941
- this.mappedPackageArticles.forEach((i, n) => {
1942
- this.onArticleInput({
1943
- index: n,
1944
- value: {
1945
- ...i,
1946
- priceType: t,
1947
- ...t === "openAcc" && { quantity: 1 }
1948
- }
1949
- });
1950
- });
1951
- }
1952
- }
1953
- s !== "openAccMaxPrice" && (this.maxTotal = null);
1954
- }
1955
- },
1956
- methods: {
1957
- onRemove() {
1958
- this.$emit("remove-package");
1959
- },
1960
- // Article Methods
1961
- createEmptyArticle() {
1962
- const s = this.newArticle({
1963
- priceType: this.priceType.startsWith("open") ? "openAcc" : this.priceType,
1964
- packageId: this.packageId,
1965
- currency: this.currency
1966
- });
1967
- this.$emit("input", {
1968
- key: "articles",
1969
- value: [...this.articles, s]
1970
- });
1971
- },
1972
- onArticleInput({ index: s, value: e }) {
1973
- const { i: t } = this.mappedPackageArticles[s], i = ne(e, [
1974
- "allowRot",
1975
- "allowRut",
1976
- "isIncVat",
1977
- "rootPriceType",
1978
- "hideControls"
1979
- ]);
1980
- i.currency = this.currency, this.$emit("input", { key: `articles[${[t]}]`, value: i });
1981
- },
1982
- onArticleAdd({ openModal: s = !1 } = {}) {
1983
- this.createEmptyArticle(), s ? this.$refs.articleList.openLastArticle() : this.$refs.articleList.focusLastArticle();
1984
- },
1985
- onInsert({ index: s, value: e }) {
1986
- const t = re(this.mappedPackageArticles).add(
1987
- { ...e, packageId: this.packageId },
1988
- s
1989
- );
1990
- this.$emit("input", {
1991
- key: "articles",
1992
- value: [
1993
- ...this.articles.filter(
1994
- ({ packageId: i }) => i !== this.packageId
1995
- ),
1996
- ...t
1997
- ]
1998
- });
1999
- },
2000
- onArticleRemove(s) {
2001
- const { i: e } = this.mappedPackageArticles[s];
2002
- this.$emit("remove", { key: `articles[${[e]}]` });
2003
- },
2004
- onArticleMove(s) {
2005
- this.$emit("input", {
2006
- key: "articles",
2007
- value: [
2008
- ...this.articles.filter(
2009
- ({ packageId: e }) => e !== this.packageId
2010
- ),
2011
- ...s
2012
- ]
2013
- });
2014
- }
2015
- }
2016
- };
2017
- var jt = function() {
2018
- var e = this, t = e._self._c;
2019
- 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() {
2020
- return [t("CButton", { staticClass: "is-thinner opacity-70", attrs: { size: "small", type: "text", pattern: "secondary" } }, [e._v(" " + e._s(e.$t("_common:change")) + " ")])];
2021
- }, proxy: !0 }], null, !1, 3891513618) }, [e.toggable ? [t("CDropdownItem", { attrs: { value: e.isSelectedDefault, toggle: !0, "close-on-click": !1 }, on: { click: function(i) {
2022
- return e.$emit("update:isSelectedDefault", !e.isSelectedDefault);
2023
- } } }, [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) {
2024
- return e.$emit("move", -1);
2025
- } } }, [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) {
2026
- return e.$emit("move", 1);
2027
- } } }, [e._v(" " + e._s(e.$t("_common:move", { thing: e.$t("_common:down") })) + " ")]), t("CDropdownItem", { attrs: { "icon-props": {
2028
- stroke: "red"
2029
- }, "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) {
2030
- return !i.type.indexOf("key") && e._k(i.keyCode, "enter", 13, i.key, "Enter") ? null : e.$refs.editor.focus();
2031
- }, input: function(i) {
2032
- i.target.composing || (e.name = i.target.value);
2033
- } } })]), 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) {
2034
- e.internalDescription = i;
2035
- }, expression: "internalDescription" } }), t("div", { directives: [{ name: "click-outside", rawName: "v-click-outside", value: () => {
2036
- e.isFocus = !1, e.isHover = !1;
2037
- }, expression: `
2038
- () => {
2039
- isFocus = false
2040
- isHover = false
2041
- }
2042
- ` }], on: { "&mouseover": function(i) {
2043
- e.isHover = !0;
2044
- }, "&mouseleave": function(i) {
2045
- e.isHover = !1;
2046
- } } }, [e.priceType === "openAccMaxPrice" ? t("MaxTotalInput", { staticClass: "mb-4", attrs: { currency: e.currency, "vat-type": e._document.vatType }, model: { value: e.maxTotal, callback: function(i) {
2047
- e.maxTotal = i;
2048
- }, expression: "maxTotal" } }) : e._e(), t("PriceFormAlternatives", { on: { input: function(i) {
2049
- return e.$emit("update:priceType", i);
2050
- } }, model: { value: e.priceType, callback: function(i) {
2051
- e.priceType = i;
2052
- }, 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) {
2053
- return e.$emit("update:setPricesIncVat", i);
2054
- }, "update:currency": function(i) {
2055
- return e.$emit("update:currency", i);
2056
- }, move: e.onArticleMove, remove: e.onArticleRemove, add: e.onArticleAdd, focus: function(i) {
2057
- e.isFocus = !0;
2058
- }, 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) {
2059
- return e.onArticleAdd();
2060
- } } }, [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: {
2061
- content: e.$t("advancedButtonTooltip"),
2062
- offset: 6
2063
- }, expression: `{
2064
- content: $t('advancedButtonTooltip'),
2065
- offset: 6
2066
- }` }], 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) {
2067
- return e.onArticleAdd({ openModal: !0 });
2068
- } } }, [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)]);
2069
- }, Nt = [], Ht = /* @__PURE__ */ u(
2070
- Ft,
2071
- jt,
2072
- Nt,
2073
- !1,
2074
- null,
2075
- "8c34e2f0"
2076
- );
2077
- const qt = Ht.exports, Ut = (s) => (s || []).slice(0, 1).map((e) => ({
2078
- ...e,
2079
- isSelected: !0,
2080
- isSelectedDefault: !0,
2081
- toggable: !1
2082
- })), Gt = (s) => {
2083
- const e = o(s, "0.data.prices.type") || "fixed";
2084
- return (s || []).map((t, i) => ({
2085
- ...t,
2086
- toggable: !0,
2087
- ...i === 0 ? {
2088
- isSelected: !0,
2089
- isSelectedDefault: !0,
2090
- toggable: !1
2091
- } : null,
2092
- data: {
2093
- ...t.data,
2094
- prices: {
2095
- ...t.data ? t.data.prices : null,
2096
- type: e
2097
- }
2098
- }
2099
- }));
2100
- }, Kt = (s = []) => {
2101
- let e = !1;
2102
- return s.map((t) => {
2103
- const i = {
2104
- ...t,
2105
- // if any earlier pkg is selected, deselect pkg, otherwise keep as is
2106
- ...e ? {
2107
- isSelected: !1,
2108
- isSelectedDefault: !1
2109
- } : null,
2110
- toggable: !0
2111
- };
2112
- return (i.isSelected || i.isSelectedDefault) && (e = !0), i;
2113
- }, []);
2114
- };
2115
- function Yt(s, ...e) {
2116
- if (s === "single")
2117
- return Ut(...e);
2118
- if (s === "checkbox")
2119
- return Gt(...e);
2120
- if (s === "radio")
2121
- return Kt(...e);
2122
- throw new Error(`Package filter type '${s}' is not implemented`);
2123
- }
2124
- const Zt = {
2125
- name: "PackageGroupEdit",
2126
- i18nOptions: {
2127
- namespaces: "PackageGroupEdit",
2128
- messages: {
2129
- en: {
2130
- base: "Default package",
2131
- add: "Add package",
2132
- basePlaceholder: "Add a default package that's always included.",
2133
- selectablePlaceholder: "Add packages your client can choose between.",
2134
- hideGroupPrice: "Hide summary for block",
2135
- reset: {
2136
- message: "Package type changed",
2137
- button: "Revert"
2138
- },
2139
- error: {
2140
- selectType: "Choose price type",
2141
- minOnePackage: "Add at least 1 package"
2142
- }
2143
- },
2144
- sv: {
2145
- base: "Grundpaket",
2146
- add: "Valbart alternativ",
2147
- basePlaceholder: "Lägg till ett baspaket som alltid ingår.",
2148
- selectablePlaceholder: "Lägg till valbara paket som din kund kan välja mellan.",
2149
- hideGroupPrice: "Dölj summering för block",
2150
- reset: {
2151
- message: "Pakettyp har ändrats",
2152
- button: "Återställ"
2153
- },
2154
- error: {
2155
- selectType: "Välj ett prisförslag",
2156
- minOnePackage: "Lägg till minst 1 paket"
2157
- }
2158
- }
2159
- }
2160
- },
2161
- components: {
2162
- ErrorCallout: V,
2163
- PackageItem: qt,
2164
- PackageGroupSelect: We,
2165
- CCallout: W,
2166
- CDropdown: x,
2167
- CDropdownItem: b
2168
- },
2169
- mixins: [
2170
- y([
2171
- "type",
2172
- // 'title',
2173
- "packages",
2174
- "articles",
2175
- "hideGroupPrice"
2176
- ])
2177
- ],
2178
- props: {
2179
- persistedGroup: {
2180
- type: Object,
2181
- default: () => ({})
2182
- },
2183
- validator: {
2184
- type: Object,
2185
- default: () => ({})
2186
- }
2187
- },
2188
- data() {
2189
- return {
2190
- setPricesDirty: !1
2191
- };
2192
- },
2193
- computed: {
2194
- ...h({
2195
- getSetting: ["settings/getCompanySetting"],
2196
- defaultCurrency: "settings/defaultCurrency",
2197
- newArticle: "articles/getNewArticle"
2198
- }),
2199
- internalPackages() {
2200
- return this.packages.map((s, e) => ({ ...s, index: e }));
2201
- },
2202
- topRowPackages() {
2203
- return this.type === "checkbox" ? this.internalPackages.filter(({ toggable: s }) => s === !1) : this.internalPackages;
2204
- },
2205
- bottomRowPackages() {
2206
- return this.type === "checkbox" ? this.internalPackages.filter(({ toggable: s }) => s === !0) : [];
2207
- },
2208
- group() {
2209
- return this._document.packageGroups.getPackageGroupUniqId(
2210
- this._value.groupId
2211
- ) || {};
2212
- },
2213
- houseWorkType() {
2214
- return o(this.group, "prices.region.houseWorkType", null);
2215
- },
2216
- isIndivid() {
2217
- return o(this, "_document.prices.helpers.isIndivid", !0);
2218
- },
2219
- setPricesIncVat() {
2220
- return this._document.setPricesIncVat;
2221
- },
2222
- defaultVatInput() {
2223
- return this.isIndivid ? this.getSetting("priceInputDefault") : this.getSetting("priceInputCompany");
2224
- },
2225
- currency() {
2226
- return this._document.currency;
2227
- }
2228
- },
2229
- watch: {
2230
- isIndivid() {
2231
- this.setPricesDirty || this.setPricesIncVatAsDefault();
2232
- }
2233
- },
2234
- created() {
2235
- this.setPricesIncVat === null && this.setPricesIncVatAsDefault({ ignoreChanges: !0 });
2236
- },
2237
- methods: {
2238
- ...v({
2239
- showMessage: p.SHOW_MESSAGE
2240
- }),
2241
- setPricesIncVatAsDefault(s = {}) {
2242
- this.$emit("input", {
2243
- key: "data.formSettings.setPricesIncVat",
2244
- value: this.defaultVatInput === "incVat",
2245
- options: s
2246
- });
2247
- },
2248
- onSelectType(s) {
2249
- this.type = s;
2250
- const { type: e, packages: t } = this.persistedGroup || {};
2251
- if (e && t && t.length)
2252
- this.addPersistedGroup(s), s !== e && this.showMessage({
2253
- type: "info",
2254
- message: this.$t("reset.message"),
2255
- actions: {
2256
- undo: {
2257
- text: this.$t("reset.button"),
2258
- callback: () => {
2259
- this.addPersistedGroup(e), this.type = e;
2260
- }
2261
- }
2262
- }
2263
- });
2264
- else {
2265
- if (s === "checkbox")
2266
- return;
2267
- this.addPackage({});
2268
- }
2269
- },
2270
- addPersistedGroup(s) {
2271
- if (!this.persistedGroup || !this.persistedGroup.type)
2272
- return;
2273
- let { packages: e, articles: t } = this.persistedGroup;
2274
- if (!e.length)
2275
- return;
2276
- if (s !== this.persistedGroup.type && (e = Yt(s, e)), s === "single" && t.length) {
2277
- const [{ packageId: n }] = e;
2278
- t = t.filter((a) => a.packageId === n);
2279
- }
2280
- const i = Oe(
2281
- [...this._document.allArticles || [], ...t || []],
2282
- (n) => n._uniqueId
2283
- );
2284
- this.$emit("input", { key: "articles", value: i }), this.$emit("input", { key: `${[this._value.packages]}`, value: e });
2285
- },
2286
- addPackage(s = {}) {
2287
- const e = oe(), t = this.type === "checkbox" && this.packages.length ? this.packages[0].data.prices.type : "fixed", i = this.currency || this.defaultCurrency, n = {
2288
- isSelected: this.type === "single",
2289
- isSelectedDefault: this.type === "single",
2290
- toggable: !0,
2291
- packageId: e,
2292
- data: {
2293
- name: "",
2294
- description: "",
2295
- prices: {
2296
- type: t,
2297
- currency: i
2298
- }
2299
- },
2300
- ...s
2301
- };
2302
- this.$emit("input", { key: this._value.packages, value: n }), this.$emit("input", {
2303
- key: "articles",
2304
- value: this.newArticle({
2305
- priceType: t.startsWith("open") ? "openAcc" : t,
2306
- packageId: e,
2307
- currency: i
2308
- })
2309
- }), this.$nextTick(() => {
2310
- const a = document.getElementById(`package-name-${e}`);
2311
- a && a.focus();
2312
- });
2313
- },
2314
- onInputPriceType(s, e) {
2315
- this.type === "checkbox" && this.packages.forEach((t, i) => {
2316
- i !== s && this.$emit("input", {
2317
- key: `${[this._value.packages]}[${[i]}].data.prices.type`,
2318
- value: e
2319
- });
2320
- });
2321
- },
2322
- onInputSelectedDefault(s, e) {
2323
- this.type === "radio" && !e || (this.type === "radio" && e && this.packages.forEach((t, i) => {
2324
- i !== s && (this.$emit("input", {
2325
- key: `${[this._value.packages]}[${[i]}].isSelectedDefault`,
2326
- value: !1
2327
- }), this.$emit("input", {
2328
- key: `${[this._value.packages]}[${[i]}].isSelected`,
2329
- value: !1
2330
- }));
2331
- }), this.$emit("input", {
2332
- key: `${[this._value.packages]}[${[s]}].isSelectedDefault`,
2333
- value: e
2334
- }), this.$emit("input", {
2335
- key: `${[this._value.packages]}[${[s]}].isSelected`,
2336
- value: e
2337
- }));
2338
- },
2339
- removeByIndex(s) {
2340
- const { packageId: e } = this.packages[s], t = this._document.allArticles.filter(
2341
- ({ packageId: i }) => i !== e
2342
- );
2343
- this.$emit("input", { key: "articles", value: t }), this.$emit("remove", { key: `${[this._value.packages]}[${[s]}]` });
2344
- },
2345
- async onResetType() {
2346
- const s = this.packages.map((i) => i.packageId), [e, t] = this._document.allArticles.reduce(
2347
- ([i, n], a) => s.includes(a.packageId) ? [[...i, a], n] : [i, [...n, a]],
2348
- [[], []]
2349
- );
2350
- this.$emit("update:persisted-group", {
2351
- type: this.type,
2352
- packages: this.packages,
2353
- articles: e
2354
- }), this.$emit("input", { key: "articles", value: t }), this.$emit("input", { key: `${[this._value.packages]}`, value: [] }), this.type = "";
2355
- },
2356
- moveOptions(s, e) {
2357
- const t = { up: !1, down: !1 };
2358
- return s > 0 && (t.up = !0), s < e - 1 && (t.down = !0), t;
2359
- },
2360
- moveItem(s, e) {
2361
- const t = A(this.packages, s, e);
2362
- this.$emit("input", { key: this._value.packages, value: t });
2363
- }
2364
- }
2365
- };
2366
- var Jt = function() {
2367
- var e = this, t = e._self._c;
2368
- 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() {
2369
- return [t("CButton", { attrs: { type: "none", size: "normal", pattern: "secondary", icon: "more-horizontal", circle: "" } })];
2370
- }, 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) {
2371
- e.hideGroupPrice = i;
2372
- } } }, [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) {
2373
- return e.addPackage({
2374
- isSelected: !0,
2375
- isSelectedDefault: !0,
2376
- toggable: !1
2377
- });
2378
- } } }, [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) {
2379
- return t("div", { key: i.packageId, staticClass: "section-item pb-4" }, [t("PackageItem", { attrs: { _document: e._document, _value: {
2380
- isSelectedDefault: `${e._value.packages}[${i.index}].isSelectedDefault`,
2381
- isSelected: `${e._value.packages}[${i.index}].isSelected`,
2382
- name: `${e._value.packages}[${i.index}].data.name`,
2383
- description: `${e._value.packages}[${i.index}].data.description`,
2384
- priceType: `${e._value.packages}[${i.index}].data.prices.type`,
2385
- maxTotal: `${e._value.packages}[${i.index}].data.prices.maxTotal`,
2386
- basePath: `${e._value.packages}[${i.index}]`,
2387
- currency: `${e._value.packages}[${i.index}].data.prices.currency`
2388
- }, 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) {
2389
- return e.$emit("input", a);
2390
- }, add: function(a) {
2391
- return e.$emit("add", a);
2392
- }, "update:isSelectedDefault": (a) => e.onInputSelectedDefault(i.index, a), "update:priceType": (a) => e.onInputPriceType(i.index, a), "update:setPricesIncVat": (a) => {
2393
- e.$emit("input", {
2394
- key: "data.formSettings.setPricesIncVat",
2395
- value: a
2396
- }), e.setPricesDirty = !0;
2397
- }, "update:currency": (a) => e.$emit("input", { key: "currency", value: a }), remove: function(a) {
2398
- return e.$emit("remove", a);
2399
- }, "remove-package": function(a) {
2400
- return e.removeByIndex(i.index);
2401
- }, move: function(a) {
2402
- return e.moveItem(i.index, e.topRowPackages[n + a].index);
2403
- } } })], 1);
2404
- }), 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) {
2405
- 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: {
2406
- isSelectedDefault: `${e._value.packages}[${i.index}].isSelectedDefault`,
2407
- isSelected: `${e._value.packages}[${i.index}].isSelected`,
2408
- name: `${e._value.packages}[${i.index}].data.name`,
2409
- description: `${e._value.packages}[${i.index}].data.description`,
2410
- priceType: `${e._value.packages}[${i.index}].data.prices.type`,
2411
- maxTotal: `${e._value.packages}[${i.index}].data.prices.maxTotal`,
2412
- basePath: `${e._value.packages}[${i.index}]`,
2413
- currency: `${e._value.packages}[${i.index}].data.prices.currency`
2414
- }, 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) {
2415
- return e.$emit("input", a);
2416
- }, add: function(a) {
2417
- return e.$emit("add", a);
2418
- }, "update:isSelectedDefault": (a) => e.onInputSelectedDefault(i.index, a), "update:priceType": (a) => e.onInputPriceType(i.index, a), "update:setPricesIncVat": (a) => {
2419
- e.$emit("input", {
2420
- key: "data.formSettings.setPricesIncVat",
2421
- value: a
2422
- }), e.setPricesDirty = !0;
2423
- }, remove: function(a) {
2424
- return e.$emit("remove", a);
2425
- }, "remove-package": function(a) {
2426
- return e.removeByIndex(i.index);
2427
- }, move: function(a) {
2428
- return e.moveItem(i.index, e.bottomRowPackages[n + a].index);
2429
- } } })], 1);
2430
- }), 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) {
2431
- return e.addPackage();
2432
- } } }, [e._v(" " + e._s(e.$t("add")) + " ")])], 1)], 1) : e._e()] : t("div", [t("PackageGroupSelect", { on: { input: function(i) {
2433
- return e.onSelectType(i);
2434
- } } }), 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);
2435
- }, Xt = [], Qt = /* @__PURE__ */ u(
2436
- Zt,
2437
- Jt,
2438
- Xt,
2439
- !1,
2440
- null,
2441
- "2a8fb7bc"
2442
- );
2443
- const mi = Qt.exports;
2444
- export {
2445
- mi as default
2446
- };