You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
18KB

  1. (self["webpackChunk"] = self["webpackChunk"] || []).push([["adminlte-field-collection"],{
  2. /***/ "../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js":
  3. /*!**************************************************************************************************!*\
  4. !*** ../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js ***!
  5. \**************************************************************************************************/
  6. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  7. "use strict";
  8. __webpack_require__.r(__webpack_exports__);
  9. /* 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");
  10. /* 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__);
  11. /* 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");
  12. /* 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__);
  13. /* 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");
  14. /* 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__);
  15. /* harmony import */ var jquery_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! jquery-ui */ "./node_modules/jquery-ui-dist/jquery-ui.js");
  16. /* harmony import */ var jquery_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(jquery_ui__WEBPACK_IMPORTED_MODULE_3__);
  17. /* harmony import */ var _form_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./form.scss */ "../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/form.scss");
  18. $(document).ready(function () {
  19. initCollectionWidget();
  20. });
  21. function initCollectionWidget() {
  22. $('.field-collection[data-prototype]').each(function (i, collectionWidget) {
  23. setCollectionWidgetSortable($(collectionWidget));
  24. reindexKeyCollectionWidget($(collectionWidget));
  25. setCollectionWidgetAdd($(collectionWidget));
  26. setCollectionWidgetDelete($(collectionWidget));
  27. });
  28. }
  29. function setCollectionWidgetAdd($collectionWidget) {
  30. if ($collectionWidget.data('allow-add')) {
  31. $collectionWidget.find('.field-collection-add').on('click', function (e) {
  32. // grab the prototype template
  33. var newWidget = $collectionWidget.attr('data-prototype'); // replace the "__name__" used in the id and name of the prototype
  34. // with a number that's unique to your emails
  35. // end name attribute looks like name="contact[emails][2]"
  36. newWidget = newWidget.replace(/__name__/g, getNumItems($collectionWidget)); // create a new list element and add it to the list
  37. $collectionWidget.find('.form-widget-compound .field-collection-group').append(newWidget);
  38. $collectionWidget.find('.field-collection-item:last').find('.field-position').val(getNumItems($collectionWidget));
  39. reindexKeyCollectionWidget($collectionWidget);
  40. setCollectionWidgetDelete($collectionWidget);
  41. $collectionWidget.trigger('collection-add-item');
  42. $collectionWidget.data('num-items', $collectionWidget.data('num-items') + 1);
  43. $collectionWidget.find('.collection-empty').hide();
  44. });
  45. }
  46. }
  47. function setCollectionWidgetDelete($collectionWidget) {
  48. if ($collectionWidget.data('allow-delete')) {
  49. $collectionWidget.find('.field-collection-delete').off('click');
  50. $collectionWidget.find('.field-collection-delete').on('click', function () {
  51. $(this).parents('.form-group:first').remove();
  52. reindexKeyCollectionWidget($collectionWidget);
  53. if (getNumItems($collectionWidget) == 0) $collectionWidget.find('.collection-empty').show();
  54. });
  55. }
  56. }
  57. function getNumItems($collectionWidget) {
  58. if ($collectionWidget.data('reindex-key')) {
  59. return $collectionWidget.find('.field-collection-item').length;
  60. } else {
  61. return $collectionWidget.data('num-items');
  62. }
  63. }
  64. function reindexKeyCollectionWidget($collectionWidget) {
  65. if ($collectionWidget.data('reindex-key')) {
  66. $collectionWidget.find('.field-collection-item').each(function (i, item) {
  67. $(item).find('input,textarea').each(function (y, field) {
  68. var $field = $(field); //Chanegment ID
  69. var posId = Tools.indexOfLastDigit($field.prop('id'));
  70. var idPrefix = $field.prop('id').substr(0, posId);
  71. var idSuffix = $field.prop('id').substr(posId + 1);
  72. $field.prop('id', idPrefix + i + idSuffix); //Chanegment Name
  73. var posName = Tools.indexOfLastDigit($field.prop('name'));
  74. var namePrefix = $field.prop('name').substr(0, posName);
  75. var nameSuffix = $field.prop('name').substr(posName + 1);
  76. $field.prop('name', namePrefix + i + nameSuffix);
  77. });
  78. });
  79. }
  80. }
  81. function setCollectionWidgetSortable($collectionWidget) {
  82. if ($collectionWidget.data('sortable')) {
  83. $collectionWidget.find('.field-collection-group').sortable({
  84. "handle": '.lc-btn-sortable',
  85. cancel: ''
  86. });
  87. $collectionWidget.find('.field-collection-group').on("sortupdate", function (event, ui) {
  88. $collectionWidget.find('.field-collection-group>div').each(function (index, item) {
  89. $(item).find('.field-position').val(index);
  90. });
  91. });
  92. }
  93. }
  94. /***/ }),
  95. /***/ "../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/form.scss":
  96. /*!******************************************************************************************!*\
  97. !*** ../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/form.scss ***!
  98. \******************************************************************************************/
  99. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  100. "use strict";
  101. __webpack_require__.r(__webpack_exports__);
  102. // extracted by mini-css-extract-plugin
  103. /***/ })
  104. },
  105. /******/ __webpack_require__ => { // webpackRuntimeModules
  106. /******/ "use strict";
  107. /******/
  108. /******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
  109. /******/ __webpack_require__.O(0, ["vendors-node_modules_core-js_internals_export_js","vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-bed4a0","vendors-node_modules_core-js_internals_a-function_js-node_modules_jquery_src_jquery_js","vendors-node_modules_jquery-ui-dist_jquery-ui_js","vendors-node_modules_core-js_modules_es_array_find_js-node_modules_core-js_modules_es_string_-b9e064"], () => (__webpack_exec__("../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js")));
  110. /******/ var __webpack_exports__ = __webpack_require__.O();
  111. /******/ }
  112. ]);
  113. //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi4vTGFDbGljQnVuZGxlL1NvdkJ1bmRsZS9SZXNvdXJjZXMvYXNzZXRzL2FwcC9hZG1pbmx0ZS9maWVsZC9jb2xsZWN0aW9uL2FwcC5jb2xsZWN0aW9uLmpzIiwid2VicGFjazovLy8uLi9MYUNsaWNCdW5kbGUvU292QnVuZGxlL1Jlc291cmNlcy9hc3NldHMvYXBwL2FkbWlubHRlL2ZpZWxkL2NvbGxlY3Rpb24vZm9ybS5zY3NzIl0sIm5hbWVzIjpbIiQiLCJkb2N1bWVudCIsInJlYWR5IiwiaW5pdENvbGxlY3Rpb25XaWRnZXQiLCJlYWNoIiwiaSIsImNvbGxlY3Rpb25XaWRnZXQiLCJzZXRDb2xsZWN0aW9uV2lkZ2V0U29ydGFibGUiLCJyZWluZGV4S2V5Q29sbGVjdGlvbldpZGdldCIsInNldENvbGxlY3Rpb25XaWRnZXRBZGQiLCJzZXRDb2xsZWN0aW9uV2lkZ2V0RGVsZXRlIiwiJGNvbGxlY3Rpb25XaWRnZXQiLCJkYXRhIiwiZmluZCIsIm9uIiwiZSIsIm5ld1dpZGdldCIsImF0dHIiLCJyZXBs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gkY29sbGVjdGlvbldpZGdldC5kYXRhKCdyZWluZGV4LWtleScpKSB7XG4gICAgICAgICRjb2xsZWN0aW9uV2lkZ2V0LmZpbmQoJy5maWVsZC1jb2xsZWN0aW9uLWl0ZW0nKS5lYWNoKGZ1bmN0aW9uIChpLCBpdGVtKSB7XG4gICAgICAgICAgICAkKGl0ZW0pLmZpbmQoJ2lucHV0LHRleHRhcmVhJykuZWFjaChmdW5jdGlvbiAoeSwgZmllbGQpIHtcbiAgICAgICAgICAgICAgICBsZXQgJGZpZWxkID0gJChmaWVsZCk7XG4gICAgICAgICAgICAgICAgLy9DaGFuZWdtZW50IElEXG4gICAgICAgICAgICAgICAgbGV0IHBvc0lkID0gVG9vbHMuaW5kZXhPZkxhc3REaWdpdCgkZmllbGQucHJvcCgnaWQnKSk7XG4gICAgICAgICAgICAgICAgbGV0IGlkUHJlZml4ID0gJGZpZWxkLnByb3AoJ2lkJykuc3Vic3RyKDAsIHBvc0lkKTtcbiAgICAgICAgICAgICAgICBsZXQgaWRTdWZmaXggPSAkZmllbGQucHJvcCgnaWQnKS5zdWJzdHIocG9zSWQgKyAxKTtcbiAgICAgICAgICAgICAgICAkZmllbGQucHJvcCgnaWQnLCBpZFByZWZpeCArIGkgKyBpZFN1ZmZpeCk7XG5cbiAgICAgICAgICAgICAgICAvL0NoYW5lZ21lbnQgTmFtZVxuICAgICAgICAgICAgICAgIGxldCBwb3NOYW1lID0gVG9vbHMuaW5kZXhPZkxhc3REaWdpdCgkZmllbGQucHJvcCgnbmFtZScpKTtcbiAgICAgICAgICAgICAgICBsZXQgbmFtZVByZWZpeCA9ICRmaWVsZC5wcm9wKCduYW1lJykuc3Vic3RyKDAsIHBvc05hbWUpO1xuICAgICAgICAgICAgICAgIGxldCBuYW1lU3VmZml4ID0gJGZpZWxkLnByb3AoJ25hbWUnKS5zdWJzdHIocG9zTmFtZSArIDEpO1xuICAgICAgICAgICAgICAgICRmaWVsZC5wcm9wKCduYW1lJywgbmFtZVByZWZp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