Merge branch 'master' into frontend-performance-improvements

This commit is contained in:
Darko Gjorgjijoski
2025-05-05 02:24:27 +02:00
committed by GitHub
257 changed files with 30966 additions and 11128 deletions

View File

@@ -4,7 +4,7 @@
<div class="flex justify-between w-full">
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="onCancel"
/>
@@ -78,7 +78,7 @@
<template #left="slotProps">
<BaseIcon
v-if="!isCreateLoading"
name="SaveIcon"
name="ArrowDownOnSquareIcon"
:class="slotProps.class"
/>
</template>

View File

@@ -4,7 +4,7 @@
<div class="flex justify-between w-full">
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="closeCategoryModal"
/>
@@ -74,7 +74,7 @@
<template #left="slotProps">
<BaseIcon
v-if="!isSaving"
name="SaveIcon"
name="ArrowDownOnSquareIcon"
:class="slotProps.class"
/>
</template>

View File

@@ -5,7 +5,7 @@
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="closeCompanyModal"
/>
@@ -117,7 +117,7 @@
<template #left="slotProps">
<BaseIcon
v-if="!isSaving"
name="SaveIcon"
name="ArrowDownOnSquareIcon"
:class="slotProps.class"
/>
</template>

View File

@@ -9,7 +9,7 @@
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="h-6 w-6 text-gray-500 cursor-pointer"
@click="closeCustomerModal"
/>
@@ -167,7 +167,7 @@
>
<template #right>
<BaseIcon
:name="isShowPassword ? 'EyeIcon' : 'EyeOffIcon'"
:name="isShowPassword ? 'EyeIcon' : 'EyeSlashIcon'"
class="mr-1 text-gray-500 cursor-pointer"
@click="isShowPassword = !isShowPassword"
/>
@@ -193,7 +193,7 @@
>
<template #right>
<BaseIcon
:name="isShowConfirmPassword ? 'EyeIcon' : 'EyeOffIcon'"
:name="isShowConfirmPassword ? 'EyeIcon' : 'EyeSlashIcon'"
class="mr-1 text-gray-500 cursor-pointer"
@click="isShowConfirmPassword = !isShowConfirmPassword"
/>
@@ -438,7 +438,7 @@
<template #left="slotProps">
<BaseIcon
v-if="!isLoading"
name="SaveIcon"
name="ArrowDownOnSquareIcon"
:class="slotProps.class"
/>
</template>

View File

@@ -9,7 +9,7 @@
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="closeExchangeRateModal"
/>
@@ -171,7 +171,7 @@
<template #left="slotProps">
<BaseIcon
v-if="!isSaving"
name="SaveIcon"
name="ArrowDownOnSquareIcon"
:class="slotProps.class"
/>
</template>

View File

@@ -4,7 +4,7 @@
<div class="flex justify-between w-full">
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="h-6 w-6 text-gray-500 cursor-pointer"
@click="closeDiskModal"
/>
@@ -40,7 +40,7 @@
>
<BaseIcon
v-if="!isRequestFire(slotProps)"
name="SaveIcon"
name="ArrowDownOnSquareIcon"
class="w-6 mr-2"
/>

View File

