Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
navdhi-infotech committed May 4, 2022
1 parent c6d2038 commit 50cd982
Show file tree
Hide file tree
Showing 18 changed files with 155 additions and 94 deletions.
3 changes: 1 addition & 2 deletions packages/attendance/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,4 @@
"FAILED": "Failed",
"RETRY": "Retry",
"DONE": "Done"
}

}
2 changes: 1 addition & 1 deletion packages/attendance/public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@
"THIS_MONTH": "इस महीने",
"LAST_MONTH": "पिछला महीना",
"CANCEL": "रद्द करना"
}
}
13 changes: 7 additions & 6 deletions packages/attendance/src/components/AttendanceComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@ export const weekDates = (currentDate = moment()) => {
};

export const GetAttendance = async (params) => {
let test = await attendanceServiceRegistry.getAll({
let test = await attendanceServiceRegistry.getAll({
params: params,
});

// console.log(test);
return test

return test;
};

export const GetIcon = ({ status, _box, color, _icon }) => {
Expand Down Expand Up @@ -161,15 +160,17 @@ export const MultipalAttendance = ({
toDate: weekdays?.[weekdays.length - 1]?.format("Y-MM-DD"),
};
// await attendanceServiceRegistry.getAll({ params: params});
let attendanceData = await attendanceServiceRegistry.getAll({ params: params});
let attendanceData = await attendanceServiceRegistry.getAll({
params: params,
});
console.log("attendanceData", attendanceData);
const present = getStudentsPresentAbsent(
attendanceData,
students,
workingDaysCount
);

setPresentStudents(await studentServiceRegistry.setDefaultValue(present));
// setPresentStudents(await studentServiceRegistry.setDefaultValue(present));
};
getPresentStudents({ students });
}, [students]);
Expand Down Expand Up @@ -268,6 +269,7 @@ export const MultipalAttendance = ({
}
};

console.log(presentStudents);
return (
<>
{isWithEditButton || !isEditDisabled ? (
Expand Down Expand Up @@ -527,7 +529,6 @@ export default function AttendanceComponent({
getData();
}, [page, attendanceProp, type]);

console.log("A b c", attendance);
const markAttendance = async (dataObject) => {
setLoding({
[dataObject.date + dataObject.id]: true,
Expand Down
6 changes: 3 additions & 3 deletions packages/attendance/src/services/studentServiceRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ export const getAll = async (params = {}, header = {}) => {
Accept: "application/json",
...header,
};
params.classId ="d287fa46-5308-48b8-a2ec-ee78f83e5f14";
params.classId = "d287fa46-5308-48b8-a2ec-ee78f83e5f14";
const result = await get(
manifest.api_url + "/group/" + params?.classId + "/participants",
{ params: { role: "Student", ...params }, headers }
);
if(result.data.data.length !== 0) {
return result.data.data.map((e) => mapInterfaceData(e, interfaceData))
if (result.data.data.length !== 0) {
return result.data.data.map((e) => mapInterfaceData(e, interfaceData));
}
return [];
};
Expand Down
2 changes: 1 addition & 1 deletion packages/calendar/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"code": "hi"
}
],
"api_url":"https://sandbox.shikshaplatform.io/api/v1",
"api_url": "https://sandbox.shikshaplatform.io/api/v1",
"auth_url": "https://dev-shiksha.uniteframework.io/auth/realms/sunbird-rc/protocol/openid-connect/token",
"maxWidth": "1080"
}
12 changes: 5 additions & 7 deletions packages/calendar/src/services/teacherServiceRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ const interfaceData = {
designation: "designation",
image: "image",
schoolId: "schoolId",
workingStatus: "workingStatus"
workingStatus: "workingStatus",
};


export const getAll = async (
filters = {
filters: {},
Expand All @@ -38,13 +37,12 @@ export const getAll = async (
};

export const getOne = async (filters = {}, headers = {}) => {
const result = await get(
`${manifest.api_url}/teacher`,
{ headers }
).catch((error) => error);
const result = await get(`${manifest.api_url}/teacher`, { headers }).catch(
(error) => error
);
if (result.data) {
return mapInterfaceData(result.data.data[0], interfaceData);
} else {
return {};
}
};
};
75 changes: 37 additions & 38 deletions packages/classes/public/locales/en/translation.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
{
"SCIENCE": "Science",
"ASSIGNMENTS": "Content Videos",
"LESSON_PLANS": "Lesson Plans",
"ASSESSMENTS": "Worksheets",
"MATHS": "Maths",
"ENGLISH": "English",
"HISTORY": "History",
"GEOGRAPHY": "Geography",
"MY_CLASSES": "My Classes",
"CLASS_DETAILS": "Class details",
"TAKE_ATTENDANCE": "Mark Attendance",
"CLASS_ATTENDANCE": "Class Attendance",
"STATUS": "Today's Status",
"PRESENT": "present",
"TOTAL": "Total",
"STUDENTS": "Students",
"ATTENDANCE_REGISTER": "Attendance register",
"REPORTS": "Attendance Reports",
"SMS_REPORTS": "SMS Status Reports",
"SUMMARY": "Summary",
"CLASS_TEACHER": "Class teacher",
"CLASS_STRENGTH": "Class Strength",
"GIRLS": "Girls",
"BOYS": "Boys",
"CONTACTS_TEACHERS": "Subject Teachers",
"DETAILS": "Details",
"AWARDS_AND_RECOGNITION": "Awards & Accolades",
"STUDENT_COMPETENCIES": "Student Competencies",
"SHOW_ALL_STUDENTS": "Show all students",
"SUBJECTS": "Subjects",
"CHOOSE_ANOTHER_CLASS": "Choose another Class",
"TODAY_VIEW": "Day View",
"WEEK_VIEW": "Week View",
"MONTH_VIEW": "Month View",
"TODAY": "Today",
"TIME": "Time"
}

"SCIENCE": "Science",
"ASSIGNMENTS": "Content Videos",
"LESSON_PLANS": "Lesson Plans",
"ASSESSMENTS": "Worksheets",
"MATHS": "Maths",
"ENGLISH": "English",
"HISTORY": "History",
"GEOGRAPHY": "Geography",
"MY_CLASSES": "My Classes",
"CLASS_DETAILS": "Class details",
"TAKE_ATTENDANCE": "Mark Attendance",
"CLASS_ATTENDANCE": "Class Attendance",
"STATUS": "Today's Status",
"PRESENT": "present",
"TOTAL": "Total",
"STUDENTS": "Students",
"ATTENDANCE_REGISTER": "Attendance register",
"REPORTS": "Attendance Reports",
"SMS_REPORTS": "SMS Status Reports",
"SUMMARY": "Summary",
"CLASS_TEACHER": "Class teacher",
"CLASS_STRENGTH": "Class Strength",
"GIRLS": "Girls",
"BOYS": "Boys",
"CONTACTS_TEACHERS": "Subject Teachers",
"DETAILS": "Details",
"AWARDS_AND_RECOGNITION": "Awards & Accolades",
"STUDENT_COMPETENCIES": "Student Competencies",
"SHOW_ALL_STUDENTS": "Show all students",
"SUBJECTS": "Subjects",
"CHOOSE_ANOTHER_CLASS": "Choose another Class",
"TODAY_VIEW": "Day View",
"WEEK_VIEW": "Week View",
"MONTH_VIEW": "Month View",
"TODAY": "Today",
"TIME": "Time"
}
2 changes: 1 addition & 1 deletion packages/classes/public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
"TODAY_VIEW": "आज का दृश्य",
"WEEK_VIEW": "सप्ताह का दृश्य",
"MONTH_VIEW": "माह दृश्य"
}
}
2 changes: 1 addition & 1 deletion packages/classes/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
}
],
"api_url": "https://sandbox.shikshaplatform.io/api",
"api_version":"v1",
"api_version": "v1",
"auth_url": "https://dev-shiksha.uniteframework.io/auth/realms/sunbird-rc/protocol/openid-connect/token",
"maxWidth": "1080"
}
2 changes: 1 addition & 1 deletion packages/classes/src/pages/ClassDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const ClassDetails = ({ footerLinks }) => {
};
getData();
}, [classId]);

