-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into migrate-to-aws
- Loading branch information
Showing
201 changed files
with
10,054 additions
and
2,075 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function AgentPage() { | ||
return <div>Agent</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
import { useRouter } from "next/router"; | ||
import { HiPlus, HiOutlineDocumentMagnifyingGlass } from "react-icons/hi2"; | ||
import { ListAgents } from "@sahil/features/Agents/ListAgents"; | ||
|
||
export default function Agents() { | ||
const router = useRouter(); | ||
return ( | ||
<section className="space-y-2"> | ||
<div> | ||
<h1>Agents Page</h1> | ||
<section className="space-y-4"> | ||
<div className="flex justify-between items-center"> | ||
<div> | ||
<h1 className="text-xl">Agent</h1> | ||
</div> | ||
<div className="flex gap-2"> | ||
<button | ||
className="btn btn-sm btn-primary" | ||
onClick={() => router.push("/orders/new/order_details")} | ||
> | ||
<HiPlus /> New Agent | ||
</button> | ||
</div> | ||
</div> | ||
<ListAgents /> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { useRouter } from "next/router"; | ||
import { useFetchSupplierByPK } from "@sahil/lib/hooks/suppliers"; | ||
import { useFetchBusinessByPK } from "@sahil/lib/hooks/businesses"; | ||
import { | ||
SupplierOrderHistory, | ||
SupplierProducts, | ||
ServiceZones, | ||
SupplierProfileOverview, | ||
} from "@sahil/features/Suppliers"; | ||
import { | ||
BusinessProfileOverview, | ||
BusinessOrderHistory, | ||
} from "@sahil/features/businesses"; | ||
import { Business, Suppliers } from "@sahil/lib/graphql/__generated__/graphql"; | ||
|
||
export default function ClientPage() { | ||
const router = useRouter(); | ||
const { clientId, type } = router.query; | ||
const isSupplier = type === 'supplier'; | ||
|
||
if (!clientId || !type) { | ||
return <div>Invalid client details</div>; | ||
} | ||
|
||
if (isSupplier) { | ||
return <SupplierView clientId={clientId as string} />; | ||
} | ||
|
||
return <BusinessView clientId={clientId as string} />; | ||
} | ||
|
||
function SupplierView({ clientId }: { clientId: string }) { | ||
const { | ||
data: supplier, | ||
error: supplierError, | ||
loading: supplierLoading | ||
} = useFetchSupplierByPK(clientId); | ||
|
||
if (supplierLoading) { | ||
return <p>Loading...</p>; | ||
} | ||
|
||
if (supplierError) { | ||
return <div>Error loading supplier details</div>; | ||
} | ||
|
||
if (!supplier) { | ||
return <div>Supplier not found</div>; | ||
} | ||
|
||
return ( | ||
<div className="space-y-4"> | ||
<div className="flex flex-col lg:flex-row sm:gap-1"> | ||
<div className="space-y-2"> | ||
<SupplierProfileOverview supplier={supplier as Suppliers} /> | ||
<ServiceZones /> | ||
</div> | ||
<div className="basis-5/6 space-y-4"> | ||
<SupplierProducts | ||
productsCount={supplier?.products_aggregate.aggregate?.count || 0} | ||
/> | ||
<SupplierOrderHistory supplierId={clientId} /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
function BusinessView({ clientId }: { clientId: string }) { | ||
const { | ||
data: business, | ||
error: businessError, | ||
loading: businessLoading | ||
} = useFetchBusinessByPK(clientId); | ||
|
||
if (businessLoading) { | ||
return <p>Loading...</p>; | ||
} | ||
|
||
if (businessError) { | ||
return <div>Error loading business details</div>; | ||
} | ||
|
||
if (!business) { | ||
return <div>Business not found</div>; | ||
} | ||
|
||
return ( | ||
<div className="space-y-4"> | ||
<div className="flex flex-col lg:flex-row sm:gap-1"> | ||
<div className="space-y-2"> | ||
<BusinessProfileOverview business={business as Business} /> | ||
</div> | ||
<div className="basis-5/6 space-y-4"> | ||
<BusinessOrderHistory /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import { useRouter } from "next/router"; | ||
import { HiPlus, HiOutlineDocumentMagnifyingGlass } from "react-icons/hi2"; | ||
import { ListClients } from "@sahil/features/Clients/ListClients"; | ||
|
||
export default function Clients() { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<section className="space-y-2"> | ||
<div> | ||
<h1>Clients Page</h1> | ||
</div> | ||
</section> | ||
<main className="container mx-auto px-4 py-6"> | ||
<ListClients /> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ListNotifications } from "@sahil/features/Notifications/ListNotifications"; | ||
|
||
export default function Notifications() { | ||
return ( | ||
<section className="space-y-4"> | ||
<ListNotifications /> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function OrderPage() { | ||
return <div>Order</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
import { useRouter } from "next/router"; | ||
import { HiPlus, HiOutlineDocumentMagnifyingGlass } from "react-icons/hi2"; | ||
import { ListOrders } from "@sahil/features/Orders/ListOrders"; | ||
import { Card, Stats, Stat } from "ui"; | ||
|
||
export default function Orders() { | ||
const router = useRouter(); | ||
return ( | ||
<section className="space-y-2"> | ||
<div> | ||
<h1>Orders Page</h1> | ||
</div> | ||
<section className="space-y-4"> | ||
<Card> | ||
<div className="flex justify-between items-center"> | ||
<div> | ||
<h1 className="text-xl">Orders</h1> | ||
</div> | ||
<div className="flex gap-2"> | ||
<button className="btn btn-sm"> | ||
<HiOutlineDocumentMagnifyingGlass /> | ||
track Order | ||
</button> | ||
<button | ||
className="btn btn-sm btn-primary" | ||
onClick={() => router.push("/orders/new/order_details")} | ||
> | ||
<HiPlus /> New Order | ||
</button> | ||
</div> | ||
</div> | ||
</Card> | ||
<ListOrders /> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function ZonePage() { | ||
return <div>Zone</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
import { useRouter } from "next/router"; | ||
import { HiPlus, HiOutlineDocumentMagnifyingGlass } from "react-icons/hi2"; | ||
import { ListZones } from "@sahil/features/Zones/ListZones"; | ||
|
||
export default function Zones() { | ||
const router = useRouter(); | ||
return ( | ||
<section className="space-y-2"> | ||
<div> | ||
<h1>Zones Page</h1> | ||
<section className="space-y-4"> | ||
<div className="flex justify-between items-center"> | ||
<div> | ||
<h1 className="text-xl">Zones</h1> | ||
</div> | ||
<div className="flex gap-2"> | ||
<button | ||
className="btn btn-sm btn-primary" | ||
onClick={() => router.push("/orders/new/order_details")} | ||
> | ||
<HiPlus /> New Zone | ||
</button> | ||
</div> | ||
</div> | ||
<ListZones /> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function NewZonePage() { | ||
return <div>New Zone Page</div>; | ||
} |
Oops, something went wrong.