Skip to content

Commit f4b7dfc

Browse files
committed
refactor: simplify inline text edit component and update product total label
1 parent 23b44a6 commit f4b7dfc

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

packages/Webkul/Admin/src/Resources/views/components/form/control-group/controls/inline/text.blade.php

+4-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<v-inline-text-edit
66
{{ $attributes }}
7-
:allow-edit="{{ $allowEdit ? 'true' : 'false' }}"
7+
:allow-edit="{{ $allowEdit }}"
88
>
99
<div class="group w-full max-w-full hover:rounded-sm">
1010
<div class="rounded-xs flex h-[34px] items-center pl-2.5 text-left">
@@ -37,11 +37,9 @@ class="group relative h-[18px] !w-full pl-2.5"
3737
:style="{ 'text-align': position }"
3838
>
3939
<span class="cursor-pointer truncate rounded">
40-
@{{
41-
(transformedLabel || inputValue || '').length > 20
42-
? (transformedLabel || inputValue).substring(0, 20) + '...'
43-
: (transformedLabel || inputValue)
44-
}}
40+
@{{ (valueLabel || inputValue || '').length > 20
41+
? (valueLabel || inputValue).substring(0, 20) + '...'
42+
: (valueLabel || inputValue) }}
4543
</span>
4644
4745
<!-- Tooltip -->
@@ -175,8 +173,6 @@ class="flex items-center justify-center bg-red-100 p-1 hover:bg-red-200 ltr:roun
175173
isEditing: false,
176174
177175
isRTL: document.documentElement.dir === 'rtl',
178-
179-
transformedLabel: this.valueLabel,
180176
};
181177
},
182178
@@ -217,8 +213,6 @@ class="flex items-center justify-center bg-red-100 p-1 hover:bg-red-200 ltr:roun
217213
218214
if (this.url) {
219215
let formData = new FormData();
220-
221-
this.transformedLabel = this.inputValue;
222216
223217
formData.append(this.name, this.inputValue);
224218
@@ -234,8 +228,6 @@ class="flex items-center justify-center bg-red-100 p-1 hover:bg-red-200 ltr:roun
234228
.catch((error) => {
235229
this.inputValue = this.value;
236230
237-
this.transformedLabel = this.inputValue;
238-
239231
this.$emitter.emit('add-flash', { type: 'error', message: error.response.data.message });
240232
});
241233
}

packages/Webkul/Admin/src/Resources/views/leads/common/products.blade.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class="flex max-w-max items-center gap-2 text-brandColor"
144144
</x-admin::form.control-group>
145145
</x-admin::table.td>
146146
147-
<!-- Total -->
147+
<!-- Amount -->
148148
<x-admin::table.td class="text-right">
149149
<x-admin::form.control-group>
150150
<x-admin::form.control-group.control
@@ -154,7 +154,8 @@ class="flex max-w-max items-center gap-2 text-brandColor"
154154
rules="required|decimal:4"
155155
:label="trans('admin::app.leads.common.products.total')"
156156
:placeholder="trans('admin::app.leads.common.products.total')"
157-
::allowEdit="false"
157+
::value-label="$admin.formatPrice(product.price * product.quantity)"
158+
:allowEdit="'false'"
158159
position="center"
159160
/>
160161
</x-admin::form.control-group>

0 commit comments

Comments
 (0)