Skip to content

Commit

Permalink
Merge branch 'develop' into treatment_summary_ui_enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaJ2305 authored Feb 12, 2025
2 parents b237889 + d9bf2c7 commit e1e2a51
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
4 changes: 4 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@
"create_consultation": "Create Consultation",
"create_encounter": "Create Encounter",
"create_facility": "Create Facility",
"create_new": "Create New",
"create_new_asset": "Create New Asset",
"create_new_encounter": "Create a new encounter to get started",
"create_new_facility": "Create a new facility and add it to the organization.",
Expand Down Expand Up @@ -1269,6 +1270,7 @@
"make_facility_public": "Make this facility public",
"make_facility_public_description": "When enabled, this facility will be visible to the public and can be discovered by anyone using the platform",
"make_multiple_beds_label": "Do you want to make multiple beds?",
"manage_and_view_questionnaires": "Manage and view questionnaires",
"manage_bed_presets": "Manage Presets of Bed",
"manage_facility_users": "Manage encounters",
"manage_my_schedule": "Manage my schedule",
Expand Down Expand Up @@ -1722,6 +1724,7 @@
"questionnaire_not_exist": "The questionnaire you tried to access does not exist.",
"questionnaire_submission_failed": "Failed to submit questionnaire",
"questionnaire_submitted_successfully": "Questionnaire submitted successfully",
"questionnaires": "Questionnaires",
"quick_access": "Quick Access",
"quick_actions": "Quick Actions",
"quick_actions_description": "Schedule an appointment or create a new encounter",
Expand Down Expand Up @@ -2036,6 +2039,7 @@
"skills": "Skills",
"slot_configuration": "Slot Configuration",
"slots_left": "slots left",
"slug": "Slug",
"social_profile": "Social Profile",
"social_profile_detail": "Include occupation, ration card category, socioeconomic status, and domestic healthcare support for a complete profile.",
"socioeconomic_status": "Socioeconomic status",
Expand Down
30 changes: 21 additions & 9 deletions src/components/Questionnaire/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
import { useQuery } from "@tanstack/react-query";
import { t } from "i18next";
import { useNavigate } from "raviger";

import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";

import Loading from "@/components/Common/Loading";

import useFilters from "@/hooks/useFilters";

import query from "@/Utils/request/query";
import { QuestionnaireDetail } from "@/types/questionnaire/questionnaire";
import questionnaireApi from "@/types/questionnaire/questionnaireApi";

export function QuestionnaireList() {
const { qParams, Pagination, resultsPerPage } = useFilters({
limit: 15,
});
const navigate = useNavigate();
const { data: response, isLoading } = useQuery({
queryKey: ["questionnaires"],
queryFn: query(questionnaireApi.list),
queryKey: ["questionnaires", qParams],
queryFn: query(questionnaireApi.list, {
queryParams: {
limit: resultsPerPage,
offset: ((qParams.page ?? 1) - 1) * resultsPerPage,
},
}),
});

if (isLoading) {
Expand All @@ -27,11 +38,11 @@ export function QuestionnaireList() {
<div className="container mx-auto px-4 py-6">
<div className="mb-6 flex items-center justify-between">
<div>
<h1 className="text-2xl font-bold">Questionnaires</h1>
<p className="text-gray-600">Manage and view questionnaires</p>
<h1 className="text-2xl font-bold">{t("questionnaires")}</h1>
<p className="text-gray-600">{t("manage_and_view_questionnaires")}</p>
</div>
<Button onClick={() => navigate("/questionnaire/create")}>
Create New
{t("create_new")}
</Button>
</div>

Expand All @@ -40,16 +51,16 @@ export function QuestionnaireList() {
<thead className="bg-gray-50">
<tr>
<th className="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">
Title
{t("title")}
</th>
<th className="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">
Description
{t("description")}
</th>
<th className="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">
Status
{t("status")}
</th>
<th className="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">
Slug
{t("slug")}
</th>
</tr>
</thead>
Expand Down Expand Up @@ -89,6 +100,7 @@ export function QuestionnaireList() {
</tbody>
</table>
</div>
<Pagination totalCount={response?.count ?? 0} />
</div>
);
}
2 changes: 1 addition & 1 deletion src/components/Users/UserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function UserForm({
last_name: z.string().min(1, t("field_required")),
email: z.string().email(t("invalid_email_address")),
phone_number: validators.phoneNumber.required,
gender: z.enum(GENDERS),
gender: z.enum(GENDERS, { required_error: t("gender_is_required") }),
/* TODO: Userbase doesn't currently support these, neither does BE
but we will probably need these */
/* qualification: z.string().optional(),
Expand Down

0 comments on commit e1e2a51

Please sign in to comment.