@@ -204,8 +205,9 @@ export const ResourceDetailsUpdate = (props: resourceProps) => {
name="status"
value={state.form.status}
options={RESOURCE_STATUS_CHOICES}
+ optionValue={(option) => option.text}
onChange={handleChange}
- optionLabel={(option) => t(`resource_status__${option}`)}
+ optionLabel={(option) => t(`resource_status__${option.text}`)}
/>
diff --git a/src/components/Resource/ResourceList.tsx b/src/components/Resource/ResourceList.tsx
index acf363305ac..552e9383fc8 100644
--- a/src/components/Resource/ResourceList.tsx
+++ b/src/components/Resource/ResourceList.tsx
@@ -12,6 +12,7 @@ import {
Card,
CardContent,
CardDescription,
+ CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
@@ -58,12 +59,12 @@ function EmptyState() {
);
}
-export default function ResourceList() {
+export default function ResourceList({ facilityId }: { facilityId: string }) {
const { qParams, updateQuery, Pagination, resultsPerPage } = useFilters({
limit: 15,
cacheBlacklist: ["title"],
});
- const { status, title } = qParams;
+ const { status, title, outgoing } = qParams;
const searchOptions = [
{
@@ -85,13 +86,16 @@ export default function ResourceList() {
const { data: queryResources, isLoading } = useQuery<
PaginatedResponse
>({
- queryKey: ["resources", qParams],
+ queryKey: ["resources", facilityId, qParams],
queryFn: query.debounced(routes.listResourceRequests, {
queryParams: {
status: currentStatus,
title,
limit: resultsPerPage,
offset: ((qParams.page || 1) - 1) * resultsPerPage,
+ ...(outgoing
+ ? { origin_facility: facilityId }
+ : { assigned_facility: facilityId }),
},
}),
});
@@ -154,6 +158,39 @@ export default function ResourceList() {
+
+
+
+
+ updateQuery({
+ outgoing: true,
+ title,
+ })
+ }
+ >
+ {t("outgoing")}
+
+
+ updateQuery({
+ outgoing: false,
+ title,
+ })
+ }
+ >
+ {t("incoming")}
+
+
+
+