flowrix 1.0.1-beta.83 → 1.0.1-beta.85

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 (382) hide show
  1. package/dist/module.d.cts +2 -0
  2. package/package.json +8 -33
  3. package/dist/module.d.mts +0 -3
  4. package/dist/module.json +0 -9
  5. package/dist/module.mjs +0 -338
  6. package/dist/runtime/composables/Blog/useBlogIndex.d.ts +0 -108
  7. package/dist/runtime/composables/Blog/useBlogIndex.js +0 -86
  8. package/dist/runtime/composables/Blog/useBlogMain.d.ts +0 -13
  9. package/dist/runtime/composables/Blog/useBlogMain.js +0 -7
  10. package/dist/runtime/composables/Blog/useBlogSidebar.d.ts +0 -7
  11. package/dist/runtime/composables/Blog/useBlogSidebar.js +0 -37
  12. package/dist/runtime/composables/Blog/useBlogSingle.d.ts +0 -30
  13. package/dist/runtime/composables/Blog/useBlogSingle.js +0 -87
  14. package/dist/runtime/composables/Blog/useMagazineCard.d.ts +0 -13
  15. package/dist/runtime/composables/Blog/useMagazineCard.js +0 -14
  16. package/dist/runtime/composables/Blog/useSingleBlogMain.d.ts +0 -20
  17. package/dist/runtime/composables/Blog/useSingleBlogMain.js +0 -28
  18. package/dist/runtime/composables/Brand/brand.d.ts +0 -7
  19. package/dist/runtime/composables/Brand/brand.js +0 -47
  20. package/dist/runtime/composables/Cart/useCart.d.ts +0 -40
  21. package/dist/runtime/composables/Cart/useCart.js +0 -10
  22. package/dist/runtime/composables/Cart/useCartDetail.d.ts +0 -59
  23. package/dist/runtime/composables/Cart/useCartDetail.js +0 -51
  24. package/dist/runtime/composables/Category/useCategoryContent.d.ts +0 -9
  25. package/dist/runtime/composables/Category/useCategoryContent.js +0 -15
  26. package/dist/runtime/composables/Category/useCategoryGrid.d.ts +0 -40
  27. package/dist/runtime/composables/Category/useCategoryGrid.js +0 -38
  28. package/dist/runtime/composables/Category/useCategoryIndex.d.ts +0 -33
  29. package/dist/runtime/composables/Category/useCategoryIndex.js +0 -65
  30. package/dist/runtime/composables/Category/useCategoryTop.d.ts +0 -18
  31. package/dist/runtime/composables/Category/useCategoryTop.js +0 -65
  32. package/dist/runtime/composables/Checkout/PaymentMethods/useDirectDeposit.d.ts +0 -3
  33. package/dist/runtime/composables/Checkout/PaymentMethods/useDirectDeposit.js +0 -22
  34. package/dist/runtime/composables/Checkout/PaymentMethods/useEway.d.ts +0 -8
  35. package/dist/runtime/composables/Checkout/PaymentMethods/useEway.js +0 -88
  36. package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.d.ts +0 -52
  37. package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.js +0 -155
  38. package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.d.ts +0 -48
  39. package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.js +0 -90
  40. package/dist/runtime/composables/Checkout/PaymentMethods/usePaymentMethods.d.ts +0 -15
  41. package/dist/runtime/composables/Checkout/PaymentMethods/usePaymentMethods.js +0 -135
  42. package/dist/runtime/composables/Checkout/PaymentMethods/usePaypal.d.ts +0 -3
  43. package/dist/runtime/composables/Checkout/PaymentMethods/usePaypal.js +0 -22
  44. package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.d.ts +0 -7
  45. package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.js +0 -43
  46. package/dist/runtime/composables/Checkout/PaymentMethods/useZippay.d.ts +0 -3
  47. package/dist/runtime/composables/Checkout/PaymentMethods/useZippay.js +0 -22
  48. package/dist/runtime/composables/Checkout/useCheckout.d.ts +0 -197
  49. package/dist/runtime/composables/Checkout/useCheckout.js +0 -374
  50. package/dist/runtime/composables/Checkout/useCheckoutBillingAddress.d.ts +0 -43
  51. package/dist/runtime/composables/Checkout/useCheckoutBillingAddress.js +0 -84
  52. package/dist/runtime/composables/Checkout/useCheckoutShippingAddress.d.ts +0 -55
  53. package/dist/runtime/composables/Checkout/useCheckoutShippingAddress.js +0 -196
  54. package/dist/runtime/composables/Checkout/useCreateAccount.d.ts +0 -15
  55. package/dist/runtime/composables/Checkout/useCreateAccount.js +0 -63
  56. package/dist/runtime/composables/Checkout/useDeliveryMethod.d.ts +0 -4
  57. package/dist/runtime/composables/Checkout/useDeliveryMethod.js +0 -37
  58. package/dist/runtime/composables/Customer/useBillingAddress.d.ts +0 -112
  59. package/dist/runtime/composables/Customer/useBillingAddress.js +0 -93
  60. package/dist/runtime/composables/Customer/useLogin.d.ts +0 -9
  61. package/dist/runtime/composables/Customer/useLogin.js +0 -34
  62. package/dist/runtime/composables/Customer/useOrders.d.ts +0 -29
  63. package/dist/runtime/composables/Customer/useOrders.js +0 -56
  64. package/dist/runtime/composables/Customer/usePasswordReset.d.ts +0 -26
  65. package/dist/runtime/composables/Customer/usePasswordReset.js +0 -258
  66. package/dist/runtime/composables/Customer/useProfile.d.ts +0 -75
  67. package/dist/runtime/composables/Customer/useProfile.js +0 -106
  68. package/dist/runtime/composables/Customer/useQuotations.d.ts +0 -32
  69. package/dist/runtime/composables/Customer/useQuotations.js +0 -40
  70. package/dist/runtime/composables/Customer/useRegister.d.ts +0 -127
  71. package/dist/runtime/composables/Customer/useRegister.js +0 -325
  72. package/dist/runtime/composables/Customer/useShippingAddress.d.ts +0 -121
  73. package/dist/runtime/composables/Customer/useShippingAddress.js +0 -145
  74. package/dist/runtime/composables/Customer/useUpdatePassword.d.ts +0 -21
  75. package/dist/runtime/composables/Customer/useUpdatePassword.js +0 -94
  76. package/dist/runtime/composables/Customer/useUserCards.d.ts +0 -22
  77. package/dist/runtime/composables/Customer/useUserCards.js +0 -65
  78. package/dist/runtime/composables/Customer/useWishlists.d.ts +0 -25
  79. package/dist/runtime/composables/Customer/useWishlists.js +0 -183
  80. package/dist/runtime/composables/Extras/useCountry.d.ts +0 -11
  81. package/dist/runtime/composables/Extras/useCountry.js +0 -12
  82. package/dist/runtime/composables/Extras/useDateFormatter.d.ts +0 -4
  83. package/dist/runtime/composables/Extras/useDateFormatter.js +0 -20
  84. package/dist/runtime/composables/Extras/useNumberOnly.d.ts +0 -5
  85. package/dist/runtime/composables/Extras/useNumberOnly.js +0 -21
  86. package/dist/runtime/composables/Extras/usePasswordFormatter.d.ts +0 -8
  87. package/dist/runtime/composables/Extras/usePasswordFormatter.js +0 -61
  88. package/dist/runtime/composables/Extras/useSrcSets.d.ts +0 -8
  89. package/dist/runtime/composables/Extras/useSrcSets.js +0 -26
  90. package/dist/runtime/composables/Extras/useTogglePassword.d.ts +0 -4
  91. package/dist/runtime/composables/Extras/useTogglePassword.js +0 -11
  92. package/dist/runtime/composables/Footer/useFooter.d.ts +0 -14
  93. package/dist/runtime/composables/Footer/useFooter.js +0 -61
  94. package/dist/runtime/composables/Header/useHeader.d.ts +0 -14
  95. package/dist/runtime/composables/Header/useHeader.js +0 -67
  96. package/dist/runtime/composables/Menu/MainMenu.d.ts +0 -4
  97. package/dist/runtime/composables/Menu/MainMenu.js +0 -17
  98. package/dist/runtime/composables/Product/CustomProduct/useAttributeType.d.ts +0 -3
  99. package/dist/runtime/composables/Product/CustomProduct/useAttributeType.js +0 -20
  100. package/dist/runtime/composables/Product/CustomProduct/useAttributes.d.ts +0 -70
  101. package/dist/runtime/composables/Product/CustomProduct/useAttributes.js +0 -68
  102. package/dist/runtime/composables/Product/CustomProduct/useCustomProduct.d.ts +0 -74
  103. package/dist/runtime/composables/Product/CustomProduct/useCustomProduct.js +0 -107
  104. package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.d.ts +0 -159
  105. package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.js +0 -2080
  106. package/dist/runtime/composables/Product/CustomProduct/useSingleAttribute.d.ts +0 -4
  107. package/dist/runtime/composables/Product/CustomProduct/useSingleAttribute.js +0 -27
  108. package/dist/runtime/composables/Product/CustomProduct/useSingleStep.d.ts +0 -68
  109. package/dist/runtime/composables/Product/CustomProduct/useSingleStep.js +0 -21
  110. package/dist/runtime/composables/Product/CustomProduct/useSingleValue.d.ts +0 -67
  111. package/dist/runtime/composables/Product/CustomProduct/useSingleValue.js +0 -15
  112. package/dist/runtime/composables/Product/CustomProduct/useSteps.d.ts +0 -74
  113. package/dist/runtime/composables/Product/CustomProduct/useSteps.js +0 -78
  114. package/dist/runtime/composables/Product/simpleProduct/useSimpleProduct.d.ts +0 -25
  115. package/dist/runtime/composables/Product/simpleProduct/useSimpleProduct.js +0 -77
  116. package/dist/runtime/composables/Product/useProductCard.d.ts +0 -13
  117. package/dist/runtime/composables/Product/useProductCard.js +0 -88
  118. package/dist/runtime/composables/Product/useProductComponent.d.ts +0 -5
  119. package/dist/runtime/composables/Product/useProductComponent.js +0 -23
  120. package/dist/runtime/composables/Product/useProductSlug.d.ts +0 -8
  121. package/dist/runtime/composables/Product/useProductSlug.js +0 -25
  122. package/dist/runtime/composables/Product/useQuickView.d.ts +0 -8
  123. package/dist/runtime/composables/Product/useQuickView.js +0 -27
  124. package/dist/runtime/composables/Product/useService.d.ts +0 -17
  125. package/dist/runtime/composables/Product/useService.js +0 -64
  126. package/dist/runtime/composables/Product/useTemplate.d.ts +0 -5
  127. package/dist/runtime/composables/Product/useTemplate.js +0 -21
  128. package/dist/runtime/composables/Samples/useSamples.d.ts +0 -10
  129. package/dist/runtime/composables/Samples/useSamples.js +0 -36
  130. package/dist/runtime/composables/SideBar/Filters/useFilters.d.ts +0 -6
  131. package/dist/runtime/composables/SideBar/Filters/useFilters.js +0 -51
  132. package/dist/runtime/composables/SideBar/Filters/useSorting.d.ts +0 -5
  133. package/dist/runtime/composables/SideBar/Filters/useSorting.js +0 -27
  134. package/dist/runtime/composables/SideBar/useSideBar.d.ts +0 -8
  135. package/dist/runtime/composables/SideBar/useSideBar.js +0 -68
  136. package/dist/runtime/composables/index.d.ts +0 -78
  137. package/dist/runtime/composables/index.js +0 -78
  138. package/dist/runtime/composables/types.d.ts +0 -5
  139. package/dist/runtime/composables/types.js +0 -0
  140. package/dist/runtime/composables/useAddToCart.d.ts +0 -28
  141. package/dist/runtime/composables/useAddToCart.js +0 -111
  142. package/dist/runtime/composables/useAddresses.d.ts +0 -18
  143. package/dist/runtime/composables/useAddresses.js +0 -126
  144. package/dist/runtime/composables/useCards.d.ts +0 -19
  145. package/dist/runtime/composables/useCards.js +0 -73
  146. package/dist/runtime/composables/useClientApi.d.ts +0 -23
  147. package/dist/runtime/composables/useClientApi.js +0 -53
  148. package/dist/runtime/composables/useDataLayer.d.ts +0 -18
  149. package/dist/runtime/composables/useDataLayer.js +0 -386
  150. package/dist/runtime/composables/useDynamicHtmlRenderer.d.ts +0 -4
  151. package/dist/runtime/composables/useDynamicHtmlRenderer.js +0 -33
  152. package/dist/runtime/composables/useLocation.d.ts +0 -13
  153. package/dist/runtime/composables/useLocation.js +0 -32
  154. package/dist/runtime/composables/useLocations.d.ts +0 -12
  155. package/dist/runtime/composables/useLocations.js +0 -53
  156. package/dist/runtime/composables/useMetaLayer.d.ts +0 -10
  157. package/dist/runtime/composables/useMetaLayer.js +0 -263
  158. package/dist/runtime/composables/useQuotationCheckout.d.ts +0 -78
  159. package/dist/runtime/composables/useQuotationCheckout.js +0 -138
  160. package/dist/runtime/composables/useSearch.d.ts +0 -7
  161. package/dist/runtime/composables/useSearch.js +0 -40
  162. package/dist/runtime/composables/useSubscriptions.d.ts +0 -13
  163. package/dist/runtime/composables/useSubscriptions.js +0 -58
  164. package/dist/runtime/composables/useTikTokDatalayer.d.ts +0 -8
  165. package/dist/runtime/composables/useTikTokDatalayer.js +0 -165
  166. package/dist/runtime/composables/useWebforms.d.ts +0 -16
  167. package/dist/runtime/composables/useWebforms.js +0 -75
  168. package/dist/runtime/middleware/flowrix.d.ts +0 -7
  169. package/dist/runtime/middleware/flowrix.js +0 -60
  170. package/dist/runtime/plugin.d.ts +0 -2
  171. package/dist/runtime/plugin.js +0 -5
  172. package/dist/runtime/plugins/persistedstate.client.d.ts +0 -2
  173. package/dist/runtime/plugins/persistedstate.client.js +0 -9
  174. package/dist/runtime/server/api/albums.d.ts +0 -2
  175. package/dist/runtime/server/api/albums.js +0 -18
  176. package/dist/runtime/server/api/auth/forgot.d.ts +0 -5
  177. package/dist/runtime/server/api/auth/forgot.js +0 -44
  178. package/dist/runtime/server/api/auth/login.d.ts +0 -11
  179. package/dist/runtime/server/api/auth/login.js +0 -68
  180. package/dist/runtime/server/api/auth/logout.d.ts +0 -5
  181. package/dist/runtime/server/api/auth/logout.js +0 -23
  182. package/dist/runtime/server/api/auth/register.d.ts +0 -2
  183. package/dist/runtime/server/api/auth/register.js +0 -51
  184. package/dist/runtime/server/api/auth/session.get.d.ts +0 -2
  185. package/dist/runtime/server/api/auth/session.get.js +0 -46
  186. package/dist/runtime/server/api/auth/user/reset-password.d.ts +0 -5
  187. package/dist/runtime/server/api/auth/user/reset-password.js +0 -40
  188. package/dist/runtime/server/api/auth/user/session.d.ts +0 -2
  189. package/dist/runtime/server/api/auth/user/session.js +0 -43
  190. package/dist/runtime/server/api/auth/user/verify-token.d.ts +0 -6
  191. package/dist/runtime/server/api/auth/user/verify-token.js +0 -50
  192. package/dist/runtime/server/api/banners.d.ts +0 -3
  193. package/dist/runtime/server/api/banners.js +0 -41
  194. package/dist/runtime/server/api/brand/[...slug].d.ts +0 -3
  195. package/dist/runtime/server/api/brand/[...slug].js +0 -58
  196. package/dist/runtime/server/api/brand/index.d.ts +0 -2
  197. package/dist/runtime/server/api/brand/index.js +0 -23
  198. package/dist/runtime/server/api/cache/[...slug].delete.d.ts +0 -2
  199. package/dist/runtime/server/api/cache/[...slug].delete.js +0 -40
  200. package/dist/runtime/server/api/cache/clean.get.d.ts +0 -5
  201. package/dist/runtime/server/api/cache/clean.get.js +0 -16
  202. package/dist/runtime/server/api/cart/[slug]/add.d.ts +0 -2
  203. package/dist/runtime/server/api/cart/[slug]/add.js +0 -21
  204. package/dist/runtime/server/api/cart/[slug]/update.d.ts +0 -2
  205. package/dist/runtime/server/api/cart/[slug]/update.js +0 -21
  206. package/dist/runtime/server/api/cart/related.d.ts +0 -2
  207. package/dist/runtime/server/api/cart/related.js +0 -21
  208. package/dist/runtime/server/api/cart/remove.d.ts +0 -2
  209. package/dist/runtime/server/api/cart/remove.js +0 -21
  210. package/dist/runtime/server/api/cart/service/[slug]/add.d.ts +0 -2
  211. package/dist/runtime/server/api/cart/service/[slug]/add.js +0 -16
  212. package/dist/runtime/server/api/catalog/categories.d.ts +0 -3
  213. package/dist/runtime/server/api/catalog/categories.js +0 -44
  214. package/dist/runtime/server/api/catalog/categoriesall.d.ts +0 -3
  215. package/dist/runtime/server/api/catalog/categoriesall.js +0 -44
  216. package/dist/runtime/server/api/catalog/featured.d.ts +0 -3
  217. package/dist/runtime/server/api/catalog/featured.js +0 -42
  218. package/dist/runtime/server/api/catalog/samples.d.ts +0 -3
  219. package/dist/runtime/server/api/catalog/samples.js +0 -45
  220. package/dist/runtime/server/api/catalog/search.d.ts +0 -3
  221. package/dist/runtime/server/api/catalog/search.js +0 -45
  222. package/dist/runtime/server/api/category/[...slug].d.ts +0 -3
  223. package/dist/runtime/server/api/category/[...slug].js +0 -58
  224. package/dist/runtime/server/api/checkout/applyCoupon.d.ts +0 -2
  225. package/dist/runtime/server/api/checkout/applyCoupon.js +0 -20
  226. package/dist/runtime/server/api/checkout/configs.d.ts +0 -2
  227. package/dist/runtime/server/api/checkout/configs.js +0 -19
  228. package/dist/runtime/server/api/checkout/countries.d.ts +0 -2
  229. package/dist/runtime/server/api/checkout/countries.js +0 -17
  230. package/dist/runtime/server/api/checkout/paymentmethod.d.ts +0 -2
  231. package/dist/runtime/server/api/checkout/paymentmethod.js +0 -20
  232. package/dist/runtime/server/api/checkout/quotation/[slug].d.ts +0 -2
  233. package/dist/runtime/server/api/checkout/quotation/[slug].js +0 -21
  234. package/dist/runtime/server/api/checkout/quotation/guest/[slug].d.ts +0 -2
  235. package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +0 -37
  236. package/dist/runtime/server/api/checkout/quotation/guest/customer.d.ts +0 -2
  237. package/dist/runtime/server/api/checkout/quotation/guest/customer.js +0 -21
  238. package/dist/runtime/server/api/checkout/quotation/submit/[slug].d.ts +0 -2
  239. package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +0 -23
  240. package/dist/runtime/server/api/cmspost/[...slug].d.ts +0 -3
  241. package/dist/runtime/server/api/cmspost/[...slug].js +0 -49
  242. package/dist/runtime/server/api/cmspost/all.d.ts +0 -3
  243. package/dist/runtime/server/api/cmspost/all.js +0 -17
  244. package/dist/runtime/server/api/company/profile.d.ts +0 -2
  245. package/dist/runtime/server/api/company/profile.js +0 -18
  246. package/dist/runtime/server/api/contact-center/webforms/[id]/details.d.ts +0 -3
  247. package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +0 -19
  248. package/dist/runtime/server/api/contact-center/webforms/create.d.ts +0 -2
  249. package/dist/runtime/server/api/contact-center/webforms/create.js +0 -16
  250. package/dist/runtime/server/api/countries.d.ts +0 -2
  251. package/dist/runtime/server/api/countries.js +0 -35
  252. package/dist/runtime/server/api/customer/address/add.d.ts +0 -14
  253. package/dist/runtime/server/api/customer/address/add.js +0 -33
  254. package/dist/runtime/server/api/customer/address/delete.d.ts +0 -20
  255. package/dist/runtime/server/api/customer/address/delete.js +0 -37
  256. package/dist/runtime/server/api/customer/address/setshipping.d.ts +0 -20
  257. package/dist/runtime/server/api/customer/address/setshipping.js +0 -41
  258. package/dist/runtime/server/api/customer/address/update.d.ts +0 -20
  259. package/dist/runtime/server/api/customer/address/update.js +0 -42
  260. package/dist/runtime/server/api/customer/cards/delete.d.ts +0 -2
  261. package/dist/runtime/server/api/customer/cards/delete.js +0 -23
  262. package/dist/runtime/server/api/customer/cards/get.d.ts +0 -2
  263. package/dist/runtime/server/api/customer/cards/get.js +0 -17
  264. package/dist/runtime/server/api/customer/change-password.d.ts +0 -14
  265. package/dist/runtime/server/api/customer/change-password.js +0 -34
  266. package/dist/runtime/server/api/customer/checkout.d.ts +0 -2
  267. package/dist/runtime/server/api/customer/checkout.js +0 -20
  268. package/dist/runtime/server/api/customer/orders.d.ts +0 -2
  269. package/dist/runtime/server/api/customer/orders.js +0 -17
  270. package/dist/runtime/server/api/customer/profile/update.d.ts +0 -14
  271. package/dist/runtime/server/api/customer/profile/update.js +0 -34
  272. package/dist/runtime/server/api/customer/quotations.d.ts +0 -2
  273. package/dist/runtime/server/api/customer/quotations.js +0 -17
  274. package/dist/runtime/server/api/customer/search.d.ts +0 -2
  275. package/dist/runtime/server/api/customer/search.js +0 -15
  276. package/dist/runtime/server/api/customer/tax-invoice.d.ts +0 -8
  277. package/dist/runtime/server/api/customer/tax-invoice.js +0 -36
  278. package/dist/runtime/server/api/customer/wishlist/add.d.ts +0 -2
  279. package/dist/runtime/server/api/customer/wishlist/add.js +0 -30
  280. package/dist/runtime/server/api/customer/wishlist/createWishList.d.ts +0 -2
  281. package/dist/runtime/server/api/customer/wishlist/createWishList.js +0 -29
  282. package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.d.ts +0 -2
  283. package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +0 -46
  284. package/dist/runtime/server/api/customer/wishlist/deleteWishList.d.ts +0 -2
  285. package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +0 -30
  286. package/dist/runtime/server/api/customer/wishlist/get.d.ts +0 -2
  287. package/dist/runtime/server/api/customer/wishlist/get.js +0 -17
  288. package/dist/runtime/server/api/customer/wishlist/getWishListItems.d.ts +0 -2
  289. package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +0 -21
  290. package/dist/runtime/server/api/customer/wishlist/updateWishList.d.ts +0 -2
  291. package/dist/runtime/server/api/customer/wishlist/updateWishList.js +0 -30
  292. package/dist/runtime/server/api/featured.d.ts +0 -2
  293. package/dist/runtime/server/api/featured.js +0 -16
  294. package/dist/runtime/server/api/generate/sitemap.get.d.ts +0 -5
  295. package/dist/runtime/server/api/generate/sitemap.get.js +0 -13
  296. package/dist/runtime/server/api/location.d.ts +0 -2
  297. package/dist/runtime/server/api/location.js +0 -13
  298. package/dist/runtime/server/api/nav/[id]/links.d.ts +0 -2
  299. package/dist/runtime/server/api/nav/[id]/links.js +0 -19
  300. package/dist/runtime/server/api/page/[...slug].d.ts +0 -3
  301. package/dist/runtime/server/api/page/[...slug].js +0 -49
  302. package/dist/runtime/server/api/product/[...slug].d.ts +0 -3
  303. package/dist/runtime/server/api/product/[...slug].js +0 -47
  304. package/dist/runtime/server/api/quickview/[slug].d.ts +0 -2
  305. package/dist/runtime/server/api/quickview/[slug].js +0 -16
  306. package/dist/runtime/server/api/samples.d.ts +0 -3
  307. package/dist/runtime/server/api/samples.js +0 -20
  308. package/dist/runtime/server/api/search.d.ts +0 -3
  309. package/dist/runtime/server/api/search.js +0 -15
  310. package/dist/runtime/server/api/service/[slug].d.ts +0 -3
  311. package/dist/runtime/server/api/service/[slug].js +0 -52
  312. package/dist/runtime/server/api/service/availability.d.ts +0 -2
  313. package/dist/runtime/server/api/service/availability.js +0 -27
  314. package/dist/runtime/server/api/service/getall.d.ts +0 -3
  315. package/dist/runtime/server/api/service/getall.js +0 -52
  316. package/dist/runtime/server/api/shop.d.ts +0 -3
  317. package/dist/runtime/server/api/shop.js +0 -15
  318. package/dist/runtime/server/api/subscribe.d.ts +0 -2
  319. package/dist/runtime/server/api/subscribe.js +0 -16
  320. package/dist/runtime/server/api/v2/[...slug].d.ts +0 -3
  321. package/dist/runtime/server/api/v2/[...slug].js +0 -11
  322. package/dist/runtime/server/api/webform.d.ts +0 -3
  323. package/dist/runtime/server/api/webform.js +0 -16
  324. package/dist/runtime/server/tsconfig.json +0 -3
  325. package/dist/runtime/stores/Booking.d.ts +0 -99
  326. package/dist/runtime/stores/Booking.js +0 -96
  327. package/dist/runtime/stores/Cart.d.ts +0 -79
  328. package/dist/runtime/stores/Cart.js +0 -310
  329. package/dist/runtime/stores/Categories.d.ts +0 -13
  330. package/dist/runtime/stores/Categories.js +0 -90
  331. package/dist/runtime/stores/Checkout.d.ts +0 -79
  332. package/dist/runtime/stores/Checkout.js +0 -208
  333. package/dist/runtime/stores/IpLocation.d.ts +0 -18
  334. package/dist/runtime/stores/IpLocation.js +0 -29
  335. package/dist/runtime/stores/NavMenu.d.ts +0 -15
  336. package/dist/runtime/stores/NavMenu.js +0 -26
  337. package/dist/runtime/stores/Search.d.ts +0 -5
  338. package/dist/runtime/stores/Search.js +0 -33
  339. package/dist/runtime/stores/Services.d.ts +0 -7
  340. package/dist/runtime/stores/Services.js +0 -49
  341. package/dist/runtime/stores/Utilities.d.ts +0 -5
  342. package/dist/runtime/stores/Utilities.js +0 -11
  343. package/dist/runtime/stores/addresses.d.ts +0 -15
  344. package/dist/runtime/stores/addresses.js +0 -31
  345. package/dist/runtime/stores/auth.d.ts +0 -59
  346. package/dist/runtime/stores/auth.js +0 -441
  347. package/dist/runtime/stores/cards.d.ts +0 -15
  348. package/dist/runtime/stores/cards.js +0 -22
  349. package/dist/runtime/stores/compareStore.d.ts +0 -7
  350. package/dist/runtime/stores/compareStore.js +0 -45
  351. package/dist/runtime/stores/countries.d.ts +0 -8
  352. package/dist/runtime/stores/countries.js +0 -15
  353. package/dist/runtime/stores/index.d.ts +0 -26
  354. package/dist/runtime/stores/index.js +0 -24
  355. package/dist/runtime/stores/locations.d.ts +0 -11
  356. package/dist/runtime/stores/locations.js +0 -19
  357. package/dist/runtime/stores/orders.d.ts +0 -16
  358. package/dist/runtime/stores/orders.js +0 -19
  359. package/dist/runtime/stores/product/README.md +0 -141
  360. package/dist/runtime/stores/product/slug.d.ts +0 -165
  361. package/dist/runtime/stores/product/slug.js +0 -91
  362. package/dist/runtime/stores/product.d.ts +0 -5
  363. package/dist/runtime/stores/product.js +0 -38
  364. package/dist/runtime/stores/quotations.d.ts +0 -12
  365. package/dist/runtime/stores/quotations.js +0 -19
  366. package/dist/runtime/stores/subscriptions.d.ts +0 -11
  367. package/dist/runtime/stores/subscriptions.js +0 -19
  368. package/dist/runtime/stores/useCompanyProfile.d.ts +0 -7
  369. package/dist/runtime/stores/useCompanyProfile.js +0 -22
  370. package/dist/runtime/stores/useNavMenuStore.d.ts +0 -5
  371. package/dist/runtime/stores/useNavMenuStore.js +0 -23
  372. package/dist/runtime/stores/webforms.d.ts +0 -18
  373. package/dist/runtime/stores/webforms.js +0 -23
  374. package/dist/runtime/stores/wishlists.d.ts +0 -136
  375. package/dist/runtime/stores/wishlists.js +0 -249
  376. package/dist/runtime/utils/api.d.ts +0 -13
  377. package/dist/runtime/utils/api.js +0 -98
  378. package/dist/runtime/utils/companyProfile.d.ts +0 -22
  379. package/dist/runtime/utils/companyProfile.js +0 -21
  380. package/dist/runtime/utils/htmlCache.d.ts +0 -5
  381. package/dist/runtime/utils/htmlCache.js +0 -64
  382. package/dist/types.d.mts +0 -7
