From 602230270bc48b15d0635eadcd48e179ca050b85 Mon Sep 17 00:00:00 2001 From: "snehalathad@aissel.com" Date: Tue, 10 Dec 2024 16:00:04 +0530 Subject: [PATCH] session notes added to hive --- lib/model/hive_api_constants.g.dart | 6 ++--- lib/model/sessionnotesmodel.dart | 37 ++++++++++++++++++++++------- lib/model/sessionnotesmodel.g.dart | 22 +++++++++++++++-- lib/view/profileview.dart | 16 ++++++++++--- 4 files changed, 64 insertions(+), 17 deletions(-) diff --git a/lib/model/hive_api_constants.g.dart b/lib/model/hive_api_constants.g.dart index 93fa11e..78f5a4f 100644 --- a/lib/model/hive_api_constants.g.dart +++ b/lib/model/hive_api_constants.g.dart @@ -19,9 +19,9 @@ class HiveApiConstantsAdapter extends TypeAdapter { return HiveApiConstants( functionName: fields[0] as String?, interval: fields[1] as int?, - ) - ..method = fields[2] as String? - ..module = fields[3] as String?; + method: fields[2] as String?, + module: fields[3] as String?, + ); } @override diff --git a/lib/model/sessionnotesmodel.dart b/lib/model/sessionnotesmodel.dart index 7deb4b6..d263169 100644 --- a/lib/model/sessionnotesmodel.dart +++ b/lib/model/sessionnotesmodel.dart @@ -63,15 +63,34 @@ class SessionNotesModel { String? eventname; @HiveField(7) String? hcpname; - SessionNotesModel( - {this.selectedSession, - this.addedBy, - this.addedDate, - this.eventid, - this.hcpid, - this.hcpname, - this.eventname, - this.notes}); + @HiveField(8) + String? kolid; + @HiveField(9) + String? event_attendees_id; + @HiveField(10) + String? kid; + @HiveField(11) + String? filepath; + @HiveField(12) + String? filename; + @HiveField(13) + String? noteId; + SessionNotesModel({ + this.selectedSession, + this.addedBy, + this.addedDate, + this.eventid, + this.hcpid, + this.hcpname, + this.eventname, + this.notes, + this.event_attendees_id, + this.filename, + this.filepath, + this.kid, + this.kolid, + this.noteId, + }); SessionNotesModel.fromJson(Map json) { if (json["session_name"] is String) { diff --git a/lib/model/sessionnotesmodel.g.dart b/lib/model/sessionnotesmodel.g.dart index 9a2b280..6f97c66 100644 --- a/lib/model/sessionnotesmodel.g.dart +++ b/lib/model/sessionnotesmodel.g.dart @@ -25,13 +25,19 @@ class SessionNotesModelAdapter extends TypeAdapter { hcpname: fields[7] as String?, eventname: fields[6] as String?, notes: fields[1] as String?, + event_attendees_id: fields[9] as String?, + filename: fields[12] as String?, + filepath: fields[11] as String?, + kid: fields[10] as String?, + kolid: fields[8] as String?, + noteId: fields[13] as String?, ); } @override void write(BinaryWriter writer, SessionNotesModel obj) { writer - ..writeByte(8) + ..writeByte(14) ..writeByte(0) ..write(obj.selectedSession) ..writeByte(1) @@ -47,7 +53,19 @@ class SessionNotesModelAdapter extends TypeAdapter { ..writeByte(6) ..write(obj.eventname) ..writeByte(7) - ..write(obj.hcpname); + ..write(obj.hcpname) + ..writeByte(8) + ..write(obj.kolid) + ..writeByte(9) + ..write(obj.event_attendees_id) + ..writeByte(10) + ..write(obj.kid) + ..writeByte(11) + ..write(obj.filepath) + ..writeByte(12) + ..write(obj.filename) + ..writeByte(13) + ..write(obj.noteId); } @override diff --git a/lib/view/profileview.dart b/lib/view/profileview.dart index eb80acc..ac2dccc 100644 --- a/lib/view/profileview.dart +++ b/lib/view/profileview.dart @@ -796,12 +796,22 @@ class _HCPProfileScreenState extends State { notes: notesController.text, addedBy: "user", addedDate: CustomDateFormatter().formatDate(), - eventid: widget.eventid, + eventid: sessionsTopicsData!.kolEventsId, hcpid: widget.eventid, + kolid: sessionsTopicsData!.kolId, + event_attendees_id: + sessionsTopicsData!.eventAttendeesId, + kid: eventsdetail.kId, + filepath: attachedFileName != '' + ? attachedFilePath + : "", + filename: attachedFileName != '' + ? attachedFileName + : "", selectedSession: _selectedFruit); - print( - "${notesModel.addedBy},${notesModel.notes},${notesModel.addedDate},${notesModel.eventid},${notesModel.hcpid},${notesModel.selectedSession}"); + await provider.addSessionNotes(notesModel); + _selectedFruit = null; isLoading = false; sessionsTopicsData = null; -- 2.34.1