diff --git a/campus/bffs/attendance/api/Dependencies.toml b/campus/bffs/attendance/api/Dependencies.toml index 41f0bcce..34b5eb21 100644 --- a/campus/bffs/attendance/api/Dependencies.toml +++ b/campus/bffs/attendance/api/Dependencies.toml @@ -103,7 +103,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.8.5" +version = "2.8.6" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, diff --git a/campus/bffs/attendance/api/attendance_client.bal b/campus/bffs/attendance/api/attendance_client.bal index 2c087302..152d90dd 100644 --- a/campus/bffs/attendance/api/attendance_client.bal +++ b/campus/bffs/attendance/api/attendance_client.bal @@ -302,10 +302,16 @@ log:printInfo("Formatted Response: " + formattedJson); json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); return check performDataBinding(graphqlResponse, GetTotalAttendanceCountByParentOrgResponse); } - remote isolated function getDailyAttendanceSummaryReport(string from_date, string to_date, int parent_organization_id) returns GetDailyAttendanceSummaryReportResponse|graphql:ClientError { - string query = string `query getDailyAttendanceSummaryReport($parent_organization_id:Int!,$from_date:String!,$to_date:String!) {daily_attendance_summary_report(parent_organization_id:$parent_organization_id,from_date:$from_date,to_date:$to_date) {sign_in_date present_count late_count total_count present_attendance_percentage late_attendance_percentage}}`; - map variables = {"from_date": from_date, "to_date": to_date, "parent_organization_id": parent_organization_id}; + remote isolated function getDailyAttendanceSummaryReport(string from_date, string to_date, int organization_id, int avinya_type_id) returns GetDailyAttendanceSummaryReportResponse|graphql:ClientError { + string query = string `query getDailyAttendanceSummaryReport($organization_id:Int!,$avinya_type_id:Int!,$from_date:String!,$to_date:String!) {daily_attendance_summary_report(organization_id:$organization_id,avinya_type_id:$avinya_type_id,from_date:$from_date,to_date:$to_date) {sign_in_date present_count late_count total_count present_attendance_percentage late_attendance_percentage}}`; + map variables = {"from_date": from_date, "to_date": to_date, "organization_id": organization_id, "avinya_type_id": avinya_type_id}; json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); return check performDataBinding(graphqlResponse, GetDailyAttendanceSummaryReportResponse); } + remote isolated function getOrganizationsByAvinyaType(int avinya_type) returns GetOrganizationsByAvinyaTypeResponse|graphql:ClientError { + string query = string `query getOrganizationsByAvinyaType($avinya_type:Int!) {organizations_by_avinya_type(avinya_type:$avinya_type) {id name {name_en} description organization_metadata {key_name value}}}`; + map variables = {"avinya_type": avinya_type}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return check performDataBinding(graphqlResponse, GetOrganizationsByAvinyaTypeResponse); + } } diff --git a/campus/bffs/attendance/api/service.bal b/campus/bffs/attendance/api/service.bal index 789e7e1a..49407e64 100644 --- a/campus/bffs/attendance/api/service.bal +++ b/campus/bffs/attendance/api/service.bal @@ -833,8 +833,8 @@ service / on new http:Listener(9091) { } } - resource function get daily_attendance_summary_report/[int parent_organization_id]/[string from_date]/[string to_date]() returns ActivityParticipantAttendanceSummary[]|error { - GetDailyAttendanceSummaryReportResponse|graphql:ClientError getDailyAttendanceSummaryReportResponse = globalDataClient->getDailyAttendanceSummaryReport(from_date,to_date,parent_organization_id); + resource function get daily_attendance_summary_report/[int organization_id]/[int avinya_type_id]/[string from_date]/[string to_date]() returns ActivityParticipantAttendanceSummary[]|error { + GetDailyAttendanceSummaryReportResponse|graphql:ClientError getDailyAttendanceSummaryReportResponse = globalDataClient->getDailyAttendanceSummaryReport(from_date,to_date,organization_id,avinya_type_id); if(getDailyAttendanceSummaryReportResponse is GetDailyAttendanceSummaryReportResponse) { ActivityParticipantAttendanceSummary[] activityParticipantAttendances = []; foreach var attendance_record in getDailyAttendanceSummaryReportResponse.daily_attendance_summary_report { @@ -856,4 +856,28 @@ service / on new http:Listener(9091) { ":: Detail: " + getDailyAttendanceSummaryReportResponse.detail().toString()); } } + + resource function get organizations_by_avinya_type/[int avinya_type_id]() returns Organization[]|error { + GetOrganizationsByAvinyaTypeResponse|graphql:ClientError getOrganizationsByAvinyaTypeResponse = globalDataClient->getOrganizationsByAvinyaType(avinya_type_id); + if(getOrganizationsByAvinyaTypeResponse is GetOrganizationsByAvinyaTypeResponse) { + Organization[] organizations = []; + foreach var organization_record in getOrganizationsByAvinyaTypeResponse.organizations_by_avinya_type { + Organization|error organization = organization_record.cloneWithType(Organization); + if(organization is Organization) { + organizations.push(organization); + } else { + log:printError("Error while processing Application record received", organization); + return error("Error while processing Application record received: " + organization.message() + + ":: Detail: " + organization.detail().toString()); + } + } + + return organizations; + + } else { + log:printError("Error while creating application", getOrganizationsByAvinyaTypeResponse); + return error("Error while creating application: " + getOrganizationsByAvinyaTypeResponse.message() + + ":: Detail: " + getOrganizationsByAvinyaTypeResponse.detail().toString()); + } + } } diff --git a/campus/bffs/attendance/api/types.bal b/campus/bffs/attendance/api/types.bal index d2cc9821..b29295c3 100644 --- a/campus/bffs/attendance/api/types.bal +++ b/campus/bffs/attendance/api/types.bal @@ -789,4 +789,19 @@ public type GetDailyAttendanceSummaryReportResponse record {| anydata? present_attendance_percentage; anydata? late_attendance_percentage; |}[] daily_attendance_summary_report; +|}; + +public type GetOrganizationsByAvinyaTypeResponse record {| + map __extensions?; + record {| + int? id; + record {| + string name_en; + |} name; + string? description; + record {| + string? key_name; + string? value; + |}[]? organization_metadata; + |}[] organizations_by_avinya_type; |}; \ No newline at end of file diff --git a/campus/bffs/attendance/graphql_client/activity.graphql b/campus/bffs/attendance/graphql_client/activity.graphql index 81bedeee..fef90a07 100644 --- a/campus/bffs/attendance/graphql_client/activity.graphql +++ b/campus/bffs/attendance/graphql_client/activity.graphql @@ -389,8 +389,8 @@ query getTotalAttendanceCountByParentOrg($parent_organization_id: Int!, $from_da } } -query getDailyAttendanceSummaryReport($parent_organization_id: Int!, $from_date: String!, $to_date: String!) { - daily_attendance_summary_report(parent_organization_id: $parent_organization_id, from_date: $from_date, to_date: $to_date) { +query getDailyAttendanceSummaryReport($organization_id: Int!,$avinya_type_id: Int!, $from_date: String!, $to_date: String!) { + daily_attendance_summary_report(organization_id: $organization_id, avinya_type_id: $avinya_type_id,from_date: $from_date, to_date: $to_date) { sign_in_date present_count late_count @@ -398,4 +398,18 @@ query getDailyAttendanceSummaryReport($parent_organization_id: Int!, $from_date: present_attendance_percentage late_attendance_percentage } +} + +query getOrganizationsByAvinyaType($avinya_type: Int!) { + organizations_by_avinya_type(avinya_type:$avinya_type) { + id + name{ + name_en + } + description + organization_metadata{ + key_name + value + } + } } \ No newline at end of file diff --git a/campus/bffs/attendance/graphql_client/graphql_client_cg_src/client.bal b/campus/bffs/attendance/graphql_client/graphql_client_cg_src/client.bal index 871734de..593a8912 100644 --- a/campus/bffs/attendance/graphql_client/graphql_client_cg_src/client.bal +++ b/campus/bffs/attendance/graphql_client/graphql_client_cg_src/client.bal @@ -207,10 +207,16 @@ public isolated client class GraphqlClient { json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); return check performDataBinding(graphqlResponse, GetTotalAttendanceCountByParentOrgResponse); } - remote isolated function getDailyAttendanceSummaryReport(string from_date, string to_date, int parent_organization_id) returns GetDailyAttendanceSummaryReportResponse|graphql:ClientError { - string query = string `query getDailyAttendanceSummaryReport($parent_organization_id:Int!,$from_date:String!,$to_date:String!) {daily_attendance_summary_report(parent_organization_id:$parent_organization_id,from_date:$from_date,to_date:$to_date) {sign_in_date present_count late_count total_count present_attendance_percentage late_attendance_percentage}}`; - map variables = {"from_date": from_date, "to_date": to_date, "parent_organization_id": parent_organization_id}; + remote isolated function getDailyAttendanceSummaryReport(string from_date, string to_date, int organization_id, int avinya_type_id) returns GetDailyAttendanceSummaryReportResponse|graphql:ClientError { + string query = string `query getDailyAttendanceSummaryReport($organization_id:Int!,$avinya_type_id:Int!,$from_date:String!,$to_date:String!) {daily_attendance_summary_report(organization_id:$organization_id,avinya_type_id:$avinya_type_id,from_date:$from_date,to_date:$to_date) {sign_in_date present_count late_count total_count present_attendance_percentage late_attendance_percentage}}`; + map variables = {"from_date": from_date, "to_date": to_date, "organization_id": organization_id, "avinya_type_id": avinya_type_id}; json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); return check performDataBinding(graphqlResponse, GetDailyAttendanceSummaryReportResponse); } + remote isolated function getOrganizationsByAvinyaType(int avinya_type) returns GetOrganizationsByAvinyaTypeResponse|graphql:ClientError { + string query = string `query getOrganizationsByAvinyaType($avinya_type:Int!) {organizations_by_avinya_type(avinya_type:$avinya_type) {id name {name_en} description organization_metadata {key_name value}}}`; + map variables = {"avinya_type": avinya_type}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return check performDataBinding(graphqlResponse, GetOrganizationsByAvinyaTypeResponse); + } } diff --git a/campus/bffs/attendance/graphql_client/graphql_client_cg_src/types.bal b/campus/bffs/attendance/graphql_client/graphql_client_cg_src/types.bal index 53fbb09f..06b457f5 100644 --- a/campus/bffs/attendance/graphql_client/graphql_client_cg_src/types.bal +++ b/campus/bffs/attendance/graphql_client/graphql_client_cg_src/types.bal @@ -876,3 +876,18 @@ public type GetDailyAttendanceSummaryReportResponse record {| anydata? late_attendance_percentage; |}[]? daily_attendance_summary_report; |}; + +public type GetOrganizationsByAvinyaTypeResponse record {| + map __extensions?; + record {| + int? id; + record {| + string name_en; + |} name; + string? description; + record {| + string? key_name; + string? value; + |}[]? organization_metadata; + |}[]? organizations_by_avinya_type; +|}; diff --git a/campus/bffs/attendance/graphql_client/schema.graphql b/campus/bffs/attendance/graphql_client/schema.graphql index 060d8ca7..5f2bc8ad 100644 --- a/campus/bffs/attendance/graphql_client/schema.graphql +++ b/campus/bffs/attendance/graphql_client/schema.graphql @@ -659,6 +659,14 @@ type OrganizationData { parent_organizations: [OrganizationData!] people: [PersonData!] vacancies: [VacancyData!] + organization_metadata: [OrganizationMetaData!] +} + +type OrganizationMetaData { + id: Int + organization_id: Int + key_name: String + value: String } type OrganizationStructureData { @@ -869,7 +877,7 @@ type Query { attendance_missed_by_security(organization_id: Int, parent_organization_id: Int, from_date: String = "", to_date: String = ""): [ActivityParticipantAttendanceMissedBySecurityData!] daily_students_attendance_by_parent_org(parent_organization_id: Int): [DailyActivityParticipantAttendanceByParentOrgData!] total_attendance_count_by_date(organization_id: Int, parent_organization_id: Int, from_date: String = "", to_date: String = ""): [TotalActivityParticipantAttendanceCountByDateData!] - daily_attendance_summary_report(parent_organization_id: Int, from_date: String = "", to_date: String = ""): [DailyActivityParticipantAttendanceSummaryReportData!] + daily_attendance_summary_report(organization_id: Int, avinya_type_id: Int, from_date: String = "", to_date: String = ""): [DailyActivityParticipantAttendanceSummaryReportData!] } input ResourceAllocation { diff --git a/campus/bffs/attendance/graphql_client/schema.json b/campus/bffs/attendance/graphql_client/schema.json index 715a7121..a5cb8175 100644 --- a/campus/bffs/attendance/graphql_client/schema.json +++ b/campus/bffs/attendance/graphql_client/schema.json @@ -2728,7 +2728,16 @@ "name": "daily_attendance_summary_report", "args": [ { - "name": "parent_organization_id", + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "avinya_type_id", "type": { "kind": "SCALAR", "name": "Int", @@ -5448,6 +5457,25 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "organization_metadata", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "OrganizationMetaData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -5798,6 +5826,60 @@ ], "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "OrganizationMetaData", + "fields": [ + { + "name": "id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization_id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "key_name", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "value", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "InventoryData", diff --git a/campus/bffs/profile/api/Dependencies.toml b/campus/bffs/profile/api/Dependencies.toml index 1c37998b..3bb1ca4f 100644 --- a/campus/bffs/profile/api/Dependencies.toml +++ b/campus/bffs/profile/api/Dependencies.toml @@ -103,7 +103,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.8.5" +version = "2.8.6" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, diff --git a/campus/bffs/profile/api/person_client.bal b/campus/bffs/profile/api/person_client.bal index 8b92d72c..3acfadc8 100644 --- a/campus/bffs/profile/api/person_client.bal +++ b/campus/bffs/profile/api/person_client.bal @@ -49,14 +49,14 @@ public isolated client class GraphqlClient { name_en } description - child_organizations { + } + child_organizations_for_dashboard { id name { name_en } description } - } parent_organizations { id name { diff --git a/campus/bffs/profile/api/types.bal b/campus/bffs/profile/api/types.bal index 6ab58c6e..6e630153 100644 --- a/campus/bffs/profile/api/types.bal +++ b/campus/bffs/profile/api/types.bal @@ -587,6 +587,13 @@ public type GetOrganizationResponse record {| |} name; string? description; |}[]? child_organizations; + record {| + int? id; + record {| + string name_en; + |} name; + string? description; + |}[]? child_organizations_for_dashboard; record {| int? id; record {| diff --git a/campus/bffs/profile/graphql_client/schema.graphql b/campus/bffs/profile/graphql_client/schema.graphql index 934bb793..c00ff085 100644 Binary files a/campus/bffs/profile/graphql_client/schema.graphql and b/campus/bffs/profile/graphql_client/schema.graphql differ diff --git a/campus/bffs/profile/graphql_client/schema.json b/campus/bffs/profile/graphql_client/schema.json index 42e1fa06..03cae844 100644 --- a/campus/bffs/profile/graphql_client/schema.json +++ b/campus/bffs/profile/graphql_client/schema.json @@ -368,6 +368,28 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "organization_id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "branch_code", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -647,6 +669,35 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "organizations_by_avinya_type", + "args": [ + { + "name": "avinya_type", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "OrganizationData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "student_list_by_parent", "args": [ @@ -1692,6 +1743,80 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "late_attendance_report", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "parent_organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "activity_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "result_limit", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "\"\"" + }, + { + "name": "from_date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + }, + { + "name": "to_date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ActivityParticipantAttendanceDataForLateAttendance", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "asset", "args": [ @@ -1887,6 +2012,29 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "activeActivityInstance", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ActivityInstanceData", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "resource_property", "args": [ @@ -2143,82 +2291,570 @@ }, "isDeprecated": false, "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "Address", - "fields": null, - "inputFields": [ - { - "name": "record_type", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": "\"\"" - }, - { - "name": "id", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null }, { - "name": "street_address", + "name": "resource_allocations_report", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "avinya_type_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], "type": { "kind": "NON_NULL", "name": null, "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ResourceAllocationData", + "ofType": null + } + } } }, - "defaultValue": null - }, - { - "name": "phone", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null + "isDeprecated": false, + "deprecationReason": null }, { - "name": "city_id", + "name": "duty_participants", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], "type": { "kind": "NON_NULL", "name": null, "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DutyParticipantData", + "ofType": null + } + } } }, - "defaultValue": null + "isDeprecated": false, + "deprecationReason": null }, { - "name": "name_en", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, + "name": "activities_by_avinya_type", + "args": [ + { + "name": "avinya_type_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ActivityData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "duty_rotation_metadata_by_organization", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DutyRotationMetaData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "duty_participants_by_duty_activity_id", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "duty_activity_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DutyParticipantData", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "duty_attendance_today", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "activity_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ActivityParticipantAttendanceData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "duty_participant", + "args": [ + { + "name": "person_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DutyParticipantData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "attendance_dashboard_data_by_date", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "parent_organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "activity_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "from_date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + }, + { + "name": "to_date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "AttendanceDashboardDataMain", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "attendance_missed_by_security", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "parent_organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "from_date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + }, + { + "name": "to_date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ActivityParticipantAttendanceMissedBySecurityData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "daily_students_attendance_by_parent_org", + "args": [ + { + "name": "parent_organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DailyActivityParticipantAttendanceByParentOrgData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "total_attendance_count_by_date", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "parent_organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "from_date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + }, + { + "name": "to_date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TotalActivityParticipantAttendanceCountByDateData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "daily_attendance_summary_report", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "avinya_type_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "from_date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + }, + { + "name": "to_date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DailyActivityParticipantAttendanceSummaryReportData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "Address", + "fields": null, + "inputFields": [ + { + "name": "record_type", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + }, + { + "name": "id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "street_address", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "phone", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "city_id", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "name_en", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, "defaultValue": null }, { @@ -2991,6 +3627,190 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "TotalActivityParticipantAttendanceCountByDateData", + "fields": [ + { + "name": "attendance_date", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "daily_total", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DailyActivityParticipantAttendanceSummaryReportData", + "fields": [ + { + "name": "sign_in_date", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "present_count", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "late_count", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "total_count", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "present_attendance_percentage", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Decimal", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "late_attendance_percentage", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Decimal", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AttendanceDashboardData", + "fields": [ + { + "name": "record_type", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "numOfFiles", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "svgSrc", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "color", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "percentage", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Decimal", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "ApplicantConsent", @@ -3069,7 +3889,79 @@ "defaultValue": null }, { - "name": "date_of_birth", + "name": "date_of_birth", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "done_ol", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "ol_year", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "done_al", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "al_year", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "al_stream", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "distance_to_school", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "phone", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "email", "type": { "kind": "SCALAR", "name": "String", @@ -3078,7 +3970,7 @@ "defaultValue": null }, { - "name": "done_ol", + "name": "information_correct_consent", "type": { "kind": "SCALAR", "name": "Boolean", @@ -3087,61 +3979,80 @@ "defaultValue": null }, { - "name": "ol_year", + "name": "agree_terms_consent", "type": { "kind": "SCALAR", - "name": "Int", + "name": "Boolean", "ofType": null }, "defaultValue": null }, { - "name": "distance_to_school", + "name": "created", "type": { "kind": "SCALAR", - "name": "Int", + "name": "String", "ofType": null }, "defaultValue": null }, { - "name": "phone", + "name": "updated", "type": { "kind": "SCALAR", - "name": "Int", + "name": "String", "ofType": null }, "defaultValue": null - }, + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Decimal", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DutyRotationMetaDetails", + "fields": null, + "inputFields": [ { - "name": "email", + "name": "record_type", "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null + "defaultValue": "\"\"" }, { - "name": "information_correct_consent", + "name": "id", "type": { "kind": "SCALAR", - "name": "Boolean", + "name": "Int", "ofType": null }, "defaultValue": null }, { - "name": "agree_terms_consent", + "name": "start_date", "type": { "kind": "SCALAR", - "name": "Boolean", + "name": "String", "ofType": null }, "defaultValue": null }, { - "name": "created", + "name": "end_date", "type": { "kind": "SCALAR", "name": "String", @@ -3150,10 +4061,10 @@ "defaultValue": null }, { - "name": "updated", + "name": "organization_id", "type": { "kind": "SCALAR", - "name": "String", + "name": "Int", "ofType": null }, "defaultValue": null @@ -3781,6 +4692,60 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "ActivityParticipantAttendanceMissedBySecurityData", + "fields": [ + { + "name": "sign_in_time", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "preferred_name", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "digital_id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "SCALAR", "name": "Boolean", @@ -4436,6 +5401,25 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "child_organizations_for_dashboard", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "OrganizationData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "parent_organizations", "args": [], @@ -4492,6 +5476,25 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "organization_metadata", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "OrganizationMetaData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -4785,106 +5788,280 @@ "deprecationReason": null }, { - "name": "SCHEMA", + "name": "SCHEMA", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCALAR", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD_DEFINITION", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ARGUMENT_DEFINITION", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM_VALUE", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_FIELD_DEFINITION", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OrganizationMetaData", + "fields": [ + { + "name": "id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization_id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "key_name", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "value", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "InventoryData", + "fields": [ + { + "name": "id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, "isDeprecated": false, "deprecationReason": null }, { - "name": "SCALAR", + "name": "avinya_type", + "args": [], + "type": { + "kind": "OBJECT", + "name": "AvinyaTypeData", + "ofType": null + }, "isDeprecated": false, "deprecationReason": null }, { - "name": "OBJECT", + "name": "avinya_type_id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, "isDeprecated": false, "deprecationReason": null }, { - "name": "FIELD_DEFINITION", + "name": "asset", + "args": [], + "type": { + "kind": "OBJECT", + "name": "AssetData", + "ofType": null + }, "isDeprecated": false, "deprecationReason": null }, { - "name": "ARGUMENT_DEFINITION", + "name": "consumable", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ConsumableData", + "ofType": null + }, "isDeprecated": false, "deprecationReason": null }, { - "name": "INTERFACE", + "name": "organization", + "args": [], + "type": { + "kind": "OBJECT", + "name": "OrganizationData", + "ofType": null + }, "isDeprecated": false, "deprecationReason": null }, { - "name": "UNION", + "name": "person", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PersonData", + "ofType": null + }, "isDeprecated": false, "deprecationReason": null }, { - "name": "ENUM", + "name": "quantity", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, "isDeprecated": false, "deprecationReason": null }, { - "name": "ENUM_VALUE", + "name": "quantity_in", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, "isDeprecated": false, "deprecationReason": null }, { - "name": "INPUT_OBJECT", + "name": "quantity_out", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, "isDeprecated": false, "deprecationReason": null }, { - "name": "INPUT_FIELD_DEFINITION", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "InventoryData", - "fields": [ - { - "name": "id", + "name": "created", "args": [], "type": { "kind": "SCALAR", - "name": "Int", + "name": "String", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "asset", + "name": "updated", "args": [], "type": { - "kind": "OBJECT", - "name": "AssetData", + "kind": "SCALAR", + "name": "String", "ofType": null }, "isDeprecated": false, "deprecationReason": null - }, + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DutyParticipantData", + "fields": [ { - "name": "consumable", + "name": "id", "args": [], "type": { - "kind": "OBJECT", - "name": "ConsumableData", + "kind": "SCALAR", + "name": "Int", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "organization", + "name": "person_id", "args": [], "type": { - "kind": "OBJECT", - "name": "OrganizationData", + "kind": "SCALAR", + "name": "Int", "ofType": null }, "isDeprecated": false, @@ -4902,18 +6079,18 @@ "deprecationReason": null }, { - "name": "quantity", + "name": "activity", "args": [], "type": { - "kind": "SCALAR", - "name": "Int", + "kind": "OBJECT", + "name": "ActivityData", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "quantity_in", + "name": "activity_id", "args": [], "type": { "kind": "SCALAR", @@ -4924,11 +6101,11 @@ "deprecationReason": null }, { - "name": "quantity_out", + "name": "role", "args": [], "type": { "kind": "SCALAR", - "name": "Int", + "name": "String", "ofType": null }, "isDeprecated": false, @@ -6518,24 +7695,149 @@ } ], "type": { - "kind": "OBJECT", - "name": "ResourceAllocationData", + "kind": "OBJECT", + "name": "ResourceAllocationData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "update_resource_allocation", + "args": [ + { + "name": "resourceAllocation", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ResourceAllocation", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "ResourceAllocationData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "add_inventory", + "args": [ + { + "name": "inventory", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "Inventory", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "InventoryData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "update_inventory", + "args": [ + { + "name": "inventory", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "Inventory", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "InventoryData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "add_duty_for_participant", + "args": [ + { + "name": "dutyparticipant", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DutyParticipant", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DutyParticipantData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "delete_duty_for_participant", + "args": [ + { + "name": "id", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Int", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "update_resource_allocation", + "name": "update_duty_rotation_metadata", "args": [ { - "name": "resourceAllocation", + "name": "duty_rotation", "type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "INPUT_OBJECT", - "name": "ResourceAllocation", + "name": "DutyRotationMetaDetails", "ofType": null } }, @@ -6544,23 +7846,23 @@ ], "type": { "kind": "OBJECT", - "name": "ResourceAllocationData", + "name": "DutyRotationMetaData", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "add_inventory", + "name": "add_duty_attendance", "args": [ { - "name": "inventory", + "name": "duty_attendance", "type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "INPUT_OBJECT", - "name": "Inventory", + "name": "ActivityParticipantAttendance", "ofType": null } }, @@ -6569,23 +7871,23 @@ ], "type": { "kind": "OBJECT", - "name": "InventoryData", + "name": "ActivityParticipantAttendanceData", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "update_inventory", + "name": "add_duty_evaluation", "args": [ { - "name": "inventory", + "name": "duty_evaluation", "type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "INPUT_OBJECT", - "name": "Inventory", + "name": "Evaluation", "ofType": null } }, @@ -6594,7 +7896,7 @@ ], "type": { "kind": "OBJECT", - "name": "InventoryData", + "name": "EvaluationData", "ofType": null }, "isDeprecated": false, @@ -7090,6 +8392,24 @@ "ofType": null }, "defaultValue": null + }, + { + "name": "academy_org_name", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "branch_code", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null } ], "interfaces": null, @@ -7574,6 +8894,23 @@ }, "defaultValue": null }, + { + "name": "child_organizations_for_dashboard", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + } + }, + "defaultValue": null + }, { "name": "address_id", "type": { @@ -7736,6 +9073,125 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "DutyRotationMetaData", + "fields": [ + { + "name": "id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "start_date", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "end_date", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization_id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DailyActivityParticipantAttendanceByParentOrgData", + "fields": [ + { + "name": "description", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "present_count", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "total_student_count", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "svg_src", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "color", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "__Type", @@ -8192,6 +9648,17 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "avinya_type_id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "created", "args": [], @@ -8563,6 +10030,23 @@ "ofType": null }, "defaultValue": null + }, + { + "name": "resource_properties", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ResourceProperty", + "ofType": null + } + } + }, + "defaultValue": null } ], "interfaces": null, @@ -8585,18 +10069,84 @@ "deprecationReason": null }, { - "name": "active", + "name": "active", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "phone", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "email", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "date_of_birth", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "done_ol", "args": [], "type": { "kind": "SCALAR", - "name": "Boolean", + "name": "String", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "phone", + "name": "ol_year", "args": [], "type": { "kind": "SCALAR", @@ -8607,7 +10157,7 @@ "deprecationReason": null }, { - "name": "name", + "name": "done_al", "args": [], "type": { "kind": "SCALAR", @@ -8618,7 +10168,7 @@ "deprecationReason": null }, { - "name": "id", + "name": "al_year", "args": [], "type": { "kind": "SCALAR", @@ -8629,7 +10179,7 @@ "deprecationReason": null }, { - "name": "email", + "name": "al_stream", "args": [], "type": { "kind": "SCALAR", @@ -8640,18 +10190,18 @@ "deprecationReason": null }, { - "name": "date_of_birth", + "name": "distance_to_school", "args": [], "type": { "kind": "SCALAR", - "name": "String", + "name": "Int", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "done_ol", + "name": "information_correct_consent", "args": [], "type": { "kind": "SCALAR", @@ -8662,7 +10212,18 @@ "deprecationReason": null }, { - "name": "ol_year", + "name": "agree_terms_consent", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "application_id", "args": [], "type": { "kind": "SCALAR", @@ -8673,7 +10234,7 @@ "deprecationReason": null }, { - "name": "distance_to_school", + "name": "person_id", "args": [], "type": { "kind": "SCALAR", @@ -8684,22 +10245,22 @@ "deprecationReason": null }, { - "name": "information_correct_consent", + "name": "avinya_type_id", "args": [], "type": { "kind": "SCALAR", - "name": "Boolean", + "name": "Int", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "agree_terms_consent", + "name": "organization_id", "args": [], "type": { "kind": "SCALAR", - "name": "Boolean", + "name": "Int", "ofType": null }, "isDeprecated": false, @@ -9010,6 +10571,29 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "resource_properties", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ResourcePropertyData", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -9402,91 +10986,272 @@ "name": "Int", "ofType": null }, - "defaultValue": null + "defaultValue": null + }, + { + "name": "avinya_type_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "name", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "description", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "manufacturer", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "model", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "serial_number", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "created", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "updated", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Schema", + "fields": [ + { + "name": "description", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "types", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queryType", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mutationType", + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionType", + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "directives", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Directive", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ActivityParticipantAttendanceDataForLateAttendance", + "fields": [ + { + "name": "id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null }, { - "name": "avinya_type_id", + "name": "activity_instance_id", + "args": [], "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, - "defaultValue": null - }, - { - "name": "name", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null + "isDeprecated": false, + "deprecationReason": null }, { - "name": "description", + "name": "person_id", + "args": [], "type": { "kind": "SCALAR", - "name": "String", + "name": "Int", "ofType": null }, - "defaultValue": null + "isDeprecated": false, + "deprecationReason": null }, { - "name": "manufacturer", + "name": "person", + "args": [], "type": { - "kind": "SCALAR", - "name": "String", + "kind": "OBJECT", + "name": "PersonData", "ofType": null }, - "defaultValue": null + "isDeprecated": false, + "deprecationReason": null }, { - "name": "model", + "name": "sign_in_time", + "args": [], "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null + "isDeprecated": false, + "deprecationReason": null }, { - "name": "serial_number", + "name": "description", + "args": [], "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null + "isDeprecated": false, + "deprecationReason": null }, { - "name": "created", + "name": "preferred_name", + "args": [], "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null + "isDeprecated": false, + "deprecationReason": null }, { - "name": "updated", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Schema", - "fields": [ - { - "name": "description", + "name": "digital_id", "args": [], "type": { "kind": "SCALAR", @@ -9497,84 +11262,56 @@ "deprecationReason": null }, { - "name": "types", + "name": "sign_out_time", "args": [], "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - } - } + "kind": "SCALAR", + "name": "String", + "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "queryType", + "name": "created", "args": [], "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } + "kind": "SCALAR", + "name": "String", + "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "mutationType", + "name": "updated", "args": [], "type": { - "kind": "OBJECT", - "name": "__Type", + "kind": "SCALAR", + "name": "String", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "subscriptionType", + "name": "in_marked_by", "args": [], "type": { - "kind": "OBJECT", - "name": "__Type", + "kind": "SCALAR", + "name": "String", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "directives", + "name": "out_marked_by", "args": [], "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Directive", - "ofType": null - } - } - } + "kind": "SCALAR", + "name": "String", + "ofType": null }, "isDeprecated": false, "deprecationReason": null @@ -9982,6 +11719,38 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "AttendanceDashboardDataMain", + "fields": [ + { + "name": "record_type", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "attendance_dashboard_data", + "args": [], + "type": { + "kind": "OBJECT", + "name": "AttendanceDashboardData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "EvaluationCycle", @@ -10535,6 +12304,97 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "INPUT_OBJECT", + "name": "DutyParticipant", + "fields": null, + "inputFields": [ + { + "name": "record_type", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + }, + { + "name": "id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "activity_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "activity", + "type": { + "kind": "INPUT_OBJECT", + "name": "Activity", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "person_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "person", + "type": { + "kind": "INPUT_OBJECT", + "name": "Person", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "role", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "created", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "updated", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "__Directive", diff --git a/campus/frontend/.vscode/settings.json b/campus/frontend/.vscode/settings.json index b242572e..16a2796b 100644 --- a/campus/frontend/.vscode/settings.json +++ b/campus/frontend/.vscode/settings.json @@ -1,5 +1,7 @@ { "githubPullRequests.ignoredPullRequestBranches": [ "main" - ] + ], + "editor.formatOnSave": true, + "editor.formatOnPaste": true } \ No newline at end of file diff --git a/campus/frontend/assets/icons/icons8-computer-96.png b/campus/frontend/assets/icons/icons8-computer-96.png new file mode 100644 index 00000000..39838c83 Binary files /dev/null and b/campus/frontend/assets/icons/icons8-computer-96.png differ diff --git a/campus/frontend/assets/icons/icons8-customer-service-64.png b/campus/frontend/assets/icons/icons8-customer-service-64.png new file mode 100644 index 00000000..5be791a0 Binary files /dev/null and b/campus/frontend/assets/icons/icons8-customer-service-64.png differ diff --git a/campus/frontend/lib/avinya/attendance/lib/data/activity_attendance.dart b/campus/frontend/lib/avinya/attendance/lib/data/activity_attendance.dart index 9845a190..5bc53c0a 100644 --- a/campus/frontend/lib/avinya/attendance/lib/data/activity_attendance.dart +++ b/campus/frontend/lib/avinya/attendance/lib/data/activity_attendance.dart @@ -1,6 +1,4 @@ import 'dart:ui'; - -import 'package:gallery/avinya/attendance/lib/data.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; @@ -546,12 +544,13 @@ Future> getTotalAttendanceCountByParentOrg( } Future> getDailyAttendanceSummaryReport( - int parent_organization_id, + int organization_id, + int avinya_type_id, String from_date, String to_date) async { final response = await http.get( Uri.parse( - '${AppConfig.campusAttendanceBffApiUrl}/daily_attendance_summary_report/$parent_organization_id/$from_date/$to_date'), + '${AppConfig.campusAttendanceBffApiUrl}/daily_attendance_summary_report/$organization_id/$avinya_type_id/$from_date/$to_date'), headers: { 'Content-Type': 'application/json; charset=UTF-8', 'accept': 'application/json', @@ -566,6 +565,6 @@ Future> getDailyAttendanceSummaryReport( return activityAttendances; } else { throw Exception( - 'Failed to get Daily Activity Participant Attendances Count'); + 'Failed to get Daily Attendances Summary Data'); } } diff --git a/campus/frontend/lib/avinya/attendance/lib/data/organization.dart b/campus/frontend/lib/avinya/attendance/lib/data/organization.dart new file mode 100644 index 00000000..f32ad128 --- /dev/null +++ b/campus/frontend/lib/avinya/attendance/lib/data/organization.dart @@ -0,0 +1,122 @@ +import 'package:gallery/avinya/attendance/lib/data.dart'; +import 'package:gallery/avinya/attendance/lib/data/organization_meta_data.dart'; +import 'package:http/http.dart' as http; +import 'dart:convert'; + +import 'package:gallery/config/app_config.dart'; + +class Name { + String? name_en; + String? name_si; + String? name_ta; + + Name({ + this.name_en, + this.name_si, + this.name_ta, + }); + + factory Name.fromJson(Map json) { + return Name( + name_en: json['name_en'], + name_si: json['name_si'], + name_ta: json['name_ta'], + ); + } + + Map toJson() => { + if (name_en != null) 'name_en': name_en, + if (name_si != null) 'name_si': name_si, + if (name_ta != null) 'name_ta': name_ta, + // if (address != null) 'address': address!.toJson(), + // if (employees != null) 'employees': List.from(employees!.map((x) => x.toJson())), + }; +} + +class Organization { + int? id; + Name? name; + String? description; + var child_organizations = []; + var parent_organizations = []; + var people = []; + var organization_metadata = []; + + Organization({ + this.id, + this.name, + this.description, + this.child_organizations = const [], + this.parent_organizations = const [], + this.people = const [], + this.organization_metadata = const[], + }); + + factory Organization.fromJson(Map json) { + return Organization( + id: json['id'], + name: json['name'] != null ? Name.fromJson(json['name']) : null, + description: json['description'], + child_organizations: json['child_organizations'] != null + ? List.from( + json['child_organizations'].map((x) => Organization.fromJson(x))) + : [], + parent_organizations: json['parent_organizations'] != null + ? List.from( + json['parent_organizations'].map((x) => Organization.fromJson(x))) + : [], + people: json['people'] != null + ? List.from(json['people'].map((x) => Person.fromJson(x))) + : [], + organization_metadata: json['organization_metadata'] != null + ? List.from( + json['organization_metadata'].map((x) => OrganizationMetaData.fromJson(x))) + : [], + ); + } + + Map toJson() => { + if (id != null) 'id': id, + // if (name != null) 'name': name, + // if (name != null) 'name': Name!.toJson(), + if (name != null) 'name': name!.toJson(), + if (description != null) 'description': description, + 'child_organizations': + List.from(child_organizations.map((x) => x.toJson())), + 'parent_organizations': + List.from(parent_organizations.map((x) => x.toJson())), + 'people': List.from(people.map((x) => x.toJson())), + 'organization_metadata':List.from(organization_metadata.map((x) => x.toJson())) + // if (employees != null) 'employees': List.from(employees!.map((x) => x.toJson())), + }; + + +} + +Future> fetchOrganizationsByAvinyaType(int avinya_type) async { + + final response = await http.get( + Uri.parse( + '${AppConfig.campusAttendanceBffApiUrl}/organizations_by_avinya_type/$avinya_type'), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + 'accept': 'application/json', + 'Authorization': 'Bearer ${AppConfig.campusBffApiKey}', + }, + ); + + if (response.statusCode > 199 && response.statusCode < 300) { + + var resultsJson = json.decode(response.body).cast>(); + + List organization = + await resultsJson + .map((json) => Organization.fromJson(json)) + .toList(); + return organization; + } else { + throw Exception('Failed to load organizations'); + } +} + + diff --git a/campus/frontend/lib/avinya/attendance/lib/data/organization_meta_data.dart b/campus/frontend/lib/avinya/attendance/lib/data/organization_meta_data.dart new file mode 100644 index 00000000..71b2d281 --- /dev/null +++ b/campus/frontend/lib/avinya/attendance/lib/data/organization_meta_data.dart @@ -0,0 +1,29 @@ +class OrganizationMetaData { + int? id; + int? organization_id; + String? key_name; + String? value; + + OrganizationMetaData({ + this.id, + this.organization_id, + this.key_name, + this.value, + }); + + factory OrganizationMetaData.fromJson(Map json) { + return OrganizationMetaData( + id: json['id'], + organization_id: json['organization_id'], + key_name: json['key_name'], + value: json['value'], + ); + } + + Map toJson() => { + if (id != null) 'id': id, + if (organization_id != null) 'organization_id': organization_id, + if (key_name != null) 'key_name': key_name, + if (value != null) 'value': value, + }; +} diff --git a/campus/frontend/lib/avinya/attendance/lib/screens/daily_attendance_summary_report.dart b/campus/frontend/lib/avinya/attendance/lib/screens/daily_attendance_summary_report.dart index 32b72c2b..61efb8a2 100644 --- a/campus/frontend/lib/avinya/attendance/lib/screens/daily_attendance_summary_report.dart +++ b/campus/frontend/lib/avinya/attendance/lib/screens/daily_attendance_summary_report.dart @@ -32,129 +32,11 @@ class _DailyAttendanceSummaryReportScreenState extends State selected) { - setState(() { - selected[index] = value; - }); - } - - void updateDateRange(_rangeStart, _rangeEnd) async { - - int? parentOrgId = - campusAppsPortalInstance.getUserPerson().organization!.id; - if (parentOrgId != null) { - setState(() { - _isFetching = true; // Set _isFetching to true before starting the fetch - }); - - _fetchedExcelReportData = await getDailyAttendanceSummaryReport( - parentOrgId, - DateFormat('yyyy-MM-dd') - .format(DateFormat('MMM d, yyyy').parse(this.formattedStartDate)), - DateFormat('yyyy-MM-dd') - .format(DateFormat('MMM d, yyyy').parse(this.formattedEndDate))); - - - try { - setState(() { - final startDate = _rangeStart ?? _selectedDay; - final endDate = _rangeEnd ?? _selectedDay; - final formatter = DateFormat('MMM d, yyyy'); - final formattedStartDate = formatter.format(startDate!); - final formattedEndDate = formatter.format(endDate!); - this.formattedStartDate = formattedStartDate; - this.formattedEndDate = formattedEndDate; - this._fetchedExcelReportData = _fetchedExcelReportData; - refreshState(); - }); - } catch (error) { - // Handle any errors that occur during the fetch - setState(() { - _isFetching = false; // Set _isFetching to false in case of error - }); - // Perform error handling, e.g., show an error message - } - } - } - - void refreshState() async { - setState(() { - _isFetching = true; // Set _isFetching to true before starting the fetch - }); - int? parentOrgId = - campusAppsPortalInstance.getUserPerson().organization!.id; - - _fetchedExcelReportData = await getDailyAttendanceSummaryReport( - parentOrgId!, - DateFormat('yyyy-MM-dd') - .format(DateFormat('MMM d, yyyy').parse(this.formattedStartDate)), - DateFormat('yyyy-MM-dd') - .format(DateFormat('MMM d, yyyy').parse(this.formattedEndDate))); - - - setState(() { - this._isFetching = false; - _data = MyData(_fetchedDailyAttendanceSummaryData,updateSelected); - }); - } - - List _buildDataColumns() { - - List ColumnNames = []; - - ColumnNames.add(DataColumn( - label: Text('Date', - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)))); - ColumnNames.add(DataColumn( - label: Text('Daily Count', - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)))); - ColumnNames.add(DataColumn( - label: Text('Daily Attendance Percentage', - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)))); - ColumnNames.add(DataColumn( - label: Text('Late Count', - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)))); - ColumnNames.add(DataColumn( - label: Text('Late Attendance Percentage', - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)))); - ColumnNames.add(DataColumn( - label: Text('Total Count', - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)))); - - return ColumnNames; } - @override void dispose() { super.dispose(); @@ -171,25 +53,11 @@ class _DailyAttendanceSummaryReportScreenState extends State { String formattedStartDate = ""; String formattedEndDate = ""; + String batchStartDate = ""; + String batchEndDate = ""; String startDate = ""; String endDate = ""; List cardData = []; + late Future> _fetchBatchData; + Organization? _selectedOrganizationValue; + List _batchData = []; + List _fetchedOrganizations = []; @override void initState() { @@ -47,8 +54,12 @@ class _AttendanceDashboardScreenState extends State { today = DateTime.now(); formattedStartDate = DateFormat('MMM d, yyyy').format(today); formattedEndDate = DateFormat('MMM d, yyyy').format(today); + // batchStartDate = DateFormat('MMM d, yyyy').format(today); + // batchEndDate = DateFormat('MMM d, yyyy').format(today); + ; String formattedToday = DateFormat('yyyy-MM-dd').format(today); - refreshState(null, formattedToday, formattedToday); + _fetchBatchData = _loadBatchData(); + // refreshState(null, formattedToday, formattedToday, 'batch'); } @override @@ -56,6 +67,26 @@ class _AttendanceDashboardScreenState extends State { super.dispose(); } + Future> _loadBatchData() async { + _batchData = await fetchOrganizationsByAvinyaType(86); + _selectedOrganizationValue = _batchData.isNotEmpty ? _batchData.last : null; + batchStartDate = DateFormat('MMM d, yyyy').format(DateTime.parse( + _selectedOrganizationValue!.organization_metadata[0].value.toString())); + batchEndDate = DateFormat('MMM d, yyyy').format(DateTime.parse( + _selectedOrganizationValue!.organization_metadata[1].value.toString())); + if (_selectedOrganizationValue != null) { + int orgId = _selectedOrganizationValue!.id!; + _fetchedOrganization = await fetchOrganization(orgId); + _fetchedOrganizations = + _fetchedOrganization?.child_organizations_for_dashboard ?? []; + setState(() { + _fetchedOrganizations = _fetchedOrganizations; + }); + } + this.updateDateRange(today, today); + return _batchData; + } + DateRange? selectedDateRange; void updateDateRange(_rangeStart, _rangeEnd) async { int? parentOrgId = @@ -75,7 +106,8 @@ class _AttendanceDashboardScreenState extends State { this.formattedEndDate = formattedEndDate; this.startDate = DateFormat('yyyy-MM-dd').format(startDate); this.endDate = DateFormat('yyyy-MM-dd').format(endDate); - refreshState(this._selectedValue, this.startDate, this.endDate); + refreshState( + this._selectedValue, this.startDate, this.endDate, 'date'); }); } catch (error) { // Handle any errors that occur during the fetch @@ -107,8 +139,8 @@ class _AttendanceDashboardScreenState extends State { return totalAttendance; } - void refreshState( - Organization? newValue, String startDate, String endDate) async { + void refreshState(Organization? newValue, String startDate, String endDate, + String from) async { setState(() { _isFetching = true; // Set _isFetching to true before starting the fetch }); @@ -146,11 +178,10 @@ class _AttendanceDashboardScreenState extends State { _fetchedOrganization!.description = "Select All"; } } else { - _fetchedOrganization = await fetchOrganization(newValue!.id!); _fetchedDashboardData = - await getDashboardCardDataByDate(startDate, endDate, newValue.id!); + await getDashboardCardDataByDate(startDate, endDate, newValue?.id!); _fetchedAttendanceData = await getAttendanceMissedBySecurityByOrg( - newValue.id!, startDate, endDate); + newValue!.id!, startDate, endDate); _fetchedLineChartData = await getTotalAttendanceCountByDateByOrg( newValue.id!, startDate, endDate); } @@ -162,6 +193,7 @@ class _AttendanceDashboardScreenState extends State { setState(() { _fetchedOrganization; + _fetchedOrganizations; this._isFetching = false; this.cardData = _fetchedDashboardData; this._fetchedAttendanceData = _fetchedAttendanceData; @@ -175,6 +207,8 @@ class _AttendanceDashboardScreenState extends State { BuildContext context, dynamic Function(DateRange?) onDateRangeChanged, [bool doubleMonth = false]) => DateRangePickerWidget( + minDate: DateFormat('MMM d, yyyy').parse(batchStartDate), + maxDate: DateFormat('MMM d, yyyy').parse(batchEndDate), doubleMonth: doubleMonth, maximumDateRangeLength: 200, theme: CalendarTheme( @@ -213,27 +247,29 @@ class _AttendanceDashboardScreenState extends State { DateTime.now(), ), ), - QuickDateRange( - label: 'Last 90 days', - dateRange: DateRange( - DateTime.now().subtract(const Duration(days: 90)), - DateTime.now(), - ), - ), - QuickDateRange( - label: 'Last 180 days', - dateRange: DateRange( - DateTime.now().subtract(const Duration(days: 180)), - DateTime.now(), - ), - ), + // QuickDateRange( + // label: 'Last 90 days', + // dateRange: DateRange( + // DateTime.now().subtract(const Duration(days: 90)), + // DateTime.now(), + // ), + // ), + // QuickDateRange( + // label: 'Last 180 days', + // dateRange: DateRange( + // DateTime.now().subtract(const Duration(days: 180)), + // DateTime.now(), + // ), + // ), ], minimumDateRangeLength: 3, // initialDateRange: this.selectedDateRange ?? // DateRange( // DateTime.now(), DateTime.now().add(const Duration(days: 7))), // disabledDates: [DateTime(2023, 11, 20)], - initialDisplayedDate: this.selectedDateRange?.start ?? today, + // initialDisplayedDate: this.selectedDateRange?.start ?? today, + initialDisplayedDate: this.selectedDateRange?.start ?? + DateFormat('MMM d, yyyy').parse(batchStartDate), onDateRangeChanged: (DateRange? value) { if (value != null) { var _rangeStart = value.start; @@ -249,6 +285,8 @@ class _AttendanceDashboardScreenState extends State { BuildContext context, dynamic Function(DateRange?) onDateRangeChanged, [bool doubleMonth = false]) => DateRangePickerWidget( + minDate: DateFormat('MMM d, yyyy').parse(batchStartDate), + maxDate: DateFormat('MMM d, yyyy').parse(batchEndDate), doubleMonth: doubleMonth, maximumDateRangeLength: 10, theme: CalendarTheme( @@ -269,7 +307,9 @@ class _AttendanceDashboardScreenState extends State { // DateRange( // DateTime.now(), DateTime.now().add(const Duration(days: 7))), // disabledDates: [DateTime(2023, 11, 20)], - initialDisplayedDate: this.selectedDateRange?.start ?? today, + // initialDisplayedDate: this.selectedDateRange?.start ?? today, + initialDisplayedDate: this.selectedDateRange?.start ?? + DateFormat('MMM d, yyyy').parse(batchStartDate), onDateRangeChanged: (DateRange? value) { if (value != null) { var _rangeStart = value.start; @@ -327,89 +367,162 @@ class _AttendanceDashboardScreenState extends State { ), child: Text(formattedStartDate + " - " + formattedEndDate), ), + SizedBox( + width: 30, + ), + Text('Select a Batch :'), + SizedBox( + width: 10, + ), + FutureBuilder>( + future: _fetchBatchData, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return Container( + margin: EdgeInsets.only(top: 10), + child: SpinKitCircle( + color: (Colors.deepPurpleAccent), + size: 70, + ), + ); + } else if (snapshot.hasError) { + return const Center( + child: Text('Something went wrong...'), + ); + } else if (!snapshot.hasData) { + return const Center( + child: Text('No batch found'), + ); + } + final batchData = snapshot.data!; + return DropdownButton( + value: _selectedOrganizationValue, + items: batchData.map((Organization batch) { + return DropdownMenuItem( + value: batch, + child: Text(batch.name!.name_en ?? '')); + }).toList(), + onChanged: (Organization? newValue) async { + if (newValue == null) { + return; + } + + if (newValue.organization_metadata.isEmpty) { + return; + } + + _fetchedOrganization = + await fetchOrganization(newValue!.id!); + _fetchedOrganizations = _fetchedOrganization + ?.child_organizations_for_dashboard ?? + []; + + setState(() { + _fetchedOrganizations; + _selectedValue = null; + _selectedOrganizationValue = newValue; + batchStartDate = DateFormat('MMM d, yyyy').format( + DateTime.parse(_selectedOrganizationValue! + .organization_metadata[0].value + .toString())); + + batchEndDate = DateFormat('MMM d, yyyy').format( + DateTime.parse(_selectedOrganizationValue! + .organization_metadata[1].value + .toString())); + + this.updateDateRange( + DateTime.parse(_selectedOrganizationValue! + .organization_metadata[0].value + .toString()), + DateTime.parse(_selectedOrganizationValue! + .organization_metadata[1].value + .toString())); + }); + }); + }, + ), Expanded( child: Container( margin: EdgeInsets.only(left: 8.0), child: Row(children: [ - for (var org in campusAppsPortalInstance - .getUserPerson() - .organization! - .child_organizations) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (org.child_organizations.length > 0) - Container( - margin: EdgeInsets.only( - left: 20, top: 20, bottom: 10), - child: Row(children: [ - Text('Select a class:'), - SizedBox(width: 10), - DropdownButton( - value: _selectedValue, - onChanged: - (Organization? newValue) async { - _selectedValue = newValue ?? null; - int? parentOrgId = - campusAppsPortalInstance - .getUserPerson() - .organization! - .id; - if (_selectedValue == null) { - setState(() { - if (_fetchedOrganization != null) { - _fetchedOrganization!.id = - parentOrgId; - _fetchedOrganization! - .description = "Select All"; - } else { - _fetchedOrganization = - Organization(); - _fetchedOrganization!.id = - parentOrgId; - _fetchedOrganization! - .description = "Select All"; - } - _fetchedDashboardData; - }); + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // if (org.child_organizations_for_dashboard.length > 0) + Container( + margin: EdgeInsets.only( + left: 20, top: 20, bottom: 10), + child: Row(children: [ + Text('Select a class:'), + SizedBox(width: 10), + DropdownButton( + value: _selectedValue, + onChanged: (Organization? newValue) async { + _selectedValue = newValue ?? null; + int? parentOrgId = campusAppsPortalInstance + .getUserPerson() + .organization! + .id; + if (_selectedValue == null) { + setState(() { + if (_fetchedOrganization != null) { + _fetchedOrganization!.id = + parentOrgId; + _fetchedOrganization!.description = + "Select All"; } else { - setState(() { - _fetchedOrganization; - _fetchedDashboardData; - }); + _fetchedOrganization = Organization(); + _fetchedOrganization!.id = + parentOrgId; + _fetchedOrganization!.description = + "Select All"; } - if (this.startDate == "" && - this.endDate == "") { - today = DateTime.now(); - String formattedToday = - DateFormat('yyyy-MM-dd') - .format(today); - refreshState(this._selectedValue, - formattedToday, formattedToday); - } else { - refreshState(this._selectedValue, - this.startDate, this.endDate); - } - }, - items: [ - // Add "Select All" option - DropdownMenuItem( - value: null, - child: Text("Select All"), - ), - // Add other organization options - ...org.child_organizations - .map((Organization value) { - return DropdownMenuItem( - value: value, - child: Text(value.description!), - ); - }), - ], + _fetchedDashboardData; + }); + } else { + setState(() { + _selectedValue; + _fetchedOrganization; + _fetchedDashboardData; + }); + } + if (this.startDate == "" && + this.endDate == "") { + today = DateTime.now(); + String formattedToday = + DateFormat('MMM d, yyyy') + .format(today); + refreshState( + this._selectedValue, + formattedToday, + formattedToday, + 'class'); + } else { + refreshState( + this._selectedValue, + this.startDate, + this.endDate, + 'class'); + } + }, + items: [ + // Add "Select All" option + DropdownMenuItem( + value: null, + child: Text("Select All"), ), - ]), + // Add other organization options + for (var org in _fetchedOrganizations) + DropdownMenuItem( + value: org, + child: Text(org.description!), + ) + ], ), - ]), + ]), + ), + ]), ]), )), ], @@ -420,147 +533,174 @@ class _AttendanceDashboardScreenState extends State { children: [ Row( children: [ - Expanded( - child: Container( - margin: EdgeInsets.only(left: 8.0), - child: Row(children: [ - for (var org in campusAppsPortalInstance - .getUserPerson() - .organization! - .child_organizations) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (org.child_organizations.length > 0) - Container( - margin: EdgeInsets.only( - left: 20, top: 20, bottom: 10), - child: Row(children: [ - Text('Select a class:'), - SizedBox(width: 10), - DropdownButton( - value: _selectedValue, - onChanged: - (Organization? newValue) async { - _selectedValue = newValue ?? null; - int? parentOrgId = - campusAppsPortalInstance - .getUserPerson() - .organization! - .id; - if (_selectedValue == null) { - // _fetchedOrganization = null; - if (this.startDate == "" && - this.endDate == "") { - today = DateTime.now(); - String formattedToday = - DateFormat('yyyy-MM-dd') - .format(today); - _fetchedDashboardData = - await getDashboardCardDataByParentOrg( - formattedToday, - formattedToday, - parentOrgId!); - } else { - _fetchedDashboardData = - await getDashboardCardDataByParentOrg( - this.startDate, - this.endDate, - parentOrgId!); - } - } else { - // _fetchedDashboardData = []; - _fetchedOrganization = - await fetchOrganization( - newValue!.id!); - if (this.startDate == "" && - this.endDate == "") { - today = DateTime.now(); - String formattedToday = - DateFormat('yyyy-MM-dd') - .format(today); - _fetchedDashboardData = - await getDashboardCardDataByDate( - formattedToday, - formattedToday, - newValue.id!); - } else { - _fetchedDashboardData = - await getDashboardCardDataByDate( - this.startDate, - this.endDate, - newValue.id!); - } - } - if (_selectedValue == null) { - setState(() { - if (_fetchedOrganization != - null) { - // _fetchedOrganization!.people = - // _fetchedDashboardData; - _fetchedOrganization!.id = - parentOrgId; - _fetchedOrganization! - .description = - "Select All"; - } else { - _fetchedOrganization = - Organization(); - // _fetchedOrganization!.people = - // _fetchedDashboardData; - _fetchedOrganization!.id = - parentOrgId; - _fetchedOrganization! - .description = - "Select All"; - } - _fetchedDashboardData; - // cardData = _fetchedDashboardData; - }); - } else { - setState(() { - _fetchedOrganization; - _fetchedDashboardData; - // cardData = _fetchedDashboardData; - }); - } - if (this.startDate == "" && - this.endDate == "") { - today = DateTime.now(); - String formattedToday = - DateFormat('yyyy-MM-dd') - .format(today); - refreshState( - this._selectedValue, - formattedToday, - formattedToday); - } else { - refreshState(this._selectedValue, - this.startDate, this.endDate); - } - }, - items: [ - // Add "Select All" option - DropdownMenuItem( - value: null, - child: Text("Select All"), - ), - // Add other organization options - ...org.child_organizations - .map((Organization value) { - return DropdownMenuItem< - Organization>( - value: value, - child: Text(value.description!), - ); - }), - ], - ), - ]), - ), + Text('Select a Batch :'), + SizedBox( + width: 5, + ), + SizedBox( + width: 240, + child: FutureBuilder>( + future: _fetchBatchData, + builder: (context, snapshot) { + if (snapshot.connectionState == + ConnectionState.waiting) { + return Container( + margin: EdgeInsets.only(top: 10), + child: SpinKitCircle( + color: (Colors.deepPurpleAccent), + size: 70, + ), + ); + } else if (snapshot.hasError) { + return const Center( + child: Text('Something went wrong...'), + ); + } else if (!snapshot.hasData) { + return const Center( + child: Text('No batch found'), + ); + } + final batchData = snapshot.data!; + return DropdownButton( + value: _selectedOrganizationValue, + items: batchData.map((Organization batch) { + return DropdownMenuItem( + value: batch, + child: Text(batch.name!.name_en ?? '')); + }).toList(), + onChanged: (Organization? newValue) async { + if (newValue == null) { + return; + } + + if (newValue.organization_metadata.isEmpty) { + return; + } + + _fetchedOrganization = + await fetchOrganization(newValue!.id!); + _fetchedOrganizations = _fetchedOrganization + ?.child_organizations_for_dashboard ?? + []; + + setState(() { + _fetchedOrganizations; + _selectedValue = null; + _selectedOrganizationValue = newValue; + batchStartDate = DateFormat('MMM d, yyyy') + .format(DateTime.parse( + _selectedOrganizationValue! + .organization_metadata[0].value + .toString())); + + batchEndDate = DateFormat('MMM d, yyyy') + .format(DateTime.parse( + _selectedOrganizationValue! + .organization_metadata[1].value + .toString())); + + this.updateDateRange( + DateTime.parse( + _selectedOrganizationValue! + .organization_metadata[0].value + .toString()), + DateTime.parse( + _selectedOrganizationValue! + .organization_metadata[1].value + .toString())); + }); + }); + }, + ), + ), + ], + ), + Row( + children: [ + Text('Select a Class :'), + SizedBox( + width: 5, + ), + SizedBox( + width: 240, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // if (org.child_organizations_for_dashboard.length > 0) + Container( + margin: EdgeInsets.only( + left: 20, top: 20, bottom: 10), + child: Row(children: [ + DropdownButton( + value: _selectedValue, + onChanged: (Organization? newValue) async { + _selectedValue = newValue ?? null; + int? parentOrgId = + campusAppsPortalInstance + .getUserPerson() + .organization! + .id; + if (_selectedValue == null) { + setState(() { + if (_fetchedOrganization != null) { + _fetchedOrganization!.id = + parentOrgId; + _fetchedOrganization!.description = + "Select All"; + } else { + _fetchedOrganization = + Organization(); + _fetchedOrganization!.id = + parentOrgId; + _fetchedOrganization!.description = + "Select All"; + } + _fetchedDashboardData; + }); + } else { + setState(() { + _selectedValue; + _fetchedOrganization; + _fetchedDashboardData; + }); + } + if (this.startDate == "" && + this.endDate == "") { + today = DateTime.now(); + String formattedToday = + DateFormat('MMM d, yyyy') + .format(today); + refreshState( + this._selectedValue, + formattedToday, + formattedToday, + 'class'); + } else { + refreshState( + this._selectedValue, + this.startDate, + this.endDate, + 'class'); + } + }, + items: [ + // Add "Select All" option + DropdownMenuItem( + value: null, + child: Text("Select All"), + ), + // Add other organization options + for (var org in _fetchedOrganizations) + DropdownMenuItem( + value: org, + child: Text(org.description!), + ) + ], + ), ]), - ]), - )), + ), + ]), + ), ], ), Row( diff --git a/campus/frontend/lib/avinya/attendance/lib/screens/scaffold.dart b/campus/frontend/lib/avinya/attendance/lib/screens/scaffold.dart index 022e7544..4d5015a9 100644 --- a/campus/frontend/lib/avinya/attendance/lib/screens/scaffold.dart +++ b/campus/frontend/lib/avinya/attendance/lib/screens/scaffold.dart @@ -118,7 +118,7 @@ class _SMSScaffoldState extends State { padding: EdgeInsets.only(left: 15.0, right: 15.0, bottom: 5.0), child: ListTile( hoverColor: Colors.white.withOpacity(0.3), - leading: Icon(Icons.report, + leading: Icon(Icons.summarize_sharp, color: Colors.white, size: 20.0), title: Container( margin: EdgeInsets.only(left: 12.0), diff --git a/campus/frontend/lib/avinya/attendance/lib/widgets/attendance_summary_excel_report_export.dart b/campus/frontend/lib/avinya/attendance/lib/widgets/attendance_summary_excel_report_export.dart index ab87645e..3897c340 100644 --- a/campus/frontend/lib/avinya/attendance/lib/widgets/attendance_summary_excel_report_export.dart +++ b/campus/frontend/lib/avinya/attendance/lib/widgets/attendance_summary_excel_report_export.dart @@ -159,13 +159,19 @@ class _AttendanceSummaryExcelReportExportState extends State{ List _fetchedDailyAttendanceSummaryData = []; List _fetchedExcelReportData = []; - bool _isFetching = true; + late Future> _fetchBatchData; + bool _isFetching = false; + Organization? _selectedValue; + AvinyaTypeId _selectedAvinyaTypeId = AvinyaTypeId.Empower; + List filteredAvinyaTypeIdValues = [AvinyaTypeId.Empower,AvinyaTypeId.IT,AvinyaTypeId.CS]; List columnNames = []; - late String formattedStartDate; - late String formattedEndDate; late DataTableSource _data; //calendar specific variables - DateTime? _selectedDay; - void selectDateRange(DateTime today) async { - // Update the variables to select the week - final formatter = DateFormat('MMM d, yyyy'); - formattedStartDate = formatter.format(today); - formattedEndDate = formatter.format(today); - setState(() { - _isFetching = false; - }); - } @override void initState() { super.initState(); - var today = DateTime.now(); - selectDateRange(today); + _fetchBatchData = _loadBatchData(); + } + + Future> _loadBatchData() async{ + return await fetchOrganizationsByAvinyaType(86); } void updateExcelState() { AttendanceSummaryExcelReportExport( - fetchedDailyAttendanceSummaryData: _fetchedExcelReportData, + fetchedDailyAttendanceSummaryData: _fetchedDailyAttendanceSummaryData, columnNames: columnNames, updateExcelState: updateExcelState, isFetching: _isFetching, - formattedStartDate: formattedStartDate, - formattedEndDate: formattedEndDate, + formattedStartDate: _selectedValue!.organization_metadata[0].value!, + formattedEndDate: _selectedValue!.organization_metadata[1].value!, ); } @@ -71,7 +73,6 @@ class _AttendanceSummaryReportState extends State{ void didChangeDependencies() { super.didChangeDependencies(); _data = MyData(_fetchedDailyAttendanceSummaryData,updateSelected); - DateRangePicker(updateDateRange, formattedStartDate); } void updateSelected(int index, bool value, List selected) { @@ -80,67 +81,6 @@ class _AttendanceSummaryReportState extends State{ }); } - void updateDateRange(_rangeStart, _rangeEnd) async { - widget.updateDateRangeForExcel(_rangeStart, _rangeEnd); - int? parentOrgId = - campusAppsPortalInstance.getUserPerson().organization!.id; - if (parentOrgId != null) { - setState(() { - _isFetching = true; // Set _isFetching to true before starting the fetch - }); - - _fetchedExcelReportData = await getDailyAttendanceSummaryReport( - parentOrgId, - DateFormat('yyyy-MM-dd') - .format(DateFormat('MMM d, yyyy').parse(this.formattedStartDate)), - DateFormat('yyyy-MM-dd') - .format(DateFormat('MMM d, yyyy').parse(this.formattedEndDate))); - - - - try { - setState(() { - final startDate = _rangeStart ?? _selectedDay; - final endDate = _rangeEnd ?? _selectedDay; - final formatter = DateFormat('MMM d, yyyy'); - final formattedStartDate = formatter.format(startDate!); - final formattedEndDate = formatter.format(endDate!); - this.formattedStartDate = formattedStartDate; - this.formattedEndDate = formattedEndDate; - this._fetchedExcelReportData = _fetchedExcelReportData; - _isFetching = false; - refreshState(); - }); - } catch (error) { - // Handle any errors that occur during the fetch - setState(() { - _isFetching = false; // Set _isFetching to false in case of error - }); - // Perform error handling, e.g., show an error message - } - } - } - - void refreshState() async { - setState(() { - _isFetching = true; // Set _isFetching to true before starting the fetch - }); - int? parentOrgId = - campusAppsPortalInstance.getUserPerson().organization!.id; - - _fetchedDailyAttendanceSummaryData = await getDailyAttendanceSummaryReport( - parentOrgId!, - DateFormat('yyyy-MM-dd') - .format(DateFormat('MMM d, yyyy').parse(this.formattedStartDate)), - DateFormat('yyyy-MM-dd') - .format(DateFormat('MMM d, yyyy').parse(this.formattedEndDate))); - - setState(() { - this._isFetching = false; - _data = MyData(_fetchedDailyAttendanceSummaryData,updateSelected); - }); - } - List _buildDataColumns() { List ColumnNames = []; @@ -177,90 +117,179 @@ class _AttendanceSummaryReportState extends State{ @override Widget build(BuildContext context) { - - AttendanceSummaryExcelReportExport( - fetchedDailyAttendanceSummaryData: _fetchedExcelReportData, - columnNames: columnNames, - updateExcelState: updateExcelState, - isFetching: _isFetching, - formattedStartDate: formattedStartDate, - formattedEndDate: formattedEndDate, - ); - return SingleChildScrollView( child: Column( children: [ Wrap( children: [ - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // create a text widget with some padding - - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: - EdgeInsets.only(left: 20, top: 20, bottom: 10), - child: Row(children: [ - ElevatedButton( - style: ButtonStyle( - textStyle: MaterialStateProperty.all( - TextStyle(fontSize: 20), - ), - elevation: MaterialStateProperty.all(20), - backgroundColor: MaterialStateProperty.all( - Colors.greenAccent), - foregroundColor: - MaterialStateProperty.all(Colors.black), - ), - onPressed: _isFetching - ? null - : () { - Navigator.push( - context, - MaterialPageRoute( - builder: (_) => DateRangePicker( - updateDateRange, - formattedStartDate)), - ); - }, - child: Container( - height: 50, // Adjust the height as needed - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (_isFetching) - Padding( - padding: EdgeInsets.only(right: 10), - child: SpinKitFadingCircle( - color: Colors - .black, // Customize the color of the indicator - size: - 20, // Customize the size of the indicator - ), - ), - if (!_isFetching) - Icon(Icons.calendar_today, - color: Colors.black), - SizedBox(width: 10), - Text( - '${this.formattedStartDate} - ${this.formattedEndDate}', - style: TextStyle( - color: Colors.black, - fontSize: 17, - fontWeight: FontWeight.w400, - ), - ), - ], + Padding( + padding: EdgeInsets.only(top: 20,left: 20), + child: Row( + children: [ + Text('Select a Batch :'), + SizedBox( + width: 10, + ), + FutureBuilder>( + future: _fetchBatchData, + builder: (context,snapshot) { + + if(snapshot.connectionState == ConnectionState.waiting){ + return Container( + margin: EdgeInsets.only(top: 10), + child: SpinKitCircle( + color: (Colors.deepPurpleAccent), + size: 70, + ), + ); + }else if(snapshot.hasError){ + return const Center( + child: Text('Something went wrong...'), + ); + + }else if(!snapshot.hasData){ + return const Center( + child: Text('No batch found'), + ); + } + final batchData = snapshot.data!; + return DropdownButton( + value: _selectedValue, + items: batchData.map((Organization batch){ + return DropdownMenuItem( + value: batch, + child: Text(batch.name!.name_en??'') + ); + }).toList(), + onChanged:(Organization? newValue) async{ + if(newValue == null){ + return; + } + + if(newValue.organization_metadata.isEmpty){ + return; + } + + if (DateTime.parse(newValue.organization_metadata[1].value.toString()).isBefore(DateTime.parse('2024-03-01'))) { + filteredAvinyaTypeIdValues = [AvinyaTypeId.Empower]; + }else{ + filteredAvinyaTypeIdValues = [AvinyaTypeId.Empower,AvinyaTypeId.IT,AvinyaTypeId.CS]; + } + + setState(() { + this._isFetching = true; + filteredAvinyaTypeIdValues; + }); + + if(filteredAvinyaTypeIdValues.contains(_selectedAvinyaTypeId)){ + + _fetchedDailyAttendanceSummaryData + = await getDailyAttendanceSummaryReport( + newValue.id!, + avinyaTypeId[_selectedAvinyaTypeId]!, + newValue.organization_metadata[0].value!, + newValue.organization_metadata[1].value!, + ); + }else{ + _selectedAvinyaTypeId = filteredAvinyaTypeIdValues.first; + + _fetchedDailyAttendanceSummaryData + = await getDailyAttendanceSummaryReport( + newValue.id!, + avinyaTypeId[_selectedAvinyaTypeId]!, + newValue.organization_metadata[0].value!, + newValue.organization_metadata[1].value!, + ); + + } + + + setState(() { + _selectedValue = newValue; + this._isFetching = false; + _selectedAvinyaTypeId; + _data = MyData(_fetchedDailyAttendanceSummaryData,updateSelected); + }); + + } + ); + + }, + ), + SizedBox( + width: 30, + ), + Text('Select a Programme :'), + SizedBox( + width: 10, + ), + DropdownButton( + value: _selectedAvinyaTypeId, + items: filteredAvinyaTypeIdValues + .map( + (typeId) => DropdownMenuItem( + value: typeId, + child: Text( + typeId.name.toUpperCase() ), ), - ), - ]), - ), - ]), - ], + ) + .toList(), + onChanged: (AvinyaTypeId? value) async{ + if(value == null){ + return; + } + + + if(_selectedValue == null || _selectedValue!.organization_metadata.length == 0){ + return; + } + + setState(() { + this._isFetching = true; + }); + + _fetchedDailyAttendanceSummaryData + = await getDailyAttendanceSummaryReport( + _selectedValue!.id!, + avinyaTypeId[value]!, + _selectedValue!.organization_metadata[0].value!, + _selectedValue!.organization_metadata[1].value!, + ); + + setState(() { + _selectedAvinyaTypeId = value; + this._isFetching = false; + _data = MyData(_fetchedDailyAttendanceSummaryData,updateSelected); + }); + } + ), + SizedBox( + width: 10, + ), + Expanded( + child: Container( + alignment: Alignment.bottomRight, + margin: EdgeInsets.only( + right: 20.0 + ), + width: 25.0, + height: 30.0, + child: _selectedValue != null ? AttendanceSummaryExcelReportExport( + fetchedDailyAttendanceSummaryData: _fetchedDailyAttendanceSummaryData, + columnNames: columnNames, + updateExcelState: updateExcelState, + isFetching: _isFetching, + formattedStartDate: _selectedValue!.organization_metadata[0].value!, + formattedEndDate: _selectedValue!.organization_metadata[1].value!, + ) : SizedBox(), + ), + ) + ], + ), + ), + SizedBox( + height: 10, ), Wrap(children: [ if (_isFetching) diff --git a/campus/frontend/lib/avinya/attendance/lib/widgets/daily_late_attendance_excel_report_export.dart b/campus/frontend/lib/avinya/attendance/lib/widgets/daily_late_attendance_excel_report_export.dart new file mode 100644 index 00000000..61fa632c --- /dev/null +++ b/campus/frontend/lib/avinya/attendance/lib/widgets/daily_late_attendance_excel_report_export.dart @@ -0,0 +1,230 @@ +import 'package:excel/excel.dart'; +import 'package:flutter/material.dart'; +import 'package:attendance/data/activity_attendance.dart'; +import 'package:gallery/data/person.dart'; +import 'package:intl/intl.dart'; + +class DailyLateAttendanceExcelReportExport extends StatefulWidget { + final List fetchedDailyLateAttendanceData; + final Function() updateExcelState; + final bool isFetching; + final String formattedStartDate; + final String formattedEndDate; + var selectedValue; + + DailyLateAttendanceExcelReportExport( + {Key? key, + required this.fetchedDailyLateAttendanceData, + required this.updateExcelState, + required this.isFetching, + required this.selectedValue, + required this.formattedStartDate, + required this.formattedEndDate + }) + : super(key: key); + + @override + _DailyLateAttendanceExcelReportExportState createState() => _DailyLateAttendanceExcelReportExportState(); +} + +class _DailyLateAttendanceExcelReportExportState extends State { + List _fetchedDailyLateAttendanceData = []; + List columnNamesWithoutDates = []; + var _selectedValue; + + + void exportToExcel() async { + await widget.updateExcelState(); + + + setState(() { + this._fetchedDailyLateAttendanceData = widget.fetchedDailyLateAttendanceData; + this._selectedValue = widget.selectedValue; + this.columnNamesWithoutDates.clear(); + }); + + if (_fetchedDailyLateAttendanceData.length > 0) { + + + if (columnNamesWithoutDates.isEmpty) { + + if(_selectedValue == null){ + + columnNamesWithoutDates.addAll([ + "Date", + "Name", + "Digital ID", + "Class", + "In Time", + "Late By" + ]); + + }else{ + columnNamesWithoutDates.addAll([ + "Date", + "Name", + "Digital ID", + "In Time", + "Late By" + ]); + } + } + + final excel = Excel.createExcel(); + final Sheet sheet = excel[excel.getDefaultSheet()!]; + + // Styling for organization header + final organizationHeaderStyle = CellStyle( + bold: true, + backgroundColorHex: '#807f7d', + horizontalAlign: HorizontalAlign.Center, + ); + + // Styling for row cells + final rowCellsStyle = CellStyle( + horizontalAlign: HorizontalAlign.Center, + ); + + // Adding organization header + sheet.merge( + CellIndex.indexByColumnRow(columnIndex: 0, rowIndex: 0), + CellIndex.indexByColumnRow( + columnIndex: columnNamesWithoutDates.length - 1, rowIndex: 0), + ); + + // Adding subheaders + final subHeaderStyle = CellStyle( + bold: true, + horizontalAlign: HorizontalAlign.Center, + backgroundColorHex: '#a3a3a2', + textWrapping: TextWrapping.WrapText, + ); + + // Adding column headers + for (var colIndex = 0; + colIndex < columnNamesWithoutDates.length; + colIndex++) { + sheet + .cell(CellIndex.indexByColumnRow(columnIndex: colIndex, rowIndex: 1)) + .value = columnNamesWithoutDates[colIndex]; + sheet + .cell(CellIndex.indexByColumnRow(columnIndex: colIndex, rowIndex: 1)) + .cellStyle = subHeaderStyle; + } + sheet.setColWidth(0, 15); + sheet.setColWidth(1, 30); + sheet.setColWidth(2, 50); + + if(_selectedValue == null){ + sheet.setColWidth(3, 20); + sheet.setColWidth(4, 25); + sheet.setColWidth(5, 26); + }else{ + sheet.setColWidth(3, 20); + sheet.setColWidth(4, 25); + } + + + + sheet.cell(CellIndex.indexByColumnRow(columnIndex: 0, rowIndex: 0)).value = + "Avinya Foundation Daily Late Attendance Summary Report From ${widget.formattedStartDate} to ${widget.formattedEndDate}"; + sheet + .cell(CellIndex.indexByColumnRow(columnIndex: 0, rowIndex: 0)) + .cellStyle = organizationHeaderStyle; + + if (_fetchedDailyLateAttendanceData.isNotEmpty) { + + for (var index = 0; index < _fetchedDailyLateAttendanceData.length; index++) { + + var dailyLateAttendanceData = _fetchedDailyLateAttendanceData[index]; + var date = dailyLateAttendanceData.sign_in_time!.split(" ")[0]; + + sheet + .cell( + CellIndex.indexByColumnRow(columnIndex: 0, rowIndex: index + 2)) + .value = date.toString() ?? ''; + + sheet + .cell( + CellIndex.indexByColumnRow(columnIndex: 1, rowIndex: index + 2)) + .value = dailyLateAttendanceData.preferred_name?.toString() ?? ''; + + sheet + .cell(CellIndex.indexByColumnRow( + columnIndex: 2, rowIndex: index + 2)) + .value = + (dailyLateAttendanceData.digital_id?.toString() ?? ''); + + if(_selectedValue == null){ + + sheet + .cell( + CellIndex.indexByColumnRow(columnIndex: 3, rowIndex: index + 2)) + .value = dailyLateAttendanceData.description?.toString() ?? ''; + + + var lateSignInTime = + DateTime.parse(dailyLateAttendanceData.sign_in_time!); + var officeStartTime = DateTime.parse("$date 08:30:00"); + var lateBy = lateSignInTime.difference(officeStartTime).inMinutes; + var formattedTime = DateFormat('hh:mm a').format(lateSignInTime); + + sheet + .cell( + CellIndex.indexByColumnRow(columnIndex: 4, rowIndex: index + 2)) + .value = (formattedTime.toString()??''); + + sheet + .cell( + CellIndex.indexByColumnRow(columnIndex: 5, rowIndex: index + 2)) + .value = (lateBy.toString()??'') + " minutes"; + + }else{ + + var lateSignInTime = + DateTime.parse(dailyLateAttendanceData.sign_in_time!); + var officeStartTime = DateTime.parse("$date 08:30:00"); + var lateBy = lateSignInTime.difference(officeStartTime).inMinutes; + var formattedTime = DateFormat('hh:mm a').format(lateSignInTime); + + sheet + .cell( + CellIndex.indexByColumnRow(columnIndex: 3, rowIndex: index + 2)) + .value = (formattedTime.toString()??''); + + sheet + .cell( + CellIndex.indexByColumnRow(columnIndex: 4, rowIndex: index + 2)) + .value = (lateBy.toString()??'')+ " minutes"; + + } + + } + } + + excel.save(fileName: "DailyLateAttendanceReport_${widget.formattedStartDate}_to_${widget.formattedEndDate}.xlsx"); + } + +} + + @override + Widget build(BuildContext context) { + return IgnorePointer( + ignoring: widget.isFetching, + child: ElevatedButton.icon( + icon: Icon(Icons.download), + label: Text('Excel Export'), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.deepPurpleAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10) + ), + ), + onPressed: (){ + exportToExcel(); + }, + + ), + ); + } +} diff --git a/campus/frontend/lib/avinya/attendance/lib/widgets/late_attendance_report.dart b/campus/frontend/lib/avinya/attendance/lib/widgets/late_attendance_report.dart index 5194ce90..9382793f 100644 --- a/campus/frontend/lib/avinya/attendance/lib/widgets/late_attendance_report.dart +++ b/campus/frontend/lib/avinya/attendance/lib/widgets/late_attendance_report.dart @@ -8,6 +8,8 @@ import 'package:gallery/data/person.dart'; import 'package:intl/intl.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'daily_late_attendance_excel_report_export.dart'; + class LateAttendanceReport extends StatefulWidget { const LateAttendanceReport({Key? key, required this.title}) : super(key: key); @@ -40,6 +42,9 @@ class _LateAttendanceReportState extends State { var _selectedValue; var activityId = 0; + List ColumnNames = []; + + late String formattedStartDate; late String formattedEndDate; var today = DateTime.now(); @@ -62,6 +67,17 @@ class _LateAttendanceReportState extends State { selectWeek(today, activityId); } + void updateExcelState() { + DailyLateAttendanceExcelReportExport( + fetchedDailyLateAttendanceData: _fetchedAttendance, + updateExcelState: updateExcelState, + isFetching: _isFetching, + selectedValue: _selectedValue, + formattedStartDate: this.formattedStartDate, + formattedEndDate:this.formattedEndDate, + ); + } + @override void didChangeDependencies() async { super.didChangeDependencies(); @@ -154,7 +170,7 @@ class _LateAttendanceReportState extends State { }); } - List _buildDataColumns() { + List _buildDataColumns() { List ColumnNames = []; if (_selectedValue == null) { @@ -391,7 +407,27 @@ class _LateAttendanceReportState extends State { ), ), ), - SizedBox(width: 20), + SizedBox( + width: 10, + ), + Expanded( + child: Container( + alignment: Alignment.bottomRight, + margin: EdgeInsets.only( + right: 20.0 + ), + width: 25.0, + height: 30.0, + child: this._isFetching ? null: DailyLateAttendanceExcelReportExport( + fetchedDailyLateAttendanceData: _fetchedAttendance, + updateExcelState: updateExcelState, + isFetching: _isFetching, + selectedValue: _selectedValue, + formattedStartDate: this.formattedStartDate, + formattedEndDate:this.formattedEndDate, + ), + ), + ) ], ), SizedBox(height: 16.0), @@ -466,7 +502,7 @@ class MyData extends DataTableSource { } var lateSignInTime = DateTime.parse(_fetchedAttendance[index - 1].sign_in_time!); - var officeStartTime = DateTime.parse("$date 07:30:00"); + var officeStartTime = DateTime.parse("$date 08:30:00"); var lateBy = lateSignInTime.difference(officeStartTime).inMinutes; if (lateBy > 0) { diff --git a/campus/frontend/lib/data/person.dart b/campus/frontend/lib/data/person.dart index 83111a42..3781b823 100644 --- a/campus/frontend/lib/data/person.dart +++ b/campus/frontend/lib/data/person.dart @@ -2,6 +2,7 @@ import 'dart:developer'; import 'package:flutter/src/material/data_table.dart'; import 'package:gallery/avinya/attendance/lib/data.dart'; +import 'package:gallery/avinya/attendance/lib/data/organization_meta_data.dart'; import 'package:gallery/data/address.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; @@ -42,7 +43,9 @@ class Organization { String? description; var child_organizations = []; var parent_organizations = []; + var child_organizations_for_dashboard = []; var people = []; + var organization_metadata = []; Organization({ this.id, @@ -50,7 +53,9 @@ class Organization { this.description, this.child_organizations = const [], this.parent_organizations = const [], + this.child_organizations_for_dashboard = const [], this.people = const [], + this.organization_metadata = const[], }); factory Organization.fromJson(Map json) { @@ -66,9 +71,17 @@ class Organization { ? List.from( json['parent_organizations'].map((x) => Organization.fromJson(x))) : [], + child_organizations_for_dashboard: json['child_organizations_for_dashboard'] != null + ? List.from( + json['child_organizations_for_dashboard'].map((x) => Organization.fromJson(x))) + : [], people: json['people'] != null ? List.from(json['people'].map((x) => Person.fromJson(x))) : [], + organization_metadata: json['organization_metadata'] != null + ? List.from( + json['organization_metadata'].map((x) => OrganizationMetaData.fromJson(x))) + : [], ); } @@ -82,7 +95,10 @@ class Organization { List.from(child_organizations.map((x) => x.toJson())), 'parent_organizations': List.from(parent_organizations.map((x) => x.toJson())), + 'child_organizations_for_dashboard': + List.from(child_organizations_for_dashboard.map((x) => x.toJson())), 'people': List.from(people.map((x) => x.toJson())), + 'organization_metadata':List.from(organization_metadata.map((x) => x.toJson())) // if (employees != null) 'employees': List.from(employees!.map((x) => x.toJson())), }; } @@ -109,6 +125,7 @@ Future fetchOrganization(int id) async { } } + Future> fetchOrganizationForAll(int id) async { final uri = Uri.parse( AppConfig.campusProfileBffApiUrl + '/student_list_by_parent_org_id') @@ -134,6 +151,31 @@ Future> fetchOrganizationForAll(int id) async { throw Exception('Failed to load Person'); } } +Future> fetchOrganizationsByAvinyaType(int avinya_type) async { + + final response = await http.get( + Uri.parse( + '${AppConfig.campusAttendanceBffApiUrl}/organizations_by_avinya_type/$avinya_type'), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + 'accept': 'application/json', + 'Authorization': 'Bearer ${AppConfig.campusBffApiKey}', + }, + ); + + if (response.statusCode > 199 && response.statusCode < 300) { + + var resultsJson = json.decode(response.body).cast>(); + + List organization = + await resultsJson + .map((json) => Organization.fromJson(json)) + .toList(); + return organization; + } else { + throw Exception('Failed to load organizations'); + } +} class Person { int? id;