From 25d49675d81f9e19af7b66fedea64c1b38d5d413 Mon Sep 17 00:00:00 2001 From: Fede Isas Date: Wed, 12 Oct 2022 22:19:47 -0300 Subject: [PATCH 1/6] Collapsed Preview Attribute --- resources/js/components/FormGroup.vue | 41 +++++++++++++++++++++++++-- src/Layouts/Layout.php | 18 ++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/resources/js/components/FormGroup.vue b/resources/js/components/FormGroup.vue index cab6ad07..12e55faa 100644 --- a/resources/js/components/FormGroup.vue +++ b/resources/js/components/FormGroup.vue @@ -25,7 +25,7 @@

#{{ index + 1 }} - {{ group.title }} + {{ group.title }}: {{ collapsedPreview }}

@@ -85,6 +85,7 @@ :mode="mode" :show-help-text="item.helpText != null" :class="{ 'remove-bottom-border': index == group.fields.length - 1 }" + @change="handleFieldChanged($event, item)" />
@@ -94,6 +95,7 @@ diff --git a/src/Layouts/Layout.php b/src/Layouts/Layout.php index f324f9b8..18a4f1ff 100644 --- a/src/Layouts/Layout.php +++ b/src/Layouts/Layout.php @@ -66,6 +66,13 @@ class Layout implements LayoutInterface, JsonSerializable, ArrayAccess, Arrayabl */ protected $fields; + /** + * The layout's preview attribute + * + * @var string + */ + protected $collapsedPreviewAttribute; + /** * The attributes that should be cast to native types. * @@ -181,6 +188,16 @@ public function name() return $this->name; } + /** + * Retrieve the layout's collapsed preview attribute + * + * @return string + */ + public function collapsedPreviewAttribute() + { + return $this->collapsedPreviewAttribute; + } + /** * Retrieve the layout's title * @@ -686,6 +703,7 @@ public function jsonSerialize() 'name' => $this->name, 'title' => $this->title, 'fields' => $this->fields->jsonSerialize(), + 'collapsedPreviewAttribute' => $this->collapsedPreviewAttribute(), 'limit' => $this->limit, ]; } From 3dbe79224b9a0f4ab4a987b6b86aceb04f916db8 Mon Sep 17 00:00:00 2001 From: Fede Isas Date: Wed, 12 Oct 2022 22:22:55 -0300 Subject: [PATCH 2/6] cleanup --- resources/js/components/FormGroup.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/components/FormGroup.vue b/resources/js/components/FormGroup.vue index 12e55faa..ba809743 100644 --- a/resources/js/components/FormGroup.vue +++ b/resources/js/components/FormGroup.vue @@ -95,7 +95,7 @@