diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 56c1932..c3002df 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,7 +10,7 @@ + android:icon="@mipmap/unit"> { List schools = []; List programs = []; List honors = []; + int? profileId; + String? token; List attachmentCategories = []; EducationBloc() : super(EducationInitial()) { on((event, emit) async { + profileId = event.profileId; + token = event.token; emit(EducationalBackgroundLoadingState()); try { if (attachmentCategories.isEmpty) { @@ -206,5 +218,44 @@ class EducationBloc extends Bloc { emit(EducationalBackgroundErrorState(message: e.toString())); } }); + on((event, emit) { + String fileUrl = + '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}'; + emit(EducationAttachmentViewState( + fileUrl: fileUrl, fileName: event.fileName)); + }); + on((event, emit) async { + emit(EducationalBackgroundLoadingState()); + Directory directory; + String? appDocumentPath; + if (await requestPermission(Permission.storage)) { + directory = await getApplicationDocumentsDirectory(); + appDocumentPath = directory.path; + } + try{ + final bool success = await AttachmentServices.instance.downloadAttachment( + filename: event.fileName, + source: event.source, + downLoadDir: appDocumentPath!); + if (success) { + final result = await Share.shareXFiles( + [XFile("$appDocumentPath/${event.fileName}")]); + if (result.status == ShareResultStatus.success) { + Fluttertoast.showToast(msg: "Attachment shared successfully"); + emit(EducationAttachmentViewState( + fileUrl: event.source, fileName: event.fileName)); + } else { + Fluttertoast.showToast(msg: "Attachment shared unsuccessfully"); + emit(EducationAttachmentViewState( + fileUrl: event.source, fileName: event.fileName)); + } + } else { + emit(EducationAttachmentViewState( + fileUrl: event.source, fileName: event.fileName)); + } + }catch(e){ +emit(EducationalBackgroundErrorState(message: e.toString())); + } + }); } } diff --git a/lib/bloc/profile/education/education_event.dart b/lib/bloc/profile/education/education_event.dart index 9b68a0f..d2f57e6 100644 --- a/lib/bloc/profile/education/education_event.dart +++ b/lib/bloc/profile/education/education_event.dart @@ -83,3 +83,15 @@ class DeleteEducationAttachment extends EducationEvent{ final int profileId; const DeleteEducationAttachment({required this.attachment, required this.moduleId, required this.profileId, required this.token}); } + +class EducationViewAttachment extends EducationEvent{ + final String fileName; + final String source; + const EducationViewAttachment({required this.source,required this.fileName}); +} + +class ShareAttachment extends EducationEvent{ + final String fileName; + final String source; + const ShareAttachment({required this.fileName, required this.source}); +} diff --git a/lib/bloc/profile/education/education_state.dart b/lib/bloc/profile/education/education_state.dart index 3cfe505..d7fd394 100644 --- a/lib/bloc/profile/education/education_state.dart +++ b/lib/bloc/profile/education/education_state.dart @@ -60,7 +60,6 @@ class EducationAddedState extends EducationState { List get props => [response]; } - //// Edited State class EditedEducationState extends EducationState { final Map response; @@ -89,4 +88,15 @@ class EducationAttachmentDeletedState extends EducationState { const EducationAttachmentDeletedState({required this.success}); @override List get props => [success]; -} \ No newline at end of file +} + +class EducationAttachmentViewState extends EducationState { + final String fileUrl; + final String fileName; + const EducationAttachmentViewState({required this.fileUrl, required this.fileName}); +} + +class EducationAttachmentShareState extends EducationState{ + final bool success; + const EducationAttachmentShareState({required this.success,}); +} diff --git a/lib/bloc/profile/eligibility/eligibility_bloc.dart b/lib/bloc/profile/eligibility/eligibility_bloc.dart index 1be36b4..6710f47 100644 --- a/lib/bloc/profile/eligibility/eligibility_bloc.dart +++ b/lib/bloc/profile/eligibility/eligibility_bloc.dart @@ -11,6 +11,7 @@ import '../../../model/utils/eligibility.dart'; import '../../../sevices/profile/eligibility_services.dart'; import '../../../utils/location_utilities.dart'; import '../../../utils/profile_utilities.dart'; +import '../../../utils/urls.dart'; part 'eligibility_event.dart'; part 'eligibility_state.dart'; @@ -52,6 +53,7 @@ class EligibilityBloc extends Bloc { //// GET ELIGIBILITY on((event, emit) async { + emit(EligibilityLoadingState()); try { if (attachmentCategories.isEmpty) { attachmentCategories = @@ -257,7 +259,7 @@ class EligibilityBloc extends Bloc { on((event, emit) async { emit(EligibilityLoadingState()); - // try { + try { final bool success = await AttachmentServices.instance.deleteAttachment( attachment: event.attachment, moduleId: int.parse(event.moduleId), @@ -275,9 +277,13 @@ class EligibilityBloc extends Bloc { } else { emit(EligibilitytAttachmentDeletedState(success: success)); } - // } catch (e) { - // emit(EligibilityErrorState(message: e.toString())); - // } + } catch (e) { + emit(EligibilityErrorState(message: e.toString())); + } + }); + on((event,emit){ + String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}'; + emit(EligibilityAttachmentViewState(fileUrl: fileUrl)); }); } } diff --git a/lib/bloc/profile/eligibility/eligibility_event.dart b/lib/bloc/profile/eligibility/eligibility_event.dart index a9b6ca8..925b105 100644 --- a/lib/bloc/profile/eligibility/eligibility_event.dart +++ b/lib/bloc/profile/eligibility/eligibility_event.dart @@ -7,38 +7,44 @@ abstract class EligibilityEvent extends Equatable { List get props => []; } -class ShowAddEligibilityForm extends EligibilityEvent { +class ShowAddEligibilityForm extends EligibilityEvent {} -} - -class GetEligibilities extends EligibilityEvent{ +class GetEligibilities extends EligibilityEvent { final int profileId; final String token; const GetEligibilities({required this.profileId, required this.token}); @override - List get props => [profileId,token]; + List get props => [profileId, token]; } -class AddEligibility extends EligibilityEvent{ - final EligibityCert eligibityCert; +class AddEligibility extends EligibilityEvent { + final EligibityCert eligibityCert; final String profileId; final String token; - const AddEligibility({required this.eligibityCert, required this.profileId, required this.token}); + const AddEligibility( + {required this.eligibityCert, + required this.profileId, + required this.token}); @override - List get props => [eligibityCert, profileId, token]; + List get props => [eligibityCert, profileId, token]; } -class UpdateEligibility extends EligibilityEvent{ + +class UpdateEligibility extends EligibilityEvent { final EligibityCert eligibityCert; final String profileId; final String token; final int oldEligibility; - const UpdateEligibility({required this.eligibityCert, required this.oldEligibility,required this.profileId, required this.token}); + const UpdateEligibility( + {required this.eligibityCert, + required this.oldEligibility, + required this.profileId, + required this.token}); @override - List get props =>[eligibityCert,profileId,token,oldEligibility]; + List get props => [eligibityCert, profileId, token, oldEligibility]; } -class LoadEligibility extends EligibilityEvent { +class LoadEligibility extends EligibilityEvent { const LoadEligibility(); @override List get props => []; @@ -55,45 +61,55 @@ class DeleteEligibility extends EligibilityEvent { final String profileId; final int eligibilityId; final String token; - + const DeleteEligibility( - { - required this.eligibilityId, + {required this.eligibilityId, required this.profileId, required this.token}); @override - List get props => [ profileId, eligibilityId, token]; + List get props => [profileId, eligibilityId, token]; } -class CallErrorState extends EligibilityEvent{ - -} +class CallErrorState extends EligibilityEvent {} + ////Add Attachment -class AddEligibiltyAttachment extends EligibilityEvent{ +class AddEligibiltyAttachment extends EligibilityEvent { final String categoryId; final String attachmentModule; final List filePaths; final String token; final String profileId; - const AddEligibiltyAttachment({required this.attachmentModule, required this.filePaths, required this.categoryId, required this.profileId, required this.token}); + const AddEligibiltyAttachment( + {required this.attachmentModule, + required this.filePaths, + required this.categoryId, + required this.profileId, + required this.token}); @override - List get props => [categoryId,attachmentModule,filePaths, token,profileId]; + List get props => + [categoryId, attachmentModule, filePaths, token, profileId]; } ////Delete Attachment -class DeleteEligibyAttachment extends EligibilityEvent{ +class DeleteEligibyAttachment extends EligibilityEvent { final String profileId; final String token; final Attachment attachment; final String moduleId; - const DeleteEligibyAttachment({required this.attachment,required this.moduleId, required this.profileId, required this.token}); + const DeleteEligibyAttachment( + {required this.attachment, + required this.moduleId, + required this.profileId, + required this.token}); } +class EligibilityViewAttachments extends EligibilityEvent { + final String source; + const EligibilityViewAttachments({required this.source}); +} - - - - - - +class EligibiltyViewAttachmentEvent extends EligibilityEvent{ + final String source; + const EligibiltyViewAttachmentEvent({required this.source}); +} diff --git a/lib/bloc/profile/eligibility/eligibility_state.dart b/lib/bloc/profile/eligibility/eligibility_state.dart index 7d746d9..6f8976c 100644 --- a/lib/bloc/profile/eligibility/eligibility_state.dart +++ b/lib/bloc/profile/eligibility/eligibility_state.dart @@ -107,3 +107,8 @@ class EligibilitytAttachmentDeletedState extends EligibilityState { @override List get props => [success]; } + +class EligibilityAttachmentViewState extends EligibilityState { + final String fileUrl; + const EligibilityAttachmentViewState({required this.fileUrl}); +} diff --git a/lib/bloc/profile/learningDevelopment/learning_development_bloc.dart b/lib/bloc/profile/learningDevelopment/learning_development_bloc.dart index 465cefb..9dd75b7 100644 --- a/lib/bloc/profile/learningDevelopment/learning_development_bloc.dart +++ b/lib/bloc/profile/learningDevelopment/learning_development_bloc.dart @@ -13,6 +13,7 @@ import '../../../model/utils/category.dart'; import '../../../utils/attachment_services.dart'; import '../../../utils/location_utilities.dart'; import '../../../utils/profile_utilities.dart'; +import '../../../utils/urls.dart'; part 'learning_development_event.dart'; part 'learning_development_state.dart'; @@ -325,5 +326,10 @@ class LearningDevelopmentBloc emit(LearningDevelopmentErrorState(message: e.toString())); } }); + on((event,emit){ + String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}'; + emit(LearningAndDevelopmentAttachmentViewState(fileUrl: fileUrl)); + }); } + } diff --git a/lib/bloc/profile/learningDevelopment/learning_development_event.dart b/lib/bloc/profile/learningDevelopment/learning_development_event.dart index c8528ac..d450d7d 100644 --- a/lib/bloc/profile/learningDevelopment/learning_development_event.dart +++ b/lib/bloc/profile/learningDevelopment/learning_development_event.dart @@ -88,3 +88,9 @@ class DeleteLearningDevAttachment extends LearningDevelopmentEvent{ const DeleteLearningDevAttachment({required this.attachment, required this.moduleId, required this.profileId, required this.token}); } +class LearningDevelopmentViewAttachmentEvent extends LearningDevelopmentEvent{ + final String source; + const LearningDevelopmentViewAttachmentEvent({required this.source}); +} + + diff --git a/lib/bloc/profile/learningDevelopment/learning_development_state.dart b/lib/bloc/profile/learningDevelopment/learning_development_state.dart index 2699470..7507e9c 100644 --- a/lib/bloc/profile/learningDevelopment/learning_development_state.dart +++ b/lib/bloc/profile/learningDevelopment/learning_development_state.dart @@ -133,3 +133,9 @@ class LearningDevAttachmentDeletedState extends LearningDevelopmentState { @override List get props => [success]; } + + +class LearningAndDevelopmentAttachmentViewState extends LearningDevelopmentState { + final String fileUrl; + const LearningAndDevelopmentAttachmentViewState({required this.fileUrl}); +} \ No newline at end of file diff --git a/lib/bloc/profile/workHistory/workHistory_bloc.dart b/lib/bloc/profile/workHistory/workHistory_bloc.dart index 85bd4bd..b751baa 100644 --- a/lib/bloc/profile/workHistory/workHistory_bloc.dart +++ b/lib/bloc/profile/workHistory/workHistory_bloc.dart @@ -7,6 +7,7 @@ import 'package:unit2/model/utils/position.dart'; import 'package:unit2/sevices/profile/work_history_services.dart'; import 'package:unit2/utils/profile_utilities.dart'; import '../../../model/profile/attachment.dart'; + import '../../../model/utils/category.dart'; import '../../../utils/attachment_services.dart'; part 'workHistory_event.dart'; @@ -67,8 +68,10 @@ class WorkHistoryBloc extends Bloc { }); //// ADD WORK HISTORIES on((event, emit) async { - try { + // try { Map status = await WorkHistoryService.instance.add( + accomplishment: event.accomplishment, + actualDuties: event.actualDuties, isPrivate: event.isPrivate, workHistory: event.workHistory, token: event.token, @@ -80,35 +83,35 @@ class WorkHistoryBloc extends Bloc { } else { emit(WorkHistoryAddedState(response: status)); } - } catch (e) { - emit(WorkHistoryErrorState(message: e.toString())); - } + // } catch (e) { + // emit(WorkHistoryErrorState(message: e.toString())); + // } }); ////UPDATE WORK HISTORY - on((event, emit) async { - try { - Map status = await WorkHistoryService.instance.update( - oldWorkHistory: event.oldWorkHistory, - newWorkHistory: event.workHistory, - token: event.token, - profileId: event.profileId); - if (status['success']) { - WorkHistory workHistory = WorkHistory.fromJson(status['data']); - workExperiences.removeWhere((WorkHistory work) { - return work.id == event.oldWorkHistory.id; - }); - workExperiences.add(workHistory); - emit(WorkHistoryEditedState(response: status)); - } else { - emit(WorkHistoryEditedState( - response: status, - )); - } - } catch (e) { - emit(WorkHistoryErrorState(message: e.toString())); - } - }); + // on((event, emit) async { + // try { + // Map status = await WorkHistoryService.instance.update( + // oldWorkHistory: event.oldWorkHistory, + // newWorkHistory: event.workHistory, + // token: event.token, + // profileId: event.profileId); + // if (status['success']) { + // WorkHistory workHistory = WorkHistory.fromJson(status['data']); + // workExperiences.removeWhere((WorkHistory work) { + // return work.id == event.oldWorkHistory.id; + // }); + // workExperiences.add(workHistory); + // emit(WorkHistoryEditedState(response: status)); + // } else { + // emit(WorkHistoryEditedState( + // response: status, + // )); + // } + // } catch (e) { + // emit(WorkHistoryErrorState(message: e.toString())); + // } + // }); ////SHOW EDIT WORK HISTORIES on((event, emit) async { @@ -209,12 +212,12 @@ class WorkHistoryBloc extends Bloc { Attachment newAttachment = Attachment.fromJson(element); attachments.add(newAttachment); }); - workHistory.attachments == null - ? workHistory.attachments = attachments - : workHistory.attachments = [ - ...workHistory.attachments!, - ...attachments - ]; + // workHistory.attachments == null + // ? workHistory.attachments = attachments + // : workHistory.attachments = [ + // ...workHistory.attachments!, + // ...attachments + // ]; emit(WorkHistoryDevAttachmentAddedState(response: status)); } else { emit(WorkHistoryDevAttachmentAddedState(response: status)); @@ -223,31 +226,31 @@ class WorkHistoryBloc extends Bloc { emit(WorkHistoryErrorState(message: e.toString())); } }); - ////Delete Attachment - on((event, emit) async { - emit(WorkHistoryLoadingState()); - try { - final bool success = await AttachmentServices.instance.deleteAttachment( - attachment: event.attachment, - moduleId: event.moduleId, - profileId: event.profileId.toString(), - token: event.token); - if (success) { - final WorkHistory workHistory = - workExperiences - .firstWhere((element) => element.id == event.moduleId); - workHistory.attachments - ?.removeWhere((element) => element.id == event.attachment.id); - workExperiences - .removeWhere((element) => element.id == event.moduleId); - workExperiences.add(workHistory); - emit(WorkHistoryDevAttachmentDeletedState(success: success)); - } else { - emit(WorkHistoryDevAttachmentDeletedState(success: success)); - } - } catch (e) { - emit(WorkHistoryErrorState(message: e.toString())); - } - }); + // ////Delete Attachment + // on((event, emit) async { + // emit(WorkHistoryLoadingState()); + // try { + // final bool success = await AttachmentServices.instance.deleteAttachment( + // attachment: event.attachment, + // moduleId: event.moduleId, + // profileId: event.profileId.toString(), + // token: event.token); + // if (success) { + // final WorkHistory workHistory = + // workExperiences + // .firstWhere((element) => element.id == event.moduleId); + // workHistory.attachments + // ?.removeWhere((element) => element.id == event.attachment.id); + // workExperiences + // .removeWhere((element) => element.id == event.moduleId); + // workExperiences.add(workHistory); + // emit(WorkHistoryDevAttachmentDeletedState(success: success)); + // } else { + // emit(WorkHistoryDevAttachmentDeletedState(success: success)); + // } + // } catch (e) { + // emit(WorkHistoryErrorState(message: e.toString())); + // } + // }); } } diff --git a/lib/bloc/profile/workHistory/workHistory_event.dart b/lib/bloc/profile/workHistory/workHistory_event.dart index 1895bfe..6e73101 100644 --- a/lib/bloc/profile/workHistory/workHistory_event.dart +++ b/lib/bloc/profile/workHistory/workHistory_event.dart @@ -43,12 +43,14 @@ class DeleteWorkHistory extends WorkHistorytEvent{ class UpdateWorkHistory extends WorkHistorytEvent{ final WorkHistory workHistory; - final WorkHistory oldWorkHistory; - final String profileId; + final bool isPrivate; + final int profileId; final String token; - const UpdateWorkHistory({required this.oldWorkHistory, required this.profileId, required this.token, required this.workHistory}); + final String? actualDuties; + final String? accomplishment; + const UpdateWorkHistory({required this.profileId, required this.token, required this.workHistory, required this.accomplishment, required this.actualDuties, required this.isPrivate}); @override - List get props => [profileId,token,workHistory,oldWorkHistory]; + List get props => [profileId,token,workHistory,]; } class AddWorkHostory extends WorkHistorytEvent{ @@ -56,7 +58,9 @@ class AddWorkHostory extends WorkHistorytEvent{ final bool isPrivate; final int profileId; final String token; - const AddWorkHostory({required this.workHistory, required this.isPrivate, required this.profileId, required this.token}); + final String? actualDuties; + final String? accomplishment; + const AddWorkHostory({required this.workHistory, required this.isPrivate, required this.profileId, required this.token, required this.accomplishment, required this.actualDuties}); @override List get props => [workHistory,profileId,token,isPrivate]; } diff --git a/lib/bloc/role/pass_check/pass_check_bloc.dart b/lib/bloc/role/pass_check/pass_check_bloc.dart index 9458357..c1d157a 100644 --- a/lib/bloc/role/pass_check/pass_check_bloc.dart +++ b/lib/bloc/role/pass_check/pass_check_bloc.dart @@ -22,15 +22,15 @@ class PassCheckBloc extends Bloc { int? stationId; String? cpId; on((event, emit) async { - // try { + try { emit(PassCheckLoadingState()); List response = await PassCheckServices.instance .getPassCheckArea(roleId: event.roleId, userId: event.userId); roleId = event.roleId; emit(AssignAreaLoaded(assignedArea: response, roleId: roleId!)); - // } catch (e) { - // emit(PassCheckErrorState(message: e.toString())); - // } + } catch (e) { + emit(PassCheckErrorState(message: e.toString())); + } }); on((event, emit) { otherInputs = event.includeOtherInputs; diff --git a/lib/model/profile/work_history.dart b/lib/model/profile/work_history.dart index 5e01642..538e6f4 100644 --- a/lib/model/profile/work_history.dart +++ b/lib/model/profile/work_history.dart @@ -1,75 +1,163 @@ -// To parse this JSON data, do -// -// final workHistory = workHistoryFromJson(jsonString); - -import 'dart:convert'; +import 'package:unit2/model/utils/industry_class.dart'; import '../utils/agency.dart'; -import '../utils/category.dart'; -import '../utils/industry_class.dart'; import '../utils/position.dart'; -import 'attachment.dart'; - -WorkHistory workHistoryFromJson(String str) => WorkHistory.fromJson(json.decode(str)); - -String workHistoryToJson(WorkHistory data) => json.encode(data.toJson()); class WorkHistory { - WorkHistory({ - this.id, - this.agency, - this.sgStep, - this.toDate, - this.position, - this.fromDate, - this.attachments, - this.salaryGrade, - this.monthlySalary, - this.appointmentStatus, - }); + final PositionTitle? position; + final Agency? agency; + final Supervisor? supervisor; + final int? id; + final DateTime? fromDate; + final DateTime? toDate; + final int? agencydepid; + final double? monthlysalary; + final String? statusAppointment; + final int? salarygrade; + final int? sgstep; + final List? accomplishment; + final List? actualDuties; - final int? id; - final Agency? agency; - final int? sgStep; - final DateTime? toDate; - final PositionTitle? position; - final DateTime? fromDate; - List? attachments; - final int? salaryGrade; - final double? monthlySalary; - final String? appointmentStatus; + WorkHistory({ + required this.position, + required this.agency, + required this.supervisor, + required this.id, + required this.fromDate, + required this.toDate, + required this.agencydepid, + required this.monthlysalary, + required this.statusAppointment, + required this.salarygrade, + required this.sgstep, + required this.accomplishment, + required this.actualDuties, + }); - factory WorkHistory.fromJson(Map json) => WorkHistory( + factory WorkHistory.fromJson(Map json) => WorkHistory( + position: PositionTitle.fromJson(json["position"]), + agency: json['agency'] == null?null: Agency.fromJson(json["agency"]), + supervisor: json['supervisor'] == null?null: Supervisor.fromJson(json["supervisor"]), id: json["id"], - agency: json["agency"] == null ? null : Agency.fromJson(json["agency"]), - sgStep: json["sg_step"], - toDate: json["to_date"] == null ? null : DateTime.parse(json["to_date"]), - position: json["position"] == null ? null : PositionTitle.fromJson(json["position"]), - fromDate: json["from_date"] == null ? null : DateTime.parse(json["from_date"]), - attachments: json['attachments'] ==null?null: List.from(json["attachments"].map((x) => Attachment.fromJson(x))), - salaryGrade: json["salary_grade"], - monthlySalary: json["monthly_salary"], - appointmentStatus: json["appointment_status"], - ); + fromDate: json['from_date'] == null?null: DateTime.tryParse(json["from_date"]), + toDate: json['to_date'] == null?null: DateTime.tryParse(json["to_date"]), + agencydepid: json["agencydepid"], + monthlysalary: json["monthlysalary"], + statusAppointment: json["status_appointment"], + salarygrade: json["salarygrade"], + sgstep: json["sgstep"], + accomplishment:json['accomplishment'] == null?null: json['accomplishment'] == null?null: List.from( + json["accomplishment"].map((x) => Accomplishment.fromJson(x))), + actualDuties: json['actual_duties'] == null?null: List.from( + json["actual_duties"].map((x) => ActualDuty.fromJson(x))), + ); - Map toJson() => { - "id": id, - "agency": agency?.toJson(), - "sg_step": sgStep, - "to_date": "${toDate!.year.toString().padLeft(4, '0')}-${toDate!.month.toString().padLeft(2, '0')}-${toDate!.day.toString().padLeft(2, '0')}", + Map toJson() => { "position": position?.toJson(), - "from_date": "${fromDate!.year.toString().padLeft(4, '0')}-${fromDate!.month.toString().padLeft(2, '0')}-${fromDate!.day.toString().padLeft(2, '0')}", - // "attachments": attachments, - "salary_grade": salaryGrade, - "monthly_salary": monthlySalary, - "appointment_status": appointmentStatus, - }; + "agency": agency?.toJson(), + "supervisor": supervisor?.toJson(), + "id": id, + "from_date": + "${fromDate?.year.toString().padLeft(4, '0')}-${fromDate?.month.toString().padLeft(2, '0')}-${fromDate?.day.toString().padLeft(2, '0')}", + "to_date": toDate, + "agencydepid": agencydepid, + "monthlysalary": monthlysalary, + "status_appointment": statusAppointment, + "salarygrade": salarygrade, + "sgstep": sgstep, + "accomplishment": + List.from(accomplishment!.map((x) => x.toJson())), + "actual_duties": + List.from(actualDuties!.map((x) => x.toJson())), + }; +} + +class Accomplishment { + final int? id; + final int? workExperienceId; + final String? accomplishment; + + Accomplishment({ + required this.id, + required this.workExperienceId, + required this.accomplishment, + }); + + factory Accomplishment.fromJson(Map json) => Accomplishment( + id: json["id"], + workExperienceId: json["work_experience_id"], + accomplishment: json["accomplishment"], + ); + + Map toJson() => { + "id": id, + "work_experience_id": workExperienceId, + "accomplishment": accomplishment, + }; +} + +class ActualDuty { + final int? id; + final int? workExperienceId; + final String description; + + ActualDuty({ + required this.id, + required this.workExperienceId, + required this.description, + }); + + factory ActualDuty.fromJson(Map json) => ActualDuty( + id: json["id"], + workExperienceId: json["work_experience_id"], + description: json["description"], + ); + + Map toJson() => { + "id": id, + "work_experience_id": workExperienceId, + "description": description, + }; +} + + + +class Supervisor { + final int? id; + final int? agencyId; + final String? lastname; + final String? firstname; + final String? middlename; + final String? stationName; + + Supervisor({ + required this.id, + required this.agencyId, + required this.lastname, + required this.firstname, + required this.middlename, + required this.stationName, + }); + + factory Supervisor.fromJson(Map json) => Supervisor( + id: json["id"], + agencyId: json["agency_id"], + lastname: json["lastname"], + firstname: json["firstname"], + middlename: json["middlename"], + stationName: json["station_name"], + ); + + Map toJson() => { + "id": id, + "agency_id": agencyId, + "lastname": lastname, + "firstname": firstname, + "middlename": middlename, + "station_name": stationName, + }; } - - - - diff --git a/lib/screens/profile/components/education/education_view_attachment.dart b/lib/screens/profile/components/education/education_view_attachment.dart new file mode 100644 index 0000000..88657f9 --- /dev/null +++ b/lib/screens/profile/components/education/education_view_attachment.dart @@ -0,0 +1,121 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_progress_hud/flutter_progress_hud.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:share_plus/share_plus.dart'; +import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; +import 'package:unit2/bloc/profile/education/education_bloc.dart'; +import 'package:unit2/theme-data.dart/colors.dart'; +import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; + +class EudcationViewAttachment extends StatefulWidget { + const EudcationViewAttachment({super.key}); + + @override + State createState() => + _EudcationViewAttachmentState(); +} + +class _EudcationViewAttachmentState extends State { + @override + Widget build(BuildContext context) { + String? fileUrl; + String? filename; + return Scaffold( + floatingActionButton: FloatingActionButton( + onPressed: () async { + await _launchInBrowser(fileUrl!); + }, + child: const Icon(Icons.file_download), + ), + appBar: AppBar( + title: const Text("Attachment"), + centerTitle: true, + actions: [ + IconButton( + onPressed: () { + context.read().add( + ShareAttachment(fileName: filename!, source: fileUrl!)); + }, + icon: const Icon(Icons.share)), + ], + ), + body: ProgressHUD( + padding: const EdgeInsets.all(24), + backgroundColor: Colors.black87, + indicatorWidget: const SpinKitFadingCircle(color: Colors.white), + child: BlocConsumer( + builder: (context, state) { + if (state is EducationAttachmentViewState) { + fileUrl = state.fileUrl; + filename = state.fileName; + + bool isPDF = state.fileUrl[state.fileUrl.length - 1] == 'f' + ? true + : false; + return SizedBox( + child: isPDF + ? SfPdfViewer.network( + state.fileUrl, + onDocumentLoadFailed: (details) { + Center( + child: Text(details.description), + ); + }, + ) + : Center( + child: CachedNetworkImage( + progressIndicatorBuilder: (context, url, progress) { + return const SizedBox( + height: 100, + width: 100, + child: CircularProgressIndicator( + color: primary, + )); + }, + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + image: DecorationImage( + image: imageProvider, fit: BoxFit.fill)), + ), + imageUrl: state.fileUrl, + width: double.infinity, + height: 220, + fit: BoxFit.cover, + ), + ), + ); + } + return Container(); + }, + listener: (context, state) { + if (state is EducationalBackgroundLoadingState) { + final progress = ProgressHUD.of(context); + progress!.showWithText("Please wait..."); + } + if (state is EducationAttachmentViewState) { + final progress = ProgressHUD.of(context); + progress!.dismiss(); + } + }, + ), + )); + } + + Future _launchInBrowser(String url) async { + final UrlLauncherPlatform launcher = UrlLauncherPlatform.instance; + if (!await launcher.launch( + url, + useSafariVC: false, + useWebView: false, + enableJavaScript: false, + enableDomStorage: false, + universalLinksOnly: false, + headers: {}, + )) { + throw Exception('Could not launch $url'); + } + } +} diff --git a/lib/screens/profile/components/education_screen.dart b/lib/screens/profile/components/education_screen.dart index 15c88a0..761f285 100644 --- a/lib/screens/profile/components/education_screen.dart +++ b/lib/screens/profile/components/education_screen.dart @@ -11,6 +11,7 @@ import 'package:unit2/bloc/profile/profile_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/model/profile/educational_background.dart'; import 'package:unit2/screens/profile/components/education/add_modal.dart'; +import 'package:unit2/screens/profile/shared/view_attachment.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/widgets/Leadings/add_leading.dart'; @@ -26,6 +27,7 @@ import '../../../widgets/Leadings/close_leading.dart'; import '../shared/multiple_attachment.dart'; import '../shared/single_attachment.dart'; import 'education/edit_modal.dart'; +import 'education/education_view_attachment.dart'; class EducationScreen extends StatelessWidget { const EducationScreen({super.key}); @@ -321,12 +323,12 @@ class EducationScreen extends StatelessWidget { Column( children: honors .map((Honor honor) => Padding( - padding: const EdgeInsets.all(3.0), - child: Text( + padding: const EdgeInsets.all(3.0), + child: Text( "-${honor.name!.trim()}", style: Theme.of(context).textTheme.labelSmall, ), - )) + )) .toList(), ), ], @@ -696,6 +698,15 @@ class EducationScreen extends StatelessWidget { children: [ const Divider(), SingleAttachment( + view: () { + Navigator.push( + context, + MaterialPageRoute( + builder: ((context) => BlocProvider.value( + value: EducationBloc()..add(EducationViewAttachment(source: state.educationalBackground[index].attachments!.first.source!,fileName: state.educationalBackground[index].attachments!.first.filename!)), + child: const EudcationViewAttachment(), + )))); + }, onpressed: () { confirmAlert( @@ -728,6 +739,17 @@ class EducationScreen extends StatelessWidget { ) ////Multiple Attachments View : MultipleAttachments( + viewAttachment: + (source,filname) { + Navigator.push( + context, + MaterialPageRoute( + builder: ((context) => + BlocProvider.value( + value: EducationBloc()..add(EducationViewAttachment(source: source,fileName: filname)), + child: const EudcationViewAttachment(), + )))); + }, profileId: profileId, token: token!, diff --git a/lib/screens/profile/components/eligibility/eligibility_view_attachment.dart b/lib/screens/profile/components/eligibility/eligibility_view_attachment.dart new file mode 100644 index 0000000..9d21ba1 --- /dev/null +++ b/lib/screens/profile/components/eligibility/eligibility_view_attachment.dart @@ -0,0 +1,73 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; +import 'package:unit2/bloc/profile/education/education_bloc.dart'; +import 'package:unit2/bloc/profile/eligibility/eligibility_bloc.dart'; +import 'package:unit2/theme-data.dart/colors.dart'; +import 'package:url_launcher/url_launcher.dart'; +import '../../../../utils/urls.dart'; +class EligibilityViewAttachment extends StatefulWidget { + + const EligibilityViewAttachment({super.key}); + + @override + State createState() => _EligibilityViewAttachmentState(); +} + +class _EligibilityViewAttachmentState extends State { + @override + Widget build(BuildContext context) { + String? fileUrl; + return Scaffold( + floatingActionButton: FloatingActionButton( + onPressed: ()async { + await launchUrl(Uri.parse(fileUrl!)); + }, + child: const Icon(Icons.file_download), + ), + appBar: AppBar( + title: const Text("Attachment"), + centerTitle: true, + actions: [ + IconButton(onPressed: () {}, icon: const Icon(Icons.share)), + ], + ), + body: BlocConsumer(builder: (context,state){ + if(state is EligibilityAttachmentViewState){ + fileUrl = state.fileUrl; + bool isPDF = state.fileUrl[state.fileUrl.length - 1] == 'f' ? true : false; + return SizedBox( + child: isPDF?SfPdfViewer.network( + state.fileUrl,onDocumentLoadFailed: (details) { + Center(child: Text(details.description),); + },): Center( + child: CachedNetworkImage( + progressIndicatorBuilder: (context, url, progress) { + return const SizedBox( + height: 100, + width: 100, + child: CircularProgressIndicator(color: primary,)); + }, + + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + image: DecorationImage( + image: imageProvider, fit: BoxFit.fill)), + ), + imageUrl: + state.fileUrl, + width: double.infinity, + height: 220, + fit: BoxFit.cover, + ), + ), + ); + } + return Container(); + },listener: (context, state) { + + },) + ); + } +} diff --git a/lib/screens/profile/components/eligibility_screen.dart b/lib/screens/profile/components/eligibility_screen.dart index 0a51d26..4376fd1 100644 --- a/lib/screens/profile/components/eligibility_screen.dart +++ b/lib/screens/profile/components/eligibility_screen.dart @@ -28,6 +28,8 @@ import '../../../bloc/profile/eligibility/eligibility_bloc.dart'; import '../../../utils/alerts.dart'; import '../shared/multiple_attachment.dart'; import '../shared/single_attachment.dart'; +import '../shared/view_attachment.dart'; +import 'eligibility/eligibility_view_attachment.dart'; class EligibiltyScreen extends StatelessWidget { const EligibiltyScreen({super.key}); @@ -629,6 +631,17 @@ class EligibiltyScreen extends StatelessWidget { ? ////Single Attachment view SingleAttachment( + view: (){ + + Navigator.push( + context, + MaterialPageRoute( + builder: ((context) => BlocProvider.value( + value: EligibilityBloc()..add(EligibiltyViewAttachmentEvent(source: state.eligibilities[index].attachments!.first.source!)), + child: const EligibilityViewAttachment(), + )))); + + }, onpressed: () { confirmAlert( @@ -660,6 +673,15 @@ class EligibiltyScreen extends StatelessWidget { ) ////Multiple Attachments View : MultipleAttachments( + viewAttachment: (source,filename) { + Navigator.push( + context, + MaterialPageRoute( + builder: ((context) => BlocProvider.value( + value: EligibilityBloc()..add(EligibiltyViewAttachmentEvent(source: source)), + child: const EligibilityViewAttachment(), + )))); + }, profileId: profileId!, token: token!, diff --git a/lib/screens/profile/components/learning_and_development_screen.dart b/lib/screens/profile/components/learning_and_development_screen.dart index edb1f31..dbb74c8 100644 --- a/lib/screens/profile/components/learning_and_development_screen.dart +++ b/lib/screens/profile/components/learning_and_development_screen.dart @@ -12,6 +12,7 @@ import 'package:intl/intl.dart'; import 'package:unit2/bloc/profile/profile_bloc.dart'; import 'package:unit2/bloc/user/user_bloc.dart'; import 'package:unit2/screens/profile/components/learning_development/edit_modal.dart'; +import 'package:unit2/screens/profile/components/learning_development/learning_development_view_attachment.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/utils/global.dart'; @@ -27,6 +28,7 @@ import '../../../utils/alerts.dart'; import '../../../widgets/Leadings/close_leading.dart'; import '../shared/multiple_attachment.dart'; import '../shared/single_attachment.dart'; +import '../shared/view_attachment.dart'; import 'learning_development/add_modal.dart'; class LearningAndDevelopmentScreen extends StatelessWidget { @@ -673,6 +675,15 @@ class LearningAndDevelopmentScreen extends StatelessWidget { ? ////Single Attachment view SingleAttachment( + view: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: ((context) => BlocProvider.value( + value: LearningDevelopmentBloc()..add(LearningDevelopmentViewAttachmentEvent(source: state.learningsAndDevelopment[index].attachments!.first.source!)), + child: const LearningDevelopmentViewAttachment(), + )))); + }, onpressed: () { confirmAlert( context, @@ -703,6 +714,17 @@ class LearningAndDevelopmentScreen extends StatelessWidget { ) ////Multiple Attachments View : MultipleAttachments( + viewAttachment: + (source,filename) { + Navigator.push( + context, + MaterialPageRoute( + builder: ((context) => + BlocProvider.value( + value: LearningDevelopmentBloc()..add(LearningDevelopmentViewAttachmentEvent(source: source)), + child: const LearningDevelopmentViewAttachment(), + )))); + }, profileId: profileId, token: token, diff --git a/lib/screens/profile/components/learning_development/learning_development_view_attachment.dart b/lib/screens/profile/components/learning_development/learning_development_view_attachment.dart new file mode 100644 index 0000000..7d07997 --- /dev/null +++ b/lib/screens/profile/components/learning_development/learning_development_view_attachment.dart @@ -0,0 +1,71 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; +import 'package:unit2/bloc/profile/learningDevelopment/learning_development_bloc.dart'; +import 'package:unit2/theme-data.dart/colors.dart'; +import 'package:url_launcher/url_launcher.dart'; +class LearningDevelopmentViewAttachment extends StatefulWidget { + + const LearningDevelopmentViewAttachment({super.key}); + + @override + State createState() => _LearningDevelopmentViewAttachmentState(); +} + +class _LearningDevelopmentViewAttachmentState extends State { + @override + Widget build(BuildContext context) { + String? fileUrl; + return Scaffold( + floatingActionButton: FloatingActionButton( + onPressed: ()async { + await launchUrl(Uri.parse(fileUrl!)); + }, + child: const Icon(Icons.file_download), + ), + appBar: AppBar( + title: const Text("Attachment"), + centerTitle: true, + actions: [ + IconButton(onPressed: () {}, icon: const Icon(Icons.share)), + ], + ), + body: BlocConsumer(builder: (context,state){ + if(state is LearningAndDevelopmentAttachmentViewState){ + fileUrl = state.fileUrl; + bool isPDF = state.fileUrl[state.fileUrl.length - 1] == 'f' ? true : false; + return SizedBox( + child: isPDF?SfPdfViewer.network( + state.fileUrl,onDocumentLoadFailed: (details) { + Center(child: Text(details.description),); + },): Center( + child: CachedNetworkImage( + progressIndicatorBuilder: (context, url, progress) { + return const SizedBox( + height: 100, + width: 100, + child: CircularProgressIndicator(color: primary,)); + }, + + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + image: DecorationImage( + image: imageProvider, fit: BoxFit.fill)), + ), + imageUrl: + state.fileUrl, + width: double.infinity, + height: 220, + fit: BoxFit.cover, + ), + ), + ); + } + return Container(); + },listener: (context, state) { + + },) + ); + } +} diff --git a/lib/screens/profile/components/work_history/add_modal.dart b/lib/screens/profile/components/work_history/add_modal.dart index 38ca36a..75b0aab 100644 --- a/lib/screens/profile/components/work_history/add_modal.dart +++ b/lib/screens/profile/components/work_history/add_modal.dart @@ -14,7 +14,7 @@ import 'package:unit2/model/utils/category.dart'; import 'package:unit2/theme-data.dart/box_shadow.dart'; import 'package:unit2/theme-data.dart/btn-style.dart'; import 'package:unit2/theme-data.dart/colors.dart'; -import 'package:unit2/theme-data.dart/form-style.dart'; +import 'package:unit2/theme-data.dart/form-style.dart'; import 'package:unit2/utils/global.dart'; import 'package:unit2/utils/text_container.dart'; import 'package:unit2/utils/validators.dart'; @@ -45,6 +45,12 @@ class _AddWorkHistoryScreenState extends State { String? salary; String? salaryGrade; String? salaryGradeStep; + String? accomplishment; + String? duties; + String? sFname; + String? sLname; + String? sMname; + String? sOffice; bool showAgency = false; bool showSalaryGradeAndSalaryStep = false; bool? isPrivate = false; @@ -67,7 +73,9 @@ class _AddWorkHistoryScreenState extends State { @override Widget build(BuildContext context) { + return BlocConsumer( + listener: (context, state) { if (state is AddWorkHistoryState) { final progress = ProgressHUD.of(context); @@ -77,15 +85,14 @@ class _AddWorkHistoryScreenState extends State { if (state is AddWorkHistoryState) { return FormBuilder( key: _formKey, - child: SizedBox( - height: blockSizeVertical * 90, + child: SingleChildScrollView( child: Padding( padding: const EdgeInsets.symmetric(vertical: 32, horizontal: 28), child: Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ - Flexible( - child: ListView( - children: [ + + ////POSITIONS StatefulBuilder(builder: (context, setState) { return SearchField( @@ -93,18 +100,18 @@ class _AddWorkHistoryScreenState extends State { itemHeight: 70, suggestionsDecoration: box1(), suggestions: state.agencyPositions - .map((PositionTitle position) => SearchFieldListItem( - position.title!, - item: position, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10), - child: ListTile( - title: Text( - position.title!, - overflow: TextOverflow.visible, - ), - )))) + .map((PositionTitle position) => + SearchFieldListItem(position.title!, + item: position, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10), + child: ListTile( + title: Text( + position.title!, + overflow: TextOverflow.visible, + ), + )))) .toList(), focusNode: positionFocusNode, searchInputDecoration: @@ -127,11 +134,12 @@ class _AddWorkHistoryScreenState extends State { controller: addPositionController, onpressed: () { setState(() { - PositionTitle newAgencyPosition = PositionTitle( - id: null, - title: addPositionController.text - .toUpperCase()); - + PositionTitle newAgencyPosition = + PositionTitle( + id: null, + title: addPositionController.text + .toUpperCase()); + state.agencyPositions .insert(0, newAgencyPosition); selectedPosition = newAgencyPosition; @@ -170,7 +178,7 @@ class _AddWorkHistoryScreenState extends State { }, onSuggestionTap: (status) { selectedStatus = status.item; - + appointmentStatusNode.unfocus(); }, searchInputDecoration: @@ -182,7 +190,7 @@ class _AddWorkHistoryScreenState extends State { appointmentStatusNode.unfocus(); }, ))), - + const SizedBox( height: 12, ), @@ -226,7 +234,7 @@ class _AddWorkHistoryScreenState extends State { onSuggestionTap: (agency) { setState(() { selectedAgency = agency.item; - + if (selectedAgency!.privateEntity == null) { showIsPrivateRadio = true; @@ -260,19 +268,19 @@ class _AddWorkHistoryScreenState extends State { .toUpperCase(), category: null, privateEntity: null); - + state.agencies.insert(0, newAgency); selectedAgency = newAgency; addAgencyController.text = ""; showAgency = true; - + showIsPrivateRadio = true; - + Navigator.pop(context); }); }, title: "Add Agency")), - + SizedBox( height: showAgency ? 12 : 0, ), @@ -335,7 +343,7 @@ class _AddWorkHistoryScreenState extends State { ) : const SizedBox(), ), - + ////PRVIATE SECTOR SizedBox( child: showIsPrivateRadio @@ -356,7 +364,7 @@ class _AddWorkHistoryScreenState extends State { ], ), ), - + ////onvhange private sector onChanged: (value) { setState(() { @@ -381,7 +389,7 @@ class _AddWorkHistoryScreenState extends State { agencyCategoryFocusNode.unfocus(); }); }, - + name: 'isPrivate', validator: FormBuilderValidators.required(), @@ -476,21 +484,80 @@ class _AddWorkHistoryScreenState extends State { const SizedBox( height: 12, ), - ////MONTHLY SALARY + //// NAME OF OFFICE UNIT FormBuilderTextField( - keyboardType: TextInputType.number, - onChanged: (value) { - setState(() { - salary = value; - }); + onChanged: (value){ + sOffice = value; }, - validator: numericRequired, - name: "salary", - decoration: - normalTextFieldStyle("Monthly Salary *", "") - .copyWith(prefix: const Text("₱ ")), + validator: FormBuilderValidators.required( + errorText: "This field is required"), + name: 'office', + decoration: normalTextFieldStyle( + "Name of Office/Unit", "Name of Office/Unit"), ), - + const SizedBox( + height: 12, + ), + + ////MONTHLY SALARY + StatefulBuilder(builder: (context, setState) { + return FormBuilderTextField( + keyboardType: TextInputType.number, + onChanged: (value) { + setState(() { + salary = value; + }); + }, + validator: numericRequired, + name: "salary", + decoration: + normalTextFieldStyle("Monthly Salary *", "") + .copyWith(prefix: const Text("₱ ")), + ); + }), + const SizedBox( + height: 12, + ), + const Text("Immediate SuperVisor"), + const SizedBox( + height: 12, + ), + ////IMMEDIATE SUPERVISOR + FormBuilderTextField( + onChanged: (value){ + sFname = value; + }, + validator: FormBuilderValidators.required( + errorText: "This field is required"), + name: 'supervisor_firstname', + decoration: + normalTextFieldStyle("First name", "First Name"), + ), + const SizedBox( + height: 12, + ), + FormBuilderTextField( + onChanged: (value){ + sMname = value; + }, + name: 'supervisor_middlename', + decoration: normalTextFieldStyle( + "Middle name", "Middle Name"), + ), + const SizedBox( + height: 12, + ), + FormBuilderTextField( + onChanged: (value){ + sLname = value; + }, + validator: FormBuilderValidators.required( + errorText: "This field is required"), + name: 'supervisor_lastname', + decoration: + normalTextFieldStyle("Last name", "Last Name"), + ), + const SizedBox( height: 12, ), @@ -595,12 +662,11 @@ class _AddWorkHistoryScreenState extends State { } return true; }, - onChanged: (value) { - setState(() { - to = - DateTime.parse(value); - }); - }, + onChanged: (value) { + setState(() { + to = DateTime.parse(value); + }); + }, initialDate: from == null ? DateTime.now() : from!.add( @@ -624,8 +690,40 @@ class _AddWorkHistoryScreenState extends State { ], ); }), - ], - ), + + const Text("Work Experience"), + const SizedBox( + height: 8, + ), + FormBuilderTextField( + onChanged: (value){ + accomplishment = value; + }, + name: "accomplishment", + decoration: normalTextFieldStyle( + "List of Accomplishment and Contribution", + "", + ), + ), + const SizedBox( + height: 12, + ), + FormBuilderTextField( + onChanged: (value){ + duties = value; + }, + validator: FormBuilderValidators.required( + errorText: "This field is required"), + name: "summary", + decoration: normalTextFieldStyle( + "Summary of Actual Duties", + "", + ), + ), + + + const SizedBox( + height: 20, ), ////SUBMIT BUTTON SizedBox( @@ -635,11 +733,24 @@ class _AddWorkHistoryScreenState extends State { style: mainBtnStyle(primary, Colors.transparent, second), onPressed: () { - print(selectedStatus?.value); + print(salaryGrade); + print(salaryGradeStep); + if (_formKey.currentState!.validate()) { final progress = ProgressHUD.of(context); progress!.showWithText("Loading..."); + WorkHistory workHistory = WorkHistory( + accomplishment: null, + actualDuties: null, + agencydepid: null, + supervisor: Supervisor( + agencyId: selectedAgency?.id, + id: null, + lastname: sLname, + firstname: sFname, + middlename: sMname, + stationName: sOffice), position: selectedPosition, id: null, agency: selectedAgency, @@ -651,15 +762,17 @@ class _AddWorkHistoryScreenState extends State { "PRESENT" ? null : DateTime.parse(toDateController.text), - salaryGrade: salaryGrade == null + salarygrade: salaryGrade == null ? null : int.parse(salaryGrade!), - sgStep: salaryGradeStep == null + sgstep: salaryGradeStep == null ? null : int.parse(salaryGradeStep!), - monthlySalary: double.parse(salary!), - appointmentStatus: selectedStatus!.value); + monthlysalary: double.parse(salary!), + statusAppointment: selectedStatus!.value); context.read().add(AddWorkHostory( + accomplishment: accomplishment, + actualDuties: duties, workHistory: workHistory, profileId: widget.profileId, token: widget.token, diff --git a/lib/screens/profile/components/work_history/edit_modal.dart b/lib/screens/profile/components/work_history/edit_modal.dart index 1045946..5c0f633 100644 --- a/lib/screens/profile/components/work_history/edit_modal.dart +++ b/lib/screens/profile/components/work_history/edit_modal.dart @@ -81,7 +81,7 @@ class _EditWorkHistoryScreenState extends State { if (state is EditWorkHistoryState) { oldPositionController.text = state.workHistory.position!.title!; oldAppointmentStatusController.text = - state.workHistory.appointmentStatus!; + state.workHistory.statusAppointment!; oldAgencyController.text = state.workHistory.agency!.name!; currentlyEmployed = state.workHistory.toDate == null ? true : false; showSalaryGradeAndSalaryStep = @@ -428,7 +428,7 @@ class _EditWorkHistoryScreenState extends State { child: FormBuilderTextField( initialValue: state .workHistory - .salaryGrade + .salarygrade ?.toString(), name: 'salary_grade', keyboardType: @@ -452,7 +452,7 @@ class _EditWorkHistoryScreenState extends State { flex: 1, child: FormBuilderTextField( initialValue: state - .workHistory.sgStep + .workHistory.sgstep ?.toString(), name: 'salary_step', keyboardType: @@ -482,7 +482,7 @@ class _EditWorkHistoryScreenState extends State { ////MONTHLY SALARY FormBuilderTextField( initialValue: - state.workHistory.monthlySalary.toString(), + state.workHistory.monthlysalary.toString(), onChanged: (value) { setState(() { salary = value; @@ -654,50 +654,50 @@ class _EditWorkHistoryScreenState extends State { style: mainBtnStyle(primary, Colors.transparent, second), onPressed: () { - if (_formKey.currentState!.saveAndValidate()) { - final progress = ProgressHUD.of(context); - progress!.showWithText("Loading..."); - salary = _formKey.currentState!.value['salary']; - selectedPosition ??= state.workHistory.position; - salaryGrade = - _formKey.currentState!.value['salary_grade']; - salaryGradeStep = - _formKey.currentState!.value['salary_step']; - selectedAgency ??= state.workHistory.agency; + // if (_formKey.currentState!.saveAndValidate()) { + // final progress = ProgressHUD.of(context); + // progress!.showWithText("Loading..."); + // salary = _formKey.currentState!.value['salary']; + // selectedPosition ??= state.workHistory.position; + // salaryGrade = + // _formKey.currentState!.value['salary_grade']; + // salaryGradeStep = + // _formKey.currentState!.value['salary_step']; + // selectedAgency ??= state.workHistory.agency; - selectedStatus ??= AppoinemtStatus( - value: state.workHistory.appointmentStatus!, - label: state.workHistory.appointmentStatus!); - WorkHistory newWorkHistory = WorkHistory( - id: state.workHistory.id, - position: selectedPosition, - agency: selectedAgency, - fromDate: fromDateController.text.isEmpty - ? null - : DateTime.parse(fromDateController.text), - toDate: toDateController.text.isEmpty || - toDateController.text.toUpperCase() == - "PRESENT" || - toDateController.text.toLowerCase() == - 'null' - ? null - : DateTime.parse(toDateController.text), - monthlySalary: double.parse(salary!), - appointmentStatus: selectedStatus!.value, - salaryGrade: salaryGrade == null - ? null - : int.parse(salaryGrade!), - sgStep: salaryGradeStep == null - ? null - : int.parse(salaryGradeStep!), - ); - context.read().add( - UpdateWorkHistory( - oldWorkHistory: state.workHistory, - profileId: widget.profileId.toString(), - token: widget.token, - workHistory: newWorkHistory)); - } + // selectedStatus ??= AppoinemtStatus( + // value: state.workHistory.statusAppointment!, + // label: state.workHistory.statusAppointment!); + // WorkHistory newWorkHistory = WorkHistory( + // id: state.workHistory.id, + // position: selectedPosition, + // agency: selectedAgency, + // fromDate: fromDateController.text.isEmpty + // ? null + // : DateTime.parse(fromDateController.text), + // toDate: toDateController.text.isEmpty || + // toDateController.text.toUpperCase() == + // "PRESENT" || + // toDateController.text.toLowerCase() == + // 'null' + // ? null + // : DateTime.parse(toDateController.text), + // monthlySalary: double.parse(salary!), + // appointmentStatus: selectedStatus!.value, + // salaryGrade: salaryGrade == null + // ? null + // : int.parse(salaryGrade!), + // sgStep: salaryGradeStep == null + // ? null + // : int.parse(salaryGradeStep!), + // ); + // context.read().add( + // UpdateWorkHistory( + // oldWorkHistory: state.workHistory, + // profileId: widget.profileId.toString(), + // token: widget.token, + // workHistory: newWorkHistory)); + // } }, child: const Text(submit)), ), diff --git a/lib/screens/profile/components/work_history_screen.dart b/lib/screens/profile/components/work_history_screen.dart index 6035f79..9255c4b 100644 --- a/lib/screens/profile/components/work_history_screen.dart +++ b/lib/screens/profile/components/work_history_screen.dart @@ -44,7 +44,7 @@ class WorkHistoryScreen extends StatelessWidget { AttachmentCategory? selectedAttachmentCategory; List attachmentCategories = []; return Scaffold( - resizeToAvoidBottomInset: false, + resizeToAvoidBottomInset: true, appBar: AppBar( title: context.watch().state is AddWorkHistoryState ? const FittedBox(child: Text("Add Work History")) @@ -623,87 +623,87 @@ class WorkHistoryScreen extends StatelessWidget { ]), const Divider(), ////Show Attachments - SizedBox( - child: state - .workExperiences[ - index] - .attachments == - null || - state - .workExperiences[ - index] - .attachments! - .isEmpty - ? const SizedBox() - : state - .workExperiences[ - index] - .attachments != - null && - state - .workExperiences[ - index] - .attachments! - .length == - 1 - ? - ////Single Attachment view - SingleAttachment( - onpressed: () { - confirmAlert( - context, - () { - parent.read().add(DeleteWorkHistoryAttachment( - attachment: state - .workExperiences[ - index] - .attachments! - .first, - moduleId: state - .workExperiences[ - index] - .id!, - profileId: - profileId!, - token: - token!)); - }, "Delete?", - "Confirm Delete?"); - }, - attachment: state - .workExperiences[ - index] - .attachments! - .first, - ) - ////Multiple Attachments View - : MultipleAttachments( - profileId: - profileId!, - token: token!, - moduleId: state - .workExperiences[ - index] - .id!, - educationBloc: - null, - workHistoryBloc: - BlocProvider.of(context), - eligibilityBloc: - null, - learningDevelopmentBloc: - null, - blocId: 3, - eligibilityName: state - .workExperiences[ - index] - .position! - .title!, - attachments: state - .workExperiences[ - index] - .attachments!, - )) + // SizedBox( + // child: state + // .workExperiences[ + // index] + // .attachments == + // null || + // state + // .workExperiences[ + // index] + // .attachments! + // .isEmpty + // ? const SizedBox() + // : state + // .workExperiences[ + // index] + // .attachments != + // null && + // state + // .workExperiences[ + // index] + // .attachments! + // .length == + // 1 + // ? + // ////Single Attachment view + // SingleAttachment( + // onpressed: () { + // confirmAlert( + // context, + // () { + // parent.read().add(DeleteWorkHistoryAttachment( + // attachment: state + // .workExperiences[ + // index] + // .attachments! + // .first, + // moduleId: state + // .workExperiences[ + // index] + // .id!, + // profileId: + // profileId!, + // token: + // token!)); + // }, "Delete?", + // "Confirm Delete?"); + // }, + // attachment: state + // .workExperiences[ + // index] + // .attachments! + // .first, + // ) + // ////Multiple Attachments View + // : MultipleAttachments( + // profileId: + // profileId!, + // token: token!, + // moduleId: state + // .workExperiences[ + // index] + // .id!, + // educationBloc: + // null, + // workHistoryBloc: + // BlocProvider.of(context), + // eligibilityBloc: + // null, + // learningDevelopmentBloc: + // null, + // blocId: 3, + // eligibilityName: state + // .workExperiences[ + // index] + // .position! + // .title!, + // attachments: state + // .workExperiences[ + // index] + // .attachments!, + // )) ], ), ), diff --git a/lib/screens/profile/shared/multiple_attachment.dart b/lib/screens/profile/shared/multiple_attachment.dart index 22b04c3..149cdfb 100644 --- a/lib/screens/profile/shared/multiple_attachment.dart +++ b/lib/screens/profile/shared/multiple_attachment.dart @@ -7,6 +7,7 @@ import 'package:unit2/bloc/profile/education/education_bloc.dart'; import 'package:unit2/bloc/profile/eligibility/eligibility_bloc.dart'; import 'package:unit2/bloc/profile/learningDevelopment/learning_development_bloc.dart'; import 'package:unit2/bloc/profile/workHistory/workHistory_bloc.dart'; +import 'package:unit2/screens/profile/shared/view_attachment.dart'; import 'package:unit2/utils/global_context.dart'; import '../../../model/profile/attachment.dart'; @@ -16,6 +17,7 @@ import '../../../utils/alerts.dart'; import '../../../utils/global.dart'; class MultipleAttachments extends StatelessWidget { + final Function(String source, String fileName) viewAttachment; final List attachments; final String eligibilityName; final EducationBloc? educationBloc; @@ -28,6 +30,7 @@ class MultipleAttachments extends StatelessWidget { final String token; const MultipleAttachments( {super.key, + required this.viewAttachment, required this.blocId, required this.educationBloc, required this.eligibilityBloc, @@ -128,9 +131,14 @@ class MultipleAttachments extends StatelessWidget { flex: 4, child: Tooltip( message: e.filename, - child: Text( - e.filename!, - overflow: TextOverflow.ellipsis, + child: GestureDetector( + onTap: (){ + viewAttachment(e.source!,e.filename!); + }, + child: Text( + e.filename!, + overflow: TextOverflow.ellipsis, + ), )), ), const SizedBox( diff --git a/lib/screens/profile/shared/single_attachment.dart b/lib/screens/profile/shared/single_attachment.dart index 64f9c91..3f790da 100644 --- a/lib/screens/profile/shared/single_attachment.dart +++ b/lib/screens/profile/shared/single_attachment.dart @@ -10,9 +10,11 @@ import '../../../utils/alerts.dart'; class SingleAttachment extends StatelessWidget { final Function()? onpressed; final Attachment attachment; + final Function()? view; const SingleAttachment({ required this.attachment, required this.onpressed, + required this.view, super.key, }); @@ -32,11 +34,14 @@ class SingleAttachment extends StatelessWidget { children: [ Expanded( child: - AutoSizeText( - attachment.filename!, - wrapWords: false, - maxLines: 1, - ), + GestureDetector( + onTap: view, + child: AutoSizeText( + attachment.filename!, + wrapWords: false, + maxLines: 1, + ), + ), ), const SizedBox( width: diff --git a/lib/screens/profile/shared/view_attachment.dart b/lib/screens/profile/shared/view_attachment.dart new file mode 100644 index 0000000..54bd51d --- /dev/null +++ b/lib/screens/profile/shared/view_attachment.dart @@ -0,0 +1,62 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; +import 'package:unit2/theme-data.dart/colors.dart'; +import 'package:unit2/widgets/error_state.dart'; + +import '../../../utils/urls.dart'; + +class ImageAttachment extends StatefulWidget { + final String imgUrl; + const ImageAttachment({super.key, required this.imgUrl}); + + @override + State createState() => _ImageAttachmentState(); +} + +class _ImageAttachmentState extends State { + @override + Widget build(BuildContext context) { + bool isPDF = widget.imgUrl[widget.imgUrl.length - 1] == 'f' ? true : false; + + return Scaffold( + floatingActionButton: FloatingActionButton( + onPressed: () {}, + child: const Icon(Icons.file_download), + ), + appBar: AppBar( + title: const Text("Attachment"), + centerTitle: true, + actions: [ + IconButton(onPressed: () {}, icon: const Icon(Icons.share)), + ], + ), + body: isPDF + ? SfPdfViewer.network( + '${Url.instance.prefixHost()}://${Url.instance.host()}${widget.imgUrl}',onDocumentLoadFailed: (details) { + Center(child: Text(details.description),); + },) + : Center( + child: CachedNetworkImage( + progressIndicatorBuilder: (context, url, progress) { + return const SizedBox( + height: 100, + width: 100, + child: CircularProgressIndicator(color: primary,)); + }, + + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + image: DecorationImage( + image: imageProvider, fit: BoxFit.fill)), + ), + imageUrl: + '${Url.instance.prefixHost()}://${Url.instance.host()}${widget.imgUrl}', + width: double.infinity, + height: 220, + fit: BoxFit.cover, + ), + ), + ); + } +} diff --git a/lib/screens/superadmin/role_assignment.dart/role_assignment_screen.dart b/lib/screens/superadmin/role_assignment.dart/role_assignment_screen.dart index e895170..8feade2 100644 --- a/lib/screens/superadmin/role_assignment.dart/role_assignment_screen.dart +++ b/lib/screens/superadmin/role_assignment.dart/role_assignment_screen.dart @@ -32,6 +32,7 @@ class RbacRoleAssignment extends StatelessWidget { List selectedValueItemRoles = []; return Scaffold( appBar: AppBar( + elevation: 0, centerTitle: true, backgroundColor: primary, title: const Text("User Roles Screenss"), diff --git a/lib/screens/unit2/homepage.dart/components/dashboard/dashboard.dart b/lib/screens/unit2/homepage.dart/components/dashboard/dashboard.dart index 3cd3420..c03573d 100644 --- a/lib/screens/unit2/homepage.dart/components/dashboard/dashboard.dart +++ b/lib/screens/unit2/homepage.dart/components/dashboard/dashboard.dart @@ -8,13 +8,10 @@ import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/superadmi import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart'; import 'package:unit2/theme-data.dart/colors.dart'; import 'package:unit2/theme-data.dart/form-style.dart'; -import '../../../../../bloc/rbac/rbac_operations/agency/agency_bloc.dart'; import '../../../../../bloc/role/pass_check/est_point_person/assign_area/assign_area_agency_bloc.dart'; import '../../../../../bloc/role/pass_check/est_point_person/est_point_person_assignable/est_point_person_assinable_role_bloc.dart'; import '../../../../../bloc/role/pass_check/est_point_person/est_point_person_role_assignment/est_role_assignment_bloc.dart'; import '../../../../../bloc/role/pass_check/est_point_person/est_point_person_station/est_point_person_station_bloc.dart'; -import '../../../../../sevices/roles/est_point_person/est_point_person_role_assignment_services.dart'; -import '../../../../superadmin/agency/agency_screen.dart'; import '../../../roles/establishment_point_person/est_point_person_agecies.dart'; import '../../../roles/establishment_point_person/est_point_person_role_member_screen.dart'; import '../../../roles/establishment_point_person/est_point_person_role_under_screen.dart'; @@ -71,7 +68,9 @@ class _DashBoardState extends State { docSmsCards.add(e); } }); - + unit2Cards.forEach((element) { + print("${element.moduleName} - ${element.object.name!} - ${element.roleName} " ); + }); if (superadminCards.length > 3) { tempSuperAdminCards = superadminCards.sublist(0, 4); } @@ -85,6 +84,7 @@ class _DashBoardState extends State { child: ListView( children: [ Column( + mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ ////unit2 module operations @@ -107,7 +107,7 @@ class _DashBoardState extends State { ), Container( child: unit2Cards.isEmpty - ? const SizedBox() + ? const SizedBox.shrink() : GridView.count( shrinkWrap: true, crossAxisCount: 4, @@ -185,7 +185,7 @@ class _DashBoardState extends State { child: FadeInAnimation( child: Container( - child: (e.roleName == 'superadmin' || e.roleName == 'qr code scanner' || e.roleName == 'security guard' || e.roleName == 'establishment point-person' || e.roleName == 'registration in-charge') && e.moduleName == 'unit2' + child: (e.roleName == 'qr code scanner' || e.roleName == 'security guard' || e.roleName == 'establishment point-person' || e.roleName == 'registration in-charge') && e.moduleName == 'unit2' ? CardLabel( icon: iconGenerator(name: e.object.name!), title: e.object.name!.toLowerCase() == 'role based access control' @@ -195,7 +195,7 @@ class _DashBoardState extends State { : e.object.name!, ontap: () { if (e.object.name!.toLowerCase() == 'pass check') { - PassCheckArguments passCheckArguments = PassCheckArguments(roleId: 10, userId: widget.userId); + PassCheckArguments passCheckArguments = PassCheckArguments(roleId: e.roleId, userId: widget.userId); Navigator.pushNamed(context, '/pass-check', arguments: passCheckArguments); } if (e.object.name!.toLowerCase() == 'role based access control') { @@ -210,19 +210,22 @@ class _DashBoardState extends State { })); } if (e.object.name!.toLowerCase() == "role member") { - Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) { + Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) { return BlocProvider( create: (context) => EstRoleAssignmentBloc()..add(GetEstPointPersonRolesUnder(userId: widget.userId)), - child: EstPointPersonRoleAssignmentScreen(id: widget.userId,), + child: EstPointPersonRoleAssignmentScreen( + id: widget.userId, + ), ); })); } if (e.object.name!.toLowerCase() == 'assignable role') { - Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) { return BlocProvider( create: (context) => EstPointPersonAssinableRoleBloc()..add(const GetEstPointPersonAssignableRoles(roleId: 16)), - child: EstPointPersonRoleUnderScreen(id: widget.userId,), + child: EstPointPersonRoleUnderScreen( + id: widget.userId, + ), ); })); } @@ -421,11 +424,11 @@ class _DashBoardState extends State { ), ), SizedBox( - height: unit2Cards.isEmpty ? 0 : 24, + height: superadminCards.isEmpty ? 0 : 24, ), Container( child: superadminCards.isEmpty - ? const SizedBox() + ? const SizedBox.shrink() : Text( "Superadmin module operations", style: Theme.of(context) @@ -442,7 +445,7 @@ class _DashBoardState extends State { ), Container( child: superadminCards.isEmpty - ? const SizedBox() + ? const SizedBox.shrink() : GridView.count( shrinkWrap: true, crossAxisCount: 4, @@ -602,12 +605,12 @@ class _DashBoardState extends State { columnCount: 4, )); }).toList())), - const SizedBox( - height: 24, + SizedBox( + height: rpassCards.isEmpty?0: 24, ), Container( child: rpassCards.isEmpty - ? const SizedBox() + ? const SizedBox.shrink() : Text( "RPAss module operations", style: Theme.of(context) @@ -624,7 +627,7 @@ class _DashBoardState extends State { ), Container( child: rpassCards.isEmpty - ? const SizedBox() + ? const SizedBox.shrink() : GridView.count( shrinkWrap: true, crossAxisCount: 4, @@ -649,12 +652,12 @@ class _DashBoardState extends State { }).toList(), ), ), - const SizedBox( - height: 24, + SizedBox( + height: docSmsCards.isEmpty?0: 24, ), Container( child: docSmsCards.isEmpty - ? const SizedBox() + ? const SizedBox.shrink() : Text( "DocSMS module operations", style: Theme.of(context) diff --git a/lib/screens/unit2/homepage.dart/components/dashboard/superadmin_expanded_menu.dart b/lib/screens/unit2/homepage.dart/components/dashboard/superadmin_expanded_menu.dart index 52f2d97..dd4c00f 100644 --- a/lib/screens/unit2/homepage.dart/components/dashboard/superadmin_expanded_menu.dart +++ b/lib/screens/unit2/homepage.dart/components/dashboard/superadmin_expanded_menu.dart @@ -77,7 +77,9 @@ class SuperAdminMenu extends StatelessWidget { title: object.object.name!, ontap: () { + if (object.object.name == 'Role') { + Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) { return BlocProvider( diff --git a/lib/screens/unit2/homepage.dart/module-screen.dart b/lib/screens/unit2/homepage.dart/module-screen.dart index 26762d5..5f2046f 100644 --- a/lib/screens/unit2/homepage.dart/module-screen.dart +++ b/lib/screens/unit2/homepage.dart/module-screen.dart @@ -43,6 +43,7 @@ class _MainScreenState extends State { for (var module in role.modules!) { for (var object in module!.objects!) { DisplayCard newCard = DisplayCard( + roleId: role.id!, moduleName: module.name!.toLowerCase(), object: object!, roleName: role.name!.toLowerCase()); @@ -91,8 +92,9 @@ class DisplayCard { final String roleName; final String moduleName; final ModuleObject object; + final int roleId; const DisplayCard( - {required this.moduleName, required this.object, required this.roleName}); + {required this.moduleName, required this.object, required this.roleName,required this.roleId}); } class Module { diff --git a/lib/sevices/profile/work_history_services.dart b/lib/sevices/profile/work_history_services.dart index 068f20c..e46b08d 100644 --- a/lib/sevices/profile/work_history_services.dart +++ b/lib/sevices/profile/work_history_services.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:intl/intl.dart'; import 'package:unit2/model/profile/work_history.dart'; import 'package:http/http.dart' as http; import 'package:unit2/model/utils/agency_position.dart'; @@ -48,17 +49,17 @@ class WorkHistoryService { bool? success; Map params = {"force_mode": "true"}; String authToken = "Token $token"; - String path = "${Url.instance.workhistory()}$profileId/"; + String path = "${Url.instance.deleteWorkHistory()}$profileId/"; Map body = { "id": work.id, "position_id": work.position!.id, "agency_id": work.agency!.id, "from_date": work.fromDate?.toString(), "to_date": work.toDate?.toString(), - "monthly_salary": work.monthlySalary, - "appointment_status": work.appointmentStatus, - "salary_step": work.sgStep, - "salary_grade": work.salaryGrade, + // "monthly_salary": work.monthlysalary, + // "appointment_status": work.statusAppointment, + // "salary_step": work.sgstep, + // "salary_grade": work.salarygrade, }; Map headers = { 'Content-Type': 'application/json; charset=UTF-8', @@ -82,85 +83,212 @@ class WorkHistoryService { ////edit work history - Future> update({required WorkHistory oldWorkHistory, required WorkHistory newWorkHistory, required String token, required String profileId})async{ - Map? statusResponse={}; - String authtoken = "Token $token"; - String path = '${Url.instance.workhistory()}$profileId/'; - Map headers = { - 'Content-Type': 'application/json; charset=UTF-8', - 'Authorization': authtoken - }; - Map body = { - "id":newWorkHistory.id, - "position_id":newWorkHistory.position!.id, - "agency_id":newWorkHistory.agency!.id, - "from_date":newWorkHistory.fromDate?.toString(), - "to_date":newWorkHistory.toDate?.toString(), - "monthly_salary":newWorkHistory.monthlySalary, - "appointment_status":newWorkHistory.appointmentStatus, - "salary_grade":newWorkHistory.salaryGrade, - "sg_step":newWorkHistory.sgStep, - "_positionName":newWorkHistory.position!.title!, - "_agencyName":newWorkHistory.agency!.name!, - "_agencyCatId":newWorkHistory.agency!.category!.id!, - "_privateEntity":newWorkHistory.agency!.privateEntity, - "oldPosId":oldWorkHistory.position!.id, - "_oldAgencyId":oldWorkHistory.agency!.id, - "oldFromDate":oldWorkHistory.fromDate?.toString(), - }; - try{ - http.Response response = await Request.instance.putRequest(path: path, headers: headers, body: body, param: {}); - if(response.statusCode == 200 ){ - Map data = jsonDecode(response.body); - statusResponse = data; - }else{ - statusResponse.addAll({'success':false}); - } - return statusResponse; - }catch(e){ - throw e.toString(); - } - } + // Future> update({required WorkHistory oldWorkHistory, required WorkHistory newWorkHistory, required String token, required String profileId})async{ + // Map? statusResponse={}; + // String authtoken = "Token $token"; + // String path = '${Url.instance.workhistory()}$profileId/'; + // Map headers = { + // 'Content-Type': 'application/json; charset=UTF-8', + // 'Authorization': authtoken + // }; + // Map body = { + // "id":newWorkHistory.id, + // "position_id":newWorkHistory.position!.id, + // "agency_id":newWorkHistory.agency!.id, + // "from_date":newWorkHistory.fromDate?.toString(), + // "to_date":newWorkHistory.toDate?.toString(), + // "monthly_salary":newWorkHistory.monthlysalary, + // "appointment_status":newWorkHistory.statusAppointment, + // "salary_grade":newWorkHistory.salarygrade, + // "sg_step":newWorkHistory.sgstep, + // "_positionName":newWorkHistory.position!.title!, + // "_agencyName":newWorkHistory.agency!.name!, + // "_agencyCatId":newWorkHistory.agency!.category!.id!, + // "_privateEntity":newWorkHistory.agency!.privateEntity, + // "oldPosId":oldWorkHistory.position!.id, + // "_oldAgencyId":oldWorkHistory.agency!.id, + // "oldFromDate":oldWorkHistory.fromDate?.toString(), + // }; + + + // try{ + // http.Response response = await Request.instance.putRequest(path: path, headers: headers, body: body, param: {}); + // if(response.statusCode == 200 ){ + // Map data = jsonDecode(response.body); + // statusResponse = data; + // }else{ + // statusResponse.addAll({'success':false}); + // } + // return statusResponse; + // }catch(e){ + // throw e.toString(); + // } + // } + + ////Add work history - Future>add({required WorkHistory workHistory, required String token, required int profileId , required bool isPrivate})async{ + Future>add({required WorkHistory workHistory, required String token, required int profileId , required bool isPrivate,required String? accomplishment, required String? actualDuties})async{ String authtoken = "Token $token"; String path = '${Url.instance.workhistory()}$profileId/'; Map headers = { 'Content-Type': 'application/json; charset=UTF-8', 'Authorization': authtoken }; + Map body = {}; Map statusResponse = {}; - Map body = { - 'position_id':workHistory.position?.id, - 'agency_id': workHistory.agency?.id, - 'from_date': workHistory.fromDate?.toString(), - 'to_date': workHistory.toDate?.toString(), - 'monthly_salary': workHistory.monthlySalary, - 'appointment_status': workHistory.appointmentStatus, - 'salary_grade': workHistory.salaryGrade, - 'sg_step':workHistory.sgStep, - '_positionName':workHistory.position?.title, - '_agencyName':workHistory.agency?.name, - '_agencyCatId':workHistory.agency?.category?.id, - '_privateEntity':workHistory.agency?.privateEntity, + String fromDate = DateFormat('yyyy-MM-dd').format(workHistory.fromDate!); + String? toDate; + if(workHistory.toDate != null){ + toDate = DateFormat('yyyy-MM-dd').format(workHistory.toDate!); + } + if(workHistory.toDate == null){ + body = { +"a_category_id ": workHistory.agency?.category?.id == null? "":workHistory.agency!.category!.id.toString(), + "a_name" : workHistory.agency?.name == null? "":workHistory.agency!.name!, + " a_private_entity ": workHistory.agency?.privateEntity == null?"":workHistory.agency!.privateEntity.toString(), + "accomplishment" : accomplishment??"", + "actual_duties ": actualDuties!, + "agency_id" : workHistory.agency?.id == null?"": workHistory.agency!.id.toString() , + "from_date" : fromDate, + "monthly_salary" : workHistory.monthlysalary == null? "": workHistory.monthlysalary.toString(), + "position_id" : workHistory.position?.id == null? "": workHistory.position!.id.toString(), + "position_name" : workHistory.position?.title == null? "":workHistory.position!.title!, + "s_fname" : workHistory.supervisor?.firstname == null?"":workHistory.supervisor!.firstname!, + "s_lname" : workHistory.supervisor?.lastname == null? "":workHistory.supervisor!.lastname!, + "s_mname" : workHistory.supervisor?.middlename == null?"":workHistory.supervisor!.middlename!, + "s_office" : workHistory.supervisor?.stationName == null?"":workHistory.supervisor!.stationName!, + "salary_grade" : workHistory.salarygrade == null? "":workHistory.salarygrade.toString(), + "sg_step" : workHistory.sgstep == null?"":workHistory.sgstep.toString() , + 'status_appointment' : workHistory.statusAppointment??"", }; - try{ - http.Response response = await Request.instance.postRequest(path: path,param: {},body: body,headers: headers); - if(response.statusCode == 201){ - Map data = jsonDecode(response.body); + }else{ + body = { +"a_category_id ": workHistory.agency?.category?.id == null? "":workHistory.agency!.category!.id.toString(), + "a_name" : workHistory.agency?.name == null? "":workHistory.agency!.name!, + " a_private_entity ": workHistory.agency?.privateEntity == null?"":workHistory.agency!.privateEntity.toString(), + "accomplishment" : accomplishment??"", + "actual_duties ": actualDuties!, + "agency_id" : workHistory.agency?.id == null?"": workHistory.agency!.id.toString() , + "from_date" : workHistory.fromDate == null? "2018-10-04":"2018-06-04", + "monthly_salary" : workHistory.monthlysalary == null? "": workHistory.monthlysalary.toString(), + "position_id" : workHistory.position?.id == null? "": workHistory.position!.id.toString(), + "position_name" : workHistory.position?.title == null? "":workHistory.position!.title!, + "s_fname" : workHistory.supervisor?.firstname == null?"":workHistory.supervisor!.firstname!, + "s_lname" : workHistory.supervisor?.lastname == null? "":workHistory.supervisor!.lastname!, + "s_mname" : workHistory.supervisor?.middlename == null?"":workHistory.supervisor!.middlename!, + "s_office" : workHistory.supervisor?.stationName == null?"":workHistory.supervisor!.stationName!, + "salary_grade" : workHistory.salarygrade == null? "":workHistory.salarygrade.toString(), + "sg_step" : workHistory.sgstep == null?"":workHistory.sgstep.toString() , + 'status_appointment' : workHistory.statusAppointment??"", + "to_date" : toDate!, + }; + } + + var request = http.MultipartRequest('POST',Uri.parse('${Url.instance.prefixHost()}://${Url.instance.host()}$path')); + request.fields.addAll(body); + request.headers.addAll(headers); + try { + http.StreamedResponse response = await request.send(); + final steamResponse = await response.stream.bytesToString(); + Map data = jsonDecode(steamResponse); + if (response.statusCode == 201) { statusResponse = data; - - }else{ - statusResponse.addAll({'success':false}); + } else { + String message = data['response']['details']; + statusResponse.addAll({'message': message}); + statusResponse.addAll( + {'success': false}, + ); } - return statusResponse; - }catch(e){ + } catch (e) { throw e.toString(); } - +return statusResponse; } +Future>update({required WorkHistory workHistory, required String token, required int profileId , required bool isPrivate,required String? accomplishment, required String? actualDuties})async{ + String authtoken = "Token $token"; + String path = '${Url.instance.workhistory()}$profileId/'; + Map headers = { + 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': authtoken + }; + Map body = {}; + Map statusResponse = {}; + String fromDate = DateFormat('yyyy-MM-dd').format(workHistory.fromDate!); + String? toDate; + if(workHistory.toDate != null){ + toDate = DateFormat('yyyy-MM-dd').format(workHistory.toDate!); + } + if(workHistory.toDate == null){ + body = { +"a_category_id ": workHistory.agency?.category?.id == null? "":workHistory.agency!.category!.id.toString(), + "a_name" : workHistory.agency?.name == null? "":workHistory.agency!.name!, + " a_private_entity ": workHistory.agency?.privateEntity == null?"":workHistory.agency!.privateEntity.toString(), + "accomplishment" : accomplishment??"", + "actual_duties ": actualDuties!, + "agency_id" : workHistory.agency?.id == null?"": workHistory.agency!.id.toString() , + "from_date" : fromDate, + "monthly_salary" : workHistory.monthlysalary == null? "": workHistory.monthlysalary.toString(), + "position_id" : workHistory.position?.id == null? "": workHistory.position!.id.toString(), + "position_name" : workHistory.position?.title == null? "":workHistory.position!.title!, + "s_fname" : workHistory.supervisor?.firstname == null?"":workHistory.supervisor!.firstname!, + "s_lname" : workHistory.supervisor?.lastname == null? "":workHistory.supervisor!.lastname!, + "s_mname" : workHistory.supervisor?.middlename == null?"":workHistory.supervisor!.middlename!, + "s_office" : workHistory.supervisor?.stationName == null?"":workHistory.supervisor!.stationName!, + "salary_grade" : workHistory.salarygrade == null? "":workHistory.salarygrade.toString(), + "sg_step" : workHistory.sgstep == null?"":workHistory.sgstep.toString() , + 'status_appointment' : workHistory.statusAppointment??"", + }; + }else{ + body = { +"a_category_id ": workHistory.agency?.category?.id == null? "":workHistory.agency!.category!.id.toString(), + "a_name" : workHistory.agency?.name == null? "":workHistory.agency!.name!, + " a_private_entity ": workHistory.agency?.privateEntity == null?"":workHistory.agency!.privateEntity.toString(), + "accomplishment" : accomplishment??"", + "actual_duties ": actualDuties!, + "agency_id" : workHistory.agency?.id == null?"": workHistory.agency!.id.toString() , + "from_date" : workHistory.fromDate == null? "2018-10-04":"2018-06-04", + "monthly_salary" : workHistory.monthlysalary == null? "": workHistory.monthlysalary.toString(), + "position_id" : workHistory.position?.id == null? "": workHistory.position!.id.toString(), + "position_name" : workHistory.position?.title == null? "":workHistory.position!.title!, + "s_fname" : workHistory.supervisor?.firstname == null?"":workHistory.supervisor!.firstname!, + "s_lname" : workHistory.supervisor?.lastname == null? "":workHistory.supervisor!.lastname!, + "s_mname" : workHistory.supervisor?.middlename == null?"":workHistory.supervisor!.middlename!, + "s_office" : workHistory.supervisor?.stationName == null?"":workHistory.supervisor!.stationName!, + "salary_grade" : workHistory.salarygrade == null? "":workHistory.salarygrade.toString(), + "sg_step" : workHistory.sgstep == null?"":workHistory.sgstep.toString() , + 'status_appointment' : workHistory.statusAppointment??"", + "to_date" : toDate!, + }; + } + + var request = http.MultipartRequest('PUT',Uri.parse('${Url.instance.prefixHost()}://${Url.instance.host()}$path')); + request.fields.addAll(body); + request.headers.addAll(headers); + try { + http.StreamedResponse response = await request.send(); + final steamResponse = await response.stream.bytesToString(); + Map data = jsonDecode(steamResponse); + if (response.statusCode == 201) { + statusResponse = data; + } else { + String message = data['response']['details']; + statusResponse.addAll({'message': message}); + statusResponse.addAll( + {'success': false}, + ); + } + } catch (e) { + throw e.toString(); + } +return statusResponse; + } + + + + ////get agency position Future> getAgencyPosition() async { List agencyPositions = []; diff --git a/lib/sevices/roles/pass_check_services.dart b/lib/sevices/roles/pass_check_services.dart index 8ff5c22..3b076a6 100644 --- a/lib/sevices/roles/pass_check_services.dart +++ b/lib/sevices/roles/pass_check_services.dart @@ -32,7 +32,7 @@ class PassCheckServices { 'X-Client-Key': xClientKey, 'X-Client-Secret': xClientSecret }; - // try { + try { http.Response response = await Request.instance .getRequest(param: params, headers: headers, path: path); if (response.statusCode == 200) { @@ -133,9 +133,9 @@ class PassCheckServices { statusResponse = assignedArea; } } - // } catch (e) { - // throw e.toString(); - // } + } catch (e) { + throw e.toString(); + } return statusResponse!; } diff --git a/lib/utils/attachment_services.dart b/lib/utils/attachment_services.dart index a871c59..d09e6ba 100644 --- a/lib/utils/attachment_services.dart +++ b/lib/utils/attachment_services.dart @@ -1,6 +1,10 @@ import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:share_plus/share_plus.dart'; import 'package:unit2/utils/request.dart'; +import 'package:unit2/utils/request_permission.dart'; import 'package:unit2/utils/urls.dart'; import '../model/profile/attachment.dart'; @@ -12,7 +16,7 @@ class AttachmentServices { Future> getCategories() async { List attachmentCategories = []; - String path = Url.instance.attachmentCategories()+"11232"; + String path = Url.instance.attachmentCategories(); Map headers = { 'Content-Type': 'application/json; charset=UTF-8', }; @@ -113,7 +117,7 @@ class AttachmentServices { 'Content-Type': 'application/json; charset=UTF-8', 'Authorization': authtoken }; - // try { + try { http.Response response = await Request.instance.deleteRequest( path: path, headers: headers, body: body, param: params); if (response.statusCode == 200) { @@ -122,9 +126,29 @@ class AttachmentServices { } else { success = false; } - // } catch (e) { - // throw (e.toString()); - // } + } catch (e) { + throw (e.toString()); + } return success!; } + + Future downloadAttachment( + {required String filename, + required String source, + required String downLoadDir}) async { + bool success = false; + var dio = Dio(); + Response response; + try { + if (await requestPermission(Permission.storage)) { + response = await dio.download(source, "$downLoadDir/$filename"); + if (response.statusCode == 200) { + success = true; + } + } + return success; + } catch (e) { + throw e.toString(); + } + } } diff --git a/lib/utils/request.dart b/lib/utils/request.dart index 329b3c4..33c7a12 100644 --- a/lib/utils/request.dart +++ b/lib/utils/request.dart @@ -19,7 +19,7 @@ class Request { Map? param}) async { Response response; try { - response = await get(Uri.http(host, path!, param), headers: headers) + response = await get(Uri.https(host, path!, param), headers: headers) .timeout(Duration(seconds: requestTimeout)); } on TimeoutException catch (_) { Fluttertoast.showToast( @@ -61,7 +61,7 @@ class Request { Map? param}) async { Response response; try { - response = await post(Uri.http(host, path!, param), + response = await post(Uri.https(host, path!, param), headers: headers, body: jsonEncode(body)) .timeout(Duration(seconds: requestTimeout)); } on TimeoutException catch (_) { @@ -104,7 +104,7 @@ class Request { required Map? param}) async { Response response; try { - response =await put(Uri.http(host,path,param),headers: headers,body: jsonEncode(body)); + response =await put(Uri.https(host,path,param),headers: headers,body: jsonEncode(body)); } on TimeoutException catch (_) { Fluttertoast.showToast( msg: timeoutError, @@ -186,7 +186,7 @@ class Request { required Map? param}) async { Response response; try { - response = await delete(Uri.http(host, path, param), + response = await delete(Uri.https(host, path, param), headers: headers, body: jsonEncode(body)) .timeout(Duration(seconds: requestTimeout)); } on TimeoutException catch (_) { diff --git a/lib/utils/request_permission.dart b/lib/utils/request_permission.dart new file mode 100644 index 0000000..1d3355c --- /dev/null +++ b/lib/utils/request_permission.dart @@ -0,0 +1,14 @@ + +import 'package:permission_handler/permission_handler.dart'; + +Future requestPermission(Permission permission) async { + if (await permission.isGranted) { + return true; + } else { + var result = await permission.request(); + if (result == PermissionStatus.granted) { + return true; + } + } + return false; +} \ No newline at end of file diff --git a/lib/utils/urls.dart b/lib/utils/urls.dart index cc22b4f..a2f27e4 100644 --- a/lib/utils/urls.dart +++ b/lib/utils/urls.dart @@ -5,13 +5,17 @@ class Url { String host() { // return '192.168.10.183:3000'; - // return 'agusandelnorte.gov.ph'; - return "192.168.10.219:3000"; + return 'agusandelnorte.gov.ph'; + // return "192.168.10.219:3000"; // return "192.168.10.241"; // return "192.168.10.221:3004"; // return "playweb.agusandelnorte.gov.ph"; // return 'devapi.agusandelnorte.gov.ph:3004'; } + String prefixHost(){ + return "https"; + // return "https"; + } String authentication() { return '/api/account/auth/login/'; @@ -58,7 +62,10 @@ class Url { //// work history paths String workhistory() { - return "/api/jobnet_app/profile/pds/work/"; + return "/api/jobnet_app/profile/pds/work_experience/"; + } + String deleteWorkHistory(){ + return "/api/jobnet_app/profile/pds/work/"; } String getPositions() { diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 41d8796..fcad7d4 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -9,6 +9,7 @@ #include #include #include +#include void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar = @@ -20,4 +21,7 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) platform_device_id_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "PlatformDeviceIdLinuxPlugin"); platform_device_id_linux_plugin_register_with_registrar(platform_device_id_linux_registrar); + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 64b5f1f..54e72c5 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST audioplayers_linux modal_progress_hud_nsn platform_device_id_linux + url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index fa11536..b1f7d47 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,6 +8,7 @@ import Foundation import assets_audio_player import assets_audio_player_web import audioplayers_darwin +import device_info_plus import location import modal_progress_hud_nsn import package_info_plus @@ -15,13 +16,17 @@ import path_provider_foundation import platform_device_id import platform_device_id_macos import rive_common +import share_plus import shared_preferences_foundation import sqflite +import syncfusion_pdfviewer_macos +import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AssetsAudioPlayerPlugin.register(with: registry.registrar(forPlugin: "AssetsAudioPlayerPlugin")) AssetsAudioPlayerWebPlugin.register(with: registry.registrar(forPlugin: "AssetsAudioPlayerWebPlugin")) AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin")) + DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) ModalProgressHudNsnPlugin.register(with: registry.registrar(forPlugin: "ModalProgressHudNsnPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) @@ -29,6 +34,9 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { PlatformDeviceIdMacosPlugin.register(with: registry.registrar(forPlugin: "PlatformDeviceIdMacosPlugin")) PlatformDeviceIdMacosPlugin.register(with: registry.registrar(forPlugin: "PlatformDeviceIdMacosPlugin")) RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin")) + SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) + SyncfusionFlutterPdfViewerPlugin.register(with: registry.registrar(forPlugin: "SyncfusionFlutterPdfViewerPlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 3544957..9ce9322 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -337,6 +337,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "0b0036e8cccbfbe0555fd83c1d31a6f30b77a96b598b35a5d36dd41f718695e9" + url: "https://pub.dev" + source: hosted + version: "0.3.3+4" crypto: dependency: transitive description: @@ -385,6 +393,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" + device_info_plus: + dependency: transitive + description: + name: device_info_plus + sha256: f52ab3b76b36ede4d135aab80194df8925b553686f0fa12226b4e2d658e45903 + url: "https://pub.dev" + source: hosted + version: "8.2.2" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 + url: "https://pub.dev" + source: hosted + version: "7.0.0" device_preview: dependency: "direct main" description: @@ -1253,6 +1277,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.8" + share_plus: + dependency: "direct main" + description: + name: share_plus + sha256: "6cec740fa0943a826951223e76218df002804adb588235a8910dc3d6b0654e11" + url: "https://pub.dev" + source: hosted + version: "7.1.0" + share_plus_platform_interface: + dependency: transitive + description: + name: share_plus_platform_interface + sha256: "357412af4178d8e11d14f41723f80f12caea54cf0d5cd29af9dcdab85d58aea7" + url: "https://pub.dev" + source: hosted + version: "3.3.0" shared_preferences: dependency: transitive description: @@ -1418,6 +1458,62 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + syncfusion_flutter_core: + dependency: transitive + description: + name: syncfusion_flutter_core + sha256: "8db8f55c77f56968681447d3837c10f27a9e861e238a898fda116c7531def979" + url: "https://pub.dev" + source: hosted + version: "21.2.10" + syncfusion_flutter_pdf: + dependency: transitive + description: + name: syncfusion_flutter_pdf + sha256: a42186922a416c2c9634a8f221aee261101babc2d30b1a1e908a7f034e743046 + url: "https://pub.dev" + source: hosted + version: "21.2.4" + syncfusion_flutter_pdfviewer: + dependency: "direct main" + description: + name: syncfusion_flutter_pdfviewer + sha256: "2dc016f251c675f8e4923135c485356473b4d89c677670164292159cd1dd4f45" + url: "https://pub.dev" + source: hosted + version: "21.2.3" + syncfusion_pdfviewer_macos: + dependency: transitive + description: + name: syncfusion_pdfviewer_macos + sha256: "8cc925cae532c0fa17e849165796d962107f45b86e66ee334dcaabf6b7305c82" + url: "https://pub.dev" + source: hosted + version: "21.2.10" + syncfusion_pdfviewer_platform_interface: + dependency: transitive + description: + name: syncfusion_pdfviewer_platform_interface + sha256: "08039ecdb8f79454fb367c6bf5a833846a666039415d2b5d76a7e59a5b3ff710" + url: "https://pub.dev" + source: hosted + version: "21.2.10" + syncfusion_pdfviewer_web: + dependency: transitive + description: + name: syncfusion_pdfviewer_web + sha256: "8e5ed0d313a1aa3869e4f2e8d079bc9bfa37ce79d91be7bb328e456f37b7995f" + url: "https://pub.dev" + source: hosted + version: "21.2.10" + syncfusion_pdfviewer_windows: + dependency: transitive + description: + name: syncfusion_pdfviewer_windows + sha256: "3e93f281135fb0562f7e6c343d2db741cf3cbd78c5b04884eef9af414408bc77" + url: "https://pub.dev" + source: hosted + version: "21.2.10" synchronized: dependency: transitive description: @@ -1474,6 +1570,70 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: eb1e00ab44303d50dd487aab67ebc575456c146c6af44422f9c13889984c00f3 + url: "https://pub.dev" + source: hosted + version: "6.1.11" + url_launcher_android: + dependency: "direct main" + description: + name: url_launcher_android + sha256: "3dd2388cc0c42912eee04434531a26a82512b9cb1827e0214430c9bcbddfe025" + url: "https://pub.dev" + source: hosted + version: "6.0.38" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "9af7ea73259886b92199f9e42c116072f05ff9bea2dcb339ab935dfc957392c2" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "1c4fdc0bfea61a70792ce97157e5cc17260f61abbe4f39354513f39ec6fd73b1" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea + url: "https://pub.dev" + source: hosted + version: "2.1.3" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: cc26720eefe98c1b71d85f9dc7ef0cada5132617046369d9dc296b3ecaa5cbb4 + url: "https://pub.dev" + source: hosted + version: "2.0.18" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "7967065dd2b5fccc18c653b97958fdf839c5478c28e767c61ee879f4e7882422" + url: "https://pub.dev" + source: hosted + version: "3.0.7" uuid: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 9ac7efd..f87cecc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -89,6 +89,10 @@ dependencies: file_picker: ^5.3.1 expandable: ^5.0.1 flutter_simple_treeview: ^3.0.2 + syncfusion_flutter_pdfviewer: ^21.2.3 + url_launcher: ^6.1.11 + url_launcher_android: ^6.0.38 + share_plus: ^7.1.0 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 362613e..7af50e4 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -11,6 +11,9 @@ #include #include #include +#include +#include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { AudioplayersWindowsPluginRegisterWithRegistrar( @@ -23,4 +26,10 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("PlatformDeviceIdWindowsPlugin")); RivePluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("RivePlugin")); + SharePlusWindowsPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); + SyncfusionPdfviewerWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("SyncfusionPdfviewerWindowsPlugin")); + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 8c00e3e..6d2ce89 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -8,6 +8,9 @@ list(APPEND FLUTTER_PLUGIN_LIST permission_handler_windows platform_device_id_windows rive_common + share_plus + syncfusion_pdfviewer_windows + url_launcher_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST