diff --git a/package.json b/package.json index 82e446da..d55f42a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "store-admin", - "version": "7.0.2", + "version": "7.0.3", "private": true, "description": "Admin panel for Heseya Store API", "author": "Heseya", @@ -19,7 +19,7 @@ "postinstall": "patch-package" }, "dependencies": { - "@heseya/store-core": "7.0.0", + "@heseya/store-core": "7.1.0-beta.2", "@sentry/tracing": "^7.6.0", "@sentry/vue": "^7.6.0", "ant-design-vue": "^1.7.8", diff --git a/src/components/modules/sales/ConditionForm.vue b/src/components/modules/sales/ConditionForm.vue index 9e5889e2..4f62971f 100644 --- a/src/components/modules/sales/ConditionForm.vue +++ b/src/components/modules/sales/ConditionForm.vue @@ -60,7 +60,8 @@ "max-uses-per-user": "Max uses per user", "weekday-in": "Weekday in", "cart-length": "Number of products in the cart", - "coupons-count": "Number of coupons in the cart" + "coupons-count": "Number of coupons in the cart", + "on-sale": "Product price" } }, "pl": { @@ -79,7 +80,8 @@ "max-uses-per-user": "Maksymalna liczba użyć na użytkownika", "weekday-in": "Wybrane dni tygodnia", "cart-length": "Ilość produktów w koszyku", - "coupons-count": "Ilość kuponów w koszyku" + "coupons-count": "Ilość kuponów w koszyku", + "on-sale": "Cena produktu" } } } @@ -98,6 +100,7 @@ import DateBetweenForm from './forms/DateBetweenForm.vue' import TimeBetweenForm from './forms/TimeBetweenForm.vue' import WeekdayInForm from './forms/WeekdayInForm.vue' import EntitiesForm from './forms/EntitiesForm.vue' +import OnSaleForm from './forms/OnSaleForm.vue' import * as SALES_FORMS from '@/consts/salesConditionsForms' @@ -111,6 +114,7 @@ export default defineComponent({ TimeBetweenForm, WeekdayInForm, EntitiesForm, + OnSaleForm, }, props: { value: { type: Object as PropType, required: true }, @@ -154,6 +158,8 @@ export default defineComponent({ case DiscountConditionType.ProductInSet: case DiscountConditionType.ProductIn: return 'EntitiesForm' + case DiscountConditionType.OnSale: + return 'OnSaleForm' default: return 'div' } @@ -213,6 +219,9 @@ export default defineComponent({ case DiscountConditionType.CouponsCount: this.condition = cloneDeep(SALES_FORMS.EMPTY_COUPONS_COUNT_FORM) break + case DiscountConditionType.OnSale: + this.condition = cloneDeep(SALES_FORMS.EMPTY_ON_SALE_FORM) + break default: throw new Error(`Unknown condition type: ${newType}`) } diff --git a/src/components/modules/sales/forms/OnSaleForm.vue b/src/components/modules/sales/forms/OnSaleForm.vue new file mode 100644 index 00000000..ddeb8dd0 --- /dev/null +++ b/src/components/modules/sales/forms/OnSaleForm.vue @@ -0,0 +1,72 @@ + + + +{ + "en": { + "form": { + "on_sale": "Only for non-priced products" + }, + "tooltips": { + "on_sale": "If checked, this code will only apply to products that are not discounted" + } + }, + "pl": { + "form": { + "on_sale": "Tylko dla produktów nieprzecenionych" + }, + "tooltips": { + "on_sale": "Jeżeli zaznaczone, kod ten będzie miał zastosowanie tylko dla produktów nieprzecenionych" + } + } +} + + + diff --git a/src/consts/salesConditionsForms.ts b/src/consts/salesConditionsForms.ts index 41d3fbff..976fc5e5 100644 --- a/src/consts/salesConditionsForms.ts +++ b/src/consts/salesConditionsForms.ts @@ -12,6 +12,7 @@ import { UserInRoleDiscountConditionDto, WeekdayInDiscountConditionDto, CouponsCountDiscountConditionDto, + OnSaleDiscountConditionDto, } from '@heseya/store-core' export const EMPTY_ORDER_VALUE_FORM: OrderValueDiscountConditionDto = { @@ -86,3 +87,8 @@ export const EMPTY_COUPONS_COUNT_FORM: CouponsCountDiscountConditionDto = { min_value: 0, max_value: 0, } + +export const EMPTY_ON_SALE_FORM: OnSaleDiscountConditionDto = { + type: DiscountConditionType.OnSale, + on_sale: true, +} diff --git a/yarn.lock b/yarn.lock index 6d81fb0f..32d8c430 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1224,10 +1224,10 @@ dependencies: "@hapi/hoek" "^9.0.0" -"@heseya/store-core@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@heseya/store-core/-/store-core-7.0.0.tgz#5a1199b817e2c3f696456e01cd76370124cf337b" - integrity sha512-Rk/gX5ao+p8de5o5jtFapr4AV0uEJHDXGVq5VXXYLSMWsMfwNIyto0lC/GQvvvi3k3iUDcE+XB3zrpJKtRt12g== +"@heseya/store-core@7.1.0-rc2": + version "7.1.0-beta.2" + resolved "https://registry.yarnpkg.com/@heseya/store-core/-/store-core-7.1.0-beta.2.tgz#fe75d681f5f3c7d5fa4b5037d2122117b738f8fb" + integrity sha512-a7lmTvOWPh1g7+Bq3Fv3szlJ6RaycR9co89Sh0Ydevg8NydCN9haLTlEltkKhPvkFlHdNa8DbsuqZfa19IqaEw== dependencies: flat "^5.0.2" form-data "^4.0.0"