fix import and type of wallet

This commit is contained in:
Wikzyy
2025-05-08 18:13:59 +07:00
parent ebd5e8b4f9
commit 48c37b3879
4 changed files with 23 additions and 12 deletions

View File

@ -1,6 +1,22 @@
import React from 'react'; import React from 'react';
import { toast } from 'sonner'; import { toast } from 'sonner';
export interface WalletProps {
id: string;
name: string;
description: string;
id_currency: string;
status: string;
group: WalletGroupProps[];
}
export interface WalletGroupProps {
id: string;
name: string;
description: string;
status: string;
}
export interface CurrencyProps { export interface CurrencyProps {
ID: string; ID: string;
code: string; code: string;

View File

@ -24,7 +24,7 @@ import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox'; import { Checkbox } from '@/components/ui/checkbox';
import { doSaveLogActivity } from '@/actions/GlobalActions'; import { doSaveLogActivity } from '@/actions/GlobalActions';
import { RefreshCw } from 'lucide-react'; import { RefreshCw } from 'lucide-react';
import { CurrencyProps, GroupProps, initialStateWallet, validateFormsWallet } from './Types'; import { CurrencyProps, GroupProps, initialStateWallet, validateFormsWallet } from '../Types';
const API_URL_WALLET = apiConfig.service_wallet; const API_URL_WALLET = apiConfig.service_wallet;
const API_URL_MASTER_DATA = apiConfig.service_master_data; const API_URL_MASTER_DATA = apiConfig.service_master_data;

View File

@ -23,7 +23,7 @@ import {
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { doSaveLogActivity } from '@/actions/GlobalActions'; import { doSaveLogActivity } from '@/actions/GlobalActions';
import { RefreshCw } from 'lucide-react'; import { RefreshCw } from 'lucide-react';
import { CurrencyProps, GroupProps, initialStateWallet, validateFormsWallet } from './Types'; import { CurrencyProps, GroupProps, initialStateWallet, validateFormsWallet } from '../Types';
const API_URL_WALLET = apiConfig.service_wallet; const API_URL_WALLET = apiConfig.service_wallet;
const API_URL_MASTER_DATA = apiConfig.service_master_data; const API_URL_MASTER_DATA = apiConfig.service_master_data;

View File

@ -5,15 +5,7 @@ import { ColumnDef } from '@tanstack/react-table';
import React, { createContext, useCallback, useMemo, useState } from 'react'; import React, { createContext, useCallback, useMemo, useState } from 'react';
import { Toaster } from 'sonner'; import { Toaster } from 'sonner';
import ListToolbar from '../blocks/ListToolbar'; import ListToolbar from '../blocks/ListToolbar';
import { WalletProps } from '../Types';
interface WalletProps {
id: string;
name: string;
status: string;
description: string;
group: string[];
currency_id: string;
}
interface ContextProps { interface ContextProps {
wallet: WalletProps[]; wallet: WalletProps[];
@ -146,7 +138,10 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode }
const getWalletLists = async (page: number, limit: number, sorting: any, filter: any) => { const getWalletLists = async (page: number, limit: number, sorting: any, filter: any) => {
try { try {
sorting = sorting.length == 0 ? [{ id: 'name', desc: false }] : sorting; sorting = sorting.length == 0 ? [{ id: 'name', desc: false }] : sorting;
filter = filter.length == 0 ? {} : { 'wallets.name': { like: `%${filter[0].value?.toLowerCase()}%` } }; filter =
filter.length == 0
? {}
: { 'wallets.name': { like: `%${filter[0].value?.toLowerCase()}%` } };
const response = await GetData(`${API_URL_MASTER_DATA}/wallet/list`, { const response = await GetData(`${API_URL_MASTER_DATA}/wallet/list`, {
limit, limit,