datatable.directory codebase
https://datatable.directory/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
5.2 KiB
156 lines
5.2 KiB
@php
|
|
$tab = 'review';
|
|
/** @var \App\Tables\Changeset $changeset */
|
|
/** @var \App\Models\Table $table */
|
|
|
|
$numChangedRows = count($changeset->rowUpdates);
|
|
$numNewRows = count($changeset->newRows);
|
|
$numRemovedRows = count($changeset->removedRows);
|
|
|
|
$anyRowChanges = $numChangedRows || $numNewRows || $numRemovedRows;
|
|
|
|
$numChangedColumns = count($changeset->columnUpdates);
|
|
$numNewColumns = count($changeset->newColumns);
|
|
$numRemovedColumns = count($changeset->removedColumns);
|
|
$colsReordered = !empty($changeset->columnOrder);
|
|
|
|
$anyColChanges = $numChangedColumns || $numNewColumns || $numRemovedColumns || $colsReordered;
|
|
|
|
$anyChanges = ($anyRowChanges || $anyColChanges) && strlen(trim($changeset->note)) > 0;
|
|
@endphp
|
|
|
|
@extends('table.propose.layout')
|
|
|
|
@section('tab-content')
|
|
<div class="my-3 col-md-12">
|
|
<div class="mx-3">
|
|
|
|
<?php Widget::setLayout(3,7) ?>
|
|
|
|
{!! Widget::header(3, 'Change Summary') !!}
|
|
|
|
<div class="row border-bottom border-top py-3">
|
|
<div class="col-md-3 text-right">
|
|
Rows
|
|
</div>
|
|
<div class="col-md-7">
|
|
@if($anyRowChanges)
|
|
|
|
@if($numChangedRows)
|
|
<div class="text-info">
|
|
<b>{{ $numChangedRows }}</b> changed
|
|
<a href="{{$table->draftUpdateRoute}}?action=reset.row-update" class="ml-2"
|
|
data-confirm="Revert all row changes?">Reset</a>
|
|
</div>
|
|
@endif
|
|
|
|
@if($numNewRows)
|
|
<div class="text-success">
|
|
<b>{{ $numNewRows }}</b> new
|
|
<a href="{{$table->draftUpdateRoute}}?action=reset.row-add" class="ml-2"
|
|
data-confirm="Discard all added rows?">Reset</a>
|
|
</div>
|
|
@endif
|
|
|
|
@if($numRemovedRows)
|
|
<div class="text-danger">
|
|
<b>{{ $numRemovedRows }}</b> removed
|
|
<a href="{{$table->draftUpdateRoute}}?action=reset.row-remove" class="ml-2"
|
|
data-confirm="Undo row removals?">Reset</a>
|
|
</div>
|
|
@endif
|
|
|
|
@else
|
|
<span class="text-muted">No changes</span>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row border-bottom py-3 mb-3">
|
|
<div class="col-md-3 text-right">
|
|
Columns
|
|
</div>
|
|
<div class="col-md-7">
|
|
@if($anyColChanges)
|
|
|
|
@if($numChangedColumns)
|
|
<div class="text-info">
|
|
<b>{{ $numChangedColumns }}</b> changed
|
|
<a href="{{$table->draftUpdateRoute}}?action=reset.col-update" class="ml-2"
|
|
data-confirm="Revert all column changes?">Reset</a>
|
|
</div>
|
|
@endif
|
|
|
|
@if($numNewColumns)
|
|
<div class="text-success">
|
|
<b>{{ $numNewColumns }}</b> new
|
|
<a href="{{$table->draftUpdateRoute}}?action=reset.col-add" class="ml-2"
|
|
data-confirm="Discard all added columns?">Reset</a>
|
|
</div>
|
|
@endif
|
|
|
|
@if($numRemovedColumns)
|
|
<div class="text-danger">
|
|
<b>{{ $numRemovedColumns }}</b> removed
|
|
<a href="{{$table->draftUpdateRoute}}?action=reset.col-remove" class="ml-2"
|
|
data-confirm="Undo column removals?">Reset</a>
|
|
</div>
|
|
@endif
|
|
|
|
@if($colsReordered)
|
|
<div class="text-info">
|
|
Order changed
|
|
<a href="{{$table->draftUpdateRoute}}?action=reset.col-order" class="ml-2"
|
|
data-confirm="Reset column order changes?">Reset</a>
|
|
</div>
|
|
@endif
|
|
|
|
@else
|
|
<span class="text-muted">No changes</span>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
{!! Widget::textarea('note', 'Summary')->value($changeset->note)
|
|
->help(user()->ownsTable($table) ?
|
|
"Describe changes you made to the table; this message will annotate the
|
|
new table revision." :
|
|
"Describe you suggested changes. The table owner will read this message
|
|
and review your changes before deciding whether to accept the proposal."
|
|
)->minHeight('8em')
|
|
!!}
|
|
|
|
<div class="row">
|
|
<div class="col-md-7 offset-md-3">
|
|
@if(user()->ownsTable($table))
|
|
<a href="" id="submit-button" class="btn btn-outline-success {{$anyChanges?'':'disabled'}}">
|
|
@icon(fa-save fa-pr)Save & Apply
|
|
</a>
|
|
@else
|
|
<a href="" id="submit-button" class="btn btn-outline-success {{$anyChanges?'':'disabled'}}">
|
|
@icon(fa-paper-plane-o fa-pr)Submit for review
|
|
</a>
|
|
@endif
|
|
|
|
@if($anyRowChanges || $anyColChanges)
|
|
<span class="text-muted ml-3" id="empty-note-prompt">Write a summary to submit your changes.</span>
|
|
@else
|
|
<span class="text-danger ml-3">No changes to submit.</span>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
@stop
|
|
|
|
@push('scripts')
|
|
<script>
|
|
ready(function () {
|
|
app.DraftNotePage({
|
|
route: @json($table->draftUpdateRoute),
|
|
anyChanges: @json($anyRowChanges || $anyColChanges)
|
|
})
|
|
})
|
|
</script>
|
|
@endpush
|
|
|