fix ui issues and upload image for guild good

This commit is contained in:
2026-04-18 12:14:39 +03:30
parent ac23d47b79
commit e027b89173
32 changed files with 353 additions and 177 deletions
+20
View File
@@ -0,0 +1,20 @@
import { Maybe } from '@/core';
import { apiEnumTranslates } from '@/shared/apiEnum/constants';
const translates = {
COUNT: 'تعداد',
GRAM: 'گرم',
KILOGRAM: 'کیلوگرم',
METER: 'متر',
MILLILITER: 'میلی‌لیتر',
LITER: 'لیتر',
HOUR: 'ساعت',
};
export function enumTranslator(key: Maybe<string>): string {
if (!key) {
return '';
}
// @ts-ignore
return apiEnumTranslates[key] || translates[key] || key;
}
+25
View File
@@ -0,0 +1,25 @@
export function buildFormData(
formGroup: any,
fileProperties: { [key: string]: File | null } = {},
): FormData {
const formData = new FormData();
console.log(formGroup);
console.log(formGroup.controls);
Object.keys(formGroup.controls).forEach((key) => {
const control = formGroup.get(key);
if (control && control.value !== null && control.value !== undefined) {
formData.append(key, control.value);
}
});
Object.keys(fileProperties).forEach((key) => {
const file = fileProperties[key];
if (file) {
formData.append(key, file, file.name);
}
});
return formData;
}
+3
View File
@@ -1,6 +1,9 @@
export * from './currency';
export * from './date-formatter.utils';
export * from './enum-translator.utils';
export * from './form-data.util';
export * from './good-unit-types.utils';
export * from './license-status.utils';
export * from './name';
export * from './page-params.utils';
export * from './price-mask.utils';
+12
View File
@@ -0,0 +1,12 @@
import { Maybe } from '@/core';
import { licenseStatus } from '@/shared/localEnum/constants/licenseStatus';
export function getLicenseStatus(licenseExpiresAt?: Maybe<string>) {
if (!licenseExpiresAt) {
return null;
}
if (new Date().getTime() > new Date(licenseExpiresAt || '').getTime()) {
return licenseStatus.EXPIRED;
}
return licenseStatus.ACTIVE;
}