Improve person assets UI and fix Tahesab asnad date/list.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,8 +16,17 @@ function asAsnadList(raw: unknown): Array<Record<string, unknown>> {
|
||||
if (!raw) return [];
|
||||
if (Array.isArray(raw)) return raw as Array<Record<string, unknown>>;
|
||||
if (typeof raw === 'object') {
|
||||
return Object.values(raw as Record<string, unknown>).filter(
|
||||
(v) => v && typeof v === 'object',
|
||||
const obj = raw as Record<string, unknown>;
|
||||
for (const key of ['DoListAsnad', 'Asnad', 'asnad', 'Items', 'items', 'Data']) {
|
||||
const nested = obj[key];
|
||||
if (Array.isArray(nested)) {
|
||||
return nested.filter((v) => v && typeof v === 'object') as Array<
|
||||
Record<string, unknown>
|
||||
>;
|
||||
}
|
||||
}
|
||||
return Object.values(obj).filter(
|
||||
(v) => v && typeof v === 'object' && !Array.isArray(v),
|
||||
) as Array<Record<string, unknown>>;
|
||||
}
|
||||
return [];
|
||||
@@ -68,8 +77,8 @@ export class TahesabDocumentsService {
|
||||
);
|
||||
const link = await this.requireLink(organizationId, personId, resolvedId);
|
||||
const { api } = await this.connections.getApi(organizationId, resolvedId);
|
||||
// Count_Last = -1 برای مانده ردیفبهردیف مثل همکار
|
||||
const raw = await api.doListAsnad(-1, link.moshtariCode, from, to);
|
||||
// Count_Last = سقف تعداد سند برگشتی (۰ در نمونه گاهی خالی برمیگرداند)
|
||||
const raw = await api.doListAsnad(500, link.moshtariCode, from, to);
|
||||
const items = asAsnadList(raw);
|
||||
return {
|
||||
connectionId: resolvedId,
|
||||
|
||||
@@ -222,11 +222,14 @@ export class TahesabApi {
|
||||
fromShamsi: string,
|
||||
toShamsi: string,
|
||||
) {
|
||||
// OpenAPI: Count_Last, Moshtari_Code, AzTarikhShamsi, TaTarikhShamsi, FilterNoSanad, Mande_Jens_Felez
|
||||
return this.call('DoListAsnad', 'DoListAsnad', [
|
||||
countLast,
|
||||
moshtariCode,
|
||||
fromShamsi,
|
||||
toShamsi,
|
||||
'',
|
||||
0,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user