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