Row adding, some webpack tweaks
This commit is contained in:
@@ -1,6 +1,52 @@
|
||||
@php($tab='add-rows')
|
||||
@extends('table.propose.layout')
|
||||
@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('tab-content')
|
||||
...
|
||||
@section('header')
|
||||
<div class="form-inline py-2 px-1 border-bottom mb-3">
|
||||
{{-- TODO improve layout --}}
|
||||
<form action="{{$table->draftUpdateRoute}}" method="POST" class="form-inline">
|
||||
@csrf
|
||||
<input type="hidden" name="action" value="rows.add-csv">
|
||||
<input type="hidden" name="redirect" value="{{request()->fullUrl()}}">
|
||||
<label class="pr-2" for="csv-data">Add CSV:</label>
|
||||
<textarea name="data" id="csv-data"
|
||||
title="{{$errors->has('data') ? $errors->first('data') : ''}}"
|
||||
class="form-control mr-1 {{ $errors->has('data')?'is-invalid':'' }}"
|
||||
style="width:30em; height:10em">{{old('data')}}</textarea>
|
||||
<button class="btn btn-outline-success">Append</button>
|
||||
</form>
|
||||
|
||||
<div class="flex-grow-1"></div>
|
||||
|
||||
<form action="{{$table->draftUpdateRoute}}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="action" value="rows.add">
|
||||
<input type="hidden" name="redirect" value="{{request()->fullUrl()}}">
|
||||
<label class="form-inline pr-2" for="newrow-count">Add Empty Rows:</label>
|
||||
<input name="count" id="newrow-count" type="number" min=1 step=1 value=1 class="form-control mr-1" style="width:10em">
|
||||
<button class="btn btn-outline-success">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@section('rows')
|
||||
<div id="rows-editor"></div>
|
||||
@stop
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
ready(function() {
|
||||
app.RowsEditor('#rows-editor', {
|
||||
route: {!! toJSON($table->draftUpdateRoute) !!},
|
||||
columns: {!! toJSON($columns) !!},
|
||||
xRows: {!! toJSON($rows->keyBy('_id'), true) !!},
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
/** @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-row-pagination')
|
||||
@@ -19,9 +16,17 @@
|
||||
});
|
||||
@endphp
|
||||
|
||||
<table is="row-editor"
|
||||
route="{{$table->draftUpdateRoute}}"
|
||||
:columns="{{toJSON($columns)}}"
|
||||
:x-rows="{{toJSON($transformed)}}">
|
||||
</table>
|
||||
<div id="rows-editor"></div>
|
||||
@stop
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
ready(function() {
|
||||
app.RowsEditor('#rows-editor', {
|
||||
route: {!! toJSON($table->draftUpdateRoute) !!},
|
||||
columns: {!! toJSON($columns) !!},
|
||||
xRows: {!! toJSON($transformed, true) !!},
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
@extends('table.propose.layout')
|
||||
|
||||
@section('tab-content')
|
||||
<div class="col-12">
|
||||
@yield('header')
|
||||
</div>
|
||||
|
||||
@if($rows->hasPages())
|
||||
<div class="col-md-12 d-flex">
|
||||
<nav class="text-center" aria-label="Pages of the table">
|
||||
|
||||
@@ -14,9 +14,7 @@ if (!isset($tab) || $tab == '') $tab = 'edit-rows';
|
||||
<small class="flex-grow-1" style="font-size: 120%;">
|
||||
<a href="{{ route('profile.view', $table->owner->name) }}" class="link-no-color">{{ $table->owner->handle }}</a>{{--
|
||||
--}}<span class="px-1">/</span>{{--
|
||||
--}}<b>
|
||||
<a href="{{ $table->viewRoute }}" class="link-no-color">{{ $table->name }}</a>
|
||||
</b>
|
||||
--}}<b><a href="{{ $table->viewRoute }}" class="link-no-color">{{ $table->name }}</a></b>
|
||||
</small>
|
||||
|
||||
<h1 class="mx-3">
|
||||
|
||||
Reference in New Issue
Block a user