Files
anahita-front/initialize/new-product.js
T
2024-07-10 16:22:10 +04:30

112 lines
3.7 KiB
JavaScript

export default () => {
const { t } = inject('service')
const categories = useCategoriesStore()
const config = reactive({
btns: {
next: {
props: {
label: t('nextLevel')
}
},
prev: {
props: {
label: t('prevLevel'), outlined: true
}
},
submit: {
props: {
label: t('submit')
}
},
},
fields: {
first: {
title: {
is: "InputText",
label: t("productName"),
props: { placeholder: "" },
},
titleEN: {
is: "InputText",
label: "Product Name",
props: { placeholder: "", class: '!ltr' },
},
category: {
is: "Dropdown",
label: t("category"),
props: {
placeholder: "", filter: true,
options: categories.items, optionLabel: "name", optionGroupChildren: "sub",
optionValue: "_id"
},
},
subCategory: {
is: "Dropdown",
label: t("subCategory"),
props: {
placeholder: "", optionLabel: "name", optionValue: "_id", options: [],
disabled: true
},
},
brandID: {
is: "Dropdown",
label: t("brand"),
props: { placeholder: "" , optionLabel: "title", optionValue: "_id"},
},
warranty: {
is: "InputText",
label: t("warranty"),
props: { placeholder: "" },
},
price: {
is: "InputNumber",
label: t("price"),
props: { placeholder: "" , prefix: t('priceUnit') },
},
localSend: {
is: "Checkbox",
label: t("sendFromAsanMarket"),
props: { binary: true, inputId: 'localSend' },
},
stockQuantity: {
is: "InputNumber",
label: t("number"),
props: { placeholder: "" },
},
boxSeller: {
is: "Checkbox",
label: t("wholesale"),
props: { binary: true, inputId: 'boxSeller' },
},
description: {
is: "Editor",
label: t("description"),
props: { placeholder: t("description"), editorStyle: "min-height: 156px" },
},
minBuy: {
is: "InputNumber",
label: t("minBuyNumber"),
props: { placeholder: "", disabled: true },
},
maxBuy: {
is: "InputNumber",
label: t("maxBuyNumber"),
props: { placeholder: "", disabled: true },
},
itemInBox: {
is: "InputNumber",
label: t("itemInBox"),
props: { placeholder: "", disabled: true },
},
},
}
})
config.fields.first.subCategory.props.disabled = computed(() => {
return config.fields.first.subCategory.props.options?.length < 1
})
return config;
}