add some validation to row edit, better handle setting null cols with empty
This commit is contained in:
@@ -4,40 +4,24 @@
|
||||
/** @var \App\Tables\Changeset $changeset */
|
||||
/** @var \App\Models\Row[]|Illuminate\Pagination\Paginator $rows */
|
||||
/** @var \App\Models\Table $table */
|
||||
/** @var \App\Tables\Column[] $columns */
|
||||
/** @var \App\Tables\Changeset $changeset */
|
||||
/** @var \App\Models\Table $table */
|
||||
@endphp
|
||||
|
||||
@extends('table.propose.layout')
|
||||
@extends('table.propose.layout-row-pagination')
|
||||
|
||||
@section('tab-content')
|
||||
@section('rows')
|
||||
@php
|
||||
$transformed = $rows->keyBy('_id')->map(function($r) use ($changeset) {
|
||||
/** @var \App\Tables\Changeset $changeset */
|
||||
return $changeset->transformRow($r, true);
|
||||
});
|
||||
@endphp
|
||||
|
||||
@if($rows->hasPages())
|
||||
<div class="col-md-12 d-flex">
|
||||
<nav class="text-center" aria-label="Pages of the table">
|
||||
{{ $rows->links(null, ['ulClass' => 'mb-0']) }}
|
||||
</nav>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="col-12">
|
||||
@php
|
||||
$transformed = $rows->keyBy('_id')->map(function($r) use ($changeset) {
|
||||
/** @var \App\Tables\Changeset $changeset */
|
||||
return $changeset->transformRow($r, true);
|
||||
});
|
||||
@endphp
|
||||
|
||||
<table is="row-editor"
|
||||
route="{{$table->getDraftRoute('update')}}"
|
||||
:columns="{{toJSON($columns)}}"
|
||||
:x-rows="{{toJSON($transformed)}}">
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@if($rows->hasPages())
|
||||
<div class="col-md-12 d-flex">
|
||||
<nav class="text-center" aria-label="Pages of the table">
|
||||
{{ $rows->links(null, ['ulClass' => 'mb-0']) }}
|
||||
</nav>
|
||||
</div>
|
||||
@endif
|
||||
<table is="row-editor"
|
||||
route="{{$table->draftUpdateRoute}}"
|
||||
:columns="{{toJSON($columns)}}"
|
||||
:x-rows="{{toJSON($transformed)}}">
|
||||
</table>
|
||||
@stop
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
@php
|
||||
/** @var \App\Models\Row[]|Illuminate\Pagination\Paginator $rows */
|
||||
@endphp
|
||||
|
||||
@extends('table.propose.layout')
|
||||
|
||||
@section('tab-content')
|
||||
@if($rows->hasPages())
|
||||
<div class="col-md-12 d-flex">
|
||||
<nav class="text-center" aria-label="Pages of the table">
|
||||
{{ $rows->links(null, ['ulClass' => 'mb-0']) }}
|
||||
</nav>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="col-12">
|
||||
@yield('rows')
|
||||
</div>
|
||||
|
||||
@if($rows->hasPages())
|
||||
<div class="col-md-12 d-flex">
|
||||
<nav class="text-center" aria-label="Pages of the table">
|
||||
{{ $rows->links(null, ['ulClass' => 'mb-0']) }}
|
||||
</nav>
|
||||
</div>
|
||||
@endif
|
||||
@stop
|
||||
@@ -22,7 +22,7 @@ if (!isset($tab) || $tab == '') $tab = 'edit-rows';
|
||||
<h1 class="mx-3">
|
||||
<a href="{{ $table->viewRoute }}" class="link-no-color">{{ $table->title }}</a>
|
||||
</h1>
|
||||
<a href="" class="btn btn-outline-danger mr-2" @tooltip(Discard changes)>
|
||||
<a href="{{$table->draftDiscardRoute}}" class="btn btn-outline-danger mr-2" @tooltip(Discard changes)>
|
||||
@icon(fa-trash-o, sr:Discard)
|
||||
</a>
|
||||
@if(user()->ownsTable($table))
|
||||
|
||||
Reference in New Issue
Block a user