fix: limit for select and made it as constant

This commit is contained in:
suryac 2026-08-18 11:46:13 +05:30
parent a600121e0d
commit 819b43bd77
4 changed files with 10 additions and 6 deletions

View File

@ -270,3 +270,6 @@ export const PIPELINE = {
export const HIDDEN_FORM_FIELDS = [
'store_code_3'
];
export const LOOKUP_RECORD_LIMIT = 500;
export const MAX_SKUS_PER_CHUNK = 20;

View File

@ -1,7 +1,7 @@
import React, { useState, useEffect, useCallback, useRef } from 'react';
import type { ZinoClient } from '../../api/client';
import type { FormScreenResponse } from '../../api/types';
import { ORDER_BOOKING, PIPELINE } from '../../api/config';
import { ORDER_BOOKING, PIPELINE, LOOKUP_RECORD_LIMIT } from '../../api/config';
import { Button } from '../buttons/Button';
import { Select } from '../reusable/Select';
import { DateField, TimeField, FileInput, TextField } from './fields';
@ -184,7 +184,7 @@ export function LogVisitForm({ client, onSuccess, onCancel, onActivityChange }:
activityId,
fieldId: 'select_store',
formData: formDataToSend,
limit: 400,
limit: LOOKUP_RECORD_LIMIT,
});
const arr = Array.isArray(lookupRes)
@ -253,7 +253,7 @@ export function LogVisitForm({ client, onSuccess, onCancel, onActivityChange }:
activityId,
fieldId: 'daily_log',
formData: payload,
limit: 400,
limit: LOOKUP_RECORD_LIMIT,
});
const arr = Array.isArray(dailyLogLookupRes)

View File

@ -1,5 +1,6 @@
import { useState, useEffect } from 'react';
import type { ZinoClient } from '../../../api/client';
import { LOOKUP_RECORD_LIMIT } from '../../../api/config';
import { SelectField } from './SelectField';
export interface WfLookupFieldProps {
@ -31,7 +32,7 @@ export function WfLookupField({ label, required, value, onChange, client, config
activityId,
fieldId,
formData: JSON.parse(formDataStr),
limit: 400
limit: LOOKUP_RECORD_LIMIT
})
.then(res => {
if (!mounted) return;

View File

@ -5,7 +5,8 @@ import {
SALES_REPORT_ROUTES,
ROUTE_WISE_DISTRIBUTORS,
BASE_URL,
PIPELINE
PIPELINE,
MAX_SKUS_PER_CHUNK
} from '../api/config';
import { Download, Printer } from 'lucide-react';
import jsPDF from 'jspdf';
@ -93,7 +94,6 @@ export function DailySalesReportPage() {
};
// Split headers into chunks of exactly MAX_SKUS_PER_CHUNK, even if it means splitting a brand.
const MAX_SKUS_PER_CHUNK = 20;
const headerChunks: any[][] = [];
let currentChunk: any[] = [];
let currentSkuCount = 0;