update
This commit is contained in:
@ -14,6 +14,7 @@ const BasicSettings = () => {
|
||||
// const user = localStorage.getItem('user');
|
||||
// const parsedUser = user ? JSON.parse(user) : null;
|
||||
const parsedUser = getAuth()?.user;
|
||||
console.log('parsedUser :', parsedUser);
|
||||
const [newUsername, setNewUsername] = useState<string>(parsedUser?.username || '');
|
||||
const [newEmail, setNewEmail] = useState<string>(parsedUser?.email || '');
|
||||
const [newName, setNewName] = useState<string>(parsedUser?.name || '');
|
||||
|
||||
@ -34,7 +34,7 @@ const initialProps: ContextProps = {
|
||||
|
||||
const AccountUserProfileContext = createContext<ContextProps>(initialProps);
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
|
||||
const AccountUserProfileContextProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
/* state */
|
||||
@ -60,8 +60,7 @@ const AccountUserProfileContextProvider = ({ children }: { children: React.React
|
||||
try {
|
||||
const validate = await PostData(`${API_URL}/login`, {
|
||||
password: newPassword.current_password,
|
||||
username: newPassword.username,
|
||||
application: 'credit'
|
||||
username: newPassword.username
|
||||
});
|
||||
|
||||
if (!validate || !validate.status) {
|
||||
|
||||
@ -26,7 +26,7 @@ const initialProps: ContextProps = {
|
||||
|
||||
const LogActivityContext = createContext<ContextProps>(initialProps);
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
|
||||
const LogActivityContextProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
/* state */
|
||||
@ -122,9 +122,7 @@ const LogActivityContextProvider = ({ children }: { children: React.ReactNode })
|
||||
|
||||
sorting = [{ id: 'user_activity.created_at', desc }];
|
||||
|
||||
let dataFilter: any = {
|
||||
application: 'credit'
|
||||
};
|
||||
let dataFilter: any = {};
|
||||
|
||||
if (filter && filter.length > 0) {
|
||||
filter.forEach((f: any) => {
|
||||
@ -153,7 +151,6 @@ const LogActivityContextProvider = ({ children }: { children: React.ReactNode })
|
||||
order_field: sorting[0].id,
|
||||
order_direction: sorting[0].desc === false ? 'ASC' : 'DESC',
|
||||
filter: JSON.stringify(dataFilter),
|
||||
token: parsedUser?.access_token,
|
||||
all_user: all_user
|
||||
});
|
||||
|
||||
@ -172,9 +169,7 @@ const LogActivityContextProvider = ({ children }: { children: React.ReactNode })
|
||||
if (auth) {
|
||||
all_user = auth.role_name === 'Super Admin';
|
||||
}
|
||||
let dataFilter: any = {
|
||||
application: 'credit'
|
||||
};
|
||||
let dataFilter: any = {};
|
||||
|
||||
if (filter && filter.length > 0) {
|
||||
filter.forEach((f: any) => {
|
||||
@ -8,18 +8,17 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle
|
||||
} from '@/components/ui/dialog';
|
||||
|
||||
import { useManagePositionContext } from '../hooks';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { apiConfig } from '@/config/api.config';
|
||||
import { Alert, KeenIcon, useDataGrid } from '@/components';
|
||||
import { Alert, useDataGrid } from '@/components';
|
||||
import { toast } from 'sonner';
|
||||
import { useCallApi } from '@/hooks';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
|
||||
interface MenuItem {
|
||||
id: string;
|
||||
@ -88,7 +87,7 @@ const AddDialog = () => {
|
||||
name: formField.name,
|
||||
roles: selectMenus,
|
||||
status: 'Y',
|
||||
application: 'credit'
|
||||
application: 'ukln'
|
||||
});
|
||||
|
||||
if (response?.status) {
|
||||
@ -112,35 +111,36 @@ const AddDialog = () => {
|
||||
|
||||
return (
|
||||
<Dialog open={showAddDialog} onOpenChange={(open) => handleAddDialog(open)}>
|
||||
<DialogContent className="container-fixed max-w-[1024px] flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
||||
<DialogContent className="container-fixed max-w-screen-lg flex flex-col p-10 overflow-hidden [&>button]:hidden">
|
||||
<DialogHeader className="p-0 border-0">
|
||||
<DialogTitle></DialogTitle>
|
||||
<DialogDescription></DialogDescription>
|
||||
<div className="flex items-center justify-between flex-wrap grow">
|
||||
<div className="flex flex-col justify-center">
|
||||
<div className="flex items-center justify-between flex-wrap grow gap-5 pb-7.5">
|
||||
<div className="flex flex-col justify-center gap-2">
|
||||
<h1 className="text-xl font-semibold leading-none text-gray-900">
|
||||
Positions - Create
|
||||
</h1>
|
||||
<div className="flex items-center gap-2 text-sm font-normal text-gray-700"></div>
|
||||
</div>
|
||||
<div
|
||||
className="cursor-pointer hover:opacity-100 opacity-50"
|
||||
onClick={() => {
|
||||
handleAddDialog(false);
|
||||
}}
|
||||
<Button
|
||||
variant={'outline'}
|
||||
color="#ddd"
|
||||
size={'sm'}
|
||||
onClick={() => handleAddDialog(false)}
|
||||
>
|
||||
<KeenIcon icon="cross" className="text-1.5xl" />
|
||||
</div>
|
||||
Close
|
||||
</Button>
|
||||
</div>
|
||||
</DialogHeader>
|
||||
<DialogBody className="scrollable-y px-0 pb-0" ref={parentRef}>
|
||||
<div className="flex flex-col px-0">
|
||||
<DialogBody className="scrollable-y py-0 mb-5 ps-0 pe-3 -me-7" ref={parentRef}>
|
||||
<div className="flex flex-col items-stretch grow gap-5 lg:gap-7.5">
|
||||
{alert.show && (
|
||||
<Alert variant="danger" className="mb-3">
|
||||
<Alert variant="danger">
|
||||
<h3>{alert.message}</h3>
|
||||
</Alert>
|
||||
)}
|
||||
<form action="" onSubmit={doCreatePosition}>
|
||||
<div className="card-body grid gap-5 p-0">
|
||||
<div className="card-body grid gap-5">
|
||||
<div className="w-full">
|
||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label className="form-label flex items-center gap-1 max-w-56">Name</label>
|
||||
@ -157,8 +157,8 @@ const AddDialog = () => {
|
||||
|
||||
<div className="grid md:grid-cols-3 w-full gap-5">
|
||||
{menus.map((menu) => (
|
||||
<div className="card " key={menu.id}>
|
||||
<div className="card-body p-5 pt-2">
|
||||
<div className="card" key={menu.id}>
|
||||
<div className="card-body">
|
||||
<MenuItemComponent
|
||||
menu={menu}
|
||||
selectMenus={selectMenus}
|
||||
@ -169,7 +169,7 @@ const AddDialog = () => {
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end">
|
||||
<div className="flex justify-end pt-2.5">
|
||||
<Button className="btn btn-primary" type="submit">
|
||||
Save Changes
|
||||
</Button>
|
||||
@ -15,7 +15,7 @@ import { useCallApi } from '@/hooks';
|
||||
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||
import { EnforceSwitch } from '@/components/switch';
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
|
||||
const DeleteDialog = () => {
|
||||
const { showDeleteDialog, handleDeleteDialog, selectedPosition } = useManagePositionContext();
|
||||
@ -25,7 +25,7 @@ import {
|
||||
} from '@/components/ui/select';
|
||||
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
|
||||
interface MenuItem {
|
||||
id: string;
|
||||
@ -99,8 +99,7 @@ const EditDialog = () => {
|
||||
const response = await PutData(`${API_URL}/user_role/update/${selectedPosition.id}`, {
|
||||
name: formField.name,
|
||||
roles: selectMenus,
|
||||
status: formField.status,
|
||||
application: 'credit'
|
||||
status: formField.status
|
||||
});
|
||||
|
||||
if (response?.status) {
|
||||
@ -38,7 +38,7 @@ const initialProps: ContextProps = {
|
||||
|
||||
const ManagePositionContext = createContext<ContextProps>(initialProps);
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
const API_URL_MD = apiConfig.service_master_data;
|
||||
|
||||
const ManagePositionContextProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
@ -141,7 +141,7 @@ const ManagePositionContextProvider = ({ children }: { children: React.ReactNode
|
||||
with_deleted: false,
|
||||
order_field: sorting[0].id,
|
||||
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC',
|
||||
filter: JSON.stringify({ ...filter, application: 'credit' })
|
||||
filter: JSON.stringify({ ...filter })
|
||||
});
|
||||
|
||||
return { data: response?.data.list, totalCount: response?.data.total_count };
|
||||
@ -154,9 +154,9 @@ const ManagePositionContextProvider = ({ children }: { children: React.ReactNode
|
||||
with_deleted: false,
|
||||
order_field: 'order_number',
|
||||
order_direction: 'ASC',
|
||||
filter: JSON.stringify({ application: 'credit' })
|
||||
filter: JSON.stringify({})
|
||||
};
|
||||
const response = await GetData(`${API_URL_MD}/menu/list`, params);
|
||||
const response = await GetData(`${API_URL}/menus/list`, params);
|
||||
if (response?.status) {
|
||||
setMenus(() => [...response.data.list]);
|
||||
} else {
|
||||
@ -35,7 +35,7 @@ interface CreateUserParams {
|
||||
status: string;
|
||||
}
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
type PasswordType = 'password' | 'retype_password';
|
||||
|
||||
const AddDialog = () => {
|
||||
@ -9,7 +9,7 @@ import { useCallApi } from '@/hooks';
|
||||
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||
import { EnforceSwitch } from '@/components/switch';
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
|
||||
const DeleteDialog = () => {
|
||||
const { showDeleteDialog, handleDeleteDialog, selectedUser } = useUserContext();
|
||||
@ -24,7 +24,7 @@ import { toast } from 'sonner';
|
||||
import { useCallApi } from '@/hooks';
|
||||
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
|
||||
const EditDialog = () => {
|
||||
const parentRef = useRef<any | null>(null);
|
||||
@ -86,7 +86,7 @@ const EditDialog = () => {
|
||||
const doFetchUserData = useCallback(async (id: string) => {
|
||||
const response = await GetData(`${API_URL}/user/detail/${id}`, { id });
|
||||
if (response?.status) {
|
||||
let id_role = response.data.roles.filter((item: any) => item.application.id == 'credit');
|
||||
let id_role = response.data.roles;
|
||||
|
||||
setFormField((prev) => ({
|
||||
...prev,
|
||||
@ -47,7 +47,7 @@ const initialProps: ContextProps = {
|
||||
|
||||
const ConfigUserContext = createContext<ContextProps>(initialProps);
|
||||
|
||||
const API_URL = apiConfig.service_user;
|
||||
const API_URL = apiConfig.service_dashboard;
|
||||
|
||||
const ConfigUserContextProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
/* state */
|
||||
@ -114,9 +114,7 @@ const ConfigUserContextProvider = ({ children }: { children: React.ReactNode })
|
||||
|
||||
let html = <p className="text-danger italic">Unassigned</p>;
|
||||
for (let _role of roles) {
|
||||
if (_role.application.id == 'credit') {
|
||||
html = _role.name;
|
||||
}
|
||||
html = _role.name;
|
||||
}
|
||||
return html;
|
||||
},
|
||||
@ -200,8 +198,7 @@ const ConfigUserContextProvider = ({ children }: { children: React.ReactNode })
|
||||
order_field: 'name',
|
||||
order_direction: 'ASC',
|
||||
filter: JSON.stringify({
|
||||
status: 'Y',
|
||||
application: 'credit'
|
||||
status: 'Y'
|
||||
})
|
||||
};
|
||||
const response = await GetData(`${API_URL}/user_role/list`, params);
|
||||
Reference in New Issue
Block a user