src/Eccube/Resource/template/admin/Product/_parts/js_product_movie.twig line 1

Open in your IDE?
  1.  <script>
  2.     $(function() {
  3.         const itemClass = '.product_movie_row';
  4.         const $body = $('#product_movie_body');
  5.         let index = $body.find(itemClass).length;
  6.         function addForm() {
  7.             const prototype = $body.data('prototype');
  8.             const newForm = prototype.replace(/__name__/g, index);
  9.             $body.append(newForm);
  10.             index++;
  11.         }
  12.         $('#add_product_movie').on('click',addForm);
  13.         $(document).on('click','#remove_product_movie',function() {
  14.             if(!confirm('削除しますか?')) {
  15.                 return false;
  16.             }
  17.             const deleteIndex = $(this).data('index');
  18.             $(document).find('#product_movie_row'+deleteIndex).remove();
  19.         });
  20.     });
  21. </script>