Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions app/dashboard/DashboardClient.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client"
import { useEffect } from "react"
import { useEffect, useState } from "react"
import { useSession } from "next-auth/react"
import { fetchInvoices } from "@/lib/fetchInvoices"
import { fetchProjects } from "@/lib/fetchProjects"
Expand All @@ -15,6 +15,14 @@ export default function DashboardPage() {
const role = session?.user?.role
const username = session?.user?.name

// TODO: The data is now set correctly to avoid runtime errors if hit, but the use of the data itself may be plausible to review
const [completedProject, setCompletedProject] = useState()
const [pendingProject, setPendingProject] = useState()
const [clientName, setClientName] = useState()
const [data, setData] = useState()
const [loading, setLoading] = useState(true)
const [totalEarn, setTotalEarn] = useState()

useEffect(() => {
if (session && role == "Sales2") {
fetchProjects()
Expand All @@ -41,9 +49,9 @@ export default function DashboardPage() {
}
})

setcompletedproject(completedproject)
setclientName(uniqueClientNames)
setpendingProject(pendingProjects)
setCompletedProject(completedproject)
setClientName(uniqueClientNames)
setPendingProject(pendingProjects)
setData(filteredData)
setLoading(false)
}
Expand All @@ -67,7 +75,7 @@ export default function DashboardPage() {
0
)

settotalEarn(total)
setTotalEarn(total)
}
})
.catch((error) => {
Expand Down
4 changes: 2 additions & 2 deletions components/CropImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const CropImage = ({file,setResult}) => {
getCroppedImg(image, crop, 'profile.jpeg')
}
}
const getCroppedImg = () => {

const getCroppedImg = (image, crop, fileName) => {
if (image && crop) {
const canvas = document.createElement('canvas');
const scaleX = image.naturalWidth / image.width;
Expand Down
2 changes: 1 addition & 1 deletion components/Editinvoice.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import React, { useEffect, useState } from "react"
import React, { FormEvent, useEffect, useState } from "react"
import { useRouter } from "next/navigation"
import { format } from "date-fns"
import {
Expand Down
5 changes: 3 additions & 2 deletions components/InvoiceTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export default function InvoiceTable(props) {
<h1>loading</h1>
</>
)
}
} else {
return (
<div className="w-full">
<div>
Expand Down Expand Up @@ -391,5 +391,6 @@ export default function InvoiceTable(props) {
</div>
</div> */}
</div>
)
)
}
}
2 changes: 1 addition & 1 deletion components/SalesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const handleSalesRowClick = (salesPerson) => {
window.location.href = `/sales/${salesPerson}`
}

const columns: ColumnDef<Projects>[] = [
const columns = [
{
accessorKey: "name",
header: ({ column }) => {
Expand Down
16 changes: 9 additions & 7 deletions components/SellerList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ export default function SellerList(props) {
<div className="flex items-center justify-between">
<div className="w-5/12">
<h4 className="block py-5 text-2xl font-semibold text-left text-black">
{name && (
<div>
Sales People Under
<span className="capitalize">{decodeURIComponent(name)}</span>
</div>
)}
{!name && <>Manage Sales People</>}
<>
{name && (
<div>
Sales People Under
<span className="capitalize">{decodeURIComponent(name)}</span>
</div>
)}
{!name && <>Manage Sales People</>}
</>
</h4>
</div>
<div className="flex items-center justify-start w-4/12 px-3 bg-white border rounded-md">
Expand Down
2 changes: 1 addition & 1 deletion components/SetPassword.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import React, { useState } from "react"
import React, { FormEvent, useState } from "react"
import { useRouter } from "next/navigation"
import { Label } from "@radix-ui/react-label"

Expand Down
2 changes: 1 addition & 1 deletion components/datatable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ export default function DataTable(props) {
</ScrollArea>
</SelectContent>
</Select>
{!role === "Admin-IA" ||
{!(role === "Admin-IA") ||
(role == "SuperAdmin" && (
<Select
onValueChange={(value) =>
Expand Down
2 changes: 1 addition & 1 deletion components/meetings/AddMeeting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function AddMeeting() {
title: "video added!",
})
setLoading(false)
window.location.reload(true)
window.location.reload()
} else {
console.log("user reg failed!")
toast({
Expand Down
2 changes: 1 addition & 1 deletion components/superAdmin/EditClient.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import React, { useEffect, useState } from "react"
import React, { FormEvent, useEffect, useState } from "react"
import { Checkbox } from "@/components/ui/checkbox"
import {
Calendar as CalendarIcon,
Expand Down
6 changes: 4 additions & 2 deletions components/superAdmin/EditUser.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import React, { useEffect, useState } from "react"
import React, { FormEvent, useEffect, useState } from "react"
import {
Calendar as CalendarIcon,
Check,
Expand Down Expand Up @@ -163,6 +163,7 @@ export default function EditUser(props) {
<DialogDescription>
<div className="grid w-full items-center gap-1.5">
<form onSubmit={handleSubmit}>
<>
<label className="mb-1 text-black">Username:</label>
<Input
className="mb-5"
Expand Down Expand Up @@ -260,8 +261,9 @@ export default function EditUser(props) {
</div>
}

</>
</>
)}
</>

{Role && (
<>
Expand Down
2 changes: 1 addition & 1 deletion components/superAdmin/TotalClients.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client"
import React, { useState } from "react"
import React, { useEffect, useState } from "react"

import { fetchProjectsBySales } from "@/lib/fetchProjects"

Expand Down
2 changes: 1 addition & 1 deletion components/superAdmin/TotalEarning.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react"
import {InvoiceByUserId} from "/lib/fetchInvoices"
import { InvoiceByUserId } from "@/lib/fetchInvoices"
export default function TotalEarning(props) {
const userId = props.userId
const [invoices, setInvoices] = useState(0)
Expand Down
2 changes: 1 addition & 1 deletion components/superAdmin/TotalProject.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client"
import React, { useState } from "react"
import React, { useEffect, useState } from "react"

export default function TotalEarning(props) {
const [count, setcount] = useState()
Expand Down
10 changes: 9 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^3.7.2",
"@types/js-cookie": "^3.0.6",
"@types/node": "^17.0.45",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
Expand Down
Loading