Merge pull request #224 from bipproduction/amalia/12-september-24
Amalia/12 september 24
This commit is contained in:
@@ -47,6 +47,7 @@ model UserRole {
|
|||||||
|
|
||||||
model Village {
|
model Village {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
|
idTheme String?
|
||||||
name String
|
name String
|
||||||
desc String @db.Text
|
desc String @db.Text
|
||||||
isActive Boolean @default(true)
|
isActive Boolean @default(true)
|
||||||
@@ -57,6 +58,7 @@ model Village {
|
|||||||
Announcement Announcement[]
|
Announcement Announcement[]
|
||||||
Project Project[]
|
Project Project[]
|
||||||
Division Division[]
|
Division Division[]
|
||||||
|
ColorTheme ColorTheme[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model Group {
|
model Group {
|
||||||
@@ -364,6 +366,7 @@ model DivisionDocumentFolderFile {
|
|||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
Division Division @relation(fields: [idDivision], references: [id])
|
Division Division @relation(fields: [idDivision], references: [id])
|
||||||
idDivision String
|
idDivision String
|
||||||
|
idStorage String?
|
||||||
category String @default("FOLDER") // FOLDER OR FILE
|
category String @default("FOLDER") // FOLDER OR FILE
|
||||||
name String
|
name String
|
||||||
extension String
|
extension String
|
||||||
@@ -451,6 +454,7 @@ model ContainerFileDivision {
|
|||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
Division Division @relation(fields: [idDivision], references: [id])
|
Division Division @relation(fields: [idDivision], references: [id])
|
||||||
idDivision String
|
idDivision String
|
||||||
|
idStorage String?
|
||||||
name String
|
name String
|
||||||
extension String
|
extension String
|
||||||
isActive Boolean @default(true)
|
isActive Boolean @default(true)
|
||||||
@@ -458,3 +462,19 @@ model ContainerFileDivision {
|
|||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
DivisionProjectFile DivisionProjectFile[]
|
DivisionProjectFile DivisionProjectFile[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model ColorTheme {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
Village Village? @relation(fields: [idVillage], references: [id])
|
||||||
|
idVillage String?
|
||||||
|
name String
|
||||||
|
utama String
|
||||||
|
bgUtama String
|
||||||
|
bgIcon String
|
||||||
|
bgFiturHome String
|
||||||
|
bgFiturDivision String
|
||||||
|
bgTotalKegiatan String
|
||||||
|
isActive Boolean @default(true)
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { seederAdmin, seederAdminRole, seederDesa, seederGroup, seederPosition, seederUser, seederUserRole } from '@/module/seeder';
|
import { seederAdmin, seederAdminRole, seederDesa, seederGroup, seederPosition, seederTheme, seederUser, seederUserRole } from '@/module/seeder';
|
||||||
import { PrismaClient } from '@prisma/client';
|
import { PrismaClient } from '@prisma/client';
|
||||||
const prisma = new PrismaClient()
|
const prisma = new PrismaClient()
|
||||||
|
|
||||||
@@ -43,6 +43,34 @@ async function main() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// THEME
|
||||||
|
for (let data of seederTheme) {
|
||||||
|
await prisma.colorTheme.upsert({
|
||||||
|
where: {
|
||||||
|
id: data.id
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: data.name,
|
||||||
|
utama: data.utama,
|
||||||
|
bgUtama: data.bgUtama,
|
||||||
|
bgIcon: data.bgIcon,
|
||||||
|
bgFiturHome: data.bgFiturHome,
|
||||||
|
bgFiturDivision: data.bgFiturDivisi,
|
||||||
|
bgTotalKegiatan: data.bgTotalKegiatan
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: data.id,
|
||||||
|
name: data.name,
|
||||||
|
utama: data.utama,
|
||||||
|
bgUtama: data.bgUtama,
|
||||||
|
bgIcon: data.bgIcon,
|
||||||
|
bgFiturHome: data.bgFiturHome,
|
||||||
|
bgFiturDivision: data.bgFiturDivisi,
|
||||||
|
bgTotalKegiatan: data.bgTotalKegiatan
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// DESA
|
// DESA
|
||||||
for (let data of seederDesa) {
|
for (let data of seederDesa) {
|
||||||
await prisma.village.upsert({
|
await prisma.village.upsert({
|
||||||
@@ -51,12 +79,14 @@ async function main() {
|
|||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
name: data.name,
|
name: data.name,
|
||||||
desc: data.desc
|
desc: data.desc,
|
||||||
|
idTheme: "theme1"
|
||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
desc: data.desc
|
desc: data.desc,
|
||||||
|
idTheme: "theme1"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -127,7 +157,7 @@ async function main() {
|
|||||||
idUserRole: data.idUserRole,
|
idUserRole: data.idUserRole,
|
||||||
nik: data.nik,
|
nik: data.nik,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
phone: data.phone,
|
// phone: data.phone,
|
||||||
email: data.email,
|
email: data.email,
|
||||||
gender: data.gender
|
gender: data.gender
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ export async function GET(request: Request) {
|
|||||||
|
|
||||||
formatDataShare = dataShare.map((v: any) => ({
|
formatDataShare = dataShare.map((v: any) => ({
|
||||||
..._.omit(v, ["DivisionDocumentFolderFile"]),
|
..._.omit(v, ["DivisionDocumentFolderFile"]),
|
||||||
|
idStorage: '',
|
||||||
id: v.DivisionDocumentFolderFile.id,
|
id: v.DivisionDocumentFolderFile.id,
|
||||||
category: v.DivisionDocumentFolderFile.category,
|
category: v.DivisionDocumentFolderFile.category,
|
||||||
name: v.DivisionDocumentFolderFile.name,
|
name: v.DivisionDocumentFolderFile.name,
|
||||||
@@ -156,6 +157,7 @@ export async function GET(request: Request) {
|
|||||||
category: true,
|
category: true,
|
||||||
name: true,
|
name: true,
|
||||||
extension: true,
|
extension: true,
|
||||||
|
idStorage: true,
|
||||||
path: true,
|
path: true,
|
||||||
User: {
|
User: {
|
||||||
select: {
|
select: {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { DIR, funUploadFile, prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
@@ -70,7 +70,8 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
const fExt = file.name.split(".").pop()
|
const fExt = file.name.split(".").pop()
|
||||||
const fName = file.name.replace("." + fExt, "")
|
const fName = file.name.replace("." + fExt, "")
|
||||||
|
const upload = await funUploadFile({ file: file, dirId: DIR.document })
|
||||||
|
if (upload.success) {
|
||||||
const dataInsert = await prisma.divisionDocumentFolderFile.create({
|
const dataInsert = await prisma.divisionDocumentFolderFile.create({
|
||||||
data: {
|
data: {
|
||||||
name: fName,
|
name: fName,
|
||||||
@@ -79,24 +80,19 @@ export async function POST(request: Request) {
|
|||||||
category: "FILE",
|
category: "FILE",
|
||||||
extension: String(fExt),
|
extension: String(fExt),
|
||||||
createdBy: user.id,
|
createdBy: user.id,
|
||||||
|
idStorage: upload.data.id
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true
|
id: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const root = path.join(process.cwd(), "./public/file/dokumen/");
|
|
||||||
const nameFix = dataInsert.id + '.' + fExt
|
|
||||||
const filePath = path.join(root, nameFix)
|
|
||||||
// Konversi ArrayBuffer ke Buffer
|
|
||||||
const buffer = Buffer.from(await file.arrayBuffer());
|
|
||||||
// Tulis file ke sistem
|
|
||||||
fs.writeFileSync(filePath, buffer);
|
|
||||||
|
|
||||||
// create log user
|
// create log user
|
||||||
const log = await createLogUser({ act: 'CREATE', desc: 'User mengupload file baru', table: 'divisionDocumentFolderFile', data: dataInsert.id })
|
const log = await createLogUser({ act: 'CREATE', desc: 'User mengupload file baru', table: 'divisionDocumentFolderFile', data: dataInsert.id })
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil upload file" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil upload file" }, { status: 200 });
|
||||||
|
} else {
|
||||||
|
return NextResponse.json({ success: false, message: "Gagal upload file, coba lagi nanti" }, { status: 400 });
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal upload file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal upload file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
name: true,
|
name: true,
|
||||||
extension: true
|
extension: true,
|
||||||
|
idStorage: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,6 +102,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
nameInStorage: v.ContainerFileDivision.id,
|
nameInStorage: v.ContainerFileDivision.id,
|
||||||
name: v.ContainerFileDivision.name,
|
name: v.ContainerFileDivision.name,
|
||||||
extension: v.ContainerFileDivision.extension,
|
extension: v.ContainerFileDivision.extension,
|
||||||
|
idStorage: v.ContainerFileDivision.idStorage,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
allData = fix
|
allData = fix
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { DIR, funDeleteFile, funUploadFile, prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
@@ -42,7 +42,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
fs.unlink(`./public/file/task/${dataFile?.id}.${dataFile?.extension}`, (err) => { })
|
await funDeleteFile({ fileId: String(dataFile?.idStorage) })
|
||||||
|
|
||||||
const deleteRelasi = await prisma.divisionProjectFile.delete({
|
const deleteRelasi = await prisma.divisionProjectFile.delete({
|
||||||
where: {
|
where: {
|
||||||
@@ -57,7 +57,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
});
|
});
|
||||||
|
|
||||||
// create log user
|
// create log user
|
||||||
const log = await createLogUser({ act: 'DELETE', desc: 'User menghpus file divisi', table: 'divisionProject', data: String(dataRelasi?.idProject) })
|
const log = await createLogUser({ act: 'DELETE', desc: 'User menghapus file tugas divisi', table: 'divisionProject', data: String(dataRelasi?.idProject) })
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "File berhasil dihapus", data, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "File berhasil dihapus", data, }, { status: 200 });
|
||||||
|
|
||||||
@@ -115,25 +115,20 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
const fName = file.name.replace("." + fExt, "")
|
const fName = file.name.replace("." + fExt, "")
|
||||||
|
|
||||||
|
|
||||||
|
const upload = await funUploadFile({ file: file, dirId: DIR.task })
|
||||||
|
if (upload.success) {
|
||||||
const insertToContainer = await prisma.containerFileDivision.create({
|
const insertToContainer = await prisma.containerFileDivision.create({
|
||||||
data: {
|
data: {
|
||||||
idDivision: String(dataProject?.idDivision),
|
idDivision: String(dataProject?.idDivision),
|
||||||
name: fName,
|
name: fName,
|
||||||
extension: String(fExt)
|
extension: String(fExt),
|
||||||
|
idStorage: upload.data.id
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true
|
id: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const nameFix = insertToContainer.id + '.' + fExt
|
|
||||||
const filePath = path.join(root, nameFix)
|
|
||||||
// Konversi ArrayBuffer ke Buffer
|
|
||||||
const buffer = Buffer.from(await file.arrayBuffer());
|
|
||||||
// Tulis file ke sistem
|
|
||||||
fs.writeFileSync(filePath, buffer);
|
|
||||||
|
|
||||||
|
|
||||||
const dataFile = {
|
const dataFile = {
|
||||||
idProject: id,
|
idProject: id,
|
||||||
idDivision: dataProject?.idDivision,
|
idDivision: dataProject?.idDivision,
|
||||||
@@ -141,10 +136,10 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
createdBy: user.id,
|
createdBy: user.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fileFix.push(dataFile)
|
fileFix.push(dataFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const insertFile = await prisma.divisionProjectFile.createMany({
|
const insertFile = await prisma.divisionProjectFile.createMany({
|
||||||
data: fileFix
|
data: fileFix
|
||||||
@@ -152,12 +147,12 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create log user
|
// create log user
|
||||||
const log = await createLogUser({ act: 'CREATE', desc: 'User meambahkan file tugas divisi baru', table: 'divisionProject', data: id })
|
const log = await createLogUser({ act: 'CREATE', desc: 'User menambahkan file tugas divisi baru', table: 'divisionProject', data: id })
|
||||||
return NextResponse.json({ success: true, message: "Berhasil membuat tugas divisi" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil menambahkan file" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membuat tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menambahkan filae, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { DIR, funUploadFile, prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
import _, { ceil } from "lodash";
|
import _, { ceil } from "lodash";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
@@ -153,33 +153,26 @@ export async function POST(request: Request) {
|
|||||||
let fileFix: any[] = []
|
let fileFix: any[] = []
|
||||||
|
|
||||||
if (cekFile) {
|
if (cekFile) {
|
||||||
const root = path.join(process.cwd(), "./public/file/task/");
|
|
||||||
for (var pair of body.entries()) {
|
for (var pair of body.entries()) {
|
||||||
if (String(pair[0]).substring(0, 4) == "file") {
|
if (String(pair[0]).substring(0, 4) == "file") {
|
||||||
const file = body.get(pair[0]) as File
|
const file = body.get(pair[0]) as File
|
||||||
const fExt = file.name.split(".").pop()
|
const fExt = file.name.split(".").pop()
|
||||||
const fName = file.name.replace("." + fExt, "")
|
const fName = file.name.replace("." + fExt, "")
|
||||||
|
|
||||||
|
const upload = await funUploadFile({ file: file, dirId: DIR.task })
|
||||||
|
if (upload.success) {
|
||||||
const insertToContainer = await prisma.containerFileDivision.create({
|
const insertToContainer = await prisma.containerFileDivision.create({
|
||||||
data: {
|
data: {
|
||||||
idDivision: idDivision,
|
idDivision: idDivision,
|
||||||
name: fName,
|
name: fName,
|
||||||
extension: String(fExt)
|
extension: String(fExt),
|
||||||
|
idStorage: upload.data.id
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true
|
id: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const nameFix = insertToContainer.id + '.' + fExt
|
|
||||||
const filePath = path.join(root, nameFix)
|
|
||||||
// Konversi ArrayBuffer ke Buffer
|
|
||||||
const buffer = Buffer.from(await file.arrayBuffer());
|
|
||||||
// Tulis file ke sistem
|
|
||||||
fs.writeFileSync(filePath, buffer);
|
|
||||||
|
|
||||||
|
|
||||||
const dataFile = {
|
const dataFile = {
|
||||||
idProject: data.id,
|
idProject: data.id,
|
||||||
idDivision: idDivision,
|
idDivision: idDivision,
|
||||||
@@ -187,10 +180,10 @@ export async function POST(request: Request) {
|
|||||||
createdBy: user.id,
|
createdBy: user.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fileFix.push(dataFile)
|
fileFix.push(dataFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const insertFile = await prisma.divisionProjectFile.createMany({
|
const insertFile = await prisma.divisionProjectFile.createMany({
|
||||||
data: fileFix
|
data: fileFix
|
||||||
|
|||||||
@@ -2,13 +2,15 @@
|
|||||||
import { useHookstate } from "@hookstate/core";
|
import { useHookstate } from "@hookstate/core";
|
||||||
import { globalRole } from "../bin/val_global";
|
import { globalRole } from "../bin/val_global";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
export default function WrapLayout({ children, role }: { children: React.ReactNode, role: any }) {
|
export default function WrapLayout({ children, role }: { children: React.ReactNode, role: any }) {
|
||||||
const roleLogin = useHookstate(globalRole)
|
const roleLogin = useHookstate(globalRole)
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useEffect(() => {
|
||||||
roleLogin.set(role)
|
roleLogin.set(role)
|
||||||
}, [])
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [role])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export interface IDataDocument {
|
export interface IDataDocument {
|
||||||
|
idStorage: string;
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
extension: string;
|
extension: string;
|
||||||
|
|||||||
@@ -114,7 +114,10 @@ export default function DrawerMenuDocumentDivision() {
|
|||||||
maxSize={3 * 1024 ** 2}
|
maxSize={3 * 1024 ** 2}
|
||||||
accept={['text/csv', 'image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
accept={['text/csv', 'image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
||||||
onReject={(files) => {
|
onReject={(files) => {
|
||||||
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
refresh.set(true)
|
||||||
|
setOpenModal(false)
|
||||||
|
setOpenDrawerDocument(false)
|
||||||
|
toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex justify={'center'} align={'center'} direction={'column'} mb={20} onClick={() => openRef.current?.()}>
|
<Flex justify={'center'} align={'center'} direction={'column'} mb={20} onClick={() => openRef.current?.()}>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function NavbarDocumentDivision() {
|
|||||||
const param = useParams<{ id: string }>()
|
const param = useParams<{ id: string }>()
|
||||||
const [isOpenModalView, setOpenModalView] = useState(false)
|
const [isOpenModalView, setOpenModalView] = useState(false)
|
||||||
const [isExtension, setExtension] = useState('')
|
const [isExtension, setExtension] = useState('')
|
||||||
const [idData, setIdData] = useState('')
|
const [idStorage, setIdStorage] = useState('')
|
||||||
const [name, setName] = useState('')
|
const [name, setName] = useState('')
|
||||||
const [isOpen, setOpen] = useState(false)
|
const [isOpen, setOpen] = useState(false)
|
||||||
const [isDelete, setIsDelete] = useState(false)
|
const [isDelete, setIsDelete] = useState(false)
|
||||||
@@ -337,7 +337,7 @@ export default function NavbarDocumentDivision() {
|
|||||||
router.push('?path=' + v.id)
|
router.push('?path=' + v.id)
|
||||||
} else if (v.category == "FILE" && selectedFiles.length == 0 && !dariSelectAll) {
|
} else if (v.category == "FILE" && selectedFiles.length == 0 && !dariSelectAll) {
|
||||||
setExtension(v.extension)
|
setExtension(v.extension)
|
||||||
setIdData(v.id)
|
setIdStorage(v.idStorage)
|
||||||
setOpenModalView(true)
|
setOpenModalView(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ export default function NavbarDocumentDivision() {
|
|||||||
router.push('?path=' + v.id)
|
router.push('?path=' + v.id)
|
||||||
} else if (v.category == "FILE" && selectedFiles.length == 0 && !dariSelectAll) {
|
} else if (v.category == "FILE" && selectedFiles.length == 0 && !dariSelectAll) {
|
||||||
setExtension(v.extension)
|
setExtension(v.extension)
|
||||||
setIdData(v.id)
|
setIdStorage(v.idStorage)
|
||||||
setOpenModalView(true)
|
setOpenModalView(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,7 +485,7 @@ export default function NavbarDocumentDivision() {
|
|||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
|
|
||||||
<LayoutModalViewFile opened={isOpenModalView} onClose={() => setOpenModalView(false)} file={idData + '.' + isExtension} extension={isExtension} fitur='dokumen' />
|
<LayoutModalViewFile opened={isOpenModalView} onClose={() => setOpenModalView(false)} file={idStorage} extension={isExtension} fitur='dokumen' />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
22
src/module/seeder/data/theme.json
Normal file
22
src/module/seeder/data/theme.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "theme1",
|
||||||
|
"name": "Tema 1",
|
||||||
|
"utama": "#19345E",
|
||||||
|
"bgUtama": "#F4F9FD",
|
||||||
|
"bgIcon": "#384288",
|
||||||
|
"bgFiturHome": "#FCAA4B",
|
||||||
|
"bgFiturDivisi": "#FCAA4B",
|
||||||
|
"bgTotalKegiatan": "#DCEED8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "theme2",
|
||||||
|
"name": "Tema 2",
|
||||||
|
"utama": "#508D4E",
|
||||||
|
"bgUtama": "#F4F9FD",
|
||||||
|
"bgIcon": "#3C8754",
|
||||||
|
"bgFiturHome": "#FCAA4B",
|
||||||
|
"bgFiturDivisi": "#FCAA4B",
|
||||||
|
"bgTotalKegiatan": "#DCEED8"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -5,5 +5,6 @@ import seederUser from "./data/user.json";
|
|||||||
import seederDesa from "./data/desa.json";
|
import seederDesa from "./data/desa.json";
|
||||||
import seederGroup from "./data/group.json";
|
import seederGroup from "./data/group.json";
|
||||||
import seederPosition from "./data/position.json";
|
import seederPosition from "./data/position.json";
|
||||||
|
import seederTheme from "./data/theme.json";
|
||||||
|
|
||||||
export { seederAdminRole, seederAdmin, seederDesa, seederGroup, seederPosition, seederUserRole, seederUser, }
|
export { seederAdminRole, seederAdmin, seederDesa, seederGroup, seederPosition, seederUserRole, seederUser, seederTheme }
|
||||||
@@ -68,5 +68,6 @@ export interface IDataFileTaskDivision {
|
|||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
extension: string,
|
extension: string,
|
||||||
nameInStorage: string
|
nameInStorage: string,
|
||||||
|
idStorage: string
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { LayoutNavbarNew, WARNA } from "@/module/_global";
|
import { LayoutNavbarNew, WARNA } from "@/module/_global";
|
||||||
import {
|
import {
|
||||||
|
ActionIcon,
|
||||||
Avatar,
|
Avatar,
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
@@ -19,9 +20,10 @@ import { useParams, useRouter } from "next/navigation";
|
|||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { IFormDateTask } from "../lib/type_task";
|
import { IFormDateTask } from "../lib/type_task";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import { HiChevronLeft } from "react-icons/hi2";
|
||||||
|
|
||||||
|
|
||||||
export default function ViewDateEndTask({ onClose }: { onClose: (val: IFormDateTask) => void }) {
|
export default function ViewDateEndTask({ onClose, onSet }: {onClose: (val: boolean) => void, onSet: (val: IFormDateTask) => void }) {
|
||||||
const [value, setValue] = useState<[Date | null, Date | null]>([null, null]);
|
const [value, setValue] = useState<[Date | null, Date | null]>([null, null]);
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const param = useParams<{ id: string }>()
|
const param = useParams<{ id: string }>()
|
||||||
@@ -37,7 +39,7 @@ export default function ViewDateEndTask({ onClose }: { onClose: (val: IFormDateT
|
|||||||
if (title == "")
|
if (title == "")
|
||||||
return toast.error("Error! harus memasukkan judul tugas")
|
return toast.error("Error! harus memasukkan judul tugas")
|
||||||
|
|
||||||
onClose(
|
onSet(
|
||||||
{
|
{
|
||||||
dateStart: value[0],
|
dateStart: value[0],
|
||||||
dateEnd: value[1],
|
dateEnd: value[1],
|
||||||
@@ -49,7 +51,13 @@ export default function ViewDateEndTask({ onClose }: { onClose: (val: IFormDateT
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<LayoutNavbarNew back={`/division/${param.id}/task/create`} title={"Tanggal Tugas"} menu />
|
<LayoutNavbarNew state={
|
||||||
|
<Box>
|
||||||
|
<ActionIcon variant="light" onClick={() => { onClose(true) }} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||||
|
<HiChevronLeft size={20} color='white' />
|
||||||
|
</ActionIcon>
|
||||||
|
</Box>
|
||||||
|
} title={"Tanggal Tugas"} menu />
|
||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<Group
|
<Group
|
||||||
justify="center"
|
justify="center"
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export default function CreateTask() {
|
|||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
toast.success(response.message)
|
toast.success(response.message)
|
||||||
// setTitle("")
|
setTitle("")
|
||||||
member.set([])
|
member.set([])
|
||||||
setFileForm([])
|
setFileForm([])
|
||||||
setListFile([])
|
setListFile([])
|
||||||
@@ -92,7 +92,7 @@ export default function CreateTask() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (openTugas) return <ViewDateEndTask onClose={(val) => {
|
if (openTugas) return <ViewDateEndTask onClose={(val) => { setOpenTugas(false) }} onSet={(val) => {
|
||||||
setDataTask([...dataTask, val])
|
setDataTask([...dataTask, val])
|
||||||
setOpenTugas(false)
|
setOpenTugas(false)
|
||||||
}} />;
|
}} />;
|
||||||
@@ -148,7 +148,10 @@ export default function CreateTask() {
|
|||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
}}
|
}}
|
||||||
onClick={() => setOpenDrawer(true)}
|
onClick={() =>
|
||||||
|
// setOpenDrawer(true)
|
||||||
|
openRef.current?.()
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Text>Upload File</Text>
|
<Text>Upload File</Text>
|
||||||
<IoIosArrowDropright size={25} />
|
<IoIosArrowDropright size={25} />
|
||||||
@@ -290,15 +293,6 @@ export default function CreateTask() {
|
|||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Drawer pilih file */}
|
|
||||||
<LayoutDrawer
|
|
||||||
opened={openDrawer}
|
|
||||||
onClose={() => setOpenDrawer(false)}
|
|
||||||
title={"Pilih File"}
|
|
||||||
>
|
|
||||||
<Flex justify={"flex-start"} px={20}>
|
|
||||||
<Dropzone
|
<Dropzone
|
||||||
openRef={openRef}
|
openRef={openRef}
|
||||||
onDrop={async (files) => {
|
onDrop={async (files) => {
|
||||||
@@ -313,7 +307,18 @@ export default function CreateTask() {
|
|||||||
onReject={(files) => {
|
onReject={(files) => {
|
||||||
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
||||||
}}
|
}}
|
||||||
|
></Dropzone>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* Drawer pilih file */}
|
||||||
|
{/* <LayoutDrawer
|
||||||
|
opened={openDrawer}
|
||||||
|
onClose={() => setOpenDrawer(false)}
|
||||||
|
title={"Pilih File"}
|
||||||
>
|
>
|
||||||
|
<Flex justify={"flex-start"} px={20}>
|
||||||
|
|
||||||
<Box onClick={() => openRef.current?.()}>
|
<Box onClick={() => openRef.current?.()}>
|
||||||
<Box
|
<Box
|
||||||
bg={"#DCEED8"}
|
bg={"#DCEED8"}
|
||||||
@@ -332,8 +337,8 @@ export default function CreateTask() {
|
|||||||
</Text>
|
</Text>
|
||||||
<Text ta={"center"}>diperangkat</Text>
|
<Text ta={"center"}>diperangkat</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Dropzone>
|
|
||||||
{/* <Box onClick={() => router.push("/task/create?page=file-save")}>
|
<Box onClick={() => router.push("/task/create?page=file-save")}>
|
||||||
<Box
|
<Box
|
||||||
bg={"#DCEED8"}
|
bg={"#DCEED8"}
|
||||||
style={{
|
style={{
|
||||||
@@ -350,9 +355,9 @@ export default function CreateTask() {
|
|||||||
Pilih file yang
|
Pilih file yang
|
||||||
</Text>
|
</Text>
|
||||||
<Text ta={"center"}>sudah ada</Text>
|
<Text ta={"center"}>sudah ada</Text>
|
||||||
</Box> */}
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer> */}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { globalMemberTask } from "../lib/val_task";
|
|||||||
import { FaCheck } from "react-icons/fa6";
|
import { FaCheck } from "react-icons/fa6";
|
||||||
import { RiListCheck } from "react-icons/ri";
|
import { RiListCheck } from "react-icons/ri";
|
||||||
import { BsListCheck } from "react-icons/bs";
|
import { BsListCheck } from "react-icons/bs";
|
||||||
import { HiMagnifyingGlass } from "react-icons/hi2";
|
import { HiChevronLeft, HiMagnifyingGlass } from "react-icons/hi2";
|
||||||
import { IoArrowBackOutline, IoClose } from "react-icons/io5";
|
import { IoArrowBackOutline, IoClose } from "react-icons/io5";
|
||||||
import { Carousel } from "@mantine/carousel";
|
import { Carousel } from "@mantine/carousel";
|
||||||
|
|
||||||
@@ -133,7 +133,13 @@ export default function CreateUsersProject({ onClose }: { onClose: (val: any) =>
|
|||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<LayoutNavbarNew
|
<LayoutNavbarNew
|
||||||
// back=""
|
state={
|
||||||
|
<Box>
|
||||||
|
<ActionIcon variant="light" onClick={() => { onClose(true) }} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||||
|
<HiChevronLeft size={20} color='white' />
|
||||||
|
</ActionIcon>
|
||||||
|
</Box>
|
||||||
|
}
|
||||||
title="Pilih Anggota"
|
title="Pilih Anggota"
|
||||||
menu={<ActionIcon onClick={handleSearchClick} variant="light" bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="search">
|
menu={<ActionIcon onClick={handleSearchClick} variant="light" bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="search">
|
||||||
<HiMagnifyingGlass size={20} color='white' />
|
<HiMagnifyingGlass size={20} color='white' />
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export default function ListFileDetailTask() {
|
|||||||
const [openDrawer, setOpenDrawer] = useState(false)
|
const [openDrawer, setOpenDrawer] = useState(false)
|
||||||
const [isOpenModal, setOpenModal] = useState(false)
|
const [isOpenModal, setOpenModal] = useState(false)
|
||||||
const [idData, setIdData] = useState('')
|
const [idData, setIdData] = useState('')
|
||||||
|
const [idDataStorage, setIdDataStorage] = useState('')
|
||||||
const [nameStorage, setNameStorage] = useState('')
|
const [nameStorage, setNameStorage] = useState('')
|
||||||
const [nameData, setNameData] = useState('')
|
const [nameData, setNameData] = useState('')
|
||||||
const [isOpenModalView, setOpenModalView] = useState(false)
|
const [isOpenModalView, setOpenModalView] = useState(false)
|
||||||
@@ -52,6 +53,7 @@ export default function ListFileDetailTask() {
|
|||||||
toast.success(res.message)
|
toast.success(res.message)
|
||||||
getOneData()
|
getOneData()
|
||||||
setIdData("")
|
setIdData("")
|
||||||
|
setIdDataStorage("")
|
||||||
setOpenDrawer(false)
|
setOpenDrawer(false)
|
||||||
} else {
|
} else {
|
||||||
toast.error(res.message);
|
toast.error(res.message);
|
||||||
@@ -102,6 +104,7 @@ export default function ListFileDetailTask() {
|
|||||||
setExtension(item.extension)
|
setExtension(item.extension)
|
||||||
setNameStorage(item.nameInStorage)
|
setNameStorage(item.nameInStorage)
|
||||||
setIdData(item.id)
|
setIdData(item.id)
|
||||||
|
setIdDataStorage(item.idStorage)
|
||||||
setOpenDrawer(true)
|
setOpenDrawer(true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -167,7 +170,7 @@ export default function ListFileDetailTask() {
|
|||||||
setOpenModal(false)
|
setOpenModal(false)
|
||||||
}} />
|
}} />
|
||||||
|
|
||||||
<LayoutModalViewFile opened={isOpenModalView} onClose={() => setOpenModalView(false)} file={nameStorage + '.' + isExtension} extension={isExtension} fitur='task' />
|
<LayoutModalViewFile opened={isOpenModalView} onClose={() => setOpenModalView(false)} file={idDataStorage} extension={isExtension} fitur='task' />
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user