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!;
|
||||
|
||||
console.log(
|
||||
process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY,
|
||||
process.env.VAPID_PRIVATE_KEY
|
||||
);
|
||||
// console.log(
|
||||
// process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY,
|
||||
// process.env.VAPID_PRIVATE_KEY
|
||||
// );
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { prisma } from "@/module/_global";
|
||||
import { funGetUserByCookies } from "@/module/auth";
|
||||
import _, { ceil } from "lodash";
|
||||
import _, { ceil, some } from "lodash";
|
||||
import moment from "moment";
|
||||
import "moment/locale/id";
|
||||
import { NextResponse } from "next/server";
|
||||
@@ -35,11 +35,21 @@ export async function GET(request: Request) {
|
||||
isActive: true,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (roleUser == "admin" || roleUser == "cosupadmin") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
idGroup: idGroup
|
||||
}
|
||||
} else {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
idGroup: idGroup,
|
||||
ProjectMember: {
|
||||
some: {
|
||||
idUser: user.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const data = await prisma.project.findMany({
|
||||
@@ -133,17 +143,31 @@ export async function GET(request: Request) {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
Division: {
|
||||
isActive: true,
|
||||
idVillage: idVillage,
|
||||
Group: {
|
||||
isActive: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (roleUser == "admin" || roleUser == "cosupadmin") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
Division: {
|
||||
isActive: true,
|
||||
idGroup: idGroup
|
||||
}
|
||||
}
|
||||
} else {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
Division: {
|
||||
idGroup: idGroup
|
||||
isActive: true,
|
||||
DivisionMember: {
|
||||
some: {
|
||||
idUser: user.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,18 +209,33 @@ export async function GET(request: Request) {
|
||||
isActive: true,
|
||||
category: 'FILE',
|
||||
Division: {
|
||||
isActive: true,
|
||||
idVillage: idVillage,
|
||||
Group: {
|
||||
isActive: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (roleUser == "admin" || roleUser == "cosupadmin") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
category: 'FILE',
|
||||
Division: {
|
||||
isActive: true,
|
||||
idGroup: idGroup
|
||||
}
|
||||
}
|
||||
} else {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
category: 'FILE',
|
||||
Division: {
|
||||
idGroup: idGroup
|
||||
isActive: true,
|
||||
DivisionMember: {
|
||||
some: {
|
||||
idUser: user.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,7 +323,7 @@ export async function GET(request: Request) {
|
||||
dateEnd: true,
|
||||
createdAt: true,
|
||||
status: true,
|
||||
idDivision:true,
|
||||
idDivision: true,
|
||||
DivisionCalendar: {
|
||||
select: {
|
||||
title: true,
|
||||
@@ -327,18 +366,33 @@ export async function GET(request: Request) {
|
||||
isActive: true,
|
||||
status: 1,
|
||||
Division: {
|
||||
isActive: true,
|
||||
idVillage: idVillage,
|
||||
Group: {
|
||||
isActive: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (roleUser == "admin" || roleUser == "cosupadmin") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
status: 1,
|
||||
Division: {
|
||||
idGroup: idGroup,
|
||||
isActive: true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
status: 1,
|
||||
Division: {
|
||||
idGroup: idGroup
|
||||
isActive: true,
|
||||
DivisionMember: {
|
||||
some: {
|
||||
idUser: user.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ export async function POST() {
|
||||
const subscriptionData = sub.data as any;
|
||||
|
||||
await webpush.sendNotification(subscriptionData, notificationPayload);
|
||||
console.log(
|
||||
`Notification sent successfully to ${subscriptionData.endpoint}`
|
||||
);
|
||||
// console.log(
|
||||
// `Notification sent successfully to ${subscriptionData.endpoint}`
|
||||
// );
|
||||
successCount++;
|
||||
} catch (error: any) {
|
||||
console.error(
|
||||
|
||||
@@ -167,7 +167,7 @@ export async function POST(request: Request) {
|
||||
|
||||
const cekPhone = await prisma.user.count({
|
||||
where: {
|
||||
phone: data.phone
|
||||
phone: "62" + data.phone
|
||||
},
|
||||
});
|
||||
|
||||
@@ -177,7 +177,7 @@ export async function POST(request: Request) {
|
||||
data: {
|
||||
nik: data.nik,
|
||||
name: data.name,
|
||||
phone: data.phone,
|
||||
phone: "62" + data.phone,
|
||||
email: data.email,
|
||||
gender: data.gender,
|
||||
idGroup: groupFix,
|
||||
|
||||
@@ -42,6 +42,7 @@ export default function CreateProject() {
|
||||
const roleLogin = useHookstate(globalRole)
|
||||
const isMobile = useMediaQuery('(max-width: 369px)');
|
||||
const tema = useHookstate(TEMA)
|
||||
const [loadingModal, setLoadingModal] = useState(false)
|
||||
|
||||
const [body, setBody] = useState<any>({
|
||||
idGroup: "",
|
||||
@@ -102,6 +103,7 @@ export default function CreateProject() {
|
||||
|
||||
async function onSubmit() {
|
||||
try {
|
||||
setLoadingModal(true)
|
||||
const fd = new FormData();
|
||||
for (let i = 0; i < fileForm.length; i++) {
|
||||
fd.append(`file${i}`, fileForm[i]);
|
||||
@@ -130,6 +132,9 @@ export default function CreateProject() {
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan kegiatan, coba lagi nanti");
|
||||
} finally {
|
||||
setLoadingModal(false)
|
||||
setModal(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,13 +499,15 @@ export default function CreateProject() {
|
||||
</LayoutDrawer>
|
||||
|
||||
|
||||
<LayoutModal opened={isModal} onClose={() => setModal(false)}
|
||||
<LayoutModal loading={loadingModal} opened={isModal} onClose={() => setModal(false)}
|
||||
description="Apakah Anda yakin ingin menambahkan data?"
|
||||
onYes={(val) => {
|
||||
if (val) {
|
||||
onSubmit()
|
||||
}else{
|
||||
setModal(false)
|
||||
}
|
||||
setModal(false)
|
||||
|
||||
}} />
|
||||
</Box >
|
||||
);
|
||||
|
||||
@@ -24,7 +24,7 @@ import { useWibuRealtime } from "wibu-realtime";
|
||||
export default function CreateTask() {
|
||||
const router = useRouter()
|
||||
const param = useParams<{ id: string }>()
|
||||
const [openDrawer, setOpenDrawer] = useState(false)
|
||||
const [loadingModal, setLoadingModal] = useState(false)
|
||||
const [openDrawerFile, setOpenDrawerFile] = useState(false)
|
||||
const [openDrawerTask, setOpenDrawerTask] = useState(false)
|
||||
const [openMember, setOpenMember] = useState(false)
|
||||
@@ -66,6 +66,7 @@ export default function CreateTask() {
|
||||
|
||||
async function onSubmit() {
|
||||
try {
|
||||
setLoadingModal(true)
|
||||
const fd = new FormData();
|
||||
for (let i = 0; i < fileForm.length; i++) {
|
||||
fd.append(`file${i}`, fileForm[i]);
|
||||
@@ -95,6 +96,9 @@ export default function CreateTask() {
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
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?"
|
||||
onYes={(val) => {
|
||||
if (val) {
|
||||
onSubmit()
|
||||
} else {
|
||||
setOpenModal(false)
|
||||
}
|
||||
setOpenModal(false)
|
||||
}} />
|
||||
</Box >
|
||||
);
|
||||
|
||||
@@ -423,7 +423,7 @@ export default function CreateMember() {
|
||||
error={
|
||||
touched.phone && (
|
||||
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