Skip to content

Commit

Permalink
Merge branch 'feature/v6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
demtario committed May 17, 2024
2 parents f4f1fd3 + 130bdf2 commit 5165c8f
Show file tree
Hide file tree
Showing 14 changed files with 347 additions and 86 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- develop
- hotfix/*
- release/*
- feature/v*
jobs:
run:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "store-admin",
"version": "6.0.8",
"version": "6.1.0",
"private": true,
"description": "Admin panel for Heseya Store API",
"author": "Heseya",
Expand All @@ -19,7 +19,7 @@
"postinstall": "patch-package"
},
"dependencies": {
"@heseya/store-core": "6.0.3",
"@heseya/store-core": "6.1.0",
"@sentry/tracing": "^7.6.0",
"@sentry/vue": "^7.6.0",
"ant-design-vue": "^1.7.8",
Expand Down
2 changes: 1 addition & 1 deletion src/components/modules/media/MediaFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import { ALL_FILTER_VALUE } from '@/consts/filters'
export type MediaFiltersType = {
search: string
type: CdnMediaType | typeof ALL_FILTER_VALUE
has_relationships: boolean | typeof ALL_FILTER_VALUE
has_relationships: string | typeof ALL_FILTER_VALUE
}
export const EMPTY_MEDIA_FILTERS: MediaFiltersType = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/modules/orders/ShippingMethodForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</a-select-option>
</app-select>

<address-form v-if="shippingType === ShippingType.Address" v-model="form.shipping_place" />
<AddressForm v-if="shippingType === ShippingType.Address" v-model="form.shipping_place" />

<app-select
v-if="shippingType === ShippingType.Point"
Expand Down
79 changes: 79 additions & 0 deletions src/components/modules/pages/Filters.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<template>
<div>
<app-input
v-model="local.search"
class="span-2"
type="search"
:label="$t('common.search').toString()"
allow-clear
@input="debouncedSearch"
/>
</div>
</template>

<i18n lang="json">
{
"pl": {
"hasRelationships": "Czy posiada relacje",
"mediaType": "Typ mediów"
},
"en": {
"hasRelationships": "Has relationships",
"mediaType": "Media type"
}
}
</i18n>

<script lang="ts">
/* eslint-disable camelcase */
import { defineComponent, PropType } from 'vue'
import debounce from 'lodash/debounce'
export type PagesFiltersType = {
search: string
}
export const EMPTY_MEDIA_FILTERS: PagesFiltersType = {
search: '',
}
export default defineComponent({
props: {
filters: {
type: Object as PropType<PagesFiltersType>,
default: () => ({ ...EMPTY_MEDIA_FILTERS }),
},
},
data: () => ({
local: {
...EMPTY_MEDIA_FILTERS,
},
}),
watch: {
filters(filters: PagesFiltersType) {
this.local = { ...this.local, ...filters }
},
},
mounted() {
this.local = { ...this.local, ...this.filters }
},
methods: {
makeSearch() {
this.$emit('search', {
...this.filters,
...this.local,
})
},
debouncedSearch: debounce(function (this: any) {
this.$nextTick(() => {
this.makeSearch()
})
}, 300),
},
})
</script>
52 changes: 52 additions & 0 deletions src/components/modules/sales/CouponCodeGenerate.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<icon-button class="coupon-generate-btn" :disabled="disabled" @click="generateCoupon">
<template #icon>
<i class="bx bx-barcode"></i>
</template>
{{ $t('generateText') }}
</icon-button>
</template>

<i18n lang="json">
{
"en": {
"generateText": "Generate code"
},
"pl": {
"generateText": "Generuj kod"
}
}
</i18n>

<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
props: {
disabled: {
type: Boolean,
default: false,
},
},
emits: ['generate'],
methods: {
generateCoupon() {
const CODE_LENGTH = 10
const code = Array.from({ length: CODE_LENGTH }, () => Math.random().toString(36)[2])
.join('')
.toUpperCase()
this.$emit('generate', code)
},
},
})
</script>

<style scoped lang="scss">
.coupon-generate-btn {
flex-shrink: 0;
align-self: center;
width: 140px;
}
</style>
134 changes: 85 additions & 49 deletions src/components/modules/shippingMethods/Form.vue
Original file line number Diff line number Diff line change
@@ -1,56 +1,71 @@
<template>
<div class="shipping-methods-form">
<modal-form>
<div class="center">
<app-select
v-model="form.shipping_type"
<div class="shipping-methods-form__header">
<MediaUploadInput
:disabled="disabled"
option-filter-prop="label"
:label="$t('form.shippingType').toString()"
>
<a-select-option
v-for="shippingType in Object.values(ShippingType)"
:key="shippingType"
:label="$t(`shippingTypes.${shippingType}`)"
>
{{ $t(`shippingTypes.${shippingType}`) }}
</a-select-option>
</app-select>
</div>
<validated-input
v-model="form.name"
:disabled="disabled"
rules="required"
:label="$t('common.form.name')"
/>
:media="form.logo || undefined"
:file-name="$t('form.logo').toString()"
@upload="changeMedia"
/>

<div class="center">
<flex-input>
<label class="title">{{ $t('form.paymentBeforeDelivery') }}</label>
<a-switch v-model="form.payment_on_delivery" :disabled="disabled" />
<label class="title">{{ $t('form.paymentOnDelivery') }}</label>
</flex-input>
</div>
<div>
<div class="center">
<app-select
v-model="form.shipping_type"
:disabled="disabled"
option-filter-prop="label"
:label="$t('form.shippingType').toString()"
>
<a-select-option
v-for="shippingType in Object.values(ShippingType)"
:key="shippingType"
:label="$t(`shippingTypes.${shippingType}`)"
>
{{ $t(`shippingTypes.${shippingType}`) }}
</a-select-option>
</app-select>
</div>
<validated-input
v-model="form.name"
:disabled="disabled"
rules="required"
:label="$t('common.form.name')"
/>

<div v-show="!form.payment_on_delivery" class="center">
<app-select
v-model="form.payment_methods"
:disabled="disabled"
mode="multiple"
option-filter-prop="label"
:label="$t('form.paymentMethods')"
>
<a-select-option v-for="method in paymentMethods" :key="method.id" :label="method.name">
{{ method.name }}
</a-select-option>
</app-select>
</div>
<div class="center">
<flex-input>
<label class="title">{{ $t('form.paymentBeforeDelivery') }}</label>
<a-switch v-model="form.payment_on_delivery" :disabled="disabled" />
<label class="title">{{ $t('form.paymentOnDelivery') }}</label>
</flex-input>
</div>

<div class="center">
<flex-input>
<label class="title">{{ $t('form.public') }}</label>
<switch-input v-model="form.public" :disabled="disabled"> </switch-input>
</flex-input>
<div v-show="!form.payment_on_delivery" class="center">
<app-select
v-model="form.payment_methods"
:disabled="disabled"
mode="multiple"
option-filter-prop="label"
:label="$t('form.paymentMethods')"
>
<a-select-option
v-for="method in paymentMethods"
:key="method.id"
:label="method.name"
>
{{ method.name }}
</a-select-option>
</app-select>
</div>

<div class="center">
<flex-input>
<label class="title">{{ $t('form.public') }}</label>
<switch-input v-model="form.public" :disabled="disabled"> </switch-input>
</flex-input>
</div>
</div>
</div>

<hr />
Expand Down Expand Up @@ -193,6 +208,7 @@
{
"pl": {
"form": {
"logo": "logo metody dostawy",
"shippingType": "Typ dostawy",
"paymentMethods": "Dostępne metody płatności",
"public": "Widoczność metody dostawy",
Expand All @@ -216,6 +232,7 @@
},
"en": {
"form": {
"logo": "shipping method logo",
"shippingType": "Shipping type",
"paymentMethods": "Available payment methods",
"public": "Shipping method visibility",
Expand Down Expand Up @@ -249,12 +266,14 @@ import {
ShippingMethodCreateDto,
AddressDto,
ShippingType,
CdnMedia,
} from '@heseya/store-core'
import ModalForm from '@/components/form/ModalForm.vue'
import SwitchInput from '@/components/form/SwitchInput.vue'
import FlexInput from '@/components/layout/FlexInput.vue'
import AutocompleteInput from '@/components/AutocompleteInput.vue'
import MediaUploadInput from '@/components/modules/media/MediaUploadInput.vue'
import PriceRangesForm from './PriceRangesForm.vue'
import ShippingPointForm from './ShippingPoint.vue'
Expand All @@ -263,6 +282,8 @@ import ShippingPointsGrid from './ShippingPointsGrid.vue'
import { DEFAULT_ADDRESS_FORM } from '@/consts/addressConsts'
import CountriesSelect from '@/components/CountriesSelect.vue'
type ShippingMethodForm = ShippingMethodCreateDto & { logo?: CdnMedia | null }
export default defineComponent({
name: 'ShippingMethodsForm',
components: {
Expand All @@ -275,10 +296,11 @@ export default defineComponent({
ShippingPointForm,
ShippingPointsGrid,
CountriesSelect,
MediaUploadInput,
},
props: {
value: {
type: Object as PropType<ShippingMethodCreateDto>,
type: Object as PropType<ShippingMethodForm>,
required: true,
},
countries: {
Expand All @@ -299,10 +321,10 @@ export default defineComponent({
}),
computed: {
form: {
get(): ShippingMethodCreateDto {
get(): ShippingMethodForm {
return this.value
},
set(value: ShippingMethodCreateDto) {
set(value: ShippingMethodForm) {
this.$emit('input', value)
},
},
Expand Down Expand Up @@ -349,12 +371,26 @@ export default defineComponent({
removePoint(index: number) {
this.form.shipping_points?.splice(index, 1)
},
changeMedia(media: CdnMedia | null) {
this.form.logo = media ?? undefined
this.form.logo_id = media?.id || null
},
},
})
</script>

<style lang="scss">
.shipping-methods-form {
&__header {
display: grid;
grid-template-columns: 1fr;
gap: 24px;
@media ($viewport-8) {
grid-template-columns: 0.5fr 1fr;
}
}
.switch-input {
margin-top: 0;
}
Expand Down
Loading

0 comments on commit 5165c8f

Please sign in to comment.