form-repeater.int.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /******/ (function() { // webpackBootstrap
  2. var __webpack_exports__ = {};
  3. /*!*************************************************!*\
  4. !*** ./resources/js/pages/form-repeater.int.js ***!
  5. \*************************************************/
  6. /*
  7. Template Name: Skote - Admin & Dashboard Template
  8. Author: Themesbrand
  9. Website: https://themesbrand.com/
  10. Contact: themesbrand@gmail.com
  11. File: Form repeater Js File
  12. */
  13. $(document).ready(function () {
  14. 'use strict';
  15. $('.repeater').repeater({
  16. defaultValues: {
  17. 'textarea-input': 'foo',
  18. 'text-input': 'bar',
  19. 'select-input': 'B',
  20. 'checkbox-input': ['A', 'B'],
  21. 'radio-input': 'B'
  22. },
  23. show: function show() {
  24. $(this).slideDown();
  25. },
  26. hide: function hide(deleteElement) {
  27. if (confirm('Are you sure you want to delete this element?')) {
  28. $(this).slideUp(deleteElement);
  29. }
  30. },
  31. ready: function ready(setIndexes) {}
  32. });
  33. window.outerRepeater = $('.outer-repeater').repeater({
  34. defaultValues: {
  35. 'text-input': 'outer-default'
  36. },
  37. show: function show() {
  38. console.log('outer show');
  39. $(this).slideDown();
  40. },
  41. hide: function hide(deleteElement) {
  42. console.log('outer delete');
  43. $(this).slideUp(deleteElement);
  44. },
  45. repeaters: [{
  46. selector: '.inner-repeater',
  47. defaultValues: {
  48. 'inner-text-input': 'inner-default'
  49. },
  50. show: function show() {
  51. console.log('inner show');
  52. $(this).slideDown();
  53. },
  54. hide: function hide(deleteElement) {
  55. console.log('inner delete');
  56. $(this).slideUp(deleteElement);
  57. }
  58. }]
  59. });
  60. });
  61. /******/ })()
  62. ;