Skip to content

Commit ae8df52

Browse files
committed
Merge remote-tracking branch 'origin/2.0' into lead
2 parents 21a66ec + 234cae7 commit ae8df52

File tree

2 files changed

+16
-32
lines changed

2 files changed

+16
-32
lines changed

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

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -139,43 +139,31 @@ class="px-4 py-2 text-center text-gray-500"
139139
};
140140
},
141141
142-
mounted() {
143-
this.initializeValue();
144-
145-
window.addEventListener('click', this.handleFocusOut);
146-
},
147-
148142
watch: {
149-
value: {
150-
deep: true,
151-
152-
handler() {
153-
this.initializeValue();
154-
},
155-
},
156-
157143
searchTerm(newVal, oldVal) {
158144
this.search();
159145
},
146+
147+
value(newVal, oldVal) {
148+
if (newVal) {
149+
this.getLookUpEntity();
150+
}
151+
},
152+
},
153+
154+
mounted() {
155+
if (this.value) {
156+
this.getLookUpEntity();
157+
}
158+
159+
window.addEventListener('click', this.handleFocusOut);
160160
},
161161
162162
beforeDestroy() {
163163
window.removeEventListener('click', this.handleFocusOut);
164164
},
165165
166166
methods: {
167-
initializeValue() {
168-
if (this.value) {
169-
if (this.value.id && this.value.name) {
170-
this.entityId = this.value.id;
171-
172-
this.selectedItem = this.value.name;
173-
} else if (this.value.id) {
174-
this.getLookUpEntity(this.value.id);
175-
}
176-
}
177-
},
178-
179167
toggle() {
180168
this.showPopup = ! this.showPopup;
181169

packages/Webkul/Contact/src/Repositories/PersonRepository.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,9 @@ public function create(array $data)
7474
*/
7575
public function update(array $data, $id, $attributes = [])
7676
{
77-
$data['user_id'] = $data['user_id'] ?? null;
77+
$data['user_id'] = empty($data['user_id']) ? null : $data['user_id'];
7878

79-
$person = $this->find($id);
80-
81-
$data['organization_id'] = $data['organization_id'] ?? $person->organization_id;
82-
83-
$person->update($data);
79+
$person = parent::update($data, $id);
8480

8581
/**
8682
* If attributes are provided then only save the provided attributes and return.

0 commit comments

Comments
 (0)