Skip to content

Commit

Permalink
Merge pull request #475 from canyongbs/fix/advapp-239-correct-issue-e…
Browse files Browse the repository at this point in the history
…vent-creation-form-empty

[ADVAPP-239]: Correct issue for event creation when form is empty
  • Loading branch information
Orrison authored Jan 29, 2024
2 parents 4a92ee7 + d7d0e2e commit eec7619
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ public/api-docs/*
/_lighthouse_ide_helper.php
/programmatic-types.graphql
/schema-directives.graphql
/*tinkerwell.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ public function fieldBuilder(): TiptapEditor
->when($applicationStep, fn (EloquentBuilder $query) => $query->whereBelongsTo($applicationStep, 'step'))
->delete();

$content = $component->decodeBlocksBeforeSave($component->getJSON(decoded: true));
$content = [];

if (filled($component->getState())) {
$content = $component->decodeBlocksBeforeSave($component->getJSON(decoded: true));
}

$content['content'] = $this->saveFieldsFromComponents(
$application,
$content['content'] ?? [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ public function fieldBuilder(): TiptapEditor
->when($formStep, fn (EloquentBuilder $query) => $query->whereBelongsTo($formStep, 'step'))
->delete();

$content = $component->decodeBlocksBeforeSave($component->getJSON(decoded: true));
$content = [];

if (filled($component->getState())) {
$content = $component->decodeBlocksBeforeSave($component->getJSON(decoded: true));
}

$content['content'] = $this->saveFieldsFromComponents(
$form,
$content['content'] ?? [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public function form(FilamentForm $form): FilamentForm
->schema(
[
MarkdownEditor::make('on_screen_response')
->disableToolbarButtons(['attachFiles']),
->disableToolbarButtons(['attachFiles'])
->columnSpanFull(),
]
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,12 @@ public function fieldBuilder(): TiptapEditor
->when($formStep, fn (EloquentBuilder $query) => $query->whereBelongsTo($formStep, 'step'))
->delete();

$content = $component->decodeBlocksBeforeSave($component->getJSON(decoded: true));
$content = [];

if (filled($component->getState())) {
$content = $component->decodeBlocksBeforeSave($component->getJSON(decoded: true));
}

$content['content'] = $this->saveFieldsFromComponents(
$form,
$content['content'] ?? [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ public function fieldBuilder(): TiptapEditor
->when($serviceRequestFormStep, fn (EloquentBuilder $query) => $query->whereBelongsTo($serviceRequestFormStep, 'step'))
->delete();

$content = $component->decodeBlocksBeforeSave($component->getJSON(decoded: true));
$content = [];

if (filled($component->getState())) {
$content = $component->decodeBlocksBeforeSave($component->getJSON(decoded: true));
}

$content['content'] = $this->saveFieldsFromComponents(
$serviceRequestForm,
$content['content'] ?? [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ public function fieldBuilder(): TiptapEditor
->when($surveyStep, fn (EloquentBuilder $query) => $query->whereBelongsTo($surveyStep, 'step'))
->delete();

$content = $component->decodeBlocksBeforeSave($component->getJSON(decoded: true));
$content = [];

if (filled($component->getState())) {
$content = $component->decodeBlocksBeforeSave($component->getJSON(decoded: true));
}

$content['content'] = $this->saveFieldsFromComponents(
$survey,
$content['content'] ?? [],
Expand Down

0 comments on commit eec7619

Please sign in to comment.