Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified formPreview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion resources/js/components/DetailField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div
v-for="(label, option) in field.options"
:key="option"
class="flex-auto"
:class="isChild(field.isChild)"
>
<span
class="inline-block rounded-full w-2 h-2 mr-1"
Expand All @@ -29,6 +29,13 @@ export default {
'bg-danger': this.field.value ? !this.field.value.includes(option) : true,
}
},

isChild(isChild) {
return {
'flex-auto ml-8': isChild ? true : false,
'flex-auto': !isChild ? true : false,
}
},
},
}
</script>
Expand Down
9 changes: 8 additions & 1 deletion resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div
v-for="(label, option) in field.options"
:key="option"
class="flex mb-2"
:class="isChild(field.isChild)"
>
<checkbox
:value="option"
Expand Down Expand Up @@ -40,6 +40,13 @@ export default {
isChecked(option) {
return this.value ? this.value.includes(option) : false
},

isChild(isChild) {
return {
'flex mb-2 ml-8': isChild ? true : false,
'flex mb-2': !isChild ? true : false,
}
},

toggleOption(option) {
if (this.isChecked(option)) {
Expand Down
8 changes: 8 additions & 0 deletions src/Checkboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ public function withoutTypeCasting()
{
return $this->withMeta(['withoutTypeCasting' => true]);
}

/**
* check wether is child to add customize styles.
*/
public function isChild()
{
return $this->withMeta(['isChild' => true]);
}

/**
* Determine if the array keys should be converted to numeric values.
Expand Down