return (
<Layout
imageUrl={`${window.location.origin}/class.png`}
Expand Down
16 changes: 8 additions & 8 deletions packages/classes/src/services/classServiceRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,22 @@ const interfaceData = {
route: "/classes/:id",
},
};
// /api/v1/student/{id}

export const getAll = async (params = {}, header = {}) => {
let headers = {
...header,
Authorization: "Bearer " + localStorage.getItem("token"),
};
const result = await get(
`${manifest.api_url}/${manifest.api_version}/group/participant/49819de2-3c8e-473c-bda7-a1b6ea9efbbb?role=Teacher`
,
`${manifest.api_url}/${manifest.api_version}/group/participant/49819de2-3c8e-473c-bda7-a1b6ea9efbbb?role=Teacher`,
{
...params,
headers,
}
);
if (result.data) {

return result.data.data.map((e) => mapInterfaceData(e, interfaceData));
return []
return [];
} else {
return [];
}
Expand All @@ -45,9 +42,12 @@ export const getOne = async (filters = {}, header = {}) => {
...header,
Authorization: "Bearer " + localStorage.getItem("token"),
};
const result = await get(`${manifest.api_url}/${manifest.api_version}/group/${filters.id}`, {
headers,
});
const result = await get(
`${manifest.api_url}/${manifest.api_version}/group/${filters.id}`,
{
headers,
}
);
if (result.data) {
return mapInterfaceData(result.data.data, interfaceData);
} else {
Expand Down
67 changes: 67 additions & 0 deletions packages/classes/src/services/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[
{
"module": "attendance",
"attendanceState": [
{
"availableAttendanceStates": ["Present", "Absent"],
"defaultState": [],
"attendanceTags": ["Special Duty", "Govt. Duty"],
"attendanceTagStateAdmin": true,
"attendanceTagSchoolAdmin": true,
"attendanceTagTeacher": false,
"attendanceLayout": [],
"attendanceLayoutStateAdmin": true,
"attendanceLayoutSchoolAdmin": true,
"attendanceLayoutTeacher": false,

"editAttendanceStateAdmin": true,
"editAttendanceSchoolAdmin": true,
"editAttendanceTeacher": false,

"sortOptions": ["Alphabetically"],
"sortOptionsStateAdmin": true,
"sortOptionsSchoolAdmin": false,
"sortOptionsTeacher": true,

"markStudentAttendance": {
"frequency": ["Twice"],
"frequencyStateAdmin": true,
"frequencySchoolAdmin": true,
"frequencyTeacher": false,
"submitBy": ["EOD", "11:30am"],
"periodSubjectAttendance": true,
"periodSubjectAttendanceObject": {
"frequency": [],
"frequencyStateAdmin": true,
"frequencySchoolAdmin": true,
"frequencyTeacher": false,
"submitBy": []
},
"markAllPresentFeature": {
"stateAdmin": true,
"schoolAdmin": true,
"teacher": false
}
},
"canEditAttendance": {
"stateAdmin": true,
"schoolAdmin": true,
"teacher": false
},
"previousAttendance": {
"visibilityInCardView": [],
"maxPreviousVisibility": [],
"stateAdmin": true,
"schoolAdmin": true,
"teacher": false,
"canEditAttendance": {
"maxPreviousEditibility": [],
"stateAdmin": true,
"schoolAdmin": true,
"teacher": false
}
}
}
]
}
]
8 changes: 4 additions & 4 deletions packages/classes/src/services/studentServiceRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ export const getAll = async (params = {}, header = {}) => {
Accept: "application/json",
...header,
};
params.classId ="d287fa46-5308-48b8-a2ec-ee78f83e5f14";
params.classId = "d287fa46-5308-48b8-a2ec-ee78f83e5f14";
const result = await get(
`${manifest.api_url}/${manifest.api_version}/group/${params?.classId}/participants?role=Student`,
{
headers
{
headers,
}
);
if (result?.data?.data && result.data.data.length) {
return result.data.data.map((e) => mapInterfaceData(e, interfaceData))
return result.data.data.map((e) => mapInterfaceData(e, interfaceData));
}
return [];
};
Expand Down
9 changes: 6 additions & 3 deletions packages/classes/src/services/teacherServiceRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ const interfaceData = {
designation: "designation",
image: "image",
schoolId: "schoolId",
workingStatus: "workingStatus"
workingStatus: "workingStatus",
};

export const getAll = async (
filters = {
filters: {},
}
) => {
const result = await post(`${manifest.api_url}${manifest.api_version}/teacher/search/`, filters);
const result = await post(
`${manifest.api_url}${manifest.api_version}/teacher/search/`,
filters
);
if (result.data) {
return result.data.map((e) => mapInterfaceData(e, interfaceData));
} else {
Expand All @@ -38,7 +41,7 @@ export const getAll = async (

export const getOne = async (filters = {}, headers = {}) => {
const result = await get(
`${ manifest.api_url}${manifest.api_version}/teacher`,
`${manifest.api_url}${manifest.api_version}/teacher`,
{ headers }
).catch((error) => error);
if (result.data) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/pages/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Login() {
{},
{ Authorization: "Bearer " + token }
);
console.log(resultTeacher);
console.log(resultTeacher);
if (resultTeacher) {
let id = resultTeacher.id.replace("1-", "");
localStorage.setItem("id", id);
Expand Down
Loading

0 comments on commit 50cd982

Please sign in to comment.