|
- (self["webpackChunk"] = self["webpackChunk"] || []).push([["adminlte-field-collection"],{
-
- /***/ "../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js":
- /*!**************************************************************************************************!*\
- !*** ../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js ***!
- \**************************************************************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.find.js */ "./node_modules/core-js/modules/es.array.find.js");
- /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.regexp.exec.js */ "./node_modules/core-js/modules/es.regexp.exec.js");
- /* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.string.replace.js */ "./node_modules/core-js/modules/es.string.replace.js");
- /* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var jquery_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! jquery-ui */ "./node_modules/jquery-ui-dist/jquery-ui.js");
- /* harmony import */ var jquery_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(jquery_ui__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _form_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./form.scss */ "../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/form.scss");
-
-
-
-
-
- $(document).ready(function () {
- initCollectionWidget();
- });
-
- function initCollectionWidget() {
- $('.field-collection[data-prototype]').each(function (i, collectionWidget) {
- setCollectionWidgetSortable($(collectionWidget));
- reindexKeyCollectionWidget($(collectionWidget));
- setCollectionWidgetAdd($(collectionWidget));
- setCollectionWidgetDelete($(collectionWidget));
- });
- }
-
- function setCollectionWidgetAdd($collectionWidget) {
- if ($collectionWidget.data('allow-add')) {
- $collectionWidget.find('.field-collection-add').on('click', function (e) {
- // grab the prototype template
- var newWidget = $collectionWidget.attr('data-prototype'); // replace the "__name__" used in the id and name of the prototype
- // with a number that's unique to your emails
- // end name attribute looks like name="contact[emails][2]"
-
- newWidget = newWidget.replace(/__name__/g, getNumItems($collectionWidget)); // create a new list element and add it to the list
-
- $collectionWidget.find('.form-widget-compound .field-collection-group').append(newWidget);
- $collectionWidget.find('.field-collection-item:last').find('.field-position').val(getNumItems($collectionWidget));
- reindexKeyCollectionWidget($collectionWidget);
- setCollectionWidgetDelete($collectionWidget);
- $collectionWidget.trigger('collection-add-item');
- $collectionWidget.data('num-items', $collectionWidget.data('num-items') + 1);
- $collectionWidget.find('.collection-empty').hide();
- });
- }
- }
-
- function setCollectionWidgetDelete($collectionWidget) {
- if ($collectionWidget.data('allow-delete')) {
- $collectionWidget.find('.field-collection-delete').off('click');
- $collectionWidget.find('.field-collection-delete').on('click', function () {
- $(this).parents('.form-group:first').remove();
- reindexKeyCollectionWidget($collectionWidget);
- if (getNumItems($collectionWidget) == 0) $collectionWidget.find('.collection-empty').show();
- });
- }
- }
-
- function getNumItems($collectionWidget) {
- if ($collectionWidget.data('reindex-key')) {
- return $collectionWidget.find('.field-collection-item').length;
- } else {
- return $collectionWidget.data('num-items');
- }
- }
-
- function reindexKeyCollectionWidget($collectionWidget) {
- if ($collectionWidget.data('reindex-key')) {
- $collectionWidget.find('.field-collection-item').each(function (i, item) {
- $(item).find('input,textarea').each(function (y, field) {
- var $field = $(field); //Chanegment ID
-
- var posId = Tools.indexOfLastDigit($field.prop('id'));
- var idPrefix = $field.prop('id').substr(0, posId);
- var idSuffix = $field.prop('id').substr(posId + 1);
- $field.prop('id', idPrefix + i + idSuffix); //Chanegment Name
-
- var posName = Tools.indexOfLastDigit($field.prop('name'));
- var namePrefix = $field.prop('name').substr(0, posName);
- var nameSuffix = $field.prop('name').substr(posName + 1);
- $field.prop('name', namePrefix + i + nameSuffix);
- });
- });
- }
- }
-
- function setCollectionWidgetSortable($collectionWidget) {
- if ($collectionWidget.data('sortable')) {
- $collectionWidget.find('.field-collection-group').sortable({
- "handle": '.lc-btn-sortable',
- cancel: ''
- });
- $collectionWidget.find('.field-collection-group').on("sortupdate", function (event, ui) {
- $collectionWidget.find('.field-collection-group>div').each(function (index, item) {
- $(item).find('.field-position').val(index);
- });
- });
- }
- }
-
- /***/ }),
-
- /***/ "../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/form.scss":
- /*!******************************************************************************************!*\
- !*** ../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/form.scss ***!
- \******************************************************************************************/
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- // extracted by mini-css-extract-plugin
-
-
- /***/ })
-
- },
- /******/ __webpack_require__ => { // webpackRuntimeModules
- /******/ "use strict";
- /******/
- /******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
- /******/ __webpack_require__.O(0, ["vendors-node_modules_core-js_internals_a-function_js-node_modules_core-js_internals_export_js","vendors-node_modules_core-js_modules_es_array_find_js","vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-bed4a0","vendors-node_modules_jquery_src_jquery_js","vendors-node_modules_core-js_modules_es_string_replace_js-node_modules_jquery-ui-dist_jquery-ui_js"], () => (__webpack_exec__("../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js")));
- /******/ var __webpack_exports__ = __webpack_require__.O();
- /******/ }
- ]);
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi4vTGFDbGljQnVuZGxlL1NvdkJ1bmRsZS9SZXNvdXJjZXMvYXNzZXRzL2FwcC9hZG1pbmx0ZS9maWVsZC9jb2xsZWN0aW9uL2FwcC5jb2xsZWN0aW9uLmpzIiwid2VicGFjazovLy8uLi9MYUNsaWNCdW5kbGUvU292QnVuZGxlL1Jlc291cmNlcy9hc3NldHMvYXBwL2FkbWlubHRlL2ZpZWxkL2NvbGxlY3Rpb24vZm9ybS5zY3NzIl0sIm5hbWVzIjpbIiQiLCJkb2N1bWVudCIsInJlYWR5IiwiaW5pdENvbGxlY3Rpb25XaWRnZXQiLCJlYWNoIiwiaSIsImNvbGxlY3Rpb25XaWRnZXQiLCJzZXRDb2xsZWN0aW9uV2lkZ2V0U29ydGFibGUiLCJyZWluZGV4S2V5Q29sbGVjdGlvbldpZGdldCIsInNldENvbGxlY3Rpb25XaWRnZXRBZGQiLCJzZXRDb2xsZWN0aW9uV2lkZ2V0RGVsZXRlIiwiJGNvbGxlY3Rpb25XaWRnZXQiLCJkYXRhIiwiZmluZCIsIm9uIiwiZSIsIm5ld1dpZGdldCIsImF0dHIiLCJyZXBsYWNlIiwiZ2V0TnVtSXRlbXMiLCJhcHBlbmQiLCJ2YWwiLCJ0cmlnZ2VyIiwiaGlkZSIsIm9mZiIsInBhcmVudHMiLCJyZW1vdmUiLCJzaG93IiwibGVuZ3RoIiwiaXRlbSIsInkiLCJmaWVsZCIsIiRmaWVsZCIsInBvc0lkIiwiVG9vbHMiLCJpbmRleE9mTGFzdERpZ2l0IiwicHJvcCIsImlkUHJlZml4Iiwic3Vic3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