Skip to content

Commit

Permalink
Merge branch 'main' of github.com:tekdi/shiksha-admin into admin
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshataKatwal16 committed Aug 2, 2024
2 parents a4ec51f + f2a4c7b commit 5077a46
Show file tree
Hide file tree
Showing 13 changed files with 851 additions and 214 deletions.
29 changes: 15 additions & 14 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"SUBMIT": "Submit",
"BACK": "Back",
"CANCEL": "Cancel",
"ARE_YOU_SURE_DELETE": "Are you sure you want to delete?",
"ARE_YOU_SURE_DELETE": "Do you want to delete?",
"CONFIRM_DELETE": "Confirm Delete",
"ADD_STATE": "Add State",
"STATE_DELETED_SUCCESS": "State Deleted Successfully!",
Expand All @@ -48,7 +48,10 @@
"DISTRICT_NAME": "District Name",
"DISTRICT_CODE": "District Code",
"CONTROLLING_FIELD": "Controlling Field",
"ADD_DISTRICT": "Add District"
"ADD_DISTRICT": "Add District",
"UPDATE": "Update",
"UPDATE_STATE": "Update State",
"UPDATE_DISTRICT": "Update District"
},
"LOGIN_PAGE": {
"USERNAME": "Username",
Expand Down Expand Up @@ -223,19 +226,17 @@
"MY_MAIN_SUBJECTS": "Main subjects",
"NUMBER_OF_CLUSTERS_I_TEACH": "Number of cluster",
"DESIGNATION": "Designation",
"REGULAR": "Regular",
"REMOTE": "Remote",
"NOTE_THIS_WILL_BE_CENTER_NAME": "Note : This Will Be Center Name",
"STATE":"State",
"DISTRICT":"District",
"BLOCK":"Block",
"ACTION":"Actions",
"STATUS":"Status",
"NAME":"Name",
"MOBILE_NUMBER":"Mobile Number",
"CENTER":"Center"




"STATE": "State",
"DISTRICT": "District",
"BLOCK": "Block",
"ACTION": "Actions",
"STATUS": "Status",
"NAME": "Name",
"MOBILE_NUMBER": "Mobile Number",
"CENTER": "Center"
},
"FORM_ERROR_MESSAGES": {
"INVALID_INPUT": "Invalid Input.",
Expand Down
22 changes: 15 additions & 7 deletions src/components/AddDistrictBlockModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,27 @@ export const AddDistrictBlockModal: React.FC<AddDistrictBlockModalProps> = ({
const handleSubmit = () => {
const { name, value, controllingField } = formData;
onSubmit(name, value, controllingField, fieldId, districtId);
console.log(name, value, controllingField, fieldId, districtId);
onClose();
};

const isEditing = !!initialValues.name; // Check if we're in edit mode
const buttonText = isEditing ? t("COMMON.UPDATE") : t("COMMON.SUBMIT");
const dialogTitle = isEditing
? t("COMMON.UPDATE_DISTRICT")
: t("COMMON.ADD_DISTRICT");

const buttonStyles = {
fontSize: "14px",
fontWeight: "500",
};

return (
<Dialog open={open} onClose={onClose}>
<DialogTitle>{t("COMMON.ADD_DISTRICT")}</DialogTitle>
<DialogTitle sx={{ fontSize: "14px" }}>{dialogTitle}</DialogTitle>
<DialogContent>
<TextField
margin="dense"
label="Controlling Field"
label={t("COMMON.STATE_NAME")}
type="text"
fullWidth
variant="outlined"
Expand All @@ -87,7 +92,7 @@ export const AddDistrictBlockModal: React.FC<AddDistrictBlockModalProps> = ({
/>
<TextField
margin="dense"
label="Name"
label={t("COMMON.DISTRICT_NAME")}
type="text"
fullWidth
variant="outlined"
Expand All @@ -96,7 +101,7 @@ export const AddDistrictBlockModal: React.FC<AddDistrictBlockModalProps> = ({
/>
<TextField
margin="dense"
label="Value"
label={t("COMMON.DISTRICT_CODE")}
type="text"
fullWidth
variant="outlined"
Expand All @@ -114,9 +119,12 @@ export const AddDistrictBlockModal: React.FC<AddDistrictBlockModalProps> = ({
<Button
onClick={onClose}
sx={{
...buttonStyles,
border: "none",
color: "secondary",
fontSize: "14px",
fontWeight: "500",
"&:hover": {
border: "none",
backgroundColor: "transparent",
},
}}
Expand All @@ -130,7 +138,7 @@ export const AddDistrictBlockModal: React.FC<AddDistrictBlockModalProps> = ({
variant="contained"
color="primary"
>
{t("COMMON.SUBMIT")}
{buttonText}
</Button>
</DialogActions>
</Dialog>
Expand Down
Loading

0 comments on commit 5077a46

Please sign in to comment.