You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_QLine/lib/models/ticket_model.dart

97 lines
3.1 KiB
Dart

import 'dart:developer';
import 'package:hmg_qline/utilities/date_utils.dart';
import 'package:hmg_qline/utilities/enums.dart';
import 'package:hmg_qline/utilities/extensions.dart';
class TicketDetailsModel {
QTypeEnum? qTypeEnum;
ScreenTypeEnum? screenTypeEnum;
String? connectionID;
TicketData? ticketModel;
TicketDetailsModel({this.qTypeEnum, this.screenTypeEnum, this.connectionID, this.ticketModel});
TicketDetailsModel.fromJson(Map<String, dynamic> json) {
qTypeEnum = json['qType'] != null ? (json['qType'] as int).toQTypeEnum() : null;
screenTypeEnum = json['screenType'] != null ? (json['screenType'] as int).toScreenTypeEnum() : null;
connectionID = json['connectionID'];
ticketModel = json['data'] != null ? TicketData.fromJson(json['data']) : null;
}
}
class TicketData {
int? id;
int? patientID;
int? laBQGroupID;
String? queueNo;
int? counterBatchNo;
int? calledBy;
String? calledOn;
String? servedOn;
String? patientName;
String? mobileNo;
String? patientEmail;
int? preferredLang;
LanguageEnum voiceLanguageEnum = LanguageEnum.english;
String ticketNoText = "Ticket Number";
String postVoiceText = "Please Visit Counter";
int? patientGender;
String? roomNo;
bool? isActive;
int? createdBy;
int? editedBy;
DateTime? editedOn;
DateTime? createdOn;
TicketData({
this.id,
this.patientID,
this.laBQGroupID,
this.queueNo,
this.counterBatchNo,
this.calledBy,
this.calledOn,
this.servedOn,
this.patientName,
this.mobileNo,
this.patientEmail,
this.preferredLang,
this.voiceLanguageEnum = LanguageEnum.english,
this.ticketNoText = "Ticket Number",
this.postVoiceText = "Please Visit Counter",
this.patientGender,
this.roomNo,
this.isActive,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn,
});
TicketData.fromJson(Map<String, dynamic> json) {
id = json['id'];
patientID = json['patientID'];
laBQGroupID = json['laB_QGroupID'];
queueNo = json['queueNo'];
counterBatchNo = json['counterBatchNo'];
calledBy = json['calledBy'];
calledOn = json['calledOn'];
servedOn = json['servedOn'];
patientName = json['patientName'];
mobileNo = json['mobileNo'];
patientEmail = json['patientEmail'];
preferredLang = (json['preferredLang'] != null && json['preferredLang'].trim() != "") ? int.parse(json['preferredLang']) : 1;
voiceLanguageEnum = (json['preferredLang'] != null && json['preferredLang'].trim() != "") ? (int.parse(json['preferredLang'])).toLanguageEnum() : LanguageEnum.english;
ticketNoText = json['ticketNoText'] ?? "Ticket Number";
postVoiceText = json['pleaseVisitCounterText'] ?? "Please Visit Counter";
patientGender = json['patientGender'] ?? 1;
roomNo = json['roomNo'].toString();
isActive = json['isActive'];
createdBy = json['createdBy'];
editedBy = json['editedBy'];
editedOn = json['editedOn'] != null ? (json['editedOn'] as String).toDateTime() : DateTime.now();
createdOn = json['createdOn'] != null ? (json['createdOn'] as String).toDateTime() : DateTime.now();
}
}