|
|
|
@@ -10,7 +10,7 @@ |
|
|
|
<div class="modal-dialog modal-sm" role="document"> |
|
|
|
<div class="modal-content"> |
|
|
|
<div class="modal-header"> |
|
|
|
<h5 class="modal-title" id="exampleModalLabel">ویرایش رنگ</h5> |
|
|
|
<h5 class="modal-title" id="exampleModalLabel">ویرایش ویژگی</h5> |
|
|
|
<button |
|
|
|
type="button" |
|
|
|
class="btn-close" |
|
|
|
@@ -44,6 +44,7 @@ |
|
|
|
style="margin-top: 20px" |
|
|
|
> |
|
|
|
<button |
|
|
|
type="button" |
|
|
|
class="btn btn-secondary" |
|
|
|
data-bs-dismiss="modal" |
|
|
|
id="close" |
|
|
|
@@ -51,9 +52,9 @@ |
|
|
|
بستن |
|
|
|
</button> |
|
|
|
|
|
|
|
<button @click="handlerSubmitCategory" class="btn btn-primary" :disabled="loading"> |
|
|
|
<button @click="handlerSubmitAttribute" class="btn btn-primary" :disabled="loadingAttr"> |
|
|
|
<span |
|
|
|
v-if="loading" |
|
|
|
v-if="loadingAttr" |
|
|
|
class="spinner-border spinner-border-sm" |
|
|
|
role="status" |
|
|
|
aria-hidden="true" |
|
|
|
@@ -133,6 +134,7 @@ |
|
|
|
style="margin-top: 20px" |
|
|
|
> |
|
|
|
<button |
|
|
|
type="button" |
|
|
|
class="btn btn-secondary" |
|
|
|
data-bs-dismiss="modal" |
|
|
|
id="close" |
|
|
|
@@ -141,12 +143,12 @@ |
|
|
|
</button> |
|
|
|
|
|
|
|
<button type="submit" class="btn btn-primary" :disabled="loading"> |
|
|
|
<span |
|
|
|
v-if="loading" |
|
|
|
class="spinner-border spinner-border-sm" |
|
|
|
role="status" |
|
|
|
aria-hidden="true" |
|
|
|
/> |
|
|
|
<span |
|
|
|
v-if="loading" |
|
|
|
class="spinner-border spinner-border-sm" |
|
|
|
role="status" |
|
|
|
aria-hidden="true" |
|
|
|
/> |
|
|
|
ذخیره |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
@@ -200,6 +202,7 @@ export default { |
|
|
|
const categories = ref([]); |
|
|
|
const locale = ref('fa'); |
|
|
|
const loadingDelete = ref(false); |
|
|
|
const loadingAttr = ref(false); |
|
|
|
|
|
|
|
const attrRowModel = computed({ |
|
|
|
get: () => props.attrRow, |
|
|
|
@@ -304,11 +307,9 @@ export default { |
|
|
|
|
|
|
|
attrRowModel.value = updatedCategory; |
|
|
|
|
|
|
|
console.log(attrRowModel.value,'attrRowModel.value') |
|
|
|
|
|
|
|
toast.success(data?.message) |
|
|
|
|
|
|
|
emit("cat-updated"); |
|
|
|
emit("attribute-updated"); |
|
|
|
} |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
@@ -337,11 +338,11 @@ export default { |
|
|
|
const updatedCategory = props.attrRow; |
|
|
|
|
|
|
|
if (findLocale) { |
|
|
|
updatedCategory.translations = data?.data?.translations || []; |
|
|
|
updatedCategory.translations = data?.translations || []; |
|
|
|
} else { |
|
|
|
updatedCategory.translations = [ |
|
|
|
...(updatedCategory.translations || []), |
|
|
|
...(data?.data?.translations || []) |
|
|
|
...(data?.translations || []) |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -381,6 +382,28 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const handlerSubmitAttribute = async () => { |
|
|
|
try { |
|
|
|
loadingAttr.value = true; |
|
|
|
|
|
|
|
const params = { |
|
|
|
category_id: categoryId.value, |
|
|
|
} |
|
|
|
|
|
|
|
const { data: { success, message } } = await ApiServiece.put(`admin/attributes/${props.attrRow?.id}`, params) |
|
|
|
|
|
|
|
if (success) { |
|
|
|
toast.success(message) |
|
|
|
|
|
|
|
emit("attribute-updated"); |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
toast.error(e?.response?.data?.message) |
|
|
|
} finally { |
|
|
|
loadingAttr.value = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
getAttributes() |
|
|
|
|
|
|
|
return { |
|
|
|
@@ -399,6 +422,8 @@ export default { |
|
|
|
findLocaleTranslation, |
|
|
|
handlerRemoveTranslation, |
|
|
|
loadingDelete, |
|
|
|
handlerSubmitAttribute, |
|
|
|
loadingAttr, |
|
|
|
}; |
|
|
|
}, |
|
|
|
}; |
|
|
|
|