Merge branch 'alwi'

This commit is contained in:
Wikzyy
2025-03-25 13:58:27 +07:00
3 changed files with 45 additions and 44 deletions

View File

@ -19,7 +19,7 @@ const DialogOverlay = React.forwardRef<
<DialogPrimitive.Overlay
ref={ref}
className={cn(
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
'fixed inset-0 z-50 bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className
)}
{...props}

View File

@ -33,6 +33,7 @@ import {
} from '@/components/ui/command';
export interface CustomerProps {
id: string;
msisdn: string;
email: string;
fullname: string;
@ -86,7 +87,7 @@ const AddDialog = () => {
const response = await PostData(`${API_URL_MASTERDATA}/provider/create`, formField);
if (response?.status) {
resetForm();
// resetForm();
handleAddDialog(false);
toast.success('Success Create Provider');
reload();
@ -116,17 +117,23 @@ const AddDialog = () => {
setAlert({ show: false, message: '' });
};
useEffect(() => {
if (showAddDialog) {
setFormField({
...formField,
created_by: parsedUser.username,
created_at: formattedTime
const getTransactionTypeList = async (sorting: any) => {
try {
const response = await GetData(`${API_URL_TRANSACTION}/transactiontype/list`, {
limit: 100,
page: 1,
with_deleted: false,
order_field: sorting[0].id,
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC'
});
}
}, [formattedTime]);
useEffect(() => {
// console.log('TRANSACTION TYPE: ', response?.data);
setTransactions(response?.data.list);
} catch (error) {
console.error('Error fetching transaction type', error);
}
};
const getCustomerList = async (sorting: any) => {
try {
sorting = sorting.length == 0 ? [{ id: 'name', desc: false }] : sorting;
@ -145,24 +152,18 @@ const AddDialog = () => {
}
};
const getTransactionTypeList = async (sorting: any) => {
try {
const response = await GetData(`${API_URL_TRANSACTION}/transactiontype/list`, {
limit: 100,
page: 1,
with_deleted: false,
order_field: sorting[0].id,
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC'
useEffect(() => {
if (showAddDialog) {
setFormField({
...formField,
created_by: parsedUser.username,
created_at: formattedTime
});
// console.log('TRANSACTION TYPE: ', response?.data);
setTransactions(response?.data.list);
} catch (error) {
console.error('Error fetching transaction type', error);
}
};
}, [formattedTime]);
getCustomerList([{ id: 'msisdn', desc: false }]);
useEffect(() => {
getCustomerList([{ id: 'id', desc: false }]);
getTransactionTypeList([{ id: 'name', desc: false }]);
}, []);
@ -290,7 +291,7 @@ const AddDialog = () => {
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<button type="button" className="input col-span-5 text-left">
{customers.find((customer) => customer.msisdn === formField.agent)
{customers.find((customer) => customer.id === formField.agent)
?.fullname || 'Select Agent'}
</button>
</PopoverTrigger>
@ -302,12 +303,12 @@ const AddDialog = () => {
<CommandGroup>
{customers.map((customer) => (
<CommandItem
key={customer.msisdn}
value={customer.fullname}
key={customer.id}
value={customer.id}
onSelect={() => {
setFormField({
...formField,
agent: customer.msisdn
agent: customer.id
});
setOpen(false);
}}

View File

@ -128,7 +128,7 @@ const EditDialog = () => {
const doFetchData = useCallback(async (id: string) => {
const response = await GetData(`${API_URL_MASTERDATA}/provider/getdata/${id}`, { id });
console.log(response);
// console.log(response);
if (response?.status) {
setFormField((prev) => ({
...prev,
@ -185,7 +185,7 @@ const EditDialog = () => {
}, [formattedTime]);
useEffect(() => {
getCustomerList([{ id: 'msisdn', desc: false }]);
getCustomerList([{ id: 'id', desc: false }]);
getTransactionTypeList([{ id: 'name', desc: false }]);
}, []);