<commit_before><table class="ui table" data-role="tabular">
    <caption>
        <input type="hidden" name="{{ $name }}[rows]" data-role="rows-counter" value="{{ $limit }}">
    </caption>
    <thead>
    <tr>
        @foreach($labels as $label)
            <th>{!! $label !!}</th>
        @endforeach
        @if($allowRemoval)
            <th width="50px">&nbsp;</th>
        @endif
    </tr>
    </thead>
    <tbody>

    <template>
        <tr>
            @foreach($fields as $field)
                <td>{!! $field->bindAttribute('name', "") !!}</td>
            @endforeach
            @if($allowRemoval)
                <td>
                    <button class="ui button icon mini" type="button" data-role="tabular-remove-row" tabindex="-1">
                        <i class="icon remove"></i>
                    </button>
                </td>
            @endif
        </tr>
    </template>

    @foreach($rows as $fields)
        <tr>
            @foreach($fields as $field)
                <td>{!! $field->render() !!}</td>
            @endforeach
            @if($allowRemoval)
                <td>
                    <button class="ui button icon mini" type="button" data-role="tabular-remove-row" tabindex="-1">
                        <i class="icon remove"></i>
                    </button>
                </td>
            @endif
        </tr>
    @endforeach
    </tbody>
    <tfoot>
    @if($allowAddition)
        <tr>
            <th colspan="{{ count($labels) + ($allowRemoval) }}">
                <button class="ui button fluid" data-role="tabular-add-row" tabindex="-1"><i class="icon plus"></i>
                    Tambah
                </button>
            </th>
        </tr>
    @endif
    </tfoot>
</table>

@push('script')
    <script>
      let tabular = $('[data-role="tabular"]');

      tabular.on('click', '[data-role="tabular-remove-row"]', function (e) {
        e.preventDefault();
        let counter = $(e.delegateTarget).find('[data-role="rows-counter"]');
        let parent = $(e.currentTarget).parents('tr');
        parent.fadeOut("slow", function (e) {
          parent.remove();
          counter.val(counter.val() - 1);
        });
      });

      tabular.on('click', '[data-role="tabular-add-row"]', function (e) {
        e.preventDefault();
        let counter = $(e.delegateTarget).find('[data-role="rows-counter"]');
        let template = $(e.delegateTarget).find('template').get(0);
        var clone = document.importNode(template.content, true);
        $(e.delegateTarget).find('tbody').append($(clone));
        counter.val(parseInt(counter.val()) + 1);
      });
    </script>
@endpush<commit_msg>multirow: move template to bottom of the page<commit_after><table class="ui table" data-role="tabular">
    <caption>
        <input type="hidden" name="{{ $name }}[rows]" data-role="rows-counter" value="{{ $limit }}">
    </caption>
    <thead>
    <tr>
        @foreach($labels as $label)
            <th>{!! $label !!}</th>
        @endforeach
        @if($allowRemoval)
            <th width="50px">&nbsp;</th>
        @endif
    </tr>
    </thead>
    <tbody>
    @foreach($rows as $fields)
        <tr>
            @foreach($fields as $field)
                <td>{!! $field->render() !!}</td>
            @endforeach
            @if($allowRemoval)
                <td>
                    <button class="ui button icon mini" type="button" data-role="tabular-remove-row" tabindex="-1">
                        <i class="icon remove"></i>
                    </button>
                </td>
            @endif
        </tr>
    @endforeach
    </tbody>
    <tfoot>
    @if($allowAddition)
        <tr>
            <th colspan="{{ count($labels) + ($allowRemoval) }}">
                <button class="ui button fluid" data-template="{{ $name }}" data-role="tabular-add-row" tabindex="-1"><i
                            class="icon plus"></i>
                    Tambah
                </button>
            </th>
        </tr>
    @endif
    </tfoot>
</table>

@push('script')
    <template for="{{ $name }}">
        <tr>
            @foreach($fields as $field)
                <td>{!! $field->bindAttribute('name', "") !!}</td>
            @endforeach
            @if($allowRemoval)
                <td>
                    <button class="ui button icon mini" type="button" data-role="tabular-remove-row" tabindex="-1">
                        <i class="icon remove"></i>
                    </button>
                </td>
            @endif
        </tr>
    </template>

    <script>
      $(function () {
        let tabular = $('[data-role="tabular"]');

        tabular.on('click', '[data-role="tabular-remove-row"]', function (e) {
          e.preventDefault();
          let counter = $(e.delegateTarget).find('[data-role="rows-counter"]');
          let parent = $(e.currentTarget).parents('tr');
          parent.fadeOut("slow", function (e) {
            parent.remove();
            counter.val(counter.val() - 1);
          });
        });

        tabular.on('click', '[data-role="tabular-add-row"]', function (e) {
          e.preventDefault();
          let templateName = $(e.currentTarget).data('template');
          let counter = $(e.delegateTarget).find('[data-role="rows-counter"]');
          let template = $('template[for="'+templateName+'"]').get(0);
          var clone = document.importNode(template.content, true);
          $(e.delegateTarget).find('tbody').append($(clone));
          counter.val(parseInt(counter.val()) + 1);
        });

      });
    </script>
@endpush
{'fraction_non_alphanumeric': 0.18589628566301813, 'fraction_numerical': 0.002870985106764759, 'mean_word_length': 1.725672371638142, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 105, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4207866', 'n_tokens_mistral': 1639, 'n_tokens_neox': 1600, 'n_words': 316}