hasmanytable.blade.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <div class="row">
  2. <div class="{{$viewClass['label']}}"><h4 class="pull-right">{{ $label }}</h4></div>
  3. <div class="{{$viewClass['field']}}">
  4. <div id="has-many-{{$column}}" style="margin-top: 15px;">
  5. <table class="table table-has-many has-many-{{$column}}">
  6. <thead>
  7. <tr>
  8. @foreach($headers as $header)
  9. <th>{{ $header }}</th>
  10. @endforeach
  11. <th class="hidden"></th>
  12. @if($options['allowDelete'])
  13. <th></th>
  14. @endif
  15. </tr>
  16. </thead>
  17. <tbody class="has-many-{{$column}}-forms">
  18. @foreach($forms as $pk => $form)
  19. <tr class="has-many-{{$column}}-form fields-group">
  20. <?php $hidden = ''; ?>
  21. @foreach($form->fields() as $field)
  22. @if (is_a($field, \Encore\Admin\Form\Field\Hidden::class))
  23. <?php $hidden .= $field->render(); ?>
  24. @continue
  25. @endif
  26. <td>{!! $field->setLabelClass(['hidden'])->setWidth(12, 0)->render() !!}</td>
  27. @endforeach
  28. <td class="hidden">{!! $hidden !!}</td>
  29. @if($options['allowDelete'])
  30. <td class="form-group">
  31. <div>
  32. <div class="remove btn btn-warning btn-sm pull-right"><i class="fa fa-trash">&nbsp;</i>{{ trans('admin.remove') }}</div>
  33. </div>
  34. </td>
  35. @endif
  36. </tr>
  37. @endforeach
  38. </tbody>
  39. </table>
  40. <template class="{{$column}}-tpl">
  41. <tr class="has-many-{{$column}}-form fields-group">
  42. {!! $template !!}
  43. <td class="form-group">
  44. <div>
  45. <div class="remove btn btn-warning btn-sm pull-right"><i class="fa fa-trash">&nbsp;</i>{{ trans('admin.remove') }}</div>
  46. </div>
  47. </td>
  48. </tr>
  49. </template>
  50. @if($options['allowCreate'])
  51. <div class="form-group">
  52. <div class="{{$viewClass['field']}}">
  53. <div class="add btn btn-success btn-sm"><i class="fa fa-save"></i>&nbsp;{{ trans('admin.new') }}</div>
  54. </div>
  55. </div>
  56. @endif
  57. </div>
  58. </div>
  59. </div>
  60. <hr style="margin-top: 0px;">