Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

252 wiersze
6.6 KiB

  1. import 'dart:convert';
  2. class TodayMeetingModel {
  3. List<Meeting>? meetings;
  4. List<Meeting>? privateMeetings;
  5. String? note;
  6. TodayMeetingModel({
  7. this.meetings,
  8. this.privateMeetings,
  9. this.note,
  10. });
  11. factory TodayMeetingModel.fromRawJson(String str) =>
  12. TodayMeetingModel.fromJson(json.decode(str));
  13. String toRawJson() => json.encode(toJson());
  14. factory TodayMeetingModel.fromJson(Map<String, dynamic> json) =>
  15. TodayMeetingModel(
  16. meetings: json["meetings"] == null
  17. ? []
  18. : List<Meeting>.from(
  19. json["meetings"]!.map((x) => Meeting.fromJson(x))),
  20. privateMeetings: json["private_meetings"] == null
  21. ? []
  22. : List<Meeting>.from(
  23. json["private_meetings"]!.map((x) => Meeting.fromJson(x))),
  24. note: json["note"],
  25. );
  26. Map<String, dynamic> toJson() => {
  27. "meetings": meetings == null
  28. ? []
  29. : List<dynamic>.from(meetings!.map((x) => x.toJson())),
  30. "private_meetings": privateMeetings == null
  31. ? []
  32. : List<dynamic>.from(privateMeetings!.map((x) => x.toJson())),
  33. "note": note,
  34. };
  35. }
  36. class Meeting {
  37. int? id;
  38. int? locationsId;
  39. int? subjectId;
  40. int? managerId;
  41. int? ownerId;
  42. String? azHour;
  43. String? taHour;
  44. dynamic description;
  45. int? status;
  46. int? accepted;
  47. DateTime? dateMeeting;
  48. DateTime? endDate;
  49. DateTime? createdAt;
  50. DateTime? updatedAt;
  51. String? dateJalali;
  52. String? statusTxt;
  53. String? az;
  54. String? ta;
  55. List<dynamic>? minutes;
  56. Location? location;
  57. Subject? subject;
  58. String? visitName;
  59. String? visitMobile;
  60. String? visitRole;
  61. String? visitCompany;
  62. Meeting({
  63. this.id,
  64. this.locationsId,
  65. this.subjectId,
  66. this.managerId,
  67. this.ownerId,
  68. this.azHour,
  69. this.taHour,
  70. this.description,
  71. this.status,
  72. this.accepted,
  73. this.dateMeeting,
  74. this.endDate,
  75. this.createdAt,
  76. this.updatedAt,
  77. this.dateJalali,
  78. this.statusTxt,
  79. this.az,
  80. this.ta,
  81. this.minutes,
  82. this.location,
  83. this.subject,
  84. this.visitName,
  85. this.visitMobile,
  86. this.visitRole,
  87. this.visitCompany,
  88. });
  89. factory Meeting.fromRawJson(String str) => Meeting.fromJson(json.decode(str));
  90. String toRawJson() => json.encode(toJson());
  91. factory Meeting.fromJson(Map<String, dynamic> json) => Meeting(
  92. id: json["id"],
  93. locationsId: json["locations_id"],
  94. subjectId: json["subject_id"],
  95. managerId: json["manager_id"],
  96. ownerId: json["owner_id"],
  97. azHour: json["az_hour"],
  98. taHour: json["ta_hour"],
  99. description: json["description"],
  100. status: json["status"],
  101. accepted: json["accepted"],
  102. dateMeeting: json["date_meeting"] == null
  103. ? null
  104. : DateTime.parse(json["date_meeting"]),
  105. endDate:
  106. json["end_date"] == null ? null : DateTime.parse(json["end_date"]),
  107. createdAt: json["created_at"] == null
  108. ? null
  109. : DateTime.parse(json["created_at"]),
  110. updatedAt: json["updated_at"] == null
  111. ? null
  112. : DateTime.parse(json["updated_at"]),
  113. dateJalali: json["date_jalali"],
  114. statusTxt: json["status_txt"],
  115. az: json["az"],
  116. ta: json["ta"],
  117. minutes: json["minutes"] == null
  118. ? []
  119. : List<dynamic>.from(json["minutes"]!.map((x) => x)),
  120. location: json["location"] == null
  121. ? null
  122. : Location.fromJson(json["location"]),
  123. subject:
  124. json["subject"] == null ? null : Subject.fromJson(json["subject"]),
  125. visitName: json["visit_name"],
  126. visitMobile: json["visit_mobile"],
  127. visitRole: json["visit_role"],
  128. visitCompany: json["visit_company"],
  129. );
  130. Map<String, dynamic> toJson() => {
  131. "id": id,
  132. "locations_id": locationsId,
  133. "subject_id": subjectId,
  134. "manager_id": managerId,
  135. "owner_id": ownerId,
  136. "az_hour": azHour,
  137. "ta_hour": taHour,
  138. "description": description,
  139. "status": status,
  140. "accepted": accepted,
  141. "date_meeting": dateMeeting?.toIso8601String(),
  142. "end_date": endDate?.toIso8601String(),
  143. "created_at": createdAt?.toIso8601String(),
  144. "updated_at": updatedAt?.toIso8601String(),
  145. "date_jalali": dateJalali,
  146. "status_txt": statusTxt,
  147. "az": az,
  148. "ta": ta,
  149. "minutes":
  150. minutes == null ? [] : List<dynamic>.from(minutes!.map((x) => x)),
  151. "location": location?.toJson(),
  152. "subject": subject?.toJson(),
  153. "visit_name": visitName,
  154. "visit_mobile": visitMobile,
  155. "visit_role": visitRole,
  156. "visit_company": visitCompany,
  157. };
  158. }
  159. class Location {
  160. int? id;
  161. String? address;
  162. String? addressEn;
  163. DateTime? createdAt;
  164. DateTime? updatedAt;
  165. Location({
  166. this.id,
  167. this.address,
  168. this.addressEn,
  169. this.createdAt,
  170. this.updatedAt,
  171. });
  172. factory Location.fromRawJson(String str) =>
  173. Location.fromJson(json.decode(str));
  174. String toRawJson() => json.encode(toJson());
  175. factory Location.fromJson(Map<String, dynamic> json) => Location(
  176. id: json["id"],
  177. address: json["address"],
  178. addressEn: json["address_en"],
  179. createdAt: json["created_at"] == null
  180. ? null
  181. : DateTime.parse(json["created_at"]),
  182. updatedAt: json["updated_at"] == null
  183. ? null
  184. : DateTime.parse(json["updated_at"]),
  185. );
  186. Map<String, dynamic> toJson() => {
  187. "id": id,
  188. "address": address,
  189. "address_en": addressEn,
  190. "created_at": createdAt?.toIso8601String(),
  191. "updated_at": updatedAt?.toIso8601String(),
  192. };
  193. }
  194. class Subject {
  195. int? id;
  196. String? subject;
  197. dynamic subjectEn;
  198. DateTime? createdAt;
  199. DateTime? updatedAt;
  200. Subject({
  201. this.id,
  202. this.subject,
  203. this.subjectEn,
  204. this.createdAt,
  205. this.updatedAt,
  206. });
  207. factory Subject.fromRawJson(String str) => Subject.fromJson(json.decode(str));
  208. String toRawJson() => json.encode(toJson());
  209. factory Subject.fromJson(Map<String, dynamic> json) => Subject(
  210. id: json["id"],
  211. subject: json["subject"],
  212. subjectEn: json["subject_en"],
  213. createdAt: json["created_at"] == null
  214. ? null
  215. : DateTime.parse(json["created_at"]),
  216. updatedAt: json["updated_at"] == null
  217. ? null
  218. : DateTime.parse(json["updated_at"]),
  219. );
  220. Map<String, dynamic> toJson() => {
  221. "id": id,
  222. "subject": subject,
  223. "subject_en": subjectEn,
  224. "created_at": createdAt?.toIso8601String(),
  225. "updated_at": updatedAt?.toIso8601String(),
  226. };
  227. }