Skip to content

Commit e19dfbc

Browse files
Improved lookup attribute type
1 parent e4802d1 commit e19dfbc

File tree

19 files changed

+59
-50
lines changed

19 files changed

+59
-50
lines changed

packages/Webkul/Admin/src/Config/attribute_lookups.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
<?php
22

33
return [
4-
'organizations' => [
5-
'name' => 'Organization',
6-
'repository' => 'Webkul\Contact\Repositories\OrganizationRepository',
4+
'leads' => [
5+
'name' => 'Leads',
6+
'repository' => 'Webkul\Lead\Repositories\LeadRepository',
7+
'label_column' => 'title',
78
],
89

910
'lead_sources' => [
10-
'name' => 'Lead Source',
11+
'name' => 'Lead Sources',
1112
'repository' => 'Webkul\Lead\Repositories\SourceRepository',
1213
],
1314

1415
'lead_types' => [
15-
'name' => 'Lead Type',
16+
'name' => 'Lead Types',
1617
'repository' => 'Webkul\Lead\Repositories\TypeRepository',
1718
],
1819

@@ -22,15 +23,20 @@
2223
],
2324

2425
'lead_stages' => [
25-
'name' => 'Lead Stage',
26+
'name' => 'Lead Stages',
2627
'repository' => 'Webkul\Lead\Repositories\StageRepository',
2728
],
2829

2930
'users' => [
30-
'name' => 'Sales Owner',
31+
'name' => 'Sales Owners',
3132
'repository' => 'Webkul\User\Repositories\UserRepository',
3233
],
3334

35+
'organizations' => [
36+
'name' => 'Organizations',
37+
'repository' => 'Webkul\Contact\Repositories\OrganizationRepository',
38+
],
39+
3440
'persons' => [
3541
'name' => 'Persons',
3642
'repository' => 'Webkul\Contact\Repositories\PersonRepository',

packages/Webkul/Admin/src/Config/datagrid_filters.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,18 @@
1111
'name' => 'admin::app.leads.all',
1212
'isActive' => true,
1313
'key' => 'all',
14-
], [
15-
'name' => 'admin::app.leads.note',
16-
'isActive' => false,
17-
'key' => 'note',
1814
], [
1915
'name' => 'admin::app.leads.call',
2016
'isActive' => false,
2117
'key' => 'call',
22-
], [
23-
'name' => 'admin::app.leads.email',
24-
'isActive' => false,
25-
'key' => 'email',
2618
], [
2719
'name' => 'admin::app.leads.meeting',
2820
'isActive' => false,
2921
'key' => 'meeting',
22+
], [
23+
'name' => 'admin::app.leads.lunch',
24+
'isActive' => false,
25+
'key' => 'lunch',
3026
]
3127
]
3228
], [

packages/Webkul/Admin/src/Http/Controllers/Setting/AttributeController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ public function destroy($id)
155155
/**
156156
* Search attribute lookup results
157157
*
158-
* @param int $id
158+
* @param string $lookup
159159
* @return \Illuminate\Http\Response
160160
*/
161-
public function search($id)
161+
public function lookup($lookup)
162162
{
163-
$results = $this->attributeRepository->getLookUpOptions($id, request()->input('query'));
163+
$results = $this->attributeRepository->getLookUpOptions($lookup, request()->input('query'));
164164

165165
return response()->json($results);
166166
}

packages/Webkul/Admin/src/Http/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281

282282
Route::put('edit/{id}', 'AttributeController@update')->name('admin.settings.attributes.update');
283283

284-
Route::get('lookup/{id?}', 'AttributeController@search')->name('admin.settings.attributes.lookup');
284+
Route::get('lookup/{lookup?}', 'AttributeController@lookup')->name('admin.settings.attributes.lookup');
285285

286286
Route::delete('{id}', 'AttributeController@destroy')->name('admin.settings.attributes.delete');
287287

packages/Webkul/Admin/src/Resources/views/activities/edit.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,13 @@
9090
</div>
9191
</div>
9292

93+
9394
@include ('admin::common.custom-attributes.edit.multi-lookup')
9495

9596
<div class="form-group">
9697
<label for="participants">{{ __('admin::app.activities.participants') }}</label>
9798

98-
<multi-lookup-component :attribute="{'id': 20, 'code': 'participants[]', 'name': 'Participants'}" :data='@json($activity->participants)'></multi-lookup-component>
99+
<multi-lookup-component :attribute="{'lookup_type': 'users', 'code': 'participants[]', 'name': 'Participants'}" :data='@json($activity->participants)'></multi-lookup-component>
99100
</div>
100101

101102
{!! view_render_event('admin.activities.edit.form_controls.after', ['activity' => $activity]) !!}

packages/Webkul/Admin/src/Resources/views/common/custom-attributes/edit/checkbox.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
@php
44
$options = $attribute->lookup_type
5-
? app('Webkul\Attribute\Repositories\AttributeRepository')->getLookUpOptions($attribute->id)
5+
? app('Webkul\Attribute\Repositories\AttributeRepository')->getLookUpOptions($attribute->lookup_type)
66
: $attribute->options()->orderBy('sort_order')->get();
77
88
$selectedOption = old($attribute->code) ?: $value;

packages/Webkul/Admin/src/Resources/views/common/custom-attributes/edit/lookup.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if (isset($attribute))
22
@php
33
$lookUpEntityData = app('Webkul\Attribute\Repositories\AttributeRepository')
4-
->getLookUpEntity($attribute->code, old($attribute->code) ?: $value);
4+
->getLookUpEntity($attribute->lookup_type, old($attribute->code) ?: $value);
55
@endphp
66

77
<lookup-component :attribute='@json($attribute)' :validations="'{{$validations}}'" :data='@json($lookUpEntityData)'></lookup-component>
@@ -55,7 +55,7 @@
5555
5656
results: [],
5757
58-
search_route: this.searchRoute ?? `{{ route('admin.settings.attributes.lookup') }}/${this.attribute.id}`,
58+
search_route: this.searchRoute ?? `{{ route('admin.settings.attributes.lookup') }}/${this.attribute.lookup_type}`,
5959
}
6060
},
6161

