|
@@ -9,8 +9,8 @@
|
|
|
|
|
|
<span name="{{$column}}"></span> {{-- 用于显示错误信息 --}}
|
|
<span name="{{$column}}"></span> {{-- 用于显示错误信息 --}}
|
|
|
|
|
|
- <div class="has-many-{{$columnClass}}" >
|
|
|
|
- <table class="table table-has-many has-many-{{$columnClass}}">
|
|
|
|
|
|
+ <div class="has-many-table-{{$columnClass}}" >
|
|
|
|
+ <table class="table table-has-many has-many-table-{{$columnClass}}">
|
|
<thead>
|
|
<thead>
|
|
<tr>
|
|
<tr>
|
|
@foreach($headers as $header)
|
|
@foreach($headers as $header)
|
|
@@ -24,9 +24,9 @@
|
|
@endif
|
|
@endif
|
|
</tr>
|
|
</tr>
|
|
</thead>
|
|
</thead>
|
|
- <tbody class="has-many-{{$columnClass}}-forms">
|
|
|
|
|
|
+ <tbody class="has-many-table-{{$columnClass}}-forms">
|
|
@foreach($forms as $pk => $form)
|
|
@foreach($forms as $pk => $form)
|
|
- <tr class="has-many-{{$columnClass}}-form fields-group">
|
|
|
|
|
|
+ <tr class="has-many-table-{{$columnClass}}-form fields-group">
|
|
|
|
|
|
<?php $hidden = ''; ?>
|
|
<?php $hidden = ''; ?>
|
|
|
|
|
|
@@ -55,7 +55,7 @@
|
|
</table>
|
|
</table>
|
|
|
|
|
|
<template class="{{$columnClass}}-tpl">
|
|
<template class="{{$columnClass}}-tpl">
|
|
- <tr class="has-many-{{$columnClass}}-form fields-group">
|
|
|
|
|
|
+ <tr class="has-many-table-{{$columnClass}}-form fields-group">
|
|
|
|
|
|
{!! $template !!}
|
|
{!! $template !!}
|
|
|
|
|
|
@@ -75,7 +75,6 @@
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@endif
|
|
</div>
|
|
</div>
|
|
- @include('admin::form.help-block')
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -83,23 +82,26 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
var nestedIndex = {!! $count !!},
|
|
var nestedIndex = {!! $count !!},
|
|
- container = '.has-many-{{ $columnClass }}';
|
|
|
|
|
|
+ container = '.has-many-table-{{ $columnClass }}';
|
|
|
|
|
|
function replaceNestedFormIndex(value) {
|
|
function replaceNestedFormIndex(value) {
|
|
return String(value).replace(/{{ Dcat\Admin\Form\NestedForm::DEFAULT_KEY_NAME }}/g, nestedIndex);
|
|
return String(value).replace(/{{ Dcat\Admin\Form\NestedForm::DEFAULT_KEY_NAME }}/g, nestedIndex);
|
|
}
|
|
}
|
|
|
|
|
|
- $(container).on('click', '.add', function () {
|
|
|
|
|
|
+ $(document).off('click', container+' .add').on('click', container+' .add', function (e) {
|
|
var tpl = $('template.{{ $columnClass }}-tpl');
|
|
var tpl = $('template.{{ $columnClass }}-tpl');
|
|
|
|
|
|
nestedIndex++;
|
|
nestedIndex++;
|
|
|
|
|
|
var template = replaceNestedFormIndex(tpl.html());
|
|
var template = replaceNestedFormIndex(tpl.html());
|
|
- $('.has-many-{{ $columnClass }}-forms').append(template);
|
|
|
|
|
|
+ $(this).closest(container).find('.has-many-table-{{ $columnClass }}-forms').append(template);
|
|
|
|
+
|
|
|
|
+ e.preventDefault();
|
|
|
|
+ return false
|
|
});
|
|
});
|
|
|
|
|
|
- $(container).on('click', '.remove', function () {
|
|
|
|
- var $form = $(this).closest('.has-many-{{ $columnClass }}-form');
|
|
|
|
|
|
+ $(document).off('click', container+' .remove').on('click', container+' .remove', function () {
|
|
|
|
+ var $form = $(this).closest('.has-many-table-{{ $columnClass }}-form');
|
|
|
|
|
|
$form.hide();
|
|
$form.hide();
|
|
$form.find('[required]').prop('required', false);
|
|
$form.find('[required]').prop('required', false);
|