Skip to content

Commit 6d68eb2

Browse files
Merge pull request #2266 from suraj-webkul/issue#2170
issue #2170 fixed.
2 parents 2eaf580 + 2cbdf01 commit 6d68eb2

File tree

3 files changed

+101
-6
lines changed

3 files changed

+101
-6
lines changed

packages/Webkul/Admin/src/Resources/views/components/attributes/edit/lookup.blade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
:validations="'{{ $validations }}'"
99
:value="{{ json_encode($lookUpEntityData)}}"
1010
can-add-new="{{ $canAddNew ?? false }}"
11+
@lookup-added="handleLookupAdded"
12+
@lookup-removed="handleLookupRemoved"
1113
>
1214
<div class="relative inline-block w-full">
1315
<!-- Input Container -->
@@ -152,6 +154,8 @@ class="cursor-pointer border-t border-gray-800 px-4 py-2 text-gray-500 hover:bg-
152154
153155
props: ['validations', 'isDisabled', 'attribute', 'value', 'canAddNew'],
154156
157+
emits: ['lookup-added', 'lookup-removed'],
158+
155159
data() {
156160
return {
157161
showPopup: false,

packages/Webkul/Admin/src/Resources/views/contacts/persons/create.blade.php

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</x-slot>
66

77
{!! view_render_event('admin.persons.create.form.before') !!}
8-
8+
99
<!--Create Page Form -->
1010
<x-admin::form
1111
:action="route('admin.contacts.persons.store')"
@@ -43,13 +43,14 @@ class="primary-button"
4343
</div>
4444
</div>
4545
</div>
46-
46+
4747
<!-- Form fields -->
4848
<div class="box-shadow rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-800 dark:bg-gray-900">
4949
{!! view_render_event('admin.persons.create.form_controls.before') !!}
5050

5151
<x-admin::attributes
5252
:custom-attributes="app('Webkul\Attribute\Repositories\AttributeRepository')->findWhere([
53+
['code', 'NOTIN', ['organization_id']],
5354
'entity_type' => 'persons',
5455
])"
5556
:custom-validations="[
@@ -62,11 +63,55 @@ class="primary-button"
6263
],
6364
]"
6465
/>
65-
66+
67+
<v-organization></v-organization>
68+
6669
{!! view_render_event('admin.persons.create.form_controls.after') !!}
6770
</div>
6871
</div>
6972
</x-admin::form>
7073

7174
{!! view_render_event('admin.persons.create.form.after') !!}
75+
76+
@pushOnce('scripts')
77+
<script
78+
type="text/x-template"
79+
id="v-organization-template"
80+
>
81+
<div>
82+
<x-admin::attributes
83+
:custom-attributes="app('Webkul\Attribute\Repositories\AttributeRepository')->findWhere([
84+
['code', 'IN', ['organization_id']],
85+
'entity_type' => 'persons',
86+
])"
87+
/>
88+
89+
<template v-if="organizationName">
90+
<x-admin::form.control-group.control
91+
type="hidden"
92+
name="organization_name"
93+
v-model="organizationName"
94+
/>
95+
</template>
96+
</div>
97+
</script>
98+
99+
<script type="module">
100+
app.component('v-organization', {
101+
template: '#v-organization-template',
102+
103+
data() {
104+
return {
105+
organizationName: null,
106+
};
107+
},
108+
109+
methods: {
110+
handleLookupAdded(event) {
111+
this.organizationName = event?.name || null;
112+
},
113+
},
114+
});
115+
</script>
116+
@endPushOnce
72117
</x-admin::layouts>

packages/Webkul/Admin/src/Resources/views/contacts/persons/edit.blade.php

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
<div class="flex flex-col gap-2">
1818
{!! view_render_event('admin.persons.edit.breadcrumbs.before') !!}
1919

20-
<x-admin::breadcrumbs
21-
name="contacts.persons.edit"
20+
<x-admin::breadcrumbs
21+
name="contacts.persons.edit"
2222
:entity="$person"
2323
/>
2424

@@ -51,6 +51,7 @@ class="primary-button"
5151

5252
<x-admin::attributes
5353
:custom-attributes="app('Webkul\Attribute\Repositories\AttributeRepository')->findWhere([
54+
['code', 'NOTIN', ['organization_id']],
5455
'entity_type' => 'persons',
5556
])"
5657
:custom-validations="[
@@ -64,11 +65,56 @@ class="primary-button"
6465
]"
6566
:entity="$person"
6667
/>
67-
68+
69+
<v-organization></v-organization>
70+
6871
{!! view_render_event('admin.contacts.persons.edit.form_controls.after') !!}
6972
</div>
7073
</div>
7174
</x-admin::form>
7275

7376
{!! view_render_event('admin.persons.edit.form.after') !!}
77+
78+
@pushOnce('scripts')
79+
<script
80+
type="text/x-template"
81+
id="v-organization-template"
82+
>
83+
<div>
84+
<x-admin::attributes
85+
:custom-attributes="app('Webkul\Attribute\Repositories\AttributeRepository')->findWhere([
86+
['code', 'IN', ['organization_id']],
87+
'entity_type' => 'persons',
88+
])"
89+
:entity="$person"
90+
/>
91+
92+
<template v-if="organizationName">
93+
<x-admin::form.control-group.control
94+
type="hidden"
95+
name="organization_name"
96+
v-model="organizationName"
97+
/>
98+
</template>
99+
</div>
100+
</script>
101+
102+
<script type="module">
103+
app.component('v-organization', {
104+
template: '#v-organization-template',
105+
106+
data() {
107+
return {
108+
organizationName: null,
109+
};
110+
},
111+
112+
methods: {
113+
handleLookupAdded(event) {
114+
this.organizationName = event?.name || null;
115+
},
116+
},
117+
});
118+
</script>
119+
@endPushOnce
74120
</x-admin::layouts>

0 commit comments

Comments
 (0)