|
|
|
@php
|
|
|
|
$tab = 'add-rows';
|
|
|
|
/** @var \App\Tables\Column[] $columns */
|
|
|
|
/** @var \App\Tables\Changeset $changeset */
|
|
|
|
/** @var \App\Models\Row[]|Illuminate\Pagination\Paginator $rows */
|
|
|
|
/** @var \App\Models\Table $table */
|
|
|
|
@endphp
|
|
|
|
@extends('table.propose.layout-row-pagination')
|
|
|
|
|
|
|
|
@section('rows')
|
|
|
|
<div id="rows-editor"></div>
|
|
|
|
@stop
|
|
|
|
|
|
|
|
@push('scripts')
|
|
|
|
@php
|
|
|
|
$xrows = $rows->map(function($r) {
|
|
|
|
$r['_orig'] = $r;
|
|
|
|
return $r;
|
|
|
|
})->keyBy('_id');
|
|
|
|
@endphp
|
|
|
|
|
|
|
|
<script>
|
|
|
|
ready(function() {
|
|
|
|
var rows_editor = app.RowsEditor('#rows-editor', {
|
|
|
|
hasPages: @json($rows->hasPages()),
|
|
|
|
pager:
|
|
|
|
'<nav class="text-center" aria-label="Table pages">' +
|
|
|
|
@json((string)$rows->links(null, ['ulClass' => 'mb-0'])) +
|
|
|
|
'</nav>',
|
|
|
|
route: {!! toJSON($table->draftUpdateRoute) !!},
|
|
|
|
columns: {!! toJSON($columns) !!},
|
|
|
|
xRows: {!! toJSON($xrows, true) !!},
|
|
|
|
newRows: true, // indicate all are new
|
|
|
|
pageUrl: @json(request()->fullUrl()),
|
|
|
|
csrf: @json(csrf_token()),
|
|
|
|
})
|
|
|
|
|
|
|
|
$('#save-all-rows').on('click', function () {
|
|
|
|
rows_editor.saveAllChanges()
|
|
|
|
})
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@endpush
|