Hide box settings and rename customization labels
This commit is contained in:
@@ -263,10 +263,8 @@ function groupCatalogSetting(group: ProductGroup) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function visibleFields(group: ProductGroup) {
|
function visibleFields(group: ProductGroup) {
|
||||||
const catalogSetting = groupCatalogSetting(group);
|
|
||||||
|
|
||||||
return parameterFields.filter((field) => {
|
return parameterFields.filter((field) => {
|
||||||
if (field.key === 'quantityPerBox' && !catalogSetting.showQuantityPerBox) {
|
if (field.key === 'quantityPerBox') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,15 +486,15 @@ function customizationNotes(group: ProductGroup) {
|
|||||||
const notes: string[] = [];
|
const notes: string[] = [];
|
||||||
|
|
||||||
if (setting.allowCustomLength && setting.customLengthMinM && setting.customLengthMaxM && setting.customLengthStepM) {
|
if (setting.allowCustomLength && setting.customLengthMinM && setting.customLengthMaxM && setting.customLengthStepM) {
|
||||||
notes.push(`Своя длина ${setting.customLengthMinM}-${setting.customLengthMaxM} м, шаг ${setting.customLengthStepM} м`);
|
notes.push(`Любая длина ${setting.customLengthMinM}-${setting.customLengthMaxM} м, шаг ${setting.customLengthStepM} м`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting.allowCustomSleeveBrand) {
|
if (setting.allowCustomSleeveBrand) {
|
||||||
notes.push('Своя втулка');
|
notes.push('Втулка с логотипом');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting.allowCustomLabel) {
|
if (setting.allowCustomLabel) {
|
||||||
notes.push('Своя надпись');
|
notes.push('Нанесение надписи');
|
||||||
}
|
}
|
||||||
|
|
||||||
return notes;
|
return notes;
|
||||||
@@ -669,7 +667,6 @@ function decrementSelected(group: ProductGroup) {
|
|||||||
<th class="border-b border-base-300">Длина</th>
|
<th class="border-b border-base-300">Длина</th>
|
||||||
<th class="border-b border-base-300">Толщина</th>
|
<th class="border-b border-base-300">Толщина</th>
|
||||||
<th class="border-b border-base-300">Втулка</th>
|
<th class="border-b border-base-300">Втулка</th>
|
||||||
<th v-if="groupCatalogSetting(group).showQuantityPerBox" class="border-b border-base-300">Короб</th>
|
|
||||||
<th class="border-b border-base-300 text-right">Действие</th>
|
<th class="border-b border-base-300 text-right">Действие</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -680,7 +677,6 @@ function decrementSelected(group: ProductGroup) {
|
|||||||
<td class="border-b border-base-200">{{ product.lengthM ?? '—' }}</td>
|
<td class="border-b border-base-200">{{ product.lengthM ?? '—' }}</td>
|
||||||
<td class="border-b border-base-200">{{ product.thicknessMicron ?? '—' }}</td>
|
<td class="border-b border-base-200">{{ product.thicknessMicron ?? '—' }}</td>
|
||||||
<td class="border-b border-base-200">{{ product.sleeveBrand ?? '—' }}</td>
|
<td class="border-b border-base-200">{{ product.sleeveBrand ?? '—' }}</td>
|
||||||
<td v-if="groupCatalogSetting(group).showQuantityPerBox" class="border-b border-base-200">{{ product.quantityPerBox ?? '—' }}</td>
|
|
||||||
<td class="border-b border-base-200 text-right">
|
<td class="border-b border-base-200 text-right">
|
||||||
<button
|
<button
|
||||||
v-if="getQuantity(product.id) === 0"
|
v-if="getQuantity(product.id) === 0"
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ definePageMeta({
|
|||||||
type CatalogSettingItem = CatalogProductTypeSettingsQuery['catalogProductTypeSettings'][number];
|
type CatalogSettingItem = CatalogProductTypeSettingsQuery['catalogProductTypeSettings'][number];
|
||||||
type CatalogSettingForm = {
|
type CatalogSettingForm = {
|
||||||
productType: string;
|
productType: string;
|
||||||
showQuantityPerBox: boolean;
|
|
||||||
allowCustomLength: boolean;
|
allowCustomLength: boolean;
|
||||||
customLengthMinM: string;
|
customLengthMinM: string;
|
||||||
customLengthMaxM: string;
|
customLengthMaxM: string;
|
||||||
@@ -40,7 +39,6 @@ function toInputValue(value: number | null | undefined) {
|
|||||||
function createForm(item: CatalogSettingItem): CatalogSettingForm {
|
function createForm(item: CatalogSettingItem): CatalogSettingForm {
|
||||||
return {
|
return {
|
||||||
productType: item.productType,
|
productType: item.productType,
|
||||||
showQuantityPerBox: item.showQuantityPerBox,
|
|
||||||
allowCustomLength: item.allowCustomLength,
|
allowCustomLength: item.allowCustomLength,
|
||||||
customLengthMinM: toInputValue(item.customLengthMinM),
|
customLengthMinM: toInputValue(item.customLengthMinM),
|
||||||
customLengthMaxM: toInputValue(item.customLengthMaxM),
|
customLengthMaxM: toInputValue(item.customLengthMaxM),
|
||||||
@@ -92,7 +90,7 @@ async function saveAllSettings() {
|
|||||||
const result = await saveSettingMutation.mutate({
|
const result = await saveSettingMutation.mutate({
|
||||||
input: {
|
input: {
|
||||||
productType: form.productType,
|
productType: form.productType,
|
||||||
showQuantityPerBox: form.showQuantityPerBox,
|
showQuantityPerBox: false,
|
||||||
allowCustomLength: form.allowCustomLength,
|
allowCustomLength: form.allowCustomLength,
|
||||||
customLengthMinM: form.allowCustomLength ? parseOptionalInteger(form.customLengthMinM) : null,
|
customLengthMinM: form.allowCustomLength ? parseOptionalInteger(form.customLengthMinM) : null,
|
||||||
customLengthMaxM: form.allowCustomLength ? parseOptionalInteger(form.customLengthMaxM) : null,
|
customLengthMaxM: form.allowCustomLength ? parseOptionalInteger(form.customLengthMaxM) : null,
|
||||||
@@ -139,24 +137,19 @@ async function saveAllSettings() {
|
|||||||
|
|
||||||
<div class="grid gap-3 md:grid-cols-2">
|
<div class="grid gap-3 md:grid-cols-2">
|
||||||
<label class="surface-card flex items-center justify-between gap-4 rounded-[22px] p-4">
|
<label class="surface-card flex items-center justify-between gap-4 rounded-[22px] p-4">
|
||||||
<span class="text-sm font-semibold text-[#123824]">Своя длина</span>
|
<span class="text-sm font-semibold text-[#123824]">Любая длина</span>
|
||||||
<input v-model="formFor(item).allowCustomLength" type="checkbox" class="toggle toggle-success">
|
<input v-model="formFor(item).allowCustomLength" type="checkbox" class="toggle toggle-success">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="surface-card flex items-center justify-between gap-4 rounded-[22px] p-4">
|
<label class="surface-card flex items-center justify-between gap-4 rounded-[22px] p-4">
|
||||||
<span class="text-sm font-semibold text-[#123824]">Своя втулка</span>
|
<span class="text-sm font-semibold text-[#123824]">Втулка с логотипом</span>
|
||||||
<input v-model="formFor(item).allowCustomSleeveBrand" type="checkbox" class="toggle toggle-success">
|
<input v-model="formFor(item).allowCustomSleeveBrand" type="checkbox" class="toggle toggle-success">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="surface-card flex items-center justify-between gap-4 rounded-[22px] p-4">
|
<label class="surface-card flex items-center justify-between gap-4 rounded-[22px] p-4">
|
||||||
<span class="text-sm font-semibold text-[#123824]">Своя надпись</span>
|
<span class="text-sm font-semibold text-[#123824]">Нанесение надписи</span>
|
||||||
<input v-model="formFor(item).allowCustomLabel" type="checkbox" class="toggle toggle-success">
|
<input v-model="formFor(item).allowCustomLabel" type="checkbox" class="toggle toggle-success">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="surface-card flex items-center justify-between gap-4 rounded-[22px] p-4">
|
|
||||||
<span class="text-sm font-semibold text-[#123824]">Показывать короб</span>
|
|
||||||
<input v-model="formFor(item).showQuantityPerBox" type="checkbox" class="toggle toggle-success">
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="formFor(item).allowCustomLength" class="rounded-[24px] bg-[#f7fbf8] p-4">
|
<div v-if="formFor(item).allowCustomLength" class="rounded-[24px] bg-[#f7fbf8] p-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user