Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/tekdi/shiksha-admin into co…
Browse files Browse the repository at this point in the history
…hort_list
  • Loading branch information
upendraTekdi committed Aug 1, 2024
2 parents 4f3ffcb + 3397cfb commit af4c40a
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 86 deletions.
13 changes: 8 additions & 5 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
"MAIN_COURSE": "Main Course"
},
"FACILITATORS": {
"ALL_STATES": "All States",
"ALL_DISTRICTS": "All Districts",
"ALL_BLOCKS": "All Blocks",
"ALL_STATES": "States",
"ALL_DISTRICTS": "Districts",
"ALL_BLOCKS": "Blocks",
"NEW_FACILITATOR": "New Facilitator",
"SEARCHBAR_PLACEHOLDER": "Search Facilitators..",
"FACILITATOR_CREATED_SUCCESSFULLY": "Teacher has been Successfully Created",
Expand All @@ -89,7 +89,10 @@
},
"TEAM_LEADERS": {
"SEARCHBAR_PLACEHOLDER": "Search Team leaders..",
"NEW_TEAM_LEADER": "New Team Leader"
"NEW_TEAM_LEADER": "New Team Leader",
"FIRST_SELECT_REQUIRED_FIELDS": "First select required fields",
"TEAM_LEADER_CREATED_SUCCESSFULLY": "Team Leader has been Successfully Created!",
"TEAM_LEADER_UPDATED_SUCCESSFULLY": "Team Leader has been Successfully Updated!"
},
"COHORTS": {
"SEARCHBAR_PLACEHOLDER": "Search Center.."
Expand Down Expand Up @@ -207,7 +210,7 @@
"ASSIGN_CENTERS": "Assign Centers",
"TYPE_OF_COHORT": "Type Of Center",
"UNIT_NAME": "Unit Name",
"SUBJECTS_I_TEACH": "Subject Teach",
"SUBJECTS_I_TEACH": "Subject I Teach",
"MY_MAIN_SUBJECTS": "Main subjects",
"NUMBER_OF_CLUSTERS_I_TEACH": "Number of cluster",
"DESIGNATION": "Designation",
Expand Down
39 changes: 22 additions & 17 deletions src/components/AddFacilitator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,14 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
);
console.log(centerOptionsList);
}

console.log(response)

if (response) {
const { schema, uiSchema, formValues } = GenerateSchemaAndUiSchema(response, t);
const newResponse={
...response,
fields: response.fields.filter(field => field.name !== 'no_of_clusters')
}
const { schema, uiSchema, formValues } = GenerateSchemaAndUiSchema(newResponse, t);
setFormvalue(formValues)
setSchema(schema);
setUiSchema(uiSchema);
Expand All @@ -107,20 +112,20 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
) => {
// setOpenModal(true);
const target = event.target as HTMLFormElement;
const elementsArray = Array.from(target.elements);
// const elementsArray = Array.from(target.elements);

for (const element of elementsArray) {
if (
(element instanceof HTMLInputElement ||
element instanceof HTMLSelectElement ||
element instanceof HTMLTextAreaElement) &&
(element.value === "" ||
(Array.isArray(element.value) && element.value.length === 0))
) {
element.focus();
return;
}
}
// for (const element of elementsArray) {
// if (
// (element instanceof HTMLInputElement ||
// element instanceof HTMLSelectElement ||
// element instanceof HTMLTextAreaElement) &&
// (element.value === "" ||
// (Array.isArray(element.value) && element.value.length === 0))
// ) {
// element.focus();
// return;
// }
// }

const formData = data.formData;
console.log("Form data submitted:", formData);
Expand Down Expand Up @@ -252,9 +257,9 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
showFooter={false}
modalTitle={t("FACILITATORS.NEW_FACILITATOR")}
>
{!dynamicForm && (
{/* {!dynamicForm && (
<Typography>{t("LEARNERS.FIRST_SELECT_REQUIRED_FIELDS")} </Typography>
)}
)} */}
<AreaSelection
states={transformArray(states)}
districts={transformArray(districts)}
Expand Down
30 changes: 16 additions & 14 deletions src/components/AddLeanerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,20 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
const target = event.target as HTMLFormElement;
const elementsArray = Array.from(target.elements);

for (const element of elementsArray) {
if (
(element instanceof HTMLInputElement ||
element instanceof HTMLSelectElement ||
element instanceof HTMLTextAreaElement) &&
(element.value === "" ||
(Array.isArray(element.value) && element.value.length === 0))
) {
element.focus();
return;
}
}

console.log("onsubmit", data);
// for (const element of elementsArray) {
// if (
// (element instanceof HTMLInputElement ||
// element instanceof HTMLSelectElement ||
// element instanceof HTMLTextAreaElement) &&
// (element.value === "" ||
// (Array.isArray(element.value) && element.value.length === 0))
// ) {
// element.focus();
// return;
// }
// }
console.log("Form data submitted:", data.formData);

const formData = data.formData;
Expand Down Expand Up @@ -311,11 +313,11 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({
marginTop: "10px",
}}
>
{!dynamicForm && (
{/* {!dynamicForm && (
<Typography>
{t("LEARNERS.FIRST_SELECT_REQUIRED_FIELDS")}{" "}
</Typography>
)}
)} */}
<AreaSelection
states={transformArray(states)}
districts={transformArray(districts)}
Expand Down
1 change: 1 addition & 0 deletions src/components/DynamicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const DynamicForm: React.FC<DynamicFormProps> = ({
const { t } = useTranslation();

const handleError = (errors: any) => {
console.log('handle error', errors);
if (errors.length > 0) {
const property = errors[0].property?.replace(/^root\./, "");
const errorField = document.querySelector(
Expand Down
8 changes: 8 additions & 0 deletions src/components/KaTableComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ const KaTableComponent: React.FC<KaTableComponentProps> = ({
/>
);
}
// if (props.column.key === "selection-cell") {
// return (
// <Checkbox
// checked={selectedRowIds.includes(props.rowData.id)}
// onChange={() => handleCheckboxChange(props.rowData.id)}
// />
// );
// }
return <div className="table-cell">{props.value}</div>;
},
},
Expand Down
Loading

0 comments on commit af4c40a

Please sign in to comment.