Apps, web, i18n, UI, partners, payouts, backoffice, bariki, prod infra
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
45d7512d2b
commit
3489e0b816
319 files changed
+45483
-121
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import type { TFunction } from '@barev/i18n';
|
||||
|
||||
/** Краткое описание параметров заказа: «Генеральная · 2 комнаты · 2 санузла» */
|
||||
export function paramsSummary(t: TFunction, serviceCode: string, params: Record<string, unknown>): string {
|
||||
if (serviceCode !== 'cleaning') return '';
|
||||
const parts = [t(`params.cleaning.cleaningType.${String(params.cleaningType)}`), t('params.cleaning.rooms.count', { count: Number(params.rooms ?? 1) })];
|
||||
const baths = Number(params.bathrooms ?? 1);
|
||||
if (baths > 1) parts.push(t('params.cleaning.bathrooms.count', { count: baths }));
|
||||
return parts.join(' · ');
|
||||
}
|
||||
|
||||
/** Выбранные доп. услуги: [{ code, qty, label: «Мытьё окон × 3» }] */
|
||||
export function paramsExtras(t: TFunction, params: Record<string, unknown>) {
|
||||
const extras = params.extras;
|
||||
if (!extras || typeof extras !== 'object') return [];
|
||||
return Object.entries(extras as Record<string, number>)
|
||||
.filter(([, qty]) => qty > 0)
|
||||
.map(([code, qty]) => ({ code, qty, label: `${t(`extras.${code}.name`)}${qty > 1 ? ` × ${qty}` : ''}` }));
|
||||
}
|
||||
Reference in new issue
Block a user