{"version":3,"file":"podeliInfoWidget.65e1d59063dee7aaa7ee.js","mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACjHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACNA;AACA;AACA","sources":["webpack://advantshop/./Modules/Podeli/Content/Scripts/client/podeliInfoWidget/styles/style.scss?c0cc","webpack://advantshop/./Modules/Podeli/Content/Scripts/client/podeliInfoWidget/podeliInfoWidget.controller.js","webpack://advantshop/./Modules/Podeli/Content/Scripts/client/podeliInfoWidget/podeliInfoWidget.directive.js","webpack://advantshop/./Modules/Podeli/Content/Scripts/client/podeliInfoWidget/podeliInfoWidget.module.js","webpack://advantshop/./scripts/appDependency.js","webpack://advantshop/webpack/bootstrap","webpack://advantshop/webpack/runtime/define property getters","webpack://advantshop/webpack/runtime/hasOwnProperty shorthand","webpack://advantshop/webpack/runtime/make namespace object","webpack://advantshop/./Modules/Podeli/bundle_config/podeliInfoWidget.js"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport {};","PodeliInfoWidgetCtrl.$inject = [\"$element\", \"modalService\", \"$templateCache\", \"$http\"];\n/* @ngInject */\nexport default function PodeliInfoWidgetCtrl($element, modalService, $templateCache, $http) {\n var ctrl = this,\n blockTypes = {\n productCart: 'product-cart',\n shoppingCart: 'shopping-cart'\n },\n modalParamObj = {},\n modalId = 'modalPodeliInfoWidget';\n ctrl.$onInit = function () {\n console.log(ctrl);\n let widgets = document.querySelectorAll('.podeli-widget');\n widgets.forEach((item, i) => {\n MarkerWidgetPodeli.init({\n total: item.dataset.total,\n maxLimit: +item.dataset.max,\n minLimit: +item.dataset.min,\n version: 4,\n index: i\n });\n });\n };\n ctrl.$postLink = function () {\n ctrl.subscribeCallback();\n };\n ctrl.init = function () {\n modalParamObj.payments = ctrl.payments;\n modalParamObj.dates = ctrl.dates;\n };\n ctrl.openModal = function () {\n ctrl.getHtml().then(function (htmlItem) {\n modalService.renderModal(modalId, null, htmlItem, null, {\n destroyOnClose: true\n }, modalParamObj);\n modalService.getModal(modalId).then(function (modal) {\n angular.extend(modal.modalScope, modalParamObj);\n modal.modalScope.open();\n });\n });\n };\n ctrl.subscribeCallback = function () {\n if (ctrl.typeBlock === blockTypes.productCart) {\n // вытаскиваем productService напрямую, \n // т.к. если инджектить можно получить ошибку\n // на других страницах из-за webpack\n const injector = angular.element('html').injector();\n const productService = injector.get('productService');\n\n // при изменени данных в карточке (смене цвета, кол-ва)\n productService.addCallback('refreshPrice', function () {\n ctrl.getPaymentSchedule(ctrl.offerPrice * ctrl.offerAmount, ctrl.numberOfPayments).then(function (result) {\n if (result) {\n ctrl.fistPayment = result.Payments[0];\n ctrl.numberOfPayments = result.Payments.length;\n modalParamObj.payments = result.Payments;\n modalParamObj.dates = result.Dates;\n $element.show();\n } else {\n $element.hide();\n }\n });\n });\n } else if (ctrl.typeBlock === blockTypes.shoppingCart) {\n // вытаскиваем cartService напрямую, \n // т.к. если инджектить можно получить ошибку\n // на других страницах из-за webpack\n const injector = angular.element('html').injector();\n const cartService = injector.get('cartService');\n cartService.addCallback('update', ctrl.updateCurrentCart);\n cartService.addCallback('remove', ctrl.updateCurrentCart);\n cartService.addCallback('add', ctrl.updateCurrentCart);\n cartService.addCallback('clear', ctrl.updateCurrentCart);\n }\n };\n ctrl.updateCurrentCart = function () {\n ctrl.getPaymentScheduleForCart(ctrl.numberOfPayments).then(function (result) {\n if (result) {\n ctrl.fistPayment = result.Payments[0];\n ctrl.numberOfPayments = result.Payments.length;\n modalParamObj.payments = result.Payments;\n modalParamObj.dates = result.Dates;\n $element.show();\n } else {\n $element.hide();\n }\n });\n };\n ctrl.getHtml = function () {\n return $http.get('/module/PodeliClient/getpopuphtml', {\n cache: $templateCache,\n params: {\n cache: ctrl.popupHtmlHash\n }\n }).then(function (response) {\n return response.data;\n });\n };\n ctrl.getPaymentSchedule = function (sum, numberOfPayments) {\n return $http.post('/module/PodeliClient/getpaymentschedule', {\n sum: sum,\n numberOfPayments: numberOfPayments\n }).then(function (response) {\n return response.data.obj;\n });\n };\n ctrl.getPaymentScheduleForCart = function (numberOfPayments) {\n return $http.post('/module/PodeliClient/getpaymentscheduleforcart', {\n numberOfPayments: numberOfPayments\n }).then(function (response) {\n return response.data.obj;\n });\n };\n}","/* @ngInject */\nconst advPodeliInfoWidget = $parse => {\n return {\n restrict: 'A',\n scope: true,\n controller: 'PodeliInfoWidgetCtrl',\n bindToController: true,\n controllerAs: '$ctrl',\n link: function (scope, element, attrs, ctrl) {\n ctrl.typeBlock = attrs.typeBlock;\n ctrl.fistPayment = $parse(attrs.fistPayment)(scope);\n ctrl.numberOfPayments = $parse(attrs.numberOfPayments)(scope);\n ctrl.popupHtmlHash = $parse(attrs.popupHtmlHash)(scope);\n ctrl.payments = $parse(attrs.payments)(scope);\n ctrl.dates = $parse(attrs.dates)(scope);\n ctrl.offerAmount = $parse(attrs.offerAmount)(scope);\n ctrl.offerPrice = $parse(attrs.offerPrice)(scope);\n scope.$watch(attrs.offerAmount, function (newVal, oldVal) {\n ctrl.offerAmount = newVal;\n });\n scope.$watch(attrs.offerPrice, function (newVal, oldVal) {\n ctrl.offerPrice = newVal;\n });\n ctrl.init();\n }\n };\n};\nadvPodeliInfoWidget.$inject = [\"$parse\"];\nexport { advPodeliInfoWidget };","import PodeliInfoWidgetCtrl from './podeliInfoWidget.controller.js';\nimport { advPodeliInfoWidget } from './podeliInfoWidget.directive.js';\nimport './styles/style.scss';\nconst MODULE_NAME = 'podeliInfoWidget';\nangular.module(MODULE_NAME, []).controller('PodeliInfoWidgetCtrl', PodeliInfoWidgetCtrl).directive('advPodeliInfoWidget', advPodeliInfoWidget);\nexport default MODULE_NAME;","class AppDependency {\n constructor() {\n if (!window.___appDependency) {\n window.___appDependency = this;\n window.___appDependencyList = [];\n }\n return window.___appDependency;\n }\n addItem(moduleName) {\n window.___appDependencyList.push(moduleName);\n }\n addList(moduleNameList) {\n window.___appDependencyList.push.apply(window.___appDependencyList, moduleNameList);\n }\n get() {\n return window.___appDependencyList;\n }\n}\nexport default new AppDependency();","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import appDependency from '../../../scripts/appDependency.js';\nimport podeliInfoWidgetModule from '../Content/Scripts/client/podeliInfoWidget/podeliInfoWidget.module.js';\nappDependency.addItem(podeliInfoWidgetModule);"],"names":[],"sourceRoot":""}