@@ -1,2080 +0,0 @@
1
- import { defineStore } from "pinia";
2
- export const useCustomScript = defineStore("CustomScript", {
3
- state: () => ({
4
- SelectedOptions: { aid: null, gid: null, vid: null, fraction: false },
5
- attributeIdz: null,
6
- lookupprices: null,
7
- servicePriceSetting: {},
8
- conditions: null,
9
- TYPES: null,
10
- PRICETYPE: null,
11
- UNIT_RELATIVE: null,
12
- DISCOUNTS: null,
13
- measurementUnit: null,
14
- promotionSettings: null,
15
- B2BTYPE: null,
16
- USEBASEPRICE: null,
17
- BASEPRICE: null,
18
- usefitting: null,
19
- sevice_price_type: null,
20
- serviceprice: 0,
21
- With_this_selection_following_selections_will_be_changed: "With this selection following selections will be changed \n",
22
- attributeOf: ".attributeof",
23
- attributeValuesClass: ".attributevalue",
24
- attributeClass: ".attribute",
25
- attributeClassName: "attribute",
26
- valueClassName: "value",
27
- valueClass: ".value",
28
- valueChildClass: ".child",
29
- groupClassName: "group",
30
- groupClass: ".group",
31
- priceClass: ".price .price_span",
32
- rrpriceClass: ".price .price_span",
33
- qtyElement: "#blind-product-form #quantity",
34
- rrpriceWrapper: ".price .if-discounted",
35
- imageElement: ".swatch-image-change img",
36
- useBackground: false,
37
- pdpsummary: {},
38
- msgStr: {},
39
- productPrice: 0,
40
- productDiscountedPrice: 0,
41
- confirmPopup: false,
42
- promotionSettings: null,
43
- linked_promotionSettings: null,
44
- promotion_excludes: [],
45
- total_values_discount: 0,
46
- exclude_from_promo_total: 0,
47
- renderdValues: 0,
48
- sampleproduct: {},
49
- findprice: "",
50
- price_by_attributes: [],
51
- price_by_attributeobject: [],
52
- attributepriceobject: [],
53
- attributeprices: [],
54
- overlayimages: []
55
- }),
56
- actions: {
57
- CallScriptFIrstTime() {
58
- this.processAttributes();
59
- this.setConditions("", true);
60
- let hasnewMeasurements = this.setWidthHeightbaseonStyle();
61
- if (hasnewMeasurements) {
62
- this.setConditions("", true);
63
- }
64
- this.calculatePrice();
65
- },
66
- async initprocess() {
67
- this.total_values_discount = 0;
68
- this.exclude_from_promo_total = 0;
69
- let gid = this.SelectedOptions.gid;
70
- let aid = this.SelectedOptions.aid;
71
- let vid = this.SelectedOptions.vid;
72
- this.msgStr = {};
73
- this.findprice = "";
74
- this.price_by_attributes = [];
75
- this.price_by_attributeobject = [];
76
- this.attributepriceobject = [];
77
- this.attributeprices = [];
78
- var current_selected = Object.values(this.attributeIdz[aid]["values"]).find((v) => v.selected === true && v.applyhidden === false && v.shouldhidden === false);
79
- if (current_selected !== void 0) {
80
- if (this.attributeIdz[aid].type === this.TYPES["width"] || this.attributeIdz[aid].type === this.TYPES["subwidth"] || this.attributeIdz[aid].type === this.TYPES["height"] || this.attributeIdz[aid].type === this.TYPES["subheight"] || this.attributeIdz[aid].type === this.TYPES["number"] || this.attributeIdz[aid].type === this.TYPES["text"] || this.attributeIdz[aid].type === this.TYPES["message"]) {
81
- let currentValue = this.attributeIdz[aid]["values"][current_selected.id]["value"];
82
- this.attributeIdz[aid]["values"][current_selected.id]["ovalue"] = currentValue;
83
- if (this.attributeIdz[aid].type !== this.TYPES["text"] && this.attributeIdz[aid].type !== this.TYPES["message"] && this.SelectedOptions.fraction == false) {
84
- vid = parseFloat(vid);
85
- }
86
- this.attributeIdz[aid]["values"][current_selected.id]["value"] = vid;
87
- this.setSummery(this.attributeIdz[aid], current_selected);
88
- } else {
89
- if (this.attributeIdz[aid].type === this.TYPES["drop-down"] || this.attributeIdz[aid].type === this.TYPES["style"] || this.attributeIdz[aid].type === this.TYPES["swatch"]) {
90
- if (this.attributeIdz[aid].parent_id) {
91
- var current_old_selected = Object.values(this.attributeIdz[aid]["values"]).find((v) => v.oldselected == true && v.parent_id == current_selected.parent_id);
92
- } else {
93
- var current_old_selected = Object.values(this.attributeIdz[aid]["values"]).find((v) => v.oldselected == true);
94
- }
95
- if (current_old_selected != void 0) {
96
- this.attributeIdz[aid]["values"][current_old_selected.id]["oldselected"] = false;
97
- }
98
- this.attributeIdz[aid]["values"][current_selected.id]["selected"] = false;
99
- this.attributeIdz[aid]["values"][current_selected.id]["oldselected"] = true;
100
- }
101
- }
102
- }
103
- var newvalue = Object.values(this.attributeIdz[aid]["values"]).find((v) => v.id === vid);
104
- if (newvalue !== void 0 && (this.attributeIdz[aid].type === this.TYPES["drop-down"] || this.attributeIdz[aid].type === this.TYPES["style"] || this.attributeIdz[aid].type === this.TYPES["swatch"])) {
105
- this.attributeIdz[aid]["values"][newvalue.id]["selected"] = true;
106
- this.attributeIdz[aid]["values"][newvalue.id]["oldselected"] = false;
107
- if (this.attributeIdz[aid].type === this.TYPES["width"] || this.attributeIdz[aid].type === this.TYPES["subwidth"] || this.attributeIdz[aid].type === this.TYPES["height"] || this.attributeIdz[aid].type === this.TYPES["subheight"]) {
108
- this.markSelected(aid, newvalue.value);
109
- } else {
110
- this.markSelected(aid, newvalue.id);
111
- }
112
- this.setSummery(this.attributeIdz[aid], newvalue);
113
- }
114
- var allattribs = Object.values(this.attributeIdz).filter((a) => a.parent_id === aid);
115
- allattribs = allattribs.sort((a, b) => a.gsortorder - b.gsortorder || a.sortorder - b.sortorder);
116
- this.processAttribute(allattribs);
117
- this.setConditions(aid, false);
118
- let hasnewMeasurements = this.setWidthHeightbaseonStyle();
119
- if (hasnewMeasurements) {
120
- this.setConditions(aid, false);
121
- }
122
- this.calculatePrice();
123
- this.calculateservicePrice();
124
- this.swatchimage();
125
- },
126
- getAvailableValues(aid, parent_value_id = -1) {
127
- if (parent_value_id != -1) {
128
- return Object.values(this.attributeIdz[aid]["values"]).filter((v) => v.selected == false && v.parent_id == parent_value_id && v.shouldhidden == false && v.applyhidden == false);
129
- }
130
- return Object.values(this.attributeIdz[aid]["values"]).filter((v) => v.selected == false && v.shouldhidden == false && v.applyhidden == false);
131
- },
132
- setWidthHeightbaseonStyle() {
133
- const style_attributes = Object.values(this.attributeIdz).filter((a) => a.type == this.TYPES["style"] && a.hide == 0);
134
- let hasChanged = false;
135
- if (style_attributes.length > 0) {
136
- let minwidths = [];
137
- let maxwidths = [];
138
- let minheights = [];
139
- let maxheights = [];
140
- style_attributes.forEach((attribute) => {
141
- const selectedv = Object.values(attribute["values"]).find((v) => v.selected == true && v.applyhidden == false && v.shouldhidden == false);
142
- if (selectedv !== void 0) {
143
- if (selectedv.enable_dimensions) {
144
- maxheights.push(selectedv.max_height);
145
- minheights.push(selectedv.min_height);
146
- maxwidths.push(selectedv.max_width);
147
- minwidths.push(selectedv.min_width);
148
- }
149
- }
150
- });
151
- const min_width = Math.max(...minwidths);
152
- const max_width = Math.max(...maxwidths);
153
- const min_height = Math.max(...minheights);
154
- const max_height = Math.max(...maxheights);
155
- if (min_width !== void 0 && min_width > 0 && max_width !== void 0 && max_width > 0) {
156
- const findwidth = Object.values(this.attributeIdz).find((a) => a.type == this.TYPES["width"]);
157
- if (findwidth !== void 0) {
158
- const value_ids = Object.keys(this.attributeIdz[findwidth.id]["values"]);
159
- if (value_ids.length > 0 && value_ids[0] !== void 0) {
160
- const vid = value_ids[0];
161
- this.attributeIdz[findwidth.id]["values"][vid]["min_width"] = min_width;
162
- this.attributeIdz[findwidth.id]["values"][vid]["max_width"] = max_width;
163
- let value = this.attributeIdz[findwidth.id]["values"][vid]["value"];
164
- this.attributeIdz[findwidth.id]["values"][vid]["ovalue"] = value;
165
- let newvalue = value;
166
- if (value < min_width) {
167
- newvalue = min_width;
168
- }
169
- if (value > max_width) {
170
- newvalue = max_width;
171
- }
172
- if (value != newvalue) {
173
- hasChanged = true;
174
- }
175
- this.attributeIdz[findwidth.id]["values"][vid]["value"] = newvalue;
176
- const widthElement = document.querySelector(this.attributeClass + findwidth.id);
177
- if (widthElement) {
178
- widthElement.value = newvalue;
179
- widthElement.setAttribute("value", newvalue);
180
- }
181
- }
182
- }
183
- }
184
- if (min_height !== void 0 && min_height > 0 && max_height !== void 0 && max_height > 0) {
185
- const findheight = Object.values(this.attributeIdz).find((a) => a.type == this.TYPES["height"]);
186
- if (findheight !== void 0) {
187
- const value_ids = Object.keys(this.attributeIdz[findheight.id]["values"]);
188
- if (value_ids.length > 0 && value_ids[0] !== void 0) {
189
- const vid = value_ids[0];
190
- this.attributeIdz[findheight.id]["values"][vid]["min_height"] = min_height;
191
- this.attributeIdz[findheight.id]["values"][vid]["max_height"] = max_height;
192
- let value = this.attributeIdz[findheight.id]["values"][vid]["value"];
193
- this.attributeIdz[findheight.id]["values"][vid]["ovalue"] = value;
194
- let newvalue = value;
195
- if (value < min_height) {
196
- newvalue = min_height;
197
- }
198
- if (value > max_height) {
199
- newvalue = max_height;
200
- }
201
- if (value != newvalue) {
202
- hasChanged = true;
203
- }
204
- this.attributeIdz[findheight.id]["values"][vid]["value"] = newvalue;
205
- const heightElement = document.querySelector(this.attributeClass + findheight.id);
206
- if (heightElement) {
207
- heightElement.value = newvalue;
208
- heightElement.setAttribute("value", newvalue);
209
- }
210
- }
211
- }
212
- }
213
- return hasChanged;
214
- }
215
- return false;
216
- },
217
- setSummery(attrib, value) {
218
- let title = "";
219
- if (attrib["type"] == this.TYPES["width"] || attrib["type"] == this.TYPES["subwidth"] || attrib["type"] == this.TYPES["height"] || attrib["type"] == this.TYPES["subheight"]) {
220
- var fraction = "";
221
- if ((value["fraction"] === 1 || value["fraction"] === "1") && (value["fvalue"] != "" && value["fvalue"] != null && value["fvalue"] != "0")) {
222
- fraction = " " + value["fvalue"] + " ";
223
- }
224
- title = parseFloat(value["value"]) + fraction + " " + this.measurementUnit;
225
- } else if (attrib["type"] == this.TYPES["number"] || attrib["type"] == this.TYPES["message"] || attrib["type"] == this.TYPES["text"]) {
226
- title = value["value"];
227
- } else {
228
- title = value["title"];
229
- }
230
- if (!attrib.hide) {
231
- this.pdpsummary[attrib["id"]] = { "attribute": attrib["title"], "value": title, "gsortorder": attrib["gsortorder"], "sortorder": attrib["sortorder"], "active": attrib["active"], "show_summary": attrib["show_summary"], "hide": attrib["hide"] };
232
- }
233
- },
234
- unsetSummery(aid) {
235
- delete this.pdpsummary[aid];
236
- },
237
- hideValue(h_aid, h_vid) {
238
- this.markUnselected(h_aid, h_vid);
239
- },
240
- showValue(h_aid, h_vid) {
241
- const element = document.querySelector(`${this.attributeClass + h_aid} [data-value="${h_vid}"]`);
242
- if (element) {
243
- element.parentElement.style.display = "block";
244
- element.removeAttribute("disabled");
245
- element.style.display = "";
246
- }
247
- },
248
- showAttribute(aid) {
249
- const element = document.querySelector(this.attributeClass + aid);
250
- if (element) {
251
- element.style.display = "";
252
- }
253
- },
254
- hideAttribute(aid) {
255
- this.unsetSummery(aid);
256
- const element = document.querySelector(this.attributeClass + aid);
257
- if (element) {
258
- element.style.display = "none";
259
- }
260
- },
261
- hideChildValues(aid, parent_id) {
262
- const childElements = document.querySelectorAll(`${this.attributeClass + aid} [data-attributevalue="${parent_id}"]`);
263
- childElements.forEach((element) => {
264
- let grandparent = element.parentElement?.parentElement;
265
- element.selected = false;
266
- element.checked = false;
267
- element.removeAttribute("selected");
268
- element.removeAttribute("checked");
269
- element.classList.remove("active");
270
- element.style.display = "none";
271
- element.parentElement.style.display = "none";
272
- if (grandparent && grandparent.classList.contains("swiper-slide")) {
273
- grandparent.parentElement.style.display = "none";
274
- }
275
- element.disabled = true;
276
- });
277
- },
278
- hideChildValuesOfParentValue(aid, parent_attribute_id, parent_value_id) {
279
- const elements = document.querySelectorAll(`[data-attributevalue="${parent_attribute_id}"][data-child="${parent_value_id}"]`);
280
- elements.forEach((element) => {
281
- let grandparent = element.parentElement?.parentElement;
282
- element.selected = false;
283
- element.checked = false;
284
- element.removeAttribute("selected");
285
- element.removeAttribute("checked");
286
- element.classList.remove("active");
287
- element.style.display = "none";
288
- element.parentElement.style.display = "none";
289
- if (grandparent && grandparent.classList.contains("swiper-slide")) {
290
- grandparent.parentElement.style.display = "none";
291
- }
292
- element.disabled = true;
293
- });
294
- },
295
- showChildValues(aid, parent_selected_val_id) {
296
- const childElements = document.querySelectorAll(`${this.attributeClass + aid} [data-child="${parent_selected_val_id}"]`);
297
- childElements.forEach((element) => {
298
- let grandparent = element.parentElement?.parentElement;
299
- element.removeAttribute("disabled");
300
- element.parentElement.style.display = "";
301
- if (grandparent && grandparent.classList.contains("swiper-slide")) {
302
- grandparent.parentElement.style.display = "";
303
- }
304
- element.style.display = "";
305
- });
306
- },
307
- showGroup(gid) {
308
- const groupElement = document.querySelector(this.groupClass + gid);
309
- if (groupElement) {
310
- groupElement.style.display = "";
311
- }
312
- },
313
- hideGroup(gid) {
314
- document.querySelector(this.groupClass + gid).style.display = "none";
315
- },
316
- markSelected(h_aid, h_vid) {
317
- const element = document.querySelector(`${this.attributeClass}${h_aid} [data-value="${h_vid}"]`);
318
- if (element) {
319
- element.parentElement.style.display = "block";
320
- element.setAttribute("selected", true);
321
- element.checked = true;
322
- element.style.display = "block";
323
- element.classList.add("active");
324
- if (element.getAttribute("customselect") == "true") {
325
- element.dispatchEvent(new Event("change"));
326
- }
327
- }
328
- const container = document.querySelector(`${this.attributeClass}${h_aid}`);
329
- if (container) {
330
- container.value = h_vid;
331
- }
332
- },
333
- markInputSelected(aid, vid, value = null) {
334
- const element = document.querySelector(this.attributeClass + aid);
335
- const dataValueElement = element.querySelector('[data-value="' + vid + '"]');
336
- if (dataValueElement) {
337
- dataValueElement.setAttribute("selected", true);
338
- dataValueElement.checked = true;
339
- dataValueElement.style.display = "block";
340
- dataValueElement.classList.add("active");
341
- }
342
- if (value == 0 || value == "0") {
343
- value = "";
344
- }
345
- element.value = value;
346
- },
347
- markUnselected(h_aid, h_vid) {
348
- const element = document.querySelector(`${this.attributeClass + h_aid} [data-value="${h_vid}"]`);
349
- if (element) {
350
- element.parentElement.style.display = "none";
351
- element.removeAttribute("selected");
352
- element.checked = false;
353
- element.style.display = "none";
354
- element.classList.remove("active");
355
- element.setAttribute("disabled", "true");
356
- }
357
- },
358
- findSelectedValue(values, parent_value_id = -1) {
359
- if (parent_value_id != -1) {
360
- return Object.values(values).find((v) => v.selected == true && v.parent_id == parent_value_id && v.applyhidden == false && v.shouldhidden == false);
361
- }
362
- return Object.values(values).find((v) => v.selected == true && v.applyhidden == false && v.shouldhidden == false);
363
- },
364
- processAttributes() {
365
- this.total_values_discount = 0;
366
- this.productPrice = 0;
367
- this.productDiscountedPrice = 0, this.msgStr = {};
368
- this.findprice = "";
369
- this.price_by_attributes = [];
370
- this.price_by_attributeobject = [];
371
- this.attributepriceobject = [];
372
- this.attributeprices = [];
373
- var allattribs = Object.values(this.attributeIdz).filter((a) => a.parent == null);
374
- allattribs = allattribs.sort((a, b) => a.gsortorder - b.gsortorder || a.sortorder - b.sortorder);
375
- this.processAttribute(allattribs);
376
- },
377
- processAttribute(attributes) {
378
- const self = this;
379
- if (attributes !== void 0 && attributes.length > 0) {
380
- attributes.forEach((attrib) => {
381
- if (attrib.values == void 0) {
382
- return;
383
- }
384
- let selected_val2 = self.findSelectedValue(attrib.values);
385
- let parent_id = attrib.parent_id;
386
- if (parent_id && parent_id !== 0) {
387
- self.hideAttribute(attrib.id);
388
- let parent_selected_val = self.findSelectedValue(self.attributeIdz[parent_id]["values"]);
389
- if (parent_selected_val !== void 0) {
390
- self.showAttribute(attrib.id);
391
- self.hideChildValues(attrib.id, parent_id);
392
- self.showChildValues(attrib.id, parent_selected_val.id);
393
- if (selected_val2 == void 0) {
394
- let available_value_array = Object.values(self.attributeIdz[attrib.id]["values"]).filter((v) => v.parent_id == parent_selected_val.id && v.selected == false && v.applyhidden == false && v.shouldhidden == false);
395
- if (available_value_array.length > 0) {
396
- available_value_array.sort((a, b) => a.sortorder - b.sortorder);
397
- selected_val2 = available_value_array[0];
398
- self.attributeIdz[attrib.id]["values"][selected_val2.id]["selected"] = true;
399
- self.attributeIdz[attrib.id]["values"][selected_val2.id]["oldselected"] = false;
400
- self.setSummery(attrib, selected_val2);
401
- if ([
402
- self.TYPES["width"],
403
- self.TYPES["subwidth"],
404
- self.TYPES["height"],
405
- self.TYPES["subheight"]
406
- ].includes(self.attributeIdz[attrib.id].type)) {
407
- self.markInputSelected(attrib.id, selected_val2.value);
408
- } else {
409
- self.markSelected(attrib.id, selected_val2.id);
410
- }
411
- } else {
412
- selected_val2 = void 0;
413
- self.hideAttribute(attrib.id);
414
- self.hideAttributeHirerachy(attrib.id);
415
- }
416
- }
417
- if (selected_val2 !== void 0 && selected_val2.parent_id !== parent_selected_val.id) {
418
- self.attributeIdz[attrib.id]["values"][selected_val2.id]["selected"] = false;
419
- self.attributeIdz[attrib.id]["values"][selected_val2.id]["oldselected"] = true;
420
- let available_value_array = Object.values(self.attributeIdz[attrib.id]["values"]).filter((v) => v.parent_id == parent_selected_val.id && v.selected == false && v.applyhidden == false && v.shouldhidden == false);
421
- if (available_value_array.length > 0) {
422
- self.hideChildValues(attrib.id, parent_id);
423
- self.showChildValues(attrib.id, parent_selected_val.id);
424
- available_value_array.sort((a, b) => a.sortorder - b.sortorder);
425
- selected_val2 = available_value_array[0];
426
- self.attributeIdz[attrib.id]["values"][selected_val2.id]["selected"] = true;
427
- self.attributeIdz[attrib.id]["values"][selected_val2.id]["oldselected"] = false;
428
- self.setSummery(attrib, selected_val2);
429
- if ([
430
- self.TYPES["width"],
431
- self.TYPES["subwidth"],
432
- self.TYPES["height"],
433
- self.TYPES["subheight"]
434
- ].includes(self.attributeIdz[attrib.id].type)) {
435
- self.markInputSelected(attrib.id, selected_val2.id, selected_val2.value);
436
- } else {
437
- self.markSelected(attrib.id, selected_val2.id);
438
- }
439
- } else {
440
- selected_val2 = void 0;
441
- self.hideAttribute(attrib.id);
442
- self.hideAttributeHirerachy(attrib.id);
443
- }
444
- } else {
445
- if (selected_val2 && selected_val2.parent_id == parent_selected_val.id) {
446
- self.showChildValues(attrib.id, parent_selected_val.id);
447
- }
448
- if (selected_val2) {
449
- if ([
450
- self.TYPES["width"],
451
- self.TYPES["subwidth"],
452
- self.TYPES["height"],
453
- self.TYPES["subheight"]
454
- ].includes(self.attributeIdz[attrib.id].type)) {
455
- self.markInputSelected(attrib.id, selected_val2.id, selected_val2.value);
456
- } else {
457
- self.markSelected(attrib.id, selected_val2.id);
458
- }
459
- }
460
- }
461
- } else {
462
- self.hideChildValues(attrib.id, parent_id);
463
- }
464
- }
465
- if (selected_val2) {
466
- self.setSummery(attrib, selected_val2);
467
- if (![self.TYPES["width"], self.TYPES["subwidth"], self.TYPES["height"], self.TYPES["subheight"], self.TYPES["number"], self.TYPES["message"], self.TYPES["text"]].includes(attrib["type"])) {
468
- if ([
469
- self.TYPES["width"],
470
- self.TYPES["subwidth"],
471
- self.TYPES["height"],
472
- self.TYPES["subheight"]
473
- ].includes(self.attributeIdz[attrib.id].type)) {
474
- self.markInputSelected(attrib.id, selected_val2.id, selected_val2.value);
475
- } else {
476
- self.markSelected(attrib.id, selected_val2.id);
477
- }
478
- let child_attrib = Object.values(self.attributeIdz).filter((a) => a.parent == attrib["id"]);
479
- if (child_attrib.length > 0) {
480
- self.processChildAttribute(child_attrib);
481
- }
482
- }
483
- }
484
- });
485
- }
486
- },
487
- processAttributeAfterCondition(attributes) {
488
- let self = this;
489
- if (attributes != void 0 && attributes.length > 0) {
490
- Object.keys(attributes).forEach(function(key) {
491
- if (attributes[key]["values"] == void 0) {
492
- return;
493
- }
494
- let hiddenvalues = Object.values(attributes[key]["values"]).filter((v) => v.applyhidden == true || v.shouldhidden == true);
495
- hiddenvalues.forEach(function(value, index) {
496
- self.markUnselected(value.aid, value.id);
497
- });
498
- var child_attrib = Object.values(self.attributeIdz).filter((a) => a.parent_id == attributes[key].id);
499
- if (child_attrib.length > 0) {
500
- self.processAttributeAfterCondition(child_attrib);
501
- }
502
- });
503
- }
504
- },
505
- hideAttributeHirerachy(aid) {
506
- var child_attrib = Object.values(this.attributeIdz).filter((a) => a.parent == aid);
507
- this.hideChildAttributes(child_attrib);
508
- },
509
- hideChildAttributes(child_attrib) {
510
- const self = this;
511
- child_attrib.forEach((cattrib) => {
512
- const select_value = Object.values(cattrib["values"]).find((v) => v.selected == true && v.applyhidden == false);
513
- if (select_value !== void 0) {
514
- self.attributeIdz[cattrib.id]["values"][select_value.id]["selected"] = false;
515
- self.attributeIdz[cattrib.id]["values"][select_value.id]["oldselected"] = true;
516
- }
517
- self.hideAttribute(cattrib["id"]);
518
- const childattrib = Object.values(self.attributeIdz).filter((a) => a.parent == cattrib["id"]);
519
- self.hideChildAttributes(childattrib);
520
- });
521
- },
522
- processChildAttribute(child_attrib) {
523
- child_attrib = child_attrib.sort((a, b) => a.gsortorder - b.gsortorder || a.sortorder - b.sortorder);
524
- this.processAttribute(child_attrib);
525
- },
526
- async setConditions(aid = "", first_call2 = false) {
527
- if (first_call2 == true) {
528
- }
529
- let available2 = 1;
530
- let changed_attribs = {};
531
- let response = true;
532
- let self = this;
533
- if (typeof self.attributeIdz !== "undefined") {
534
- let msgAttributes = {};
535
- let hiddenAttributes = {};
536
- let childAttributes = {};
537
- let changed_values2 = {};
538
- self.conditions.forEach((condition_array) => {
539
- let c_aid2 = condition_array.key;
540
- let db_condition = condition_array.values;
541
- let changed_values3 = {};
542
- let hiddenValues2 = {};
543
- let child_Values2 = {};
544
- let msgValue2 = {};
545
- Object.entries(db_condition).forEach(([v_id2, cond]) => {
546
- let newcondition2 = self.createCondition(cond);
547
- if (self.attributeIdz[c_aid2]?.values[v_id2]) {
548
- let conditionReturn = self.executeCondition(
549
- newcondition2,
550
- c_aid2,
551
- v_id2,
552
- changed_values3,
553
- msgValue2,
554
- hiddenValues2,
555
- child_Values2,
556
- first_call2
557
- );
558
- changed_values3 = conditionReturn.changed_values;
559
- msgValue2 = conditionReturn.msgValue;
560
- hiddenValues2 = conditionReturn.hiddenValues;
561
- child_Values2 = conditionReturn.child_Values;
562
- }
563
- if (Object.keys(msgValue2).length > 0) {
564
- msgAttributes[c_aid2] = msgValue2;
565
- }
566
- if (Object.keys(changed_values3).length > 0) {
567
- changed_attribs[c_aid2] = changed_values3;
568
- }
569
- if (Object.keys(hiddenValues2).length > 0) {
570
- hiddenAttributes[c_aid2] = hiddenValues2;
571
- }
572
- if (Object.keys(child_Values2).length > 0) {
573
- childAttributes[c_aid2] = child_Values2;
574
- }
575
- });
576
- let selected_value_hidden_array = Object.values(self.attributeIdz[c_aid2]?.values || {}).filter(
577
- (v) => v.selected && v.shouldhidden
578
- );
579
- if (selected_value_hidden_array.length > 0) {
580
- self.selectOneValue(c_aid2);
581
- selected_value_hidden_array.forEach((hidden_value) => {
582
- self.attributeIdz[c_aid2].values[hidden_value.id].selected = false;
583
- self.attributeIdz[c_aid2].values[hidden_value.id].oldselected = false;
584
- self.markUnselected(c_aid2, hidden_value.id);
585
- let conditionReturn = self.checkChangeAttributesMsg(
586
- c_aid2,
587
- msgAttributes,
588
- msgValue2,
589
- hidden_value,
590
- child_Values2,
591
- first_call2,
592
- available2
593
- );
594
- child_Values2 = conditionReturn.child_Values;
595
- if (Object.keys(child_Values2).length > 0) {
596
- childAttributes[c_aid2] = child_Values2;
597
- }
598
- });
599
- selected_value_hidden_array.sort((a, b) => a.sortorder - b.sortorder);
600
- let pick_first_value = selected_value_hidden_array[0];
601
- self.attributeIdz[c_aid2].values[pick_first_value.id].oldselected = true;
602
- self.hideAttributeOrGroup(c_aid2);
603
- } else {
604
- self.selectOneValue(c_aid2);
605
- }
606
- });
607
- if ((Object.values(msgAttributes).length > 0 || Object.values(childAttributes).length > 0) && !first_call2) {
608
- response = true;
609
- if (Object.values(msgAttributes).length > 0) {
610
- response = await self.confirmChange(changed_attribs, hiddenAttributes, aid);
611
- }
612
- Object.entries(childAttributes).forEach(([a_id, a_values]) => {
613
- a_id = Number(a_id);
614
- let gid = self.attributeIdz[a_id]?.gid || 1;
615
- Object.entries(a_values).forEach(([v_id2, value]) => {
616
- v_id2 = Number(v_id2);
617
- if (value.confirm_popup) {
618
- if (response) {
619
- if (value.selected && value.show && value.child > 0) {
620
- self.markSelected(a_id, v_id2);
621
- let child_attribute = Object.values(self.attributeIdz).filter(
622
- (a) => a.parent_id === a_id && !a.hide
623
- );
624
- self.processAttribute(child_attribute);
625
- }
626
- if (!value.selected && value.hide && value.child > 0) {
627
- let child_attribute = Object.values(self.attributeIdz).filter(
628
- (a) => a.parent_id === a_id && !a.hide
629
- );
630
- if (child_attribute.length > 0) {
631
- child_attribute.forEach((attribute) => {
632
- let child_selected = Object.values(attribute.values).find(
633
- (v) => v.parent_id === v_id2 && v.selected
634
- );
635
- self.hideChildValuesOfParentValue(attribute.id, a_id, v_id2);
636
- if (child_selected) {
637
- self.attributeIdz[attribute.id].values[child_selected.id].selected = false;
638
- self.markUnselected(attribute.id, child_selected.id);
639
- }
640
- let find_any_selected = Object.values(attribute.values).find(
641
- (v) => v.selected && !v.applyhidden && !v.shouldhidden
642
- );
643
- if (!find_any_selected) {
644
- self.hideAttributeOrGroup(attribute.id);
645
- self.hideAttribute(attribute.id);
646
- self.unsetMsg(attribute.id);
647
- }
648
- });
649
- }
650
- }
651
- }
652
- } else {
653
- if (!value.selected) {
654
- if (value.hide && value.child > 0) {
655
- self.markUnselected(a_id, v_id2);
656
- let child_attribute = Object.values(self.attributeIdz).filter(
657
- (a) => a.parent_id === a_id && !a.hide
658
- );
659
- if (child_attribute.length > 0) {
660
- child_attribute.forEach((attribute) => {
661
- let child_selected = Object.values(attribute.values).find(
662
- (v) => v.parent_id === v_id2 && v.selected
663
- );
664
- self.hideChildValuesOfParentValue(attribute.id, a_id, v_id2);
665
- if (child_selected) {
666
- self.attributeIdz[attribute.id].values[child_selected.id].selected = false;
667
- self.markUnselected(attribute.id, child_selected.id);
668
- }
669
- let find_any_selected = Object.values(attribute.values).find(
670
- (v) => v.selected && !v.applyhidden && !v.shouldhidden
671
- );
672
- if (!find_any_selected) {
673
- self.hideAttributeOrGroup(attribute.id);
674
- self.hideAttribute(attribute.id);
675
- self.unsetMsg(attribute.id);
676
- }
677
- });
678
- }
679
- } else if (value.show) {
680
- if (value.child > 0) {
681
- let child_attribute = Object.values(self.attributeIdz).filter(
682
- (a) => a.parent_id === a_id && !a.hide
683
- );
684
- self.processAttribute(child_attribute);
685
- self.processAttributeAfterCondition(child_attribute);
686
- } else {
687
- let child_attribute = Object.values(self.attributeIdz).filter(
688
- (a) => a.parent_id === a_id && !a.hide
689
- );
690
- child_attribute.forEach((attribute) => {
691
- if (attribute.parent_id) {
692
- let find_selectedValue = Object.values(
693
- self.attributeIdz[attribute.parent_id]?.values || {}
694
- ).find(
695
- (v) => v.selected && !v.applyhidden && !v.shouldhidden
696
- );
697
- let find_Value = Object.values(attribute.values).find(
698
- (v) => v.selected && !v.applyhidden && !v.shouldhidden
699
- );
700
- if (!find_Value) {
701
- self.markUnselected(attribute.id, v_id2);
702
- self.hideAttributeOrGroup(attribute.id);
703
- self.hideAttribute(attribute.id);
704
- self.unsetMsg(attribute.id);
705
- } else if (!find_selectedValue || find_selectedValue && find_selectedValue.id !== attribute.values[find_Value.id].parent_id) {
706
- self.markUnselected(attribute.id, v_id2);
707
- self.hideAttributeOrGroup(attribute.id);
708
- self.hideAttribute(attribute.id);
709
- self.unsetMsg(attribute.id);
710
- }
711
- }
712
- });
713
- }
714
- }
715
- } else if (value.selected) {
716
- if (value.show) {
717
- if (value.child > 0) {
718
- self.showAttribute(a_id);
719
- let child_attribute = Object.values(self.attributeIdz).filter(
720
- (a) => a.parent_id === a_id && !a.hide
721
- );
722
- child_attribute.forEach((attribute) => {
723
- let has_child_values = Object.values(attribute.values).filter(
724
- (v) => v.parent_id === v_id2 && !v.shouldhidden && !v.applyhidden
725
- );
726
- if (has_child_values.length > 0) {
727
- self.showAttribute(attribute.id);
728
- }
729
- });
730
- }
731
- }
732
- }
733
- }
734
- });
735
- });
736
- }
737
- }
738
- return response;
739
- },
740
- // setConditions(aid = '', first_call = false) {
741
- // let self = this;
742
- // let available = 1;
743
- // let changed_attribs = {};
744
- // let response = true;
745
- // if (self.attributeIdz !== undefined) {
746
- // let msgAttributes = {};
747
- // let hiddenAttributes = {};
748
- // let childAttributes = {};
749
- // (self.conditions).forEach(function (condition_array) {
750
- // let c_aid = condition_array.key;
751
- // let db_condition = condition_array.values;
752
- // let changed_values = {};
753
- // let hiddenValues = {};
754
- // let child_Values = {};
755
- // let msgValue = {};
756
- // Object.entries(db_condition).forEach(function (cond, v_id) {
757
- // let newcondition = self.createCondition(cond);
758
- // if (self.attributeIdz[c_aid]['values'][v_id] !== undefined) {
759
- // let conditionReturn = self.executeCondition(
760
- // newcondition,
761
- // c_aid,
762
- // v_id,
763
- // changed_values,
764
- // msgValue,
765
- // hiddenValues,
766
- // child_Values,
767
- // first_call
768
- // );
769
- // changed_values = conditionReturn['changed_values'];
770
- // msgValue = conditionReturn['msgValue'];
771
- // hiddenValues = conditionReturn['hiddenValues'];
772
- // child_Values = conditionReturn['child_Values'];
773
- // }
774
- // if (Object.keys(msgValue).length > 0) {
775
- // msgAttributes[c_aid] = msgValue;
776
- // }
777
- // if (Object.keys(changed_values).length > 0) {
778
- // changed_attribs[c_aid] = changed_values;
779
- // }
780
- // if (Object.keys(hiddenValues).length > 0) {
781
- // hiddenAttributes[c_aid] = hiddenValues;
782
- // }
783
- // if (Object.keys(child_Values).length > 0) {
784
- // childAttributes[c_aid] = child_Values;
785
- // }
786
- // });
787
- // let selected_value_hidden_array = Object.values(self.attributeIdz[c_aid]['values']).filter(
788
- // (v) => v.selected === true && v.shouldhidden === true
789
- // );
790
- // if (selected_value_hidden_array.length > 0) {
791
- // self.selectOneValue(c_aid);
792
- // selected_value_hidden_array.forEach(function (hidden_value) {
793
- // self.attributeIdz[c_aid]['values'][hidden_value.id]['selected'] = false;
794
- // self.attributeIdz[c_aid]['values'][hidden_value.id]['oldselected'] = false;
795
- // self.markUnselected(c_aid, hidden_value.id);
796
- // let conditionReturn = self.checkChangeAttributesMsg(
797
- // c_aid,
798
- // msgAttributes,
799
- // msgValue,
800
- // hidden_value,
801
- // child_Values,
802
- // first_call,
803
- // available
804
- // );
805
- // child_Values = conditionReturn['child_Values'];
806
- // if (Object.keys(child_Values).length > 0) {
807
- // childAttributes[c_aid] = child_Values;
808
- // }
809
- // });
810
- // selected_value_hidden_array.sort((a, b) => a.sortorder - b.sortorder);
811
- // let pick_first_value = selected_value_hidden_array[0];
812
- // self.attributeIdz[c_aid]['values'][pick_first_value.id]['oldselected'] = true;
813
- // self.hideAttributeOrGroup(c_aid);
814
- // } else {
815
- // self.selectOneValue(c_aid);
816
- // }
817
- // });
818
- // if (
819
- // (Object.values(self.msgStr).length > 0 || Object.values(childAttributes).length > 0) &&
820
- // first_call === false
821
- // ) {
822
- // response = true;
823
- // if (Object.values(msgStr).length > 0) {
824
- // response = self.confirmChange(changed_attribs, hiddenAttributes, aid);
825
- // }
826
- // for (let a_id in childAttributes) {
827
- // let a_values = childAttributes[a_id];
828
- // let gid = self.attributeIdz[a_id] ? self.attributeIdz[a_id]['gid'] : 1;
829
- // for (let v_id in a_values) {
830
- // let value = a_values[v_id];
831
- // if (value.confirmation_popup === true) {
832
- // if (response === true) {
833
- // if (value.selected === true && value.show === true && value.child > 0) {
834
- // self.markSelected(a_id, v_id);
835
- // let child_attribute = Object.values(self.attributeIdz).filter(
836
- // (a) => a.parent_id === a_id && a.hide === 0
837
- // );
838
- // self.processAttribute(child_attribute);
839
- // }
840
- // if (value.selected === false && value.hide === true && value.child > 0) {
841
- // let child_attribute = Object.values(self.attributeIdz).filter(
842
- // (a) => a.parent_id === a_id && a.hide === 0
843
- // );
844
- // if (child_attribute.length > 0) {
845
- // child_attribute.forEach(function (attribute) {
846
- // let child_selected = Object.values(attribute['values']).find(
847
- // (v) => v.parent_id === v_id && v.selected === true
848
- // );
849
- // self.hideChildValuesOfParentValue(attribute.id, a_id, v_id);
850
- // if (child_selected !== undefined) {
851
- // self.attributeIdz[attribute.id]['values'][child_selected.id]['selected'] = false;
852
- // self.markUnselected(attribute.id, child_selected.id);
853
- // }
854
- // let find_any_selected = Object.values(attribute['values']).find(
855
- // (v) =>
856
- // v.selected === true &&
857
- // v.applyhidden === false &&
858
- // v.shouldhidden === false
859
- // );
860
- // if (find_any_selected === undefined) {
861
- // self.hideAttributeOrGroup(attribute.id);
862
- // self.hideAttribute(attribute.id);
863
- // self.unsetMsg(attribute.id);
864
- // }
865
- // });
866
- // }
867
- // }
868
- // } else {
869
- // if (value.selected === false && value.hide === true && value.child > 0) {
870
- // // Handle variations if needed
871
- // } else if (value.selected === true) {
872
- // // Clear child values
873
- // }
874
- // }
875
- // } else if (value.confirmation_popup === false) {
876
- // if (value.selected === false) {
877
- // if (value.hide === true && value.child > 0) {
878
- // self.markUnselected(a_id, v_id);
879
- // let child_attribute = Object.values(self.attributeIdz).filter(
880
- // (a) => a.parent_id === a_id && a.hide === 0
881
- // );
882
- // if (child_attribute.length > 0) {
883
- // child_attribute.forEach(function (attribute) {
884
- // let child_selected = Object.values(attribute['values']).find(
885
- // (v) => v.parent_id === v_id && v.selected === true
886
- // );
887
- // self.hideChildValuesOfParentValue(attribute.id, a_id, v_id);
888
- // if (child_selected !== undefined) {
889
- // self.attributeIdz[attribute.id]['values'][child_selected.id]['selected'] = false;
890
- // self.markUnselected(attribute.id, child_selected.id);
891
- // }
892
- // let find_any_selected = Object.values(attribute['values']).find(
893
- // (v) =>
894
- // v.selected === true &&
895
- // v.applyhidden === false &&
896
- // v.shouldhidden === false
897
- // );
898
- // if (find_any_selected === undefined) {
899
- // self.hideAttributeOrGroup(attribute.id);
900
- // self.hideAttribute(attribute.id);
901
- // self.unsetMsg(attribute.id);
902
- // }
903
- // });
904
- // }
905
- // } else if (value.show === true) {
906
- // if (value.child > 0) {
907
- // let child_attribute = Object.values(self.attributeIdz).filter(
908
- // (a) => a.parent_id === a_id && a.hide === 0
909
- // );
910
- // self.processAttribute(child_attribute);
911
- // self.processAttributeAfterCondition(child_attribute);
912
- // } else {
913
- // let child_attribute = Object.values(self.attributeIdz).filter(
914
- // (a) => a.parent_id === a_id && a.hide === 0
915
- // );
916
- // child_attribute.forEach(function (attribute) {
917
- // if (attribute.parent_id) {
918
- // let find_selectedValue = Object.values(self.attributeIdz[attribute.parent_id]['values']).find(
919
- // (v) =>
920
- // v.selected === true &&
921
- // v.applyhidden === false &&
922
- // v.shouldhidden === false
923
- // );
924
- // let find_Value = Object.values(attribute['values']).find(
925
- // (v) =>
926
- // v.selected === true &&
927
- // v.applyhidden === false &&
928
- // v.shouldhidden === false
929
- // );
930
- // if (find_Value === undefined) {
931
- // self.markUnselected(attribute.id, v_id);
932
- // self.hideAttributeOrGroup(attribute.id);
933
- // self.hideAttribute(attribute.id);
934
- // self.unsetMsg(attribute.id);
935
- // } else if (
936
- // find_selectedValue === undefined ||
937
- // (find_selectedValue &&
938
- // find_selectedValue.id !== attribute['values'][find_Value.id].parent_id)
939
- // ) {
940
- // self.markUnselected(attribute.id, v_id);
941
- // self.hideAttributeOrGroup(attribute.id);
942
- // self.hideAttribute(attribute.id);
943
- // self.unsetMsg(attribute.id);
944
- // }
945
- // }
946
- // });
947
- // }
948
- // }
949
- // } else if (value.selected === true) {
950
- // if (value.show === true) {
951
- // if (value.child > 0) {
952
- // self.showAttribute(a_id);
953
- // let child_attribute = Object.values(self.attributeIdz).filter(
954
- // (a) => a.parent_id === a_id && a.hide === 0
955
- // );
956
- // child_attribute.forEach(function (attribute) {
957
- // let has_child_values = Object.values(attribute['values']).filter(
958
- // (v) =>
959
- // v.parent_id === v_id &&
960
- // v.shouldhidden === false &&
961
- // v.applyhidden === false
962
- // );
963
- // if (has_child_values.length) {
964
- // self.showAttribute(attribute.id);
965
- // }
966
- // });
967
- // }
968
- // }
969
- // }
970
- // }
971
- // }
972
- // }
973
- // }
974
- // }
975
- // return response;
976
- // },
977
- createCondition(conditionArray) {
978
- let newcondition2 = conditionArray["condition"];
979
- let appliedon = conditionArray["appliedon"];
980
- for (const con_aid in appliedon) {
981
- let findattrib = Object.values(this.attributeIdz).find((a) => a.id == con_aid);
982
- if (findattrib) {
983
- if (findattrib.type == this.TYPES["width"] || findattrib.type == this.TYPES["subwidth"] || findattrib.type == this.TYPES["height"] || findattrib.type == this.TYPES["subheight"]) {
984
- let fraction = "0.00";
985
- let value = 0;
986
- let vid = Object.keys(this.attributeIdz[findattrib.id]["values"]);
987
- if (vid != void 0 && vid.length > 0) {
988
- value = this.attributeIdz[findattrib.id]["values"][vid[0]].value;
989
- }
990
- newcondition2 = newcondition2.replaceAll("attribute" + con_aid, value);
991
- } else {
992
- let findvalue = Object.values(findattrib["values"]).find((fv) => fv.selected == true && fv.shouldhidden == false && fv.applyhidden == false);
993
- if (findvalue) {
994
- newcondition2 = newcondition2.replaceAll("attribute" + con_aid, findvalue.id);
995
- } else {
996
- newcondition2 = newcondition2.replaceAll("attribute" + con_aid, "'empty'");
997
- }
998
- }
999
- }
1000
- }
1001
- return newcondition2;
1002
- },
1003
- getelement(classname) {
1004
- var element = document.getElementsByClassName(classname);
1005
- return element.length ? element[0] : void 0;
1006
- },
1007
- toggle(classname) {
1008
- var element = document.getElementsByClassName(classname);
1009
- return element.length ? element[0] : void 0;
1010
- },
1011
- getvalue(classname) {
1012
- var element = document.getElementsByClassName(classname);
1013
- return element.length ? element[0].value : void 0;
1014
- },
1015
- executeCondition(newcondition, c_aid, v_id, changed_values, msgValue, hiddenValues, child_Values, first_call, available = 1) {
1016
- var selected_val = this.attributeIdz[c_aid]["values"][v_id];
1017
- if (selected_val.selected == false) {
1018
- if (eval(newcondition) == false) {
1019
- if (this.attributeIdz[c_aid]["values"][v_id]["applyhidden"] == false) {
1020
- changed_values[v_id] = this.attributeIdz[c_aid]["values"][v_id];
1021
- }
1022
- this.attributeIdz[c_aid]["values"][v_id]["applyhidden"] = true;
1023
- this.attributeIdz[c_aid]["values"][v_id]["shouldhidden"] = false;
1024
- this.markUnselected(c_aid, v_id);
1025
- this.hideAttributeOrGroup(c_aid);
1026
- let parent_attribute_id = c_aid;
1027
- let child_attribute = Object.values(this.attributeIdz).filter((a) => a.parent == parent_attribute_id && a.hide == 0);
1028
- if (child_attribute.length > 0) {
1029
- child_attribute.forEach((attribute) => {
1030
- let child_values = Object.values(attribute["values"]).filter((v) => v.parent_id == v_id);
1031
- child_Values[v_id] = {
1032
- v_id,
1033
- selected: false,
1034
- hide: true,
1035
- confirm_popup: false,
1036
- child: child_values.length
1037
- };
1038
- });
1039
- }
1040
- } else {
1041
- let old_selected_value = this.attributeIdz[c_aid]["values"][v_id];
1042
- if (old_selected_value["applyhidden"] == true) {
1043
- hiddenValues[v_id] = { ...old_selected_value };
1044
- }
1045
- this.attributeIdz[c_aid]["values"][v_id]["applyhidden"] = false;
1046
- this.attributeIdz[c_aid]["values"][v_id]["shouldhidden"] = false;
1047
- let showTheValue = this.showValueAttributeOrGroup(c_aid, v_id);
1048
- if (showTheValue) {
1049
- let parent_attribute_id = c_aid;
1050
- let child_attribute = Object.values(this.attributeIdz).filter((a) => a.parent == parent_attribute_id && a.hide == 0);
1051
- if (child_attribute.length > 0) {
1052
- child_attribute.forEach((attribute) => {
1053
- let child_values = Object.values(attribute["values"]).filter((v) => v.parent_id == v_id);
1054
- child_Values[v_id] = {
1055
- v_id,
1056
- selected: false,
1057
- show: true,
1058
- confirm_popup: false,
1059
- child: child_values.length
1060
- };
1061
- });
1062
- }
1063
- }
1064
- }
1065
- } else {
1066
- if (eval(newcondition) == false) {
1067
- let old_selected_value = Object.values(this.attributeIdz[c_aid]["values"]).find((v) => v.oldselected == true && v.hide == 0 && v.shouldhidden == false && v.applyhidden == false);
1068
- if (old_selected_value == void 0) {
1069
- let old_selected_array = Object.values(this.attributeIdz[c_aid]["values"]).filter((v) => v.selected == false && v.hide == 0 && v.applyhidden == false && v.shouldhidden == false);
1070
- if (old_selected_array.length > 0) {
1071
- old_selected_array.sort((a, b) => a.sortorder - b.sortorder);
1072
- old_selected_value = old_selected_array[0];
1073
- }
1074
- }
1075
- if (old_selected_value !== void 0 && this.attributeIdz[c_aid].hide == 0 && first_call == false && available == 1) {
1076
- if (this.attributeIdz[c_aid].confirm_popup == true) {
1077
- msgValue[v_id] = this.attributeIdz[c_aid]["values"][v_id];
1078
- let from = this.attributeIdz[c_aid]["values"][v_id].title;
1079
- let to = old_selected_value !== void 0 ? old_selected_value.title : "";
1080
- if (this.msgStr[c_aid] !== void 0) {
1081
- const startPosition = this.msgStr[c_aid].lastIndexOf(" to ");
1082
- let replacementText = " to " + to + ", \n";
1083
- this.msgStr[c_aid] = this.msgStr[c_aid].slice(0, startPosition) + replacementText;
1084
- } else {
1085
- this.msgStr[c_aid] = this.attributeIdz[c_aid].title + ": " + from + " to " + to + ", \n";
1086
- }
1087
- }
1088
- let parent_attribute_id = c_aid;
1089
- let child_attribute = Object.values(this.attributeIdz).filter((a) => a.parent == parent_attribute_id && a.hide == 0);
1090
- if (child_attribute.length > 0) {
1091
- child_attribute.forEach((attribute) => {
1092
- let from_has_child_values = Object.values(attribute["values"]).filter((v) => v.parent_id == v_id);
1093
- let to_has_child_values = Object.values(attribute["values"]).filter((v) => v.parent_id == old_selected_value.id);
1094
- child_Values[v_id] = {
1095
- v_id,
1096
- selected: false,
1097
- hide: true,
1098
- confirm_popup: true,
1099
- child: from_has_child_values.length
1100
- };
1101
- child_Values[old_selected_value.id] = {
1102
- v_id: old_selected_value.id,
1103
- selected: true,
1104
- show: true,
1105
- confirm_popup: true,
1106
- child: to_has_child_values.length
1107
- };
1108
- });
1109
- }
1110
- }
1111
- changed_values[v_id] = this.attributeIdz[c_aid]["values"][v_id];
1112
- this.attributeIdz[c_aid]["values"][v_id]["shouldhidden"] = true;
1113
- this.attributeIdz[c_aid]["values"][v_id]["applyhidden"] = true;
1114
- } else {
1115
- this.attributeIdz[c_aid]["values"][v_id]["shouldhidden"] = false;
1116
- this.attributeIdz[c_aid]["values"][v_id]["applyhidden"] = false;
1117
- let showTheValue = this.showValueAttributeOrGroup(c_aid, v_id);
1118
- if (showTheValue) {
1119
- let parent_attribute_id = c_aid;
1120
- let child_attribute = Object.values(this.attributeIdz).filter((a) => a.parent == parent_attribute_id && a.hide == 0);
1121
- if (child_attribute.length > 0) {
1122
- child_attribute.forEach((attribute) => {
1123
- let child_values = Object.values(attribute["values"]).filter((v) => v.parent_id == v_id);
1124
- child_Values[v_id] = {
1125
- v_id,
1126
- selected: true,
1127
- show: true,
1128
- confirm_popup: false,
1129
- child: child_values.length
1130
- };
1131
- });
1132
- }
1133
- }
1134
- }
1135
- }
1136
- return {
1137
- msgValue,
1138
- changed_values,
1139
- hiddenValues,
1140
- child_Values
1141
- };
1142
- },
1143
- // hideAttributeOrGroup ( c_aid:any) {
1144
- // let findSelected_Value='';
1145
- // var pick_first_value = '';
1146
- // var gid = '';
1147
- // var group_attributes = '';
1148
- // const self = this;
1149
- // // find any select value if found we will not hide attribute and group
1150
- // let findSelectedValue = Object.values ( this.attributeIdz[ c_aid ][ 'values' ] ).filter ( v => ( v.selected == true && v.applyhidden == false && v.shouldhidden == false ) );
1151
- // // selected value in found retrun
1152
- // if ( findSelectedValue.length )
1153
- // return;
1154
- // gid = this.attributeIdz[ c_aid ].gid;
1155
- // // let available_value_array = Object.values ( this.attributeIdz[ c_aid ][ 'values' ] ).filter ( v => ( v.selected == false && v.applyhidden == false && v.shouldhidden == false ) );
1156
- // let currentAttribute = this.attributeIdz[ c_aid ];
1157
- // gid = currentAttribute.gid;
1158
- // let value_parent_id = null;
1159
- // let childSelectedValue = null;
1160
- // let available_value_array;
1161
- // // if attribute is child attribute we will find child selected value
1162
- // if (currentAttribute.parent_id)
1163
- // {
1164
- // value_parent_id = -1;
1165
- // childSelectedValue = Object.values ( this.attributeIdz[ currentAttribute.parent_id ][ 'values' ] ).find ( v => ( v.selected == true && v.applyhidden == false && v.shouldhidden == false ) );
1166
- // if (childSelectedValue != undefined)
1167
- // {
1168
- // value_parent_id = childSelectedValue.id;
1169
- // }
1170
- // available_value_array = Object.values ( this.attributeIdz[ c_aid ][ 'values' ] ).filter ( v => ( v.selected == false && v.parent_id == value_parent_id && v.applyhidden == false && v.shouldhidden == false ) );
1171
- // }else{
1172
- // available_value_array = Object.values ( this.attributeIdz[ c_aid ][ 'values' ] ).filter ( v => ( v.selected == false && v.applyhidden == false && v.shouldhidden == false ) );
1173
- // }
1174
- // //search any value which is not hidden and not selected
1175
- // // if found select it and return
1176
- // if ( available_value_array.length > 0 )
1177
- // {
1178
- // available_value_array.sort ( ( a, b ) => ( a.sortorder - b.sortorder ) )
1179
- // pick_first_value = available_value_array[ 0 ];
1180
- // this.attributeIdz[ c_aid ][ 'values' ][ pick_first_value.id ][ 'selected' ] = true;
1181
- // this.attributeIdz[ c_aid ][ 'values' ][ pick_first_value.id ][ 'oldselected' ] = false;
1182
- // if (this.attributeIdz[ pick_first_value.aid ].type == this.TYPES['width'] || this.attributeIdz[ pick_first_value.aid ].type == this.TYPES['subwidth'] || this.attributeIdz[ pick_first_value.aid ].type == this.TYPES['height'] || this.attributeIdz[ pick_first_value.aid ].type == this.TYPES['subheight'] )
1183
- // {
1184
- // this.markInputSelected(pick_first_value.aid,pick_first_value.id,pick_first_value.value)
1185
- // }
1186
- // else
1187
- // {
1188
- // this.markSelected(pick_first_value.aid,pick_first_value.id)
1189
- // }
1190
- // this.showAttribute(c_aid);
1191
- // this.showGroup(gid);
1192
- // // jQuery ( valueClass + pick_first_value.id ).addClass ( 'selected' );
1193
- // // jQuery ( valueClass + pick_first_value.id ).prop ( 'checked', true );
1194
- // // jQuery ( document ).find ( '.CustomAttribute.attrib' + pick_first_value.aid ).val ( pick_first_value.id );
1195
- // // jQuery ( document ).find ( '.element-item-outputvalue-' + pick_first_value.aid ).html ( pick_first_value.title )
1196
- // // have we check the attributei hide==1 or not ? before showing the attribute
1197
- // return;
1198
- // }
1199
- // group_attributes = Object.values ( this.attributeIdz ).filter ( a => ( a.gid == gid && a.hide == 0 ) );
1200
- // // has only one attribute so hide the group
1201
- // if ( group_attributes.length == 1 ) {
1202
- // // jQuery ( attributeClass + c_aid ).val ( '' );
1203
- // this.hideGroup(gid)
1204
- // return
1205
- // }
1206
- // let hide_group = true;
1207
- // // if has multiple attributes
1208
- // // find if any selected value is found in any attribute
1209
- // // if find any selected value so
1210
- // group_attributes.forEach((attribute, index) => {
1211
- // let findSelectedValue = Object.values(self.attributeIdz[attribute.id]['values']).find(v => v.selected == true && v.applyhidden == false && v.shouldhidden == false);
1212
- // if (findSelectedValue !== undefined) {
1213
- // hide_group = false;
1214
- // } else {
1215
- // const element = document.querySelector(self.attributeClass + attribute.id);
1216
- // if (element) {
1217
- // element.value = ''; // Equivalent to jQuery's `.val('')`
1218
- // }
1219
- // self.hideAttribute(attribute.id);
1220
- // self.unsetMsg(attribute.id);
1221
- // }
1222
- // });
1223
- // if ( hide_group ) {
1224
- // // jQuery ( attributeClass + c_aid ).val ( '' );
1225
- // // jQuery ( groupClass + gid ).hide ().addClass('hide_attribute');
1226
- // this.hideGroup(gid)
1227
- // } else {
1228
- // // jQuery ( attributeClass + c_aid ).val ( '' );
1229
- // // jQuery ( attributeClass + c_aid ).hide ();
1230
- // this.hideAttribute(c_aid)
1231
- // this.unsetMsg(c_aid)
1232
- // }
1233
- // },
1234
- hideAttributeOrGroup(c_aid2) {
1235
- let findSelected_Value;
1236
- let attr = this.attributeIdz[c_aid2];
1237
- let parent_value_id = -1;
1238
- var available_selected_value;
1239
- if (attr.parent_id) {
1240
- parent_value_id = this.findSelectedValue(this.attributeIdz[attr.parent_id]["values"]);
1241
- if (parent_value_id == void 0) {
1242
- parent_value_id = -2;
1243
- } else {
1244
- parent_value_id = parent_value_id.id;
1245
- }
1246
- }
1247
- findSelected_Value = this.findSelectedValue(attr.values, parent_value_id);
1248
- if (findSelected_Value != void 0)
1249
- return;
1250
- let gid = attr.gid;
1251
- let available_value_array;
1252
- available_value_array = this.getAvailableValues(c_aid2, parent_value_id);
1253
- if (available_value_array.length > 0) {
1254
- available_value_array.sort((a, b) => a.sortorder - b.sortorder);
1255
- let pick_first_value = available_value_array[0];
1256
- this.attributeIdz[c_aid2]["values"][pick_first_value.id]["selected"] = true;
1257
- this.attributeIdz[c_aid2]["values"][pick_first_value.id]["oldselected"] = false;
1258
- if (this.attributeIdz[pick_first_value.aid].type == this.TYPES["width"] || this.attributeIdz[pick_first_value.aid].type == this.TYPES["subwidth"] || this.attributeIdz[pick_first_value.aid].type == this.TYPES["height"] || this.attributeIdz[pick_first_value.aid].type == this.TYPES["subheight"]) {
1259
- this.markInputSelected(pick_first_value.aid, pick_first_value.id, pick_first_value.value);
1260
- } else {
1261
- this.markSelected(pick_first_value.aid, pick_first_value.id);
1262
- }
1263
- this.showAttribute(c_aid2);
1264
- this.showGroup(gid);
1265
- return;
1266
- }
1267
- let group_attributes = Object.values(this.attributeIdz).filter((a) => a.gid == gid && a.hide == 0);
1268
- if (group_attributes.length == 1) {
1269
- this.hideGroup(gid);
1270
- return;
1271
- }
1272
- let hide_group = true;
1273
- let self = this;
1274
- group_attributes.forEach(function(attribute, index) {
1275
- let parent_value_id2 = -1;
1276
- if (attribute.parent_id) {
1277
- parent_value_id2 = self.findSelectedValue(self.attributeIdz[attribute.parent_id]["values"]);
1278
- if (parent_value_id2 === void 0) {
1279
- self.hideAttribute(attribute.id);
1280
- self.unsetMsg(attribute.id);
1281
- return;
1282
- } else {
1283
- parent_value_id2 = parent_value_id2.id;
1284
- }
1285
- }
1286
- const findSelected_Value2 = self.findSelectedValue(self.attributeIdz[attribute.id]["values"], parent_value_id2);
1287
- if (findSelected_Value2 !== void 0) {
1288
- hide_group = false;
1289
- } else {
1290
- self.hideAttribute(attribute.id);
1291
- self.unsetMsg(attribute.id);
1292
- }
1293
- });
1294
- if (hide_group) {
1295
- self.hideGroup(gid);
1296
- } else {
1297
- self.hideAttribute(c_aid2);
1298
- self.unsetMsg(c_aid2);
1299
- }
1300
- },
1301
- unsetMsg(aid) {
1302
- if (Object.values(this.msgStr).length > 0 && this.msgStr[aid] != void 0) {
1303
- delete this.msgStr[aid];
1304
- }
1305
- if (Object.values(this.pdpsummary).length > 0 && this.pdpsummary[aid] != void 0) {
1306
- delete this.pdpsummary[aid];
1307
- }
1308
- },
1309
- showValueAttributeOrGroup(c_aid2, v_id2) {
1310
- let gid = this.attributeIdz[c_aid2].gid;
1311
- let attr = this.attributeIdz[c_aid2];
1312
- if (attr.parent_id) {
1313
- let find_selectedValue = this.findSelectedValue(this.attributeIdz[attr.parent_id]["values"]);
1314
- if (find_selectedValue == void 0 || find_selectedValue && find_selectedValue.id != this.attributeIdz[c_aid2]["values"][v_id2].parent_id) {
1315
- this.markUnselected(c_aid2, v_id2);
1316
- this.hideAttributeOrGroup(c_aid2);
1317
- let attr_selected_val = this.findSelectedValue(attr.values);
1318
- if (find_selectedValue == void 0 || attr_selected_val == void 0 || attr_selected_val && attr_selected_val.parent_id != find_selectedValue.id) {
1319
- this.hideAttribute(c_aid2);
1320
- this.unsetMsg(c_aid2);
1321
- }
1322
- return false;
1323
- }
1324
- }
1325
- this.showValue(c_aid2, v_id2);
1326
- if (this.attributeIdz[c_aid2].hide == 0) {
1327
- this.showAttribute(c_aid2);
1328
- this.showGroup(gid);
1329
- }
1330
- return true;
1331
- },
1332
- // showValueAttributeOrGroup ( c_aid, v_id )
1333
- // {
1334
- // let gid = this.attributeIdz[c_aid].gid;
1335
- // // check parent child hierarchy
1336
- // let attr = this.attributeIdz[c_aid];
1337
- // // has parent
1338
- // if (attr.parent)
1339
- // {
1340
- // if(c_aid==794){
1341
- // debugger;
1342
- // }
1343
- // let find_selectedValue = Object.values ( this.attributeIdz[ attr.parent ][ 'values' ] ).find ( v => ( v.selected == true && v.applyhidden == false && v.shouldhidden == false ) );
1344
- // if (find_selectedValue == undefined || (find_selectedValue && find_selectedValue.id != this.attributeIdz[ c_aid ]['values'][v_id].parent_id ))
1345
- // {
1346
- // this.markUnselected(c_aid,v_id)
1347
- // this.hideAttributeOrGroup ( c_aid )
1348
- // this.hideAttribute(c_aid)
1349
- // this.unsetMsg(c_aid)
1350
- // return false;
1351
- // }
1352
- // }
1353
- // //show value or remove disabled
1354
- // // jQuery ( valueClass + v_id ).show ();
1355
- // this.showValue(c_aid,v_id)
1356
- // // markSelected(c_aid,v_id)
1357
- // // if ( == 0)
1358
- // // return ;
1359
- // if ( this.attributeIdz[ c_aid ].hide == 0 ) {
1360
- // // jQuery ( attributeClass + c_aid ).show ().removeClass('hide_attribute');
1361
- // this.showAttribute(c_aid)
1362
- // // jQuery ( groupClass + gid ).show ().removeClass('hide_attribute');
1363
- // this.showGroup(gid)
1364
- // }
1365
- // return true;
1366
- // },
1367
- selectOneValue(c_aid2) {
1368
- let attr = this.attributeIdz[c_aid2];
1369
- let parent_value_id = -1;
1370
- var available_selected_value;
1371
- if (attr.parent_id) {
1372
- parent_value_id = this.findSelectedValue(this.attributeIdz[attr.parent_id]["values"]);
1373
- if (parent_value_id == void 0) {
1374
- return;
1375
- }
1376
- parent_value_id = parent_value_id.id;
1377
- }
1378
- available_selected_value = this.findSelectedValue(attr.values, parent_value_id);
1379
- if (available_selected_value != void 0) {
1380
- this.attributeIdz[c_aid2]["values"][available_selected_value.id]["oldselected"] = false;
1381
- this.setSummery(this.attributeIdz[c_aid2], available_selected_value);
1382
- if (this.attributeIdz[available_selected_value.aid].type == this.TYPES["width"] || this.attributeIdz[available_selected_value.aid].type == this.TYPES["subwidth"] || this.attributeIdz[available_selected_value.aid].type == this.TYPES["height"] || this.attributeIdz[available_selected_value.aid].type == this.TYPES["subheight"]) {
1383
- this.markInputSelected(available_selected_value.aid, available_selected_value.id, available_selected_value.value);
1384
- } else {
1385
- this.markSelected(available_selected_value.aid, available_selected_value.id);
1386
- }
1387
- return;
1388
- }
1389
- let available_value_array = this.getAvailableValues(c_aid2, parent_value_id);
1390
- if (available_value_array.length > 0) {
1391
- available_value_array = available_value_array.sort((a, b) => a.sortorder - b.sortorder);
1392
- let pick_first_value = available_value_array[0];
1393
- this.attributeIdz[c_aid2]["values"][pick_first_value.id]["selected"] = true;
1394
- this.attributeIdz[c_aid2]["values"][pick_first_value.id]["oldselected"] = false;
1395
- this.setSummery(this.attributeIdz[c_aid2], pick_first_value);
1396
- if (this.attributeIdz[pick_first_value.aid].type == this.TYPES["width"] || this.attributeIdz[pick_first_value.aid].type == this.TYPES["subwidth"] || this.attributeIdz[pick_first_value.aid].type == this.TYPES["height"] || this.attributeIdz[pick_first_value.aid].type == this.TYPES["subheight"]) {
1397
- this.markInputSelected(pick_first_value.aid, pick_first_value.id, pick_first_value.value);
1398
- } else {
1399
- this.markSelected(pick_first_value.aid, pick_first_value.id);
1400
- }
1401
- }
1402
- },
1403
- checkChangeAttributesMsg(c_aid2, msgAttributes, msgValue2, selected_value_hidden, child_Values2, first_call2, available2) {
1404
- var current_selected_value = Object.values(this.attributeIdz[c_aid2]["values"]).find((v) => v.selected == true && v.shouldhidden == false && v.applyhidden == false);
1405
- var changed_aid = Object.keys(msgAttributes).find((aid) => aid == selected_value_hidden.aid);
1406
- if (changed_aid == void 0 && current_selected_value != void 0 && first_call2 == false) {
1407
- let c_s_aid = current_selected_value.aid;
1408
- var changed_value = Object.values(msgValue2).find((v) => v.id == selected_value_hidden.id);
1409
- if (changed_value == void 0 && this.attributeIdz[c_s_aid].hide == 0 && this.attributeIdz[c_s_aid].confirm_popup == true && available2 == 1) {
1410
- let newMsgStr = "";
1411
- let nfrom = this.attributeIdz[selected_value_hidden.aid]["values"][selected_value_hidden.id].title;
1412
- let nto = current_selected_value.title;
1413
- newMsgStr += this.attributeIdz[c_s_aid].title + ": " + nfrom + " to " + nto + "\n";
1414
- if (!this.msgStr[selected_value_hidden.aid] != void 0) {
1415
- this.msgStr[selected_value_hidden.aid] = newMsgStr;
1416
- let parent_attribute_id = c_aid2;
1417
- var child_attribute = Object.values(this.attributeIdz).filter((a) => a.parent == parent_attribute_id && a.hide == 0);
1418
- if (child_attribute.length > 0) {
1419
- child_attribute.forEach((attribute, index) => {
1420
- let from_has_child_values = Object.values(attribute["values"]).filter((v) => v.parent_id == selected_value_hidden.id);
1421
- let to_has_child_values = Object.values(attribute["values"]).filter((v) => v.parent_id == current_selected_value.id);
1422
- child_Values2[current_selected_value.id] = {
1423
- v_id: current_selected_value.id,
1424
- selected: true,
1425
- confirm_popup: true,
1426
- show: true,
1427
- child: to_has_child_values.length
1428
- };
1429
- child_Values2[selected_value_hidden.id] = {
1430
- v_id: selected_value_hidden.id,
1431
- selected: false,
1432
- confirm_popup: true,
1433
- hide: true,
1434
- child: from_has_child_values.length
1435
- };
1436
- });
1437
- }
1438
- }
1439
- }
1440
- } else {
1441
- if (current_selected_value != void 0 && Object.values(this.msgStr).length > 0 && this.msgStr[c_aid2] != void 0) {
1442
- let nto = current_selected_value.title;
1443
- const startPosition = this.msgStr[c_aid2].lastIndexOf(" to ");
1444
- let replacementText = " to " + nto + ", \n";
1445
- this.msgStr[c_aid2] = this.msgStr[c_aid2].slice(0, startPosition) + replacementText;
1446
- }
1447
- }
1448
- return {
1449
- child_Values: child_Values2
1450
- };
1451
- },
1452
- showbox(popUpMsg) {
1453
- this.confirmPopup = true;
1454
- const btnYes = document.querySelector("#ChangeAttributeYes");
1455
- const btnNo = document.querySelector("#ChangeAttributeNo");
1456
- return new Promise((resolve, reject) => {
1457
- let yesHandler = resolve;
1458
- let noHandler = reject;
1459
- btnYes.addEventListener("click", yesHandler);
1460
- btnNo.addEventListener("click", noHandler);
1461
- }).finally(() => {
1462
- });
1463
- },
1464
- async confirmChange(changed_attribs, hiddenAttributes, aid, paid = "") {
1465
- let self = this;
1466
- let popUpMsg = Object.values(self.msgStr).join("");
1467
- if (popUpMsg == "") {
1468
- return true;
1469
- }
1470
- var confirm_change = "";
1471
- await this.showbox(popUpMsg).then(() => {
1472
- this.confirmPopup = false;
1473
- confirm_change = true;
1474
- }).catch(() => {
1475
- confirm_change = false;
1476
- });
1477
- if (!confirm_change) {
1478
- Object.keys(hiddenAttributes).forEach((o_aid) => {
1479
- let o_values = hiddenAttributes[o_aid];
1480
- if (changed_attribs[o_aid] == void 0 && self.attributeIdz[o_aid].hide == 0) {
1481
- Object.keys(o_values).forEach((o_vid) => {
1482
- let o_value = o_values[o_vid];
1483
- let f_value = self.attributeIdz[o_aid]["values"][o_value.id];
1484
- if (f_value !== void 0) {
1485
- self.attributeIdz[o_value.aid]["values"][o_value.id].applyhidden = o_value.applyhidden;
1486
- self.attributeIdz[o_value.aid]["values"][o_value.id].shouldhidden = o_value.shouldhidden;
1487
- self.attributeIdz[o_value.aid]["values"][o_value.id].selected = o_value.selected;
1488
- if (o_value.selected == false) {
1489
- self.markUnselected(o_aid, f_value.id);
1490
- self.hideAttributeOrGroup(o_aid);
1491
- }
1492
- }
1493
- });
1494
- } else {
1495
- Object.keys(o_values).forEach((o_vid) => {
1496
- let o_value = o_values[o_vid];
1497
- let isselect_value = self.attributeIdz[o_aid]["values"][o_value.id];
1498
- if (isselect_value !== void 0 && isselect_value.selected == false && o_value.oldselected == false && o_value.applyhidden == true) {
1499
- self.attributeIdz[o_value.aid]["values"][o_value.id].applyhidden = false;
1500
- self.attributeIdz[o_value.aid]["values"][o_value.id].shouldhidden = false;
1501
- if ([self.TYPES["swatch"], self.TYPES["drop-down"], self.TYPES["style"]].includes(self.attributeIdz[o_aid].type)) {
1502
- self.attributeIdz[o_value.aid]["values"][o_value.id].selected = false;
1503
- }
1504
- self.markUnselected(o_aid, isselect_value.id);
1505
- }
1506
- });
1507
- }
1508
- });
1509
- Object.keys(changed_attribs).forEach((o_aid) => {
1510
- let o_values = changed_attribs[o_aid];
1511
- Object.keys(o_values).forEach((o_vid) => {
1512
- let o_value = o_values[o_vid];
1513
- let f_value = self.attributeIdz[o_aid]["values"][o_value.id];
1514
- if (f_value !== void 0) {
1515
- if (f_value.applyhidden == true) {
1516
- self.attributeIdz[o_value.aid]["values"][o_value.id].applyhidden = false;
1517
- self.attributeIdz[o_value.aid]["values"][o_value.id].shouldhidden = false;
1518
- self.showValueAttributeOrGroup(o_aid, o_value.id);
1519
- }
1520
- if (f_value.oldselected == true) {
1521
- let selected_value = Object.values(self.attributeIdz[o_aid]["values"]).find((v) => v.selected == true && v.shouldhidden == false && v.applyhidden == false);
1522
- if (selected_value !== void 0) {
1523
- if ([self.TYPES["swatch"], self.TYPES["drop-down"], self.TYPES["style"]].includes(self.attributeIdz[o_aid].type)) {
1524
- self.attributeIdz[o_aid]["values"][selected_value.id].selected = false;
1525
- self.attributeIdz[o_aid]["values"][selected_value.id].oldselected = true;
1526
- }
1527
- self.attributeIdz[o_aid]["values"][selected_value.id].shouldhidden = false;
1528
- self.attributeIdz[o_aid]["values"][selected_value.id].applyhidden = false;
1529
- const element = document.querySelector(self.attributeClass + o_aid + ' [data-value="' + selected_value.id + '"]');
1530
- if (element) {
1531
- element.removeAttribute("selected");
1532
- element.checked = false;
1533
- element.classList.remove("active");
1534
- }
1535
- let hidden_attribute = hiddenAttributes[o_aid];
1536
- let hidden_value;
1537
- if (hidden_attribute !== void 0) {
1538
- hidden_value = Object.values(hiddenAttributes[o_aid]).find((v) => v.id == selected_value.id);
1539
- if (hidden_value !== void 0) {
1540
- self.attributeIdz[o_aid]["values"][selected_value.id].shouldhidden = hidden_value.shouldhidden;
1541
- self.attributeIdz[o_aid]["values"][selected_value.id].applyhidden = hidden_value.applyhidden;
1542
- self.markUnselected(o_aid, selected_value.id);
1543
- }
1544
- }
1545
- }
1546
- self.attributeIdz[o_value.aid]["values"][o_value.id].selected = true;
1547
- self.attributeIdz[o_value.aid]["values"][o_value.id].oldselected = false;
1548
- if ([self.TYPES["width"], self.TYPES["subwidth"], self.TYPES["height"], self.TYPES["subheight"]].includes(self.attributeIdz[o_value.aid].type)) {
1549
- self.markInputSelected(o_value.aid, o_value.id, o_value.value);
1550
- } else {
1551
- self.markSelected(o_value.aid, o_value.id);
1552
- }
1553
- }
1554
- }
1555
- });
1556
- });
1557
- let clicked_vid = Object.values(this.attributeIdz[aid]["values"]).find((v) => v.selected == true && v.shouldhidden == false && v.applyhidden == false);
1558
- let before_clicked_vid = Object.values(this.attributeIdz[aid]["values"]).find((v) => v.oldselected == true && v.shouldhidden == false && v.applyhidden == false);
1559
- if (clicked_vid !== void 0) {
1560
- if ([this.TYPES["swatch"], this.TYPES["drop-down"], this.TYPES["style"]].includes(this.attributeIdz[aid].type)) {
1561
- this.attributeIdz[aid]["values"][clicked_vid.id].selected = false;
1562
- this.attributeIdz[aid]["values"][clicked_vid.id].oldselected = true;
1563
- }
1564
- this.attributeIdz[aid]["values"][clicked_vid.id].applyhidden = false;
1565
- this.attributeIdz[aid]["values"][clicked_vid.id].shouldhidden = false;
1566
- this.unsetSummery(aid);
1567
- const element = document.querySelector(this.attributeClass + aid + ' [data-value="' + clicked_vid.id + '"]');
1568
- if (element) {
1569
- element.removeAttribute("selected");
1570
- element.checked = false;
1571
- element.classList.remove("active");
1572
- }
1573
- if ([this.TYPES["width"], this.TYPES["subwidth"], this.TYPES["height"], this.TYPES["subheight"]].includes(this.attributeIdz[aid].type)) {
1574
- this.attributeIdz[aid]["values"][clicked_vid.id]["value"] = parseFloat(clicked_vid.ovalue);
1575
- document.querySelector(this.attributeClass + aid).value = parseFloat(clicked_vid.ovalue);
1576
- this.setSummery(this.attributeIdz[aid], clicked_vid);
1577
- }
1578
- }
1579
- if (before_clicked_vid !== void 0) {
1580
- this.attributeIdz[aid]["values"][before_clicked_vid.id].selected = true;
1581
- this.attributeIdz[aid]["values"][before_clicked_vid.id].oldselected = false;
1582
- this.attributeIdz[aid]["values"][before_clicked_vid.id].applyhidden = false;
1583
- this.attributeIdz[aid]["values"][before_clicked_vid.id].shouldhidden = false;
1584
- if ([this.TYPES["width"], this.TYPES["subwidth"], this.TYPES["height"], this.TYPES["subheight"]].includes(this.attributeIdz[aid].type)) {
1585
- this.markInputSelected(aid, before_clicked_vid.id, before_clicked_vid.value);
1586
- } else {
1587
- this.markSelected(aid, before_clicked_vid.id);
1588
- }
1589
- this.setSummery(this.attributeIdz[aid], before_clicked_vid);
1590
- }
1591
- var child_attribute = Object.values(this.attributeIdz).filter((a) => a.parent_id == aid && a.hide == 0);
1592
- if (child_attribute.length > 0) {
1593
- Object.keys(child_attribute).forEach(function(key) {
1594
- let attribute = child_attribute[key] != void 0 ? child_attribute[key] : null;
1595
- if (attribute == null) {
1596
- return;
1597
- }
1598
- var hide_child_values = Object.values(attribute["values"]).filter((v) => v.parent_id == clicked_vid.id);
1599
- if (hide_child_values.length > 0) {
1600
- self.hideChildValuesOfParentValue(attribute.id, attribute.parent_id, clicked_vid.id);
1601
- }
1602
- var show_child_values = Object.values(attribute["values"]).filter((v) => v.parent_id == before_clicked_vid.id && v.shouldhidden == false && v.applyhidden == false);
1603
- if (show_child_values.length > 0) {
1604
- self.showChildValues(attribute.id, before_clicked_vid.id);
1605
- self.showAttribute(attribute.id);
1606
- var old_selected_value = Object.values(show_child_values).find((v) => v.oldselected == true);
1607
- if (old_selected_value == void 0) {
1608
- show_child_values.sort((a, b) => a.sortorder - b.sortorder);
1609
- old_selected_value = show_child_values[0];
1610
- }
1611
- self.attributeIdz[attribute.id]["values"][old_selected_value.id]["selected"] = true;
1612
- self.attributeIdz[attribute.id]["values"][old_selected_value.id]["oldselected"] = false;
1613
- if (self.attributeIdz[old_selected_value.aid].type == self.TYPES["width"] || self.attributeIdz[old_selected_value.aid].type == self.TYPES["subwidth"] || self.attributeIdz[old_selected_value.aid].type == self.TYPES["height"] || self.attributeIdz[old_selected_value.aid].type == self.TYPES["subheight"]) {
1614
- self.markInputSelected(old_selected_value.aid, old_selected_value.id, old_selected_value.value);
1615
- } else {
1616
- self.markSelected(old_selected_value.aid, old_selected_value.id);
1617
- }
1618
- } else {
1619
- self.hideAttribute(attribute.id);
1620
- }
1621
- if (paid !== void 0 && paid !== "") {
1622
- let clicked_pvid = Object.values(this.attributeIdz[paid]["values"]).find((v) => v.selected == true && v.shouldhidden == false && v.applyhidden == false);
1623
- let before_clicked_pvid = Object.values(this.attributeIdz[paid]["values"]).find((v) => v.oldselected == true && v.shouldhidden == false && v.applyhidden == false);
1624
- if (clicked_pvid !== void 0) {
1625
- if ([this.TYPES["swatch"], this.TYPES["drop-down"], this.TYPES["style"]].includes(this.attributeIdz[aid].type)) {
1626
- this.attributeIdz[aid]["values"][clicked_pvid.id].selected = false;
1627
- this.attributeIdz[aid]["values"][clicked_pvid.id].oldselected = true;
1628
- }
1629
- this.attributeIdz[aid]["values"][clicked_pvid.id].applyhidden = false;
1630
- this.attributeIdz[aid]["values"][clicked_pvid.id].shouldhidden = false;
1631
- const element = document.querySelector(this.attributeClass + aid + ' [data-value="' + clicked_pvid.id + '"]');
1632
- if (element) {
1633
- element.removeAttribute("selected");
1634
- element.checked = false;
1635
- element.classList.remove("active");
1636
- }
1637
- }
1638
- if (before_clicked_pvid !== void 0) {
1639
- this.attributeIdz[aid]["values"][before_clicked_pvid.id].selected = true;
1640
- this.attributeIdz[aid]["values"][before_clicked_pvid.id].oldselected = false;
1641
- this.attributeIdz[aid]["values"][before_clicked_pvid.id].applyhidden = false;
1642
- this.attributeIdz[aid]["values"][before_clicked_pvid.id].shouldhidden = false;
1643
- if ([this.TYPES["width"], this.TYPES["subwidth"], this.TYPES["height"], this.TYPES["subheight"]].includes(this.attributeIdz[aid].type)) {
1644
- this.markInputSelected(aid, before_clicked_pvid.id, before_clicked_pvid.value);
1645
- } else {
1646
- this.markSelected(aid, before_clicked_pvid.id);
1647
- }
1648
- }
1649
- }
1650
- self.processAttributes();
1651
- self.calculatePrice();
1652
- return false;
1653
- });
1654
- }
1655
- this.confirmPopup = false;
1656
- return false;
1657
- }
1658
- return true;
1659
- },
1660
- customRoundUp(value) {
1661
- if (typeof value !== "number" || isNaN(value)) {
1662
- return 0;
1663
- }
1664
- let scaledValue = value * 1e3;
1665
- let roundedValue = Math.ceil(scaledValue);
1666
- return Math.round(roundedValue / 10) / 100;
1667
- },
1668
- sqrunitprice(price, width, height, unit_relative) {
1669
- var unitSqr = 0;
1670
- var unit_relative = unit_relative == void 0 || unit_relative == 0 || unit_relative == "" || unit_relative == null ? 1 : unit_relative;
1671
- let widthSqr = parseFloat(width) / unit_relative;
1672
- let heightSqr = parseFloat(height) / unit_relative;
1673
- unitSqr = parseFloat(widthSqr) * parseFloat(heightSqr);
1674
- unitSqr = this.customRoundUp(unitSqr);
1675
- return parseFloat(unitSqr) * parseFloat(price);
1676
- },
1677
- sqrmeasureprice(price, measurement, unit_relative) {
1678
- var unitSqr = 0;
1679
- var unit_relative = unit_relative == void 0 || unit_relative == 0 || unit_relative == "" || unit_relative == null ? 1 : unit_relative;
1680
- unitSqr = parseFloat(measurement) / unit_relative;
1681
- unitSqr = this.customRoundUp(unitSqr);
1682
- return parseFloat(unitSqr) * parseFloat(price);
1683
- },
1684
- closest(num, arr) {
1685
- var mid;
1686
- var lo = 0;
1687
- var hi = arr.length - 1;
1688
- while (hi - lo > 1) {
1689
- mid = Math.floor((lo + hi) / 2);
1690
- if (arr[mid] < num) {
1691
- lo = mid;
1692
- } else {
1693
- hi = mid;
1694
- }
1695
- }
1696
- if (lo == 0 && hi == 1) {
1697
- if (num <= arr[lo]) {
1698
- return arr[lo];
1699
- }
1700
- return arr[hi];
1701
- }
1702
- return arr[hi];
1703
- },
1704
- lookupprice(price, width = null, height = null) {
1705
- if (typeof price == null) {
1706
- return 0;
1707
- }
1708
- if (price == void 0) {
1709
- return 0;
1710
- }
1711
- if (width == null && height == null) {
1712
- return price;
1713
- }
1714
- let dropz = Object.keys(price);
1715
- dropz = dropz.map(Number);
1716
- dropz = dropz.sort((a, b) => a - b);
1717
- let drop = dropz.indexOf(height);
1718
- if (drop == -1) {
1719
- height = this.closest(height, dropz);
1720
- } else {
1721
- height = dropz[drop];
1722
- }
1723
- let fabprice = price[height];
1724
- if (fabprice == void 0) {
1725
- return 0;
1726
- }
1727
- let widthz = Object.keys(fabprice);
1728
- widthz = widthz.map(Number);
1729
- widthz = widthz.sort((a, b) => a - b);
1730
- let widthindex = widthz.indexOf(width);
1731
- if (widthindex == -1) {
1732
- width = this.closest(width, widthz);
1733
- } else {
1734
- width = widthz[widthindex];
1735
- }
1736
- return parseFloat(fabprice[width]);
1737
- },
1738
- swatchimage() {
1739
- this.overlayimages = [];
1740
- let findstyleswatch = Object.values(this.attributeIdz).filter((a) => (a.type == this.TYPES["style"] || a.type == this.TYPES["swatch"]) && a.generate_swatches);
1741
- if (findstyleswatch.length) {
1742
- findstyleswatch = findstyleswatch.sort((a, b) => a.gsortorder - b.gsortorder || a.sortorder - b.sortorder);
1743
- findstyleswatch.forEach((attribute) => {
1744
- const value = Object.values(attribute["values"]).find((v) => v.selected == true && v.shouldhidden == false && v.applyhidden == false && v.overlay_image !== "");
1745
- if (value !== void 0) {
1746
- this.overlayimages.push(value.overlay_image);
1747
- }
1748
- });
1749
- }
1750
- },
1751
- getMeasurement(attribute_type) {
1752
- let value = 0;
1753
- let findvalue = Object.values(this.attributeIdz).find((a) => a.type == attribute_type);
1754
- if (findvalue != void 0) {
1755
- let vid = Object.keys(this.attributeIdz[findvalue.id]["values"]);
1756
- if (vid != void 0) {
1757
- value = this.attributeIdz[findvalue.id]["values"][vid].value;
1758
- }
1759
- }
1760
- if (value == void 0 || isNaN(value) || value == "" || value < 0) {
1761
- value = 0;
1762
- }
1763
- value = parseFloat(value);
1764
- return value;
1765
- },
1766
- getMeasurementByID(attribute_id) {
1767
- let value = 0;
1768
- let findvalue = Object.values(this.attributeIdz).find((a) => a.id == attribute_id);
1769
- if (findvalue != void 0) {
1770
- let vid = Object.keys(this.attributeIdz[findvalue.id]["values"]);
1771
- if (vid != void 0) {
1772
- value = this.attributeIdz[findvalue.id]["values"][vid].value;
1773
- }
1774
- }
1775
- if (value == void 0 || isNaN(value) || value == "" || value < 0) {
1776
- value = 0;
1777
- }
1778
- value = parseFloat(value);
1779
- return value;
1780
- },
1781
- getSubHeights() {
1782
- return Object.values(this.attributeIdz).filter((a) => a.type == this.TYPES["subheight"] && a.linkto !== null);
1783
- },
1784
- getSubWidths() {
1785
- return Object.values(this.attributeIdz).filter((a) => a.type == this.TYPES["subwidth"] && a.linkto !== null);
1786
- },
1787
- calculateMultiPrice(width, height, value, subWidths, subHeights) {
1788
- let total = 0;
1789
- let sub_height = 0;
1790
- let sub_width = 0;
1791
- if (subWidths.length != 0) {
1792
- for (let index = 0; index < subWidths.length; index++) {
1793
- sub_height = sub_width = 0;
1794
- sub_width = this.getMeasurementByID(subWidths[index].id);
1795
- if (!sub_width || sub_width <= 0) {
1796
- continue;
1797
- }
1798
- if (subWidths[index].linktotype == this.TYPES["height"]) {
1799
- sub_height = height;
1800
- } else if (subWidths[index].linktotype == this.TYPES["subheight"]) {
1801
- sub_height = this.getMeasurementByID(subWidths[index].linkto);
1802
- }
1803
- if (value.price_type == this.PRICETYPE["grouppricing"]) {
1804
- var value_price = this.getValuePrice(value.group_pricing_type, sub_width, sub_height, this.PRICETYPE, value.group_price, this.lookupprices[value.id]);
1805
- } else {
1806
- var value_price = this.getValuePrice(value.price_type, sub_width, sub_height, this.PRICETYPE, value.price, this.lookupprices[value.id]);
1807
- }
1808
- this.getValuePriceDiscount(value.discount_type, value.discount, value_price);
1809
- total = parseFloat(total) + value_price;
1810
- }
1811
- } else {
1812
- for (let index = 0; index < subHeights.length; index++) {
1813
- sub_width = 0;
1814
- sub_height = this.getMeasurementByID(subHeights[index].id);
1815
- if (!sub_height || sub_height <= 0) {
1816
- continue;
1817
- }
1818
- if (subHeights[index].linktotype == this.TYPES["width"]) {
1819
- sub_width = width;
1820
- } else if (subHeights[index].linktotype == this.TYPES["subwidth"]) {
1821
- sub_width = this.getMeasurementByID(subHeights[index].linkto);
1822
- }
1823
- if (value.price_type == this.PRICETYPE["grouppricing"]) {
1824
- var value_price = this.getValuePrice(value.group_pricing_type, sub_width, sub_height, this.PRICETYPE, value.group_price, this.lookupprices[value.id]);
1825
- } else {
1826
- var value_price = this.getValuePrice(value.price_type, sub_width, sub_height, this.PRICETYPE, value.price, this.lookupprices[value.id]);
1827
- }
1828
- this.getValuePriceDiscount(value.discount_type, value.discount, value_price);
1829
- total = parseFloat(total) + value_price;
1830
- }
1831
- }
1832
- return total;
1833
- },
1834
- getValuePrice(price_type, width, height, PRICE_TYPES, price, priceArray) {
1835
- if (price_type == PRICE_TYPES["unit-price"]) {
1836
- return parseFloat(price);
1837
- } else if (price_type == PRICE_TYPES["grid"] || price_type == PRICE_TYPES["grouppricing"]) {
1838
- return parseFloat(this.lookupprice(priceArray, width, height));
1839
- } else if (price_type == PRICE_TYPES["widthlookup"] && width > 0) {
1840
- return parseFloat(this.lookupprice(priceArray, width, height));
1841
- } else if (price_type == PRICE_TYPES["heightlookup"] && height > 0) {
1842
- return parseFloat(this.lookupprice(priceArray, width, height));
1843
- } else if (price_type == PRICE_TYPES["sqr-meter"]) {
1844
- return parseFloat(this.sqrunitprice(price, width, height, this.UNIT_RELATIVE[PRICE_TYPES["sqr-meter"]]));
1845
- } else if (price_type == PRICE_TYPES["sqr-feet"]) {
1846
- return parseFloat(this.sqrunitprice(price, width, height, this.UNIT_RELATIVE[PRICE_TYPES["sqr-feet"]]));
1847
- } else if (price_type == PRICE_TYPES["widthfeet"] && width > 0) {
1848
- return parseFloat(this.sqrunitprice(price, width, height, this.UNIT_RELATIVE[PRICE_TYPES["widthfeet"]]));
1849
- } else if (price_type == PRICE_TYPES["heightfeet"] && height > 0) {
1850
- return parseFloat(this.sqrunitprice(price, width, height, this.UNIT_RELATIVE[PRICE_TYPES["heightfeet"]]));
1851
- } else if (price_type == PRICE_TYPES["width"] && width > 0) {
1852
- return parseFloat(this.sqrmeasureprice(price, width, this.UNIT_RELATIVE[PRICE_TYPES["width"]]));
1853
- } else if (price_type == PRICE_TYPES["height"] && height > 0) {
1854
- return parseFloat(this.sqrmeasureprice(price, height, this.UNIT_RELATIVE[PRICE_TYPES["height"]]));
1855
- }
1856
- return parseFloat(0);
1857
- },
1858
- getValuePriceDiscount(discount_type, discount, value_price) {
1859
- if (discount_type == 2 && discount > 0) {
1860
- if (parseFloat(discount) > parseFloat(value_price)) {
1861
- discount = value_price;
1862
- }
1863
- this.total_values_discount = parseFloat(this.total_values_discount) + parseFloat(discount);
1864
- } else if (discount_type == 1 && discount > 0) {
1865
- this.total_values_discount = parseFloat(this.total_values_discount) + parseFloat(value_price) * parseFloat(discount) / 100;
1866
- }
1867
- },
1868
- setValuePricePromotionsDiscount(attributes) {
1869
- attributes = Object.values(attributes).filter((a) => a.link_promotion == 1);
1870
- for (var index in attributes) {
1871
- var value = Object.values(attributes[index]["values"]).find((v) => v.sku_product_id != null && v.selected == true && v.applyhidden == false && v.shouldhidden == false && (v.price_type != "0" && v.price_type != null && v.price_type != ""));
1872
- if (value != void 0) {
1873
- var promotions = this.linked_promotionSettings[value.sku_product_id];
1874
- if (promotions != void 0) {
1875
- for (var p_index in promotions) {
1876
- var promotion = promotions[p_index];
1877
- for (var exc_index in promotion["excludes"]) {
1878
- if (!this.promotion_excludes.includes(promotion["excludes"][exc_index])) {
1879
- this.promotion_excludes.push(promotion["excludes"][exc_index]);
1880
- }
1881
- }
1882
- }
1883
- }
1884
- }
1885
- }
1886
- },
1887
- getValuePricePromotionDiscount(product_id, value_price) {
1888
- var fix_discount = 0;
1889
- var percentage_discount = 0;
1890
- var promotions = this.linked_promotionSettings[product_id];
1891
- if (promotions != void 0) {
1892
- for (var p_index in promotions) {
1893
- var promotion = promotions[p_index];
1894
- if (!this.promotion_excludes.includes(promotion["id"])) {
1895
- if (promotion["voucherdiscounttype_id"] == 2) {
1896
- percentage_discount = percentage_discount + promotion["discount"];
1897
- } else if (promotion["voucherdiscounttype_id"] == 3) {
1898
- fix_discount = fix_discount + promotion["discount"];
1899
- }
1900
- }
1901
- }
1902
- }
1903
- if (fix_discount > 0) {
1904
- this.getValuePriceDiscount(2, fix_discount, value_price);
1905
- }
1906
- if (percentage_discount > 0) {
1907
- this.getValuePriceDiscount(1, percentage_discount, value_price);
1908
- }
1909
- },
1910
- calculatePrice() {
1911
- let width = this.getMeasurement(this.TYPES["width"]);
1912
- let height = this.getMeasurement(this.TYPES["height"]);
1913
- let value_price = 0;
1914
- let calculate_MultiPrice = false;
1915
- let subWidths = this.getSubWidths();
1916
- let subHeights = this.getSubHeights();
1917
- let noOfSubWidths = subWidths.length;
1918
- let noOfSubdrops = subHeights.length;
1919
- if (noOfSubdrops != 0 || noOfSubWidths != 0) {
1920
- calculate_MultiPrice = true;
1921
- }
1922
- let actual_price = parseFloat(this.BASEPRICE);
1923
- let total = 0;
1924
- let attributes = Object.values(this.attributeIdz).filter((a) => a.price_applicable == true);
1925
- this.setValuePricePromotionsDiscount(attributes);
1926
- for (var index in attributes) {
1927
- var value = Object.values(attributes[index]["values"]).find((v) => v.selected == true && v.applyhidden == false && v.shouldhidden == false && (v.price_type != "0" && v.price_type != null && v.price_type != ""));
1928
- if (value != void 0) {
1929
- if (attributes[index].parent_id) {
1930
- let find_selectedValue = Object.values(this.attributeIdz[attributes[index].parent_id]["values"]).find((v) => v.selected == true && v.applyhidden == false && v.shouldhidden == false);
1931
- if (find_selectedValue == void 0 || find_selectedValue && find_selectedValue.id != attributes[index]["values"][value.id].parent_id) {
1932
- continue;
1933
- }
1934
- }
1935
- if (value.price_type == this.PRICETYPE["custom"]) {
1936
- this.price_by_attributeobject = [];
1937
- this.price_by_attributeobject["attribute"] = attributes[index];
1938
- this.price_by_attributeobject["price_attribute"] = value.price_attribute;
1939
- this.price_by_attributeobject["value"] = value;
1940
- this.price_by_attributes.push(this.price_by_attributeobject);
1941
- continue;
1942
- }
1943
- if (attributes[index].multiprice == true && calculate_MultiPrice == true) {
1944
- value_price = this.calculateMultiPrice(width, height, value, subWidths, subHeights);
1945
- this.findprice = Object.values(this.attributeprices).find((ap) => ap["attribute"].id == attributes[index].id);
1946
- if (!this.findprice) {
1947
- this.attributepriceobject = [];
1948
- this.attributepriceobject["attribute"] = attributes[index];
1949
- this.attributepriceobject["value"] = value;
1950
- this.attributepriceobject["price"] = value_price;
1951
- this.attributeprices.push(this.attributepriceobject);
1952
- }
1953
- total = parseFloat(total) + value_price;
1954
- } else {
1955
- if (value.price_type == this.PRICETYPE["grouppricing"]) {
1956
- value_price = this.getValuePrice(value.group_pricing_type, width, height, this.PRICETYPE, value.group_price, this.lookupprices[value.id]);
1957
- } else {
1958
- value_price = this.getValuePrice(value.price_type, width, height, this.PRICETYPE, value.price, this.lookupprices[value.id]);
1959
- }
1960
- if (attributes[index].link_promotion == 1 && value.sku_product_id != null) {
1961
- this.getValuePricePromotionDiscount(value.sku_product_id, value_price);
1962
- } else {
1963
- this.getValuePriceDiscount(value.discount_type, value.discount, value_price);
1964
- }
1965
- this.findprice = Object.values(this.attributeprices).find((ap) => ap["attribute"].id == attributes[index].id);
1966
- if (!this.findprice) {
1967
- this.attributepriceobject = [];
1968
- this.attributepriceobject["attribute"] = attributes[index];
1969
- this.attributepriceobject["value"] = value;
1970
- this.attributepriceobject["price"] = value_price;
1971
- this.attributeprices.push(this.attributepriceobject);
1972
- }
1973
- total = parseFloat(total) + value_price;
1974
- }
1975
- if (attributes[index].exclude_product_promotion == 1) {
1976
- this.exclude_from_promo_total = parseFloat(this.exclude_from_promo_total) + value_price;
1977
- }
1978
- }
1979
- }
1980
- for (const price_by_attribute of this.price_by_attributes) {
1981
- this.findprice = Object.values(this.attributeprices).find((ap) => ap["attribute"].id == price_by_attribute.price_attribute && ap["price"] > 0);
1982
- if (this.findprice) {
1983
- let value_price2 = parseFloat(this.findprice["price"]) * (price_by_attribute["value"].price / 100);
1984
- if (price_by_attribute["attribute"].link_promotion == 1 && price_by_attribute["value"].sku_product_id != null) {
1985
- this.getValuePricePromotionDiscount(price_by_attribute["value"].sku_product_id, value_price2);
1986
- } else {
1987
- this.getValuePriceDiscount(price_by_attribute["value"].discount_type, price_by_attribute["value"].discount, value_price2);
1988
- }
1989
- total = parseFloat(total) + value_price2;
1990
- if (price_by_attribute["attribute"].exclude_product_promotion == 1) {
1991
- this.exclude_from_promo_total = parseFloat(this.exclude_from_promo_total) + value_price2;
1992
- }
1993
- }
1994
- }
1995
- if (this.USEBASEPRICE && parseFloat(total) < parseFloat(this.BASEPRICE)) {
1996
- total = parseFloat(this.BASEPRICE);
1997
- }
1998
- actual_price = total;
1999
- let rrprice = 0;
2000
- let discount = 0;
2001
- if (Object.values(this.DISCOUNTS).length) {
2002
- discount = this.DISCOUNTS[this.B2BTYPE] != void 0 ? this.DISCOUNTS[this.B2BTYPE] : 0;
2003
- discount = parseFloat(total) * parseFloat(discount) / 100;
2004
- }
2005
- let promotionDiscount = discount + parseFloat(this.total_values_discount);
2006
- if (this.promotionSettings != void 0 && this.promotionSettings.promotion != void 0 && this.promotionSettings.promotion == true) {
2007
- if (this.promotionSettings.promotiontype == 3) {
2008
- for (var i = this.promotionSettings.rules.length - 1; i >= 0; i--) {
2009
- let rule = this.promotionSettings.rules[i];
2010
- if (rule.discounttype != void 0 || rule.discount != void 0) {
2011
- let new_total = parseFloat(total) - parseFloat(this.exclude_from_promo_total);
2012
- promotionDiscount += this.calculateDiscount(rule.discounttype, rule.discount, new_total);
2013
- }
2014
- }
2015
- }
2016
- }
2017
- if (parseFloat(total) - parseFloat(promotionDiscount) > 0 && promotionDiscount > 0) {
2018
- promotionDiscount = this.customRoundUp(promotionDiscount);
2019
- total = parseFloat(total) - parseFloat(promotionDiscount);
2020
- }
2021
- if (parseFloat(actual_price) > parseFloat(total)) {
2022
- this.productDiscountedPrice = actual_price.toFixed(2);
2023
- } else {
2024
- this.productDiscountedPrice = 0;
2025
- }
2026
- if (document.querySelector(this.priceClass)) {
2027
- document.querySelector(this.priceClass).innerHTML = total.toFixed(2);
2028
- }
2029
- this.productPrice = total.toFixed(2);
2030
- },
2031
- calculateDiscount(discounttype, discount, price) {
2032
- if (discounttype == 2) {
2033
- discount = parseFloat(price) * parseFloat(discount / 100);
2034
- if (price - discount < 0)
2035
- return 0;
2036
- return parseFloat(discount);
2037
- } else if (discounttype == 3) {
2038
- if (price - discount < 0)
2039
- return price;
2040
- return parseFloat(discount);
2041
- }
2042
- return 0;
2043
- },
2044
- calculateservicePrice() {
2045
- const self = this;
2046
- if (typeof this.servicePriceSetting == "undefined") {
2047
- this.serviceprice = 0;
2048
- return;
2049
- }
2050
- let width = this.getMeasurement(this.TYPES["width"]);
2051
- let height = this.getMeasurement(this.TYPES["height"]);
2052
- if (height == void 0 || isNaN(height) || height == "" || height < 0) {
2053
- height = 0;
2054
- }
2055
- if (width == void 0 || isNaN(width) || width == "" || width < 0) {
2056
- width = 0;
2057
- }
2058
- let total = 0;
2059
- if (this.sevice_price_type == this.servicePriceSetting["types"]["custom"]) {
2060
- Object.keys(this.servicePriceSetting["pricelist"]).forEach((aid) => {
2061
- let values = self.servicePriceSetting["pricelist"][aid];
2062
- let selected_val2 = Object.values(self.attributeIdz[aid]["values"]).find((v) => v.selected == true);
2063
- if (selected_val2 !== void 0 && values[selected_val2.id] !== void 0) {
2064
- total += parseFloat(values[selected_val2.id]);
2065
- }
2066
- });
2067
- } else {
2068
- total += this.getValuePrice(
2069
- this.sevice_price_type,
2070
- width,
2071
- height,
2072
- this.servicePriceSetting["types"],
2073
- this.servicePriceSetting["serviceprice"],
2074
- this.servicePriceSetting["pricelist"]
2075
- );
2076
- }
2077
- this.serviceprice = total;
2078
- }
2079
- }
2080
- });