Use temporary negative IDs for rows created in a draft Changeset
This commit is contained in:
@@ -3,20 +3,10 @@
|
||||
/** @var \App\Tables\Changeset $changeset */
|
||||
/** @var \App\Models\Table $table */
|
||||
|
||||
$numChangedRows = count($changeset->rowUpdates);
|
||||
$numNewRows = count($changeset->newRows);
|
||||
$numRemovedRows = count($changeset->removedRows);
|
||||
$rowChanges = $changeset->getRowChangeCounts();
|
||||
$columnChanges = $changeset->getColumnChangeCounts();
|
||||
|
||||
$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;
|
||||
$anyChanges = ($rowChanges->any || $columnChanges->any) && strlen(trim($changeset->note)) > 0;
|
||||
@endphp
|
||||
|
||||
@extends('table.propose.layout')
|
||||
@@ -35,27 +25,27 @@
|
||||
Rows
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
@if($anyRowChanges)
|
||||
@if($rowChanges->any)
|
||||
|
||||
@if($numChangedRows)
|
||||
@if($rowChanges->changed)
|
||||
<div class="text-info">
|
||||
<b>{{ $numChangedRows }}</b> changed
|
||||
<b>{{ $rowChanges->changed }}</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)
|
||||
@if($rowChanges->new)
|
||||
<div class="text-success">
|
||||
<b>{{ $numNewRows }}</b> new
|
||||
<b>{{ $rowChanges->new }}</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)
|
||||
@if($rowChanges->removed)
|
||||
<div class="text-danger">
|
||||
<b>{{ $numRemovedRows }}</b> removed
|
||||
<b>{{ $rowChanges->removed }}</b> removed
|
||||
<a href="{{$table->draftUpdateRoute}}?action=reset.row-remove" class="ml-2"
|
||||
data-confirm="Undo row removals?">Reset</a>
|
||||
</div>
|
||||
@@ -72,33 +62,33 @@
|
||||
Columns
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
@if($anyColChanges)
|
||||
@if($columnChanges->any)
|
||||
|
||||
@if($numChangedColumns)
|
||||
@if($columnChanges->changed)
|
||||
<div class="text-info">
|
||||
<b>{{ $numChangedColumns }}</b> changed
|
||||
<b>{{ $columnChanges->changed }}</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)
|
||||
@if($columnChanges->new)
|
||||
<div class="text-success">
|
||||
<b>{{ $numNewColumns }}</b> new
|
||||
<b>{{ $columnChanges->new }}</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)
|
||||
@if($columnChanges->removed)
|
||||
<div class="text-danger">
|
||||
<b>{{ $numRemovedColumns }}</b> removed
|
||||
<b>{{ $columnChanges->removed }}</b> removed
|
||||
<a href="{{$table->draftUpdateRoute}}?action=reset.col-remove" class="ml-2"
|
||||
data-confirm="Undo column removals?">Reset</a>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($colsReordered)
|
||||
@if($columnChanges->reordered)
|
||||
<div class="text-info">
|
||||
Order changed
|
||||
<a href="{{$table->draftUpdateRoute}}?action=reset.col-order" class="ml-2"
|
||||
@@ -131,7 +121,7 @@
|
||||
@endif
|
||||
</button>
|
||||
|
||||
@if($anyRowChanges || $anyColChanges)
|
||||
@if($rowChanges->any || $columnChanges->any)
|
||||
<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>
|
||||
@@ -148,7 +138,7 @@
|
||||
ready(function () {
|
||||
app.DraftNotePage({
|
||||
route: @json($table->draftUpdateRoute),
|
||||
anyChanges: @json($anyRowChanges || $anyColChanges)
|
||||
anyChanges: @json($rowChanges->any || $columnChanges->any)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user