Merge pull request #170 from bipproduction/amalia/30-agustus-24

Amalia/30 agustus 24
This commit is contained in:
Amalia
2024-08-30 11:40:16 +08:00
committed by GitHub
9 changed files with 28 additions and 19 deletions

View File

@@ -2,6 +2,7 @@
import { sealData } from "iron-session";
import { cookies } from "next/headers";
import { prisma, pwd_key_config } from "@/module/_global";
import { createLogUser } from "@/module/user";
export default async function funSetCookies({ user }: { user: string }) {
try {
@@ -11,8 +12,8 @@ export default async function funSetCookies({ user }: { user: string }) {
const dataUser = await prisma.user.findUnique({
where: {
id: user
},
select:{
},
select: {
isFirstLogin: true
}
})
@@ -34,7 +35,7 @@ export default async function funSetCookies({ user }: { user: string }) {
value: encryptedUserData,
});
const log = await createLogUser({ act: 'LOGIN', desc: 'User masuk ke program', table: 'user', data: '' })
return { success: true, message: "Login berhasil!", pertamaLogin: dataUser?.isFirstLogin };
} catch (error) {

View File

@@ -55,5 +55,6 @@ export interface IDataMemberDivision {
idUser: string,
isAdmin: string,
isLeader: string,
name: string
name: string,
img: string
}

View File

@@ -153,7 +153,7 @@ export default function CreateTask() {
borderRadius: 10,
}}
>
<Text c={WARNA.biruTua}>Tambah Anggota</Text>
<Text>Tambah Anggota</Text>
<IoIosArrowDropright size={25} />
</Group>
</Box>
@@ -205,7 +205,7 @@ export default function CreateTask() {
{
member.length > 0 &&
<Box pt={30} mb={60}>
<Box pt={30} mb={100}>
<Group justify="space-between">
<Text c={WARNA.biruTua}>Anggota Terpilih</Text>
<Text c={WARNA.biruTua}>Total {member.length} Anggota</Text>
@@ -229,7 +229,7 @@ export default function CreateTask() {
key={i}
>
<Group>
<Avatar src={"v.image"} alt="it's me" size="lg" />
<Avatar src={`/api/file/img?cat=user&file=${v.img}`} alt="it's me" size="lg" />
<Box>
<Text c={WARNA.biruTua} fw={"bold"}>
{v.name}

View File

@@ -4,18 +4,15 @@ import { funGetDivisionById, IDataMemberDivision } from "@/module/division_new";
import { useHookstate } from "@hookstate/core";
import {
ActionIcon,
Anchor,
Avatar,
Box,
Button,
Checkbox,
Divider,
Flex,
Group,
rem,
Skeleton,
Text,
TextInput,
} from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
import { useParams, useRouter } from "next/navigation";
@@ -23,6 +20,8 @@ import React, { useState } from "react";
import toast from "react-hot-toast";
import { globalMemberTask } from "../lib/val_task";
import { FaCheck } from "react-icons/fa6";
import { RiListCheck } from "react-icons/ri";
import { BsListCheck } from "react-icons/bs";
export default function CreateUsersProject({ onClose }: { onClose: (val: any) => void }) {
const router = useRouter()
@@ -64,7 +63,7 @@ export default function CreateUsersProject({ onClose }: { onClose: (val: any) =>
if (selectedFiles.some((i: any) => i.idUser == isData[index].idUser)) {
setSelectedFiles(selectedFiles.filter((i: any) => i.idUser != isData[index].idUser))
} else {
setSelectedFiles([...selectedFiles, { idUser: isData[index].idUser, name: isData[index].name }])
setSelectedFiles([...selectedFiles, { idUser: isData[index].idUser, name: isData[index].name, img: isData[index].img }])
}
};
@@ -76,7 +75,7 @@ export default function CreateUsersProject({ onClose }: { onClose: (val: any) =>
for (let index = 0; index < isData.length; index++) {
if (!selectedFiles.some((i: any) => i.idUser == isData[index].idUser)) {
const newArr = {
idUser: isData[index].idUser, name: isData[index].name
idUser: isData[index].idUser, name: isData[index].name, img: isData[index].img
}
setSelectedFiles((selectedFiles: any) => [...selectedFiles, newArr])
}
@@ -112,10 +111,10 @@ export default function CreateUsersProject({ onClose }: { onClose: (val: any) =>
<Text c={WARNA.biruTua} fw={"bold"}>
Pilih Semua Anggota
</Text>
{selectAll ? <FaCheck style={{ marginRight: 10 }} /> : ""}
<BsListCheck size={25} style={{ marginRight: 5 }} color={WARNA.biruTua}/>
</Group>
}
<Box mt={15} mb={60}>
<Box mt={15} mb={100}>
{loading ?
Array(3)
.fill(null)
@@ -146,7 +145,7 @@ export default function CreateUsersProject({ onClose }: { onClose: (val: any) =>
<Box mb={15} key={i} onClick={() => handleFileClick(i)}>
<Flex justify={"space-between"} align={"center"}>
<Group>
<Avatar src={"v.image"} alt="it's me" size="lg" />
<Avatar src={`/api/file/img?cat=user&file=${v.img}`} alt="it's me" size="lg" />
<Text style={{
cursor: 'pointer',
display: 'flex',

View File

@@ -46,7 +46,7 @@ export default function Profile() {
await fetch('/api/auth/logout', {
method: 'DELETE',
});
toast.success('Logout Success')
toast.success('Logout Sukses')
window.location.href = '/';
}