|
|
|
@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: @json($table->draftUpdateRoute),
|
|
|
|
columns: @json($columns),
|
|
|
|
xRows: @json($xrows, true),
|
|
|
|
newRows: true, // indicate all are new
|
|
|
|
pageUrl: @json(request()->fullUrl()),
|
|
|
|
loadCsvUrl: @json($table->getDraftRoute('add-rows-csv')),
|
|
|
|
csrf: @json(csrf_token()),
|
|
|
|
})
|
|
|
|
|
|
|
|
$('#save-all-rows').on('click', function () {
|
|
|
|
rows_editor.saveAllChanges()
|
|
|
|
})
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@endpush
|