Merge pull request #285 from bipproduction/amalia/03-okt-24
Amalia/03 okt 24
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 34 KiB |
BIN
public/icon2-192x192.png
Normal file
BIN
public/icon2-192x192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
@@ -2,10 +2,10 @@ import { NotificationManager } from "@/module/_global/components/notification_ma
|
|||||||
|
|
||||||
const publicKey = process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY!;
|
const publicKey = process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY!;
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY,
|
// process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY,
|
||||||
process.env.VAPID_PRIVATE_KEY
|
// process.env.VAPID_PRIVATE_KEY
|
||||||
);
|
// );
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
import _, { ceil } from "lodash";
|
import _, { ceil, some } from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import "moment/locale/id";
|
import "moment/locale/id";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
@@ -35,11 +35,21 @@ export async function GET(request: Request) {
|
|||||||
isActive: true,
|
isActive: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (roleUser == "admin" || roleUser == "cosupadmin") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
idGroup: idGroup
|
idGroup: idGroup
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
idGroup: idGroup,
|
||||||
|
ProjectMember: {
|
||||||
|
some: {
|
||||||
|
idUser: user.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await prisma.project.findMany({
|
const data = await prisma.project.findMany({
|
||||||
@@ -133,17 +143,31 @@ export async function GET(request: Request) {
|
|||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
Division: {
|
Division: {
|
||||||
|
isActive: true,
|
||||||
idVillage: idVillage,
|
idVillage: idVillage,
|
||||||
Group: {
|
Group: {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (roleUser == "admin" || roleUser == "cosupadmin") {
|
||||||
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
Division: {
|
||||||
|
isActive: true,
|
||||||
|
idGroup: idGroup
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
Division: {
|
Division: {
|
||||||
idGroup: idGroup
|
isActive: true,
|
||||||
|
DivisionMember: {
|
||||||
|
some: {
|
||||||
|
idUser: user.id
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,18 +209,33 @@ export async function GET(request: Request) {
|
|||||||
isActive: true,
|
isActive: true,
|
||||||
category: 'FILE',
|
category: 'FILE',
|
||||||
Division: {
|
Division: {
|
||||||
|
isActive: true,
|
||||||
idVillage: idVillage,
|
idVillage: idVillage,
|
||||||
Group: {
|
Group: {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (roleUser == "admin" || roleUser == "cosupadmin") {
|
||||||
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
category: 'FILE',
|
||||||
|
Division: {
|
||||||
|
isActive: true,
|
||||||
|
idGroup: idGroup
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
category: 'FILE',
|
category: 'FILE',
|
||||||
Division: {
|
Division: {
|
||||||
idGroup: idGroup
|
isActive: true,
|
||||||
|
DivisionMember: {
|
||||||
|
some: {
|
||||||
|
idUser: user.id
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -284,7 +323,7 @@ export async function GET(request: Request) {
|
|||||||
dateEnd: true,
|
dateEnd: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
status: true,
|
status: true,
|
||||||
idDivision:true,
|
idDivision: true,
|
||||||
DivisionCalendar: {
|
DivisionCalendar: {
|
||||||
select: {
|
select: {
|
||||||
title: true,
|
title: true,
|
||||||
@@ -327,18 +366,33 @@ export async function GET(request: Request) {
|
|||||||
isActive: true,
|
isActive: true,
|
||||||
status: 1,
|
status: 1,
|
||||||
Division: {
|
Division: {
|
||||||
|
isActive: true,
|
||||||
idVillage: idVillage,
|
idVillage: idVillage,
|
||||||
Group: {
|
Group: {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (roleUser == "admin" || roleUser == "cosupadmin") {
|
||||||
|
kondisi = {
|
||||||
|
isActive: true,
|
||||||
|
status: 1,
|
||||||
|
Division: {
|
||||||
|
idGroup: idGroup,
|
||||||
|
isActive: true
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
status: 1,
|
status: 1,
|
||||||
Division: {
|
Division: {
|
||||||
idGroup: idGroup
|
isActive: true,
|
||||||
|
DivisionMember: {
|
||||||
|
some: {
|
||||||
|
idUser: user.id
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ export async function POST() {
|
|||||||
const subscriptionData = sub.data as any;
|
const subscriptionData = sub.data as any;
|
||||||
|
|
||||||
await webpush.sendNotification(subscriptionData, notificationPayload);
|
await webpush.sendNotification(subscriptionData, notificationPayload);
|
||||||
console.log(
|
// console.log(
|
||||||
`Notification sent successfully to ${subscriptionData.endpoint}`
|
// `Notification sent successfully to ${subscriptionData.endpoint}`
|
||||||
);
|
// );
|
||||||
successCount++;
|
successCount++;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error(
|
console.error(
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
const cekPhone = await prisma.user.count({
|
const cekPhone = await prisma.user.count({
|
||||||
where: {
|
where: {
|
||||||
phone: data.phone
|
phone: "62" + data.phone
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ export async function POST(request: Request) {
|
|||||||
data: {
|
data: {
|
||||||
nik: data.nik,
|
nik: data.nik,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
phone: data.phone,
|
phone: "62" + data.phone,
|
||||||
email: data.email,
|
email: data.email,
|
||||||
gender: data.gender,
|
gender: data.gender,
|
||||||
idGroup: groupFix,
|
idGroup: groupFix,
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ export default function CreateProject() {
|
|||||||
const roleLogin = useHookstate(globalRole)
|
const roleLogin = useHookstate(globalRole)
|
||||||
const isMobile = useMediaQuery('(max-width: 369px)');
|
const isMobile = useMediaQuery('(max-width: 369px)');
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
|
const [loadingModal, setLoadingModal] = useState(false)
|
||||||
|
|
||||||
const [body, setBody] = useState<any>({
|
const [body, setBody] = useState<any>({
|
||||||
idGroup: "",
|
idGroup: "",
|
||||||
@@ -102,6 +103,7 @@ export default function CreateProject() {
|
|||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingModal(true)
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
for (let i = 0; i < fileForm.length; i++) {
|
for (let i = 0; i < fileForm.length; i++) {
|
||||||
fd.append(`file${i}`, fileForm[i]);
|
fd.append(`file${i}`, fileForm[i]);
|
||||||
@@ -130,6 +132,9 @@ export default function CreateProject() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan kegiatan, coba lagi nanti");
|
toast.error("Gagal menambahkan kegiatan, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setLoadingModal(false)
|
||||||
|
setModal(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,13 +499,15 @@ export default function CreateProject() {
|
|||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
|
|
||||||
<LayoutModal opened={isModal} onClose={() => setModal(false)}
|
<LayoutModal loading={loadingModal} opened={isModal} onClose={() => setModal(false)}
|
||||||
description="Apakah Anda yakin ingin menambahkan data?"
|
description="Apakah Anda yakin ingin menambahkan data?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
}
|
}else{
|
||||||
setModal(false)
|
setModal(false)
|
||||||
|
}
|
||||||
|
|
||||||
}} />
|
}} />
|
||||||
</Box >
|
</Box >
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import { useWibuRealtime } from "wibu-realtime";
|
|||||||
export default function CreateTask() {
|
export default function CreateTask() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const param = useParams<{ id: string }>()
|
const param = useParams<{ id: string }>()
|
||||||
const [openDrawer, setOpenDrawer] = useState(false)
|
const [loadingModal, setLoadingModal] = useState(false)
|
||||||
const [openDrawerFile, setOpenDrawerFile] = useState(false)
|
const [openDrawerFile, setOpenDrawerFile] = useState(false)
|
||||||
const [openDrawerTask, setOpenDrawerTask] = useState(false)
|
const [openDrawerTask, setOpenDrawerTask] = useState(false)
|
||||||
const [openMember, setOpenMember] = useState(false)
|
const [openMember, setOpenMember] = useState(false)
|
||||||
@@ -66,6 +66,7 @@ export default function CreateTask() {
|
|||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingModal(true)
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
for (let i = 0; i < fileForm.length; i++) {
|
for (let i = 0; i < fileForm.length; i++) {
|
||||||
fd.append(`file${i}`, fileForm[i]);
|
fd.append(`file${i}`, fileForm[i]);
|
||||||
@@ -95,6 +96,9 @@ export default function CreateTask() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan tugas divisi, coba lagi nanti");
|
toast.error("Gagal menambahkan tugas divisi, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setLoadingModal(false)
|
||||||
|
setOpenModal(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,13 +416,14 @@ export default function CreateTask() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<LayoutModal opened={openModal} onClose={() => setOpenModal(false)}
|
<LayoutModal loading={loadingModal} opened={openModal} onClose={() => setOpenModal(false)}
|
||||||
description="Apakah Anda yakin ingin menambahkan data?"
|
description="Apakah Anda yakin ingin menambahkan data?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
}
|
} else {
|
||||||
setOpenModal(false)
|
setOpenModal(false)
|
||||||
|
}
|
||||||
}} />
|
}} />
|
||||||
</Box >
|
</Box >
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ export default function CreateMember() {
|
|||||||
error={
|
error={
|
||||||
touched.phone && (
|
touched.phone && (
|
||||||
listData.phone == "" ? "Nomor Telepon Tidak Boleh Kosong" :
|
listData.phone == "" ? "Nomor Telepon Tidak Boleh Kosong" :
|
||||||
listData.phone.length < 10 ? "Nomor Telepon harus 10 digit" : null
|
listData.phone.length < 10 ? "Nomor Telepon Tidak Valid" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user