diff --git a/app/Http/Controllers/TableEditController.php b/app/Http/Controllers/TableEditController.php index 00e99a9..f4dbc79 100644 --- a/app/Http/Controllers/TableEditController.php +++ b/app/Http/Controllers/TableEditController.php @@ -320,4 +320,17 @@ class TableEditController extends Controller return $this->jsonResponse($resp, $code); } + + /** + * Submit the form + * + * @param Request $request + * @param User $user + * @param string $table + * @return \Symfony\Component\HttpFoundation\Response + */ + public function draftSubmit(Request $request, User $user, string $table) + { + // + } } diff --git a/app/Models/Table.php b/app/Models/Table.php index 381cd3f..7f8e637 100644 --- a/app/Models/Table.php +++ b/app/Models/Table.php @@ -28,6 +28,7 @@ use Illuminate\Database\Eloquent\Collection; * @property-read string $draftSessionKey * @property-read string $draftDiscardRoute * @property-read string $draftUpdateRoute + * @property-read string $draftSubmitRoute * @property-read User $owner * @property-read Table $parentTable * @property-read Table[]|Collection $forks @@ -141,6 +142,7 @@ class Table extends BaseModel case 'deleteRoute': return route('table.delete', $arg); case 'draftDiscardRoute': return route('table.draft-discard', $arg); case 'draftUpdateRoute': return route('table.draft-update', $arg); + case 'draftSubmitRoute': return route('table.draft-submit', $arg); } } diff --git a/resources/assets/js/components/ColumnEditor.vue b/resources/assets/js/components/ColumnEditor.vue index b923c4f..7907cf5 100644 --- a/resources/assets/js/components/ColumnEditor.vue +++ b/resources/assets/js/components/ColumnEditor.vue @@ -283,6 +283,7 @@ export default { }, (resp) => { resp.data._editing = true; this.columns.push(resp.data) + this.initColLoadvals(resp.data) }) } }, @@ -405,15 +406,21 @@ export default { if (!editing) { this.submitColChange(col) } else { - let origvals = {}; - _.each(col, (v, k) => { - if (k[0] != '_') origvals[k] = v - }) - this.$set(this.columns[n], '_loadvals', origvals) + this.initColLoadvals(col) this.$set(this.columns[n], '_editing', true) } }, + initColLoadvals(col) { + let n = this.colPos(col) + + let origvals = {}; + _.each(col, (v, k) => { + if (k[0] != '_') origvals[k] = v + }) + this.$set(this.columns[n], '_loadvals', origvals) + }, + /** Test if a value cell is changed */ isChanged (col, cell) { return col._changed && col._changed.indexOf(cell) > -1 diff --git a/resources/views/table/propose/review.blade.php b/resources/views/table/propose/review.blade.php index 92155ab..a07d148 100644 --- a/resources/views/table/propose/review.blade.php +++ b/resources/views/table/propose/review.blade.php @@ -23,7 +23,8 @@ @section('tab-content')