packages/Webkul/Admin/src/Resources/views/common/custom-attributes/edit/lookup.blade1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
7676
var self = this;
7777
78-
this.$http.get("{{ route('admin.settings.attributes.lookup', $attribute->id) }}", {params: {query: this.search_term}})
78+
this.$http.get("{{ route('admin.settings.attributes.lookup', $attribute->lookup_type) }}", {params: {query: this.search_term}})
7979
.then (function(response) {
8080
self.results = response.data;
8181

packages/Webkul/Admin/src/Resources/views/common/custom-attributes/edit/multi-lookup.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if (isset($attribute))
22
@php
33
$lookUpEntityData = app('Webkul\Attribute\Repositories\AttributeRepository')
4-
->getLookUpEntity($attribute->code, old($attribute->code) ?: $value);
4+
->getLookUpEntity($attribute->lookup_type, old($attribute->code) ?: $value);
55
@endphp
66

77
<multi-lookup-component :attribute='@json($attribute)' :validations="'{{$validations}}'" :data='@json($lookUpEntityData)'></multi-lookup-component>
@@ -60,7 +60,7 @@
6060
6161
results: [],
6262
63-
search_route: this.searchRoute ?? `{{ route('admin.settings.attributes.lookup') }}/${this.attribute.id}`,
63+
search_route: this.searchRoute ?? `{{ route('admin.settings.attributes.lookup') }}/${this.attribute.lookup_type}`,
6464
}
6565
},
6666

packages/Webkul/Admin/src/Resources/views/common/custom-attributes/edit/multiselect.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
@php
44
$options = $attribute->lookup_type
5-
? app('Webkul\Attribute\Repositories\AttributeRepository')->getLookUpOptions($attribute->id)
5+
? app('Webkul\Attribute\Repositories\AttributeRepository')->getLookUpOptions($attribute->lookup_type)
66
: $attribute->options()->orderBy('sort_order')->get();
77
88
$selectedOption = old($attribute->code) ?: $value;

0 commit comments

Comments
 (0)