From f9e0d9702fad95dd0ddccb99b22b5afb01405d2c Mon Sep 17 00:00:00 2001 From: Spitfire Date: Mon, 9 Oct 2023 16:27:20 -0600 Subject: [PATCH] Bulk: Parents should be named parent --- app/Datagrids/Bulks/AbilityBulk.php | 2 +- app/Datagrids/Bulks/CreatureBulk.php | 2 +- app/Datagrids/Bulks/EventBulk.php | 2 +- app/Datagrids/Bulks/FamilyBulk.php | 2 +- app/Datagrids/Bulks/ItemBulk.php | 2 +- app/Datagrids/Bulks/JournalBulk.php | 2 +- app/Datagrids/Bulks/MapBulk.php | 2 +- app/Datagrids/Bulks/NoteBulk.php | 2 +- app/Datagrids/Bulks/OrganisationBulk.php | 2 +- app/Datagrids/Bulks/QuestBulk.php | 2 +- app/Datagrids/Bulks/RaceBulk.php | 2 +- app/Datagrids/Bulks/TagBulk.php | 2 +- app/Datagrids/Bulks/TimelineBulk.php | 2 +- .../views/cruds/datagrids/bulks/modals/batch.blade.php | 8 +++++++- resources/views/cruds/fields/parent_location.blade.php | 1 - 15 files changed, 20 insertions(+), 15 deletions(-) delete mode 100644 resources/views/cruds/fields/parent_location.blade.php diff --git a/app/Datagrids/Bulks/AbilityBulk.php b/app/Datagrids/Bulks/AbilityBulk.php index 9bd3d0496b..09499dfeee 100644 --- a/app/Datagrids/Bulks/AbilityBulk.php +++ b/app/Datagrids/Bulks/AbilityBulk.php @@ -7,7 +7,7 @@ class AbilityBulk extends Bulk protected array $fields = [ 'name', 'type', - 'ability_id', + 'parent_ability_id', 'tags', 'private_choice', ]; diff --git a/app/Datagrids/Bulks/CreatureBulk.php b/app/Datagrids/Bulks/CreatureBulk.php index 60ad7ce644..c29194a1ca 100644 --- a/app/Datagrids/Bulks/CreatureBulk.php +++ b/app/Datagrids/Bulks/CreatureBulk.php @@ -7,7 +7,7 @@ class CreatureBulk extends Bulk protected array $fields = [ 'name', 'type', - 'creature_id', + 'parent_creature_id', 'tags', 'private_choice', ]; diff --git a/app/Datagrids/Bulks/EventBulk.php b/app/Datagrids/Bulks/EventBulk.php index 1d59fd4e7e..25c3eb96f0 100644 --- a/app/Datagrids/Bulks/EventBulk.php +++ b/app/Datagrids/Bulks/EventBulk.php @@ -7,7 +7,7 @@ class EventBulk extends Bulk protected array $fields = [ 'name', 'type', - 'event_id', + 'parent_event_id', 'location_id', 'tags', 'private_choice', diff --git a/app/Datagrids/Bulks/FamilyBulk.php b/app/Datagrids/Bulks/FamilyBulk.php index b621017de9..b34c0e363f 100644 --- a/app/Datagrids/Bulks/FamilyBulk.php +++ b/app/Datagrids/Bulks/FamilyBulk.php @@ -7,7 +7,7 @@ class FamilyBulk extends Bulk protected array $fields = [ 'name', 'type', - 'family_id', + 'parent_family_id', 'location_id', 'tags', 'private_choice', diff --git a/app/Datagrids/Bulks/ItemBulk.php b/app/Datagrids/Bulks/ItemBulk.php index 37b3dd9c38..4d2d789aa6 100644 --- a/app/Datagrids/Bulks/ItemBulk.php +++ b/app/Datagrids/Bulks/ItemBulk.php @@ -9,7 +9,7 @@ class ItemBulk extends Bulk 'type', 'price', 'size', - 'item_id', + 'parent_item_id', 'location_id', 'character_id', 'tags', diff --git a/app/Datagrids/Bulks/JournalBulk.php b/app/Datagrids/Bulks/JournalBulk.php index bae0fa11ae..fff74ab4c3 100644 --- a/app/Datagrids/Bulks/JournalBulk.php +++ b/app/Datagrids/Bulks/JournalBulk.php @@ -7,7 +7,7 @@ class JournalBulk extends Bulk protected array $fields = [ 'name', 'type', - 'journal_id', + 'parent_journal_id', 'author_id', 'location_id', 'tags', diff --git a/app/Datagrids/Bulks/MapBulk.php b/app/Datagrids/Bulks/MapBulk.php index 17211dd923..00e1938770 100644 --- a/app/Datagrids/Bulks/MapBulk.php +++ b/app/Datagrids/Bulks/MapBulk.php @@ -7,7 +7,7 @@ class MapBulk extends Bulk protected array $fields = [ 'name', 'type', - 'map_id', + 'parent_map_id', 'tags', 'private_choice', ]; diff --git a/app/Datagrids/Bulks/NoteBulk.php b/app/Datagrids/Bulks/NoteBulk.php index 9dd545437e..e7eb61f4a5 100644 --- a/app/Datagrids/Bulks/NoteBulk.php +++ b/app/Datagrids/Bulks/NoteBulk.php @@ -7,7 +7,7 @@ class NoteBulk extends Bulk protected array $fields = [ 'name', 'type', - 'note_id', + 'parent_note_id', 'tags', 'private_choice', ]; diff --git a/app/Datagrids/Bulks/OrganisationBulk.php b/app/Datagrids/Bulks/OrganisationBulk.php index 57fc70dd61..d57a72072d 100644 --- a/app/Datagrids/Bulks/OrganisationBulk.php +++ b/app/Datagrids/Bulks/OrganisationBulk.php @@ -8,7 +8,7 @@ class OrganisationBulk extends Bulk 'name', 'type', 'location_id', - 'organisation_id', + 'parent_organisation_id', 'tags', 'private_choice', 'defunct_choice' diff --git a/app/Datagrids/Bulks/QuestBulk.php b/app/Datagrids/Bulks/QuestBulk.php index 17c275ce22..aff36a2895 100644 --- a/app/Datagrids/Bulks/QuestBulk.php +++ b/app/Datagrids/Bulks/QuestBulk.php @@ -7,7 +7,7 @@ class QuestBulk extends Bulk protected array $fields = [ 'name', 'type', - 'quest_id', + 'parent_quest_id', 'instigator_id', 'completed_choice', 'tags', diff --git a/app/Datagrids/Bulks/RaceBulk.php b/app/Datagrids/Bulks/RaceBulk.php index 37e3e04107..5f6f4712fd 100644 --- a/app/Datagrids/Bulks/RaceBulk.php +++ b/app/Datagrids/Bulks/RaceBulk.php @@ -7,7 +7,7 @@ class RaceBulk extends Bulk protected array $fields = [ 'name', 'type', - 'race_id', + 'parent_race_id', 'tags', 'private_choice', ]; diff --git a/app/Datagrids/Bulks/TagBulk.php b/app/Datagrids/Bulks/TagBulk.php index decc834df3..6447a10a3a 100644 --- a/app/Datagrids/Bulks/TagBulk.php +++ b/app/Datagrids/Bulks/TagBulk.php @@ -8,7 +8,7 @@ class TagBulk extends Bulk 'name', 'type', 'colour', - 'tag_id', + 'parent_tag_id', 'private_choice', 'auto_applied_choice', 'hide_choice', diff --git a/app/Datagrids/Bulks/TimelineBulk.php b/app/Datagrids/Bulks/TimelineBulk.php index cd51a2ca40..047180f739 100644 --- a/app/Datagrids/Bulks/TimelineBulk.php +++ b/app/Datagrids/Bulks/TimelineBulk.php @@ -7,7 +7,7 @@ class TimelineBulk extends Bulk protected array $fields = [ 'name', 'type', - 'timeline_id', + 'parent_timeline_id', 'tags', 'private_choice', ]; diff --git a/resources/views/cruds/datagrids/bulks/modals/batch.blade.php b/resources/views/cruds/datagrids/bulks/modals/batch.blade.php index fb6b0f2060..c4fbfa554b 100644 --- a/resources/views/cruds/datagrids/bulks/modals/batch.blade.php +++ b/resources/views/cruds/datagrids/bulks/modals/batch.blade.php @@ -3,7 +3,12 @@ @foreach ($bulk->fields() as $field) - @php $trimmed = \Illuminate\Support\Str::beforeLast($field, '_id'); @endphp + @php + $trimmed = \Illuminate\Support\Str::between($field,'parent_', '_id'); + $isParent = \Illuminate\Support\Str::contains($field, 'parent'); + @endphp + + {!! $fieldCount % 2 === 0 ? '' : null !!} @include('cruds.fields.' . $trimmed, [ 'trans' => $name, @@ -13,6 +18,7 @@ 'allowNew' => false, 'dropdownParent' => '#bulk-edit', 'route' => null, + 'isParent' => $isParent, ]) @php $fieldCount++; @endphp @endforeach diff --git a/resources/views/cruds/fields/parent_location.blade.php b/resources/views/cruds/fields/parent_location.blade.php deleted file mode 100644 index 89351c824a..0000000000 --- a/resources/views/cruds/fields/parent_location.blade.php +++ /dev/null @@ -1 +0,0 @@ -@include('cruds.fields.location', ['isParent' => true, 'model' => null])