- added store and forward
- amended sighting ammend endpoint
This commit is contained in:
@@ -13,6 +13,7 @@ import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useUpdateBackOfficeConfig } from "../../../hooks/useBackOfficeConfig";
|
||||
import { useFormVaidate } from "../../../hooks/useFormValidate";
|
||||
import { useSightingAmend } from "../../../hooks/useSightingAmend";
|
||||
import StoreCard from "../Store/StoreCard";
|
||||
|
||||
const SettingForms = () => {
|
||||
const qc = useQueryClient();
|
||||
@@ -130,7 +131,11 @@ const SettingForms = () => {
|
||||
{({ isSubmitting, touched }) => (
|
||||
<Form>
|
||||
<div className="mx-auto grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 gap-2 px-2 sm:px-4 lg:px-0 w-full">
|
||||
<BearerTypeCard />
|
||||
<div>
|
||||
<BearerTypeCard />
|
||||
<StoreCard />
|
||||
</div>
|
||||
|
||||
<ChannelCard
|
||||
touched={touched}
|
||||
isSubmitting={isSubmitting}
|
||||
|
||||
14
src/components/SettingForms/Store/StoreCard.tsx
Normal file
14
src/components/SettingForms/Store/StoreCard.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import Card from "../../UI/Card";
|
||||
import CardHeader from "../../UI/CardHeader";
|
||||
import StoreFields from "./StoreFields";
|
||||
|
||||
const StoreCard = () => {
|
||||
return (
|
||||
<Card className="p-4">
|
||||
<CardHeader title="Store" />
|
||||
<StoreFields />
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default StoreCard;
|
||||
29
src/components/SettingForms/Store/StoreFields.tsx
Normal file
29
src/components/SettingForms/Store/StoreFields.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { useStoreDispatch } from "../../../hooks/useStoreDispatch";
|
||||
import VehicleSessionItem from "../../UI/VehicleSessionItem";
|
||||
|
||||
const StoreFields = () => {
|
||||
const { storeQuery } = useStoreDispatch();
|
||||
|
||||
const totalPending = storeQuery?.data?.totalPending;
|
||||
const totalActive = storeQuery?.data?.totalActive;
|
||||
const totalSent = storeQuery?.data?.totalSent;
|
||||
const totalReceived = storeQuery?.data?.totalReceived;
|
||||
const totalLost = storeQuery?.data?.totalLost;
|
||||
|
||||
if (storeQuery.isLoading) return <div className="p-4">Loading store data...</div>;
|
||||
if (storeQuery.error) return <div className="p-4">Error: {storeQuery.error.message}</div>;
|
||||
|
||||
return (
|
||||
<div className="p-4">
|
||||
<ul className="text-white space-y-3">
|
||||
<VehicleSessionItem sessionNumber={totalActive} textColour="text-gray-400" vehicleTag={"Total Active:"} />
|
||||
<VehicleSessionItem sessionNumber={totalSent} textColour="text-blue-400" vehicleTag={"Total Sent:"} />
|
||||
<VehicleSessionItem sessionNumber={totalReceived} textColour="text-green-400" vehicleTag={"Total Received:"} />
|
||||
<VehicleSessionItem sessionNumber={totalPending} textColour="text-amber-400" vehicleTag={"Total Pending:"} />
|
||||
<VehicleSessionItem sessionNumber={totalLost} textColour="text-red-400" vehicleTag={"Total Lost:"} />
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default StoreFields;
|
||||
Reference in New Issue
Block a user