@@ -4,7 +4,7 @@
<div class="flex justify-between w-full">
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="h-6 w-6 text-gray-500 cursor-pointer"
@click="closeItemModal"
/>
@@ -107,7 +107,7 @@
type="submit"
>
<template #left="slotProps">
<BaseIcon name="SaveIcon" :class="slotProps.class" />
<BaseIcon name="ArrowDownOnSquareIcon" :class="slotProps.class" />
</template>
{{ itemStore.isEdit ? $t('general.update') : $t('general.save') }}
</BaseButton>
@@ -178,7 +178,7 @@ const taxes = computed({
return {
...tax,
tax_type_id: tax.id,
tax_name: tax.name + ' (' + tax.percent + '%)',
tax_name: tax.name + ' (' + (tax.calculation_type === 'fixed' ? tax.fixed_amount : tax.percent) + (tax.calculation_type === 'fixed' ? companyStore.selectedCompanyCurrency.symbol : '%') + ')',
}
}
}),
@@ -217,7 +217,17 @@ const v$ = useVuelidate(
const getTaxTypes = computed(() => {
return taxTypeStore.taxTypes.map((tax) => {
return { ...tax, tax_name: tax.name + ' (' + tax.percent + '%)' }
const amount = tax.calculation_type === 'fixed'
? new Intl.NumberFormat(undefined, {
style: 'currency',
currency: companyStore.selectedCompanyCurrency.code
}).format(tax.fixed_amount / 100)
: `${tax.percent}%`
return {
...tax,
tax_name: `${tax.name} (${amount})`
}
})
})
@@ -238,8 +248,10 @@ async function submitItemData() {
taxes: itemStore.currentItem.taxes.map((tax) => {
return {
tax_type_id: tax.id,
amount: (price.value * tax.percent) / 100,
amount: tax.calculation_type === 'fixed' ? tax.fixed_amount : (price.value * tax.percent) / 100,
percent: tax.percent,
fixed_amount: tax.fixed_amount,
calculation_type: tax.calculation_type,
name: tax.name,
collective_tax: 0,
}

View File

@@ -7,7 +7,7 @@
<div class="flex justify-between w-full">
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="closeItemUnitModal"
/>
@@ -58,7 +58,7 @@
<template #left="slotProps">
<BaseIcon
v-if="!isSaving"
name="SaveIcon"
name="ArrowDownOnSquareIcon"
:class="slotProps.class"
/>
</template>

View File

@@ -4,7 +4,7 @@
<div class="flex justify-between w-full">
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="closeTestModal"
/>

View File

@@ -4,7 +4,7 @@
<div class="flex justify-between w-full">
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="h-6 w-6 text-gray-500 cursor-pointer"
@click="closeNoteModal"
/>
@@ -45,6 +45,11 @@
class="mt-2"
/>
</BaseInputGroup>
<BaseSwitchSection
v-model="noteStore.currentNote.is_default"
:title="$t('settings.customization.notes.is_default')"
:description="$t('settings.customization.notes.is_default_description')"
_ />
<BaseInputGroup
:label="$t('settings.customization.notes.notes')"
@@ -89,7 +94,7 @@
type="submit"
>
<template #left="slotProps">
<BaseIcon name="SaveIcon" :class="slotProps.class" />
<BaseIcon name="ArrowDownOnSquareIcon" :class="slotProps.class" />
</template>
{{ noteStore.isEdit ? $t('general.update') : $t('general.save') }}
</BaseButton>

View File

@@ -4,7 +4,7 @@
<div class="flex justify-between w-full">
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="closePaymentModeModal"
/>
@@ -48,7 +48,7 @@
type="submit"
>
<template #left="slotProps">
<BaseIcon name="SaveIcon" :class="slotProps.class" />
<BaseIcon name="ArrowDownOnSquareIcon" :class="slotProps.class" />
</template>
{{
paymentStore.currentPaymentMode.id

View File

@@ -5,7 +5,7 @@
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="closeRolesModal"
/>
@@ -140,7 +140,7 @@
type="submit"
>
<template #left="slotProps">
<BaseIcon name="SaveIcon" :class="slotProps.class" />
<BaseIcon name="ArrowDownOnSquareIcon" :class="slotProps.class" />
</template>
{{ !roleStore.isEdit ? $t('general.save') : $t('general.update') }}
</BaseButton>

View File

@@ -4,7 +4,7 @@
<div class="flex justify-between w-full">
{{ modalTitle }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="h-6 w-6 text-gray-500 cursor-pointer"
@click="closeModal"
/>
@@ -76,7 +76,7 @@
</BaseButton>
<BaseButton variant="primary" @click="chooseTemplate()">
<template #left="slotProps">
<BaseIcon name="SaveIcon" :class="slotProps.class" />
<BaseIcon name="ArrowDownOnSquareIcon" :class="slotProps.class" />
</template>
{{ $t('general.choose') }}
</BaseButton>

View File

@@ -8,7 +8,7 @@
<div class="flex justify-between w-full">
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="h-6 w-6 text-gray-500 cursor-pointer"
@click="closeSendEstimateModal"
/>
@@ -82,7 +82,7 @@
class="mr-3"
@click="submitForm"
>
<BaseIcon v-if="!isLoading" name="PhotographIcon" class="h-5 mr-2" />
<BaseIcon v-if="!isLoading" name="PhotoIcon" class="h-5 mr-2" />
{{ $t('general.preview') }}
</BaseButton>
</div>

View File

@@ -8,7 +8,7 @@
<div class="flex justify-between w-full">
{{ modalTitle }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="closeSendInvoiceModal"
/>
@@ -88,7 +88,7 @@
<BaseIcon
v-if="!isLoading"
:class="slotProps.class"
name="PhotographIcon"
name="PhotoIcon"
/>
</template>
{{ $t('general.preview') }}

View File

@@ -8,7 +8,7 @@
<div class="flex justify-between w-full">
{{ modalTitle }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="closeSendPaymentModal"
/>
@@ -88,7 +88,7 @@
<BaseIcon
v-if="!isLoading"
:class="slotProps.class"
name="PhotographIcon"
name="PhotoIcon"
/>
</template>
{{ $t('general.preview') }}

View File

@@ -7,7 +7,7 @@
<div class="flex justify-between w-full">
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="h-6 w-6 text-gray-500 cursor-pointer"
@click="closeTaxTypeModal"
/>
@@ -34,12 +34,28 @@
</BaseInputGroup>
<BaseInputGroup
:label="$t('tax_types.tax_type')"
variant="horizontal"
required
>
<BaseSelectInput
v-model="taxTypeStore.currentTaxType.calculation_type"
:options="[
{ id: 'percentage', label: $t('tax_types.percentage') },
{ id: 'fixed', label: $t('tax_types.fixed_amount') }
]"
:allow-empty="false"
value-prop="id"
label-prop="label"
track-by="label"
:searchable="false"
/>
</BaseInputGroup>
<BaseInputGroup
v-if="taxTypeStore.currentTaxType.calculation_type === 'percentage'"
:label="$t('tax_types.percent')"
variant="horizontal"
:error="
v$.currentTaxType.percent.$error &&
v$.currentTaxType.percent.$errors[0].$message
"
required
>
<BaseMoney
@@ -51,13 +67,18 @@
precision: 2,
masked: false,
}"
:invalid="v$.currentTaxType.percent.$error"
class="
relative
w-full
focus:border focus:border-solid focus:border-primary
"
@input="v$.currentTaxType.percent.$touch()"
/>
</BaseInputGroup>
<BaseInputGroup
v-else
:label="$t('tax_types.fixed_amount')"
variant="horizontal"
required
>
<BaseMoney
v-model="fixedAmount"
:currency="defaultCurrency"
/>
</BaseInputGroup>
@@ -105,7 +126,7 @@
<template #left="slotProps">
<BaseIcon
v-if="!isSaving"
name="SaveIcon"
name="ArrowDownOnSquareIcon"
:class="slotProps.class"
/>
</template>
@@ -127,6 +148,8 @@ import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import Guid from 'guid'
import TaxStub from '@/scripts/admin/stub/abilities'
import { useCompanyStore } from '@/scripts/admin/stores/company'
import {
required,
minLength,
@@ -148,6 +171,8 @@ const taxTypeStore = useTaxTypeStore()
const modalStore = useModalStore()
const notificationStore = useNotificationStore()
const estimateStore = useEstimateStore()
const companyStore = useCompanyStore()
const defaultCurrency = computed(() => companyStore.selectedCompanyCurrency)
const { t, tm } = useI18n()
let isSaving = ref(false)
@@ -162,6 +187,9 @@ const rules = computed(() => {
minLength(3)
),
},
calculation_type: {
required: helpers.withMessage(t('validation.required'), required),
},
percent: {
required: helpers.withMessage(t('validation.required'), required),
between: helpers.withMessage(
@@ -169,6 +197,9 @@ const rules = computed(() => {
between(-100, 100)
),
},
fixed_amount: {
required: helpers.withMessage(t('validation.required'), required),
},
description: {
maxLength: helpers.withMessage(
t('validation.description_maxlength', { count: 255 }),
@@ -206,16 +237,22 @@ async function submitTaxTypeData() {
function SelectTax(taxData) {
let amount = 0
if (estimateStore.getSubtotalWithDiscount && taxData.percent) {
amount = Math.round(
(estimateStore.getSubtotalWithDiscount * taxData.percent) / 100
)
if (estimateStore.getSubtotalWithDiscount) {
if (taxData.calculation_type === 'percentage') {
amount = Math.round(
(estimateStore.getSubtotalWithDiscount * taxData.percent) / 100
)
} else {
amount = taxData.fixed_amount
}
}
let data = {
...TaxStub,
id: Guid.raw(),
name: taxData.name,
calculation_type: taxData.calculation_type,
percent: taxData.percent,
fixed_amount: taxData.fixed_amount,
tax_type_id: taxData.id,
amount,
}
@@ -230,7 +267,9 @@ function selectItemTax(taxData) {
...TaxStub,
id: Guid.raw(),
name: taxData.name,
calculation_type: taxData.calculation_type,
percent: taxData.percent,
fixed_amount: taxData.fixed_amount,
tax_type_id: taxData.id,
}
modalStore.refreshData(data)
@@ -244,4 +283,11 @@ function closeTaxTypeModal() {
v$.value.$reset()
}, 300)
}
const fixedAmount = computed({
get: () => taxTypeStore.currentTaxType.fixed_amount / 100,
set: (value) => {
taxTypeStore.currentTaxType.fixed_amount = Math.round(value * 100)
},
})
</script>

View File

@@ -10,7 +10,7 @@
</p>
</div>
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="h-6 w-6 text-gray-500 cursor-pointer"
@click="closeModal"
/>
@@ -103,7 +103,7 @@
<template #left="slotProps">
<BaseIcon
v-if="!isLoading"
name="SaveIcon"
name="ArrowDownOnSquareIcon"
:class="slotProps.class"
/>
</template>

View File

@@ -5,7 +5,7 @@
{{ modalStore.title }}
<BaseIcon
name="XIcon"
name="XMarkIcon"
class="w-6 h-6 text-gray-500 cursor-pointer"
@click="closeCustomFieldModal"
/>
@@ -201,7 +201,7 @@
<BaseIcon
v-if="!isSaving"
:class="slotProps.class"
name="SaveIcon"
name="ArrowDownOnSquareIcon"
/>
</template>
{{