data.dart 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135
  1. import 'dart:convert';
  2. import 'package:jiffy/jiffy.dart';
  3. class Qualif {
  4. String? tlc;
  5. String? lname;
  6. String? mname;
  7. String? fname;
  8. String? date;
  9. String? ac;
  10. String? college;
  11. String? base;
  12. Qualif({
  13. this.tlc,
  14. this.lname,
  15. this.mname,
  16. this.fname,
  17. this.date,
  18. this.ac,
  19. this.college,
  20. this.base,
  21. });
  22. Qualif copyWith({
  23. String? tlc,
  24. String? lname,
  25. String? mname,
  26. String? fname,
  27. String? date,
  28. String? ac,
  29. String? college,
  30. String? base,
  31. }) {
  32. return Qualif(
  33. tlc: tlc ?? this.tlc,
  34. lname: lname ?? this.lname,
  35. mname: mname ?? this.mname,
  36. fname: fname ?? this.fname,
  37. date: date ?? this.date,
  38. ac: ac ?? this.ac,
  39. college: college ?? this.college,
  40. base: base ?? this.base,
  41. );
  42. }
  43. Map<String, dynamic> toMap() {
  44. return <String, dynamic>{
  45. 'tlc': tlc,
  46. 'lname': lname,
  47. 'mname': mname,
  48. 'fname': fname,
  49. 'date': date,
  50. 'ac': ac,
  51. 'college': college,
  52. 'base': base,
  53. };
  54. }
  55. factory Qualif.fromList(List datalist) {
  56. return Qualif(
  57. tlc: datalist[0],
  58. lname: datalist[1],
  59. mname: datalist[2],
  60. fname: datalist[3],
  61. date: datalist[4],
  62. ac: datalist[5],
  63. college: datalist[6],
  64. base: datalist[7]);
  65. }
  66. factory Qualif.fromMap(Map<String, dynamic> map) {
  67. return Qualif(
  68. tlc: map['tlc'] != null ? map['tlc'] as String : null,
  69. lname: map['lname'] != null ? map['lname'] as String : null,
  70. mname: map['mname'] != null ? map['mname'] as String : null,
  71. fname: map['fname'] != null ? map['fname'] as String : null,
  72. date: map['date'] != null ? map['date'] as String : null,
  73. ac: map['ac'] != null ? map['ac'] as String : null,
  74. college: map['college'] != null ? map['college'] as String : null,
  75. base: map['base'] != null ? map['base'] as String : null,
  76. );
  77. }
  78. String toJson() => json.encode(toMap());
  79. factory Qualif.fromJson(String source) =>
  80. Qualif.fromMap(json.decode(source) as Map<String, dynamic>);
  81. @override
  82. String toString() {
  83. return 'Qualif(tlc: $tlc, lname: $lname, mname: $mname, fname: $fname, date: $date, ac: $ac, college: $college, base: $base)';
  84. }
  85. @override
  86. bool operator ==(covariant Qualif other) {
  87. if (identical(this, other)) return true;
  88. return other.tlc == tlc &&
  89. other.lname == lname &&
  90. other.mname == mname &&
  91. other.fname == fname &&
  92. other.date == date &&
  93. other.ac == ac &&
  94. other.college == college &&
  95. other.base == base;
  96. }
  97. @override
  98. int get hashCode {
  99. return tlc.hashCode ^
  100. lname.hashCode ^
  101. mname.hashCode ^
  102. fname.hashCode ^
  103. date.hashCode ^
  104. ac.hashCode ^
  105. college.hashCode ^
  106. base.hashCode;
  107. }
  108. }
  109. class Pnleg {
  110. String? date;
  111. Jiffy? get jdate => date != null
  112. ? Jiffy.parse(date ?? "01/01/1970", pattern: "dd/MM/yyyy", isUtc: true)
  113. : null;
  114. String? tlc;
  115. String? actype;
  116. String? al;
  117. String? fnum;
  118. String? depdate;
  119. String? deptime;
  120. String? arrdate;
  121. String? arrtime;
  122. String? dep;
  123. String? arr;
  124. String? label;
  125. String? type;
  126. Jiffy? get jdep =>
  127. deptime != null ? "$depdate $deptime".parseddmmyyyyhhmm() : null;
  128. Jiffy? get jarr =>
  129. arrtime != null ? "$arrdate $arrtime".parseddmmyyyyhhmm() : null;
  130. String? get ac {
  131. switch (actype) {
  132. case "32A":
  133. return "320";
  134. case "32L":
  135. return "320";
  136. case "332":
  137. return "330";
  138. default:
  139. return actype;
  140. }
  141. }
  142. String get dutytype {
  143. if (type == "L") {
  144. return "flight";
  145. } else if ((type == "G")) {
  146. return "dhlimo";
  147. } else if ((type == "F") || ((dep ?? "") != "" && (arr ?? "") != "")) {
  148. return "dhflight";
  149. } else if ((label?.startsWith("SBY") ?? false) || (label == "R0")) {
  150. return "standby";
  151. } else if ((!["OFF", "CM", "CA", "PP"].contains(label)) &&
  152. (jarr != null &&
  153. jdep != null &&
  154. DTInterval(jdep!, jarr!).duration.inHours < 18)) {
  155. return "ground";
  156. } else {
  157. return "day";
  158. }
  159. }
  160. Pnleg({
  161. this.date,
  162. this.tlc,
  163. this.actype,
  164. this.al,
  165. this.fnum,
  166. this.depdate,
  167. this.deptime,
  168. this.arrdate,
  169. this.arrtime,
  170. this.dep,
  171. this.arr,
  172. this.label,
  173. this.type,
  174. });
  175. Pnleg copyWith({
  176. String? date,
  177. String? tlc,
  178. String? actype,
  179. String? al,
  180. String? fnum,
  181. String? depdate,
  182. String? deptime,
  183. String? arrdate,
  184. String? arrtime,
  185. String? dep,
  186. String? arr,
  187. String? label,
  188. String? type,
  189. }) {
  190. return Pnleg(
  191. date: date ?? this.date,
  192. tlc: tlc ?? this.tlc,
  193. actype: actype ?? this.actype,
  194. al: al ?? this.al,
  195. fnum: fnum ?? this.fnum,
  196. depdate: depdate ?? this.depdate,
  197. deptime: deptime ?? this.deptime,
  198. arrdate: arrdate ?? this.arrdate,
  199. arrtime: arrtime ?? this.arrtime,
  200. dep: dep ?? this.dep,
  201. arr: arr ?? this.arr,
  202. label: label ?? this.label,
  203. type: type ?? this.type,
  204. );
  205. }
  206. Map<String, dynamic> toMap() {
  207. return <String, dynamic>{
  208. 'date': date,
  209. 'tlc': tlc,
  210. 'actype': actype,
  211. 'al': al,
  212. 'fnum': fnum,
  213. 'depdate': depdate,
  214. 'deptime': deptime,
  215. 'arrdate': arrdate,
  216. 'arrtime': arrtime,
  217. 'dep': dep,
  218. 'arr': arr,
  219. 'label': label,
  220. 'type': type,
  221. };
  222. }
  223. factory Pnleg.fromList(List datalist) {
  224. return Pnleg(
  225. date: datalist[0],
  226. tlc: datalist[1],
  227. actype: datalist[2],
  228. al: datalist[3],
  229. fnum: datalist[4],
  230. depdate: datalist[5],
  231. deptime: datalist[6],
  232. arrdate: datalist[7],
  233. arrtime: datalist[8],
  234. dep: datalist[9],
  235. arr: datalist[10],
  236. label: datalist[11],
  237. type: datalist[12]);
  238. }
  239. factory Pnleg.fromMap(Map<String, dynamic> map) {
  240. return Pnleg(
  241. date: map['date'] != null ? map['date'] as String : null,
  242. tlc: map['tlc'] != null ? map['tlc'] as String : null,
  243. actype: map['actype'] != null ? map['actype'] as String : null,
  244. al: map['al'] != null ? map['al'] as String : null,
  245. fnum: map['fnum'] != null ? map['fnum'] as String : null,
  246. depdate: map['depdate'] != null ? map['depdate'] as String : null,
  247. deptime: map['deptime'] != null ? map['deptime'] as String : null,
  248. arrdate: map['arrdate'] != null ? map['arrdate'] as String : null,
  249. arrtime: map['arrtime'] != null ? map['arrtime'] as String : null,
  250. dep: map['dep'] != null ? map['dep'] as String : null,
  251. arr: map['arr'] != null ? map['arr'] as String : null,
  252. label: map['label'] != null ? map['label'] as String : null,
  253. type: map['type'] != null ? map['type'] as String : null,
  254. );
  255. }
  256. String toJson() => json.encode(toMap());
  257. factory Pnleg.fromJson(String source) =>
  258. Pnleg.fromMap(json.decode(source) as Map<String, dynamic>);
  259. @override
  260. String toString() {
  261. return 'Pnleg(date: $date, tlc: $tlc, actype: $actype, al: $al, fnum: $fnum, depdate: $depdate, deptime: $deptime, arrdate: $arrdate, arrtime: $arrtime, dep: $dep, arr: $arr, label: $label, type: $type)';
  262. }
  263. @override
  264. bool operator ==(covariant Pnleg other) {
  265. if (identical(this, other)) return true;
  266. return other.date == date &&
  267. other.tlc == tlc &&
  268. other.actype == actype &&
  269. other.al == al &&
  270. other.fnum == fnum &&
  271. other.depdate == depdate &&
  272. other.deptime == deptime &&
  273. other.arrdate == arrdate &&
  274. other.arrtime == arrtime &&
  275. other.dep == dep &&
  276. other.arr == arr &&
  277. other.label == label &&
  278. other.type == type;
  279. }
  280. @override
  281. int get hashCode {
  282. return date.hashCode ^
  283. tlc.hashCode ^
  284. actype.hashCode ^
  285. al.hashCode ^
  286. fnum.hashCode ^
  287. depdate.hashCode ^
  288. deptime.hashCode ^
  289. arrdate.hashCode ^
  290. arrtime.hashCode ^
  291. dep.hashCode ^
  292. arr.hashCode ^
  293. label.hashCode ^
  294. type.hashCode;
  295. }
  296. }
  297. //enum flt_status { sched, delayed, taxiout, enroute, landed, arrived }
  298. int convertTimeToMinutes(String strx) {
  299. String str = strx.trim();
  300. if (str.length < 5) {
  301. str = str.padLeft(5, "0");
  302. }
  303. try {
  304. final hours = int.parse(str.substring(0, str.length - 2));
  305. final minutes = int.parse(str.substring(str.length - 2));
  306. if (minutes >= 60) {
  307. throw FormatException('Minutes must be less than 60');
  308. }
  309. return hours * 60 + minutes;
  310. } catch (e) {
  311. print("data: converttimetominutes: $str");
  312. throw FormatException('Invalid time format. Expected hhhmm');
  313. }
  314. }
  315. class Acleg {
  316. String? LEG_NO;
  317. String? FN_CARRIER;
  318. String? FN_NUMBER;
  319. String? FN_SUFFIX;
  320. String? DAY_OF_ORIGIN;
  321. String? AC_OWNER;
  322. String? AC_SUBTYPE;
  323. String? AC_VERSION;
  324. String? AC_REGISTRATION;
  325. String? DEP_AP_ACTUAL;
  326. String? DEP_AP_SCHED;
  327. String? DEP_DT_EST;
  328. Jiffy? get jdepest =>
  329. (DEP_DT_EST == null) ? null : DEP_DT_EST!.parseyyyymmddhhmm();
  330. String? DEP_SCHED_DT;
  331. Jiffy? get jdepsched =>
  332. (DEP_SCHED_DT == null) ? null : DEP_SCHED_DT!.parseyyyymmddhhmm();
  333. String? ARR_AP_ACTUAL;
  334. String? ARR_AP_SCHED;
  335. String? ARR_DT_EST;
  336. Jiffy? get jarrest =>
  337. (ARR_DT_EST == null) ? null : ARR_DT_EST!.parseyyyymmddhhmm();
  338. String? ARR_SCHED_DT;
  339. Jiffy? get jarrsched =>
  340. (ARR_SCHED_DT == null) ? null : ARR_SCHED_DT!.parseyyyymmddhhmm();
  341. String? SLOT_TIME_ACTUAL;
  342. Jiffy? get slot =>
  343. (SLOT_TIME_ACTUAL == null) ? null : SLOT_TIME_ACTUAL!.parseyyyymmddhhmm();
  344. String? LEG_TYPE;
  345. String? STATUS;
  346. String? EMPLOYER_COCKPIT;
  347. String? EMPLOYER_CABIN;
  348. String? CYCLES;
  349. String? DELAY_CODE_01;
  350. String? DELAY_CODE_02;
  351. String? DELAY_CODE_03;
  352. String? DELAY_CODE_04;
  353. String? DELAY_TIME_01;
  354. String? DELAY_TIME_02;
  355. String? DELAY_TIME_03;
  356. String? DELAY_TIME_04;
  357. String? SUBDELAY_CODE_01;
  358. String? SUBDELAY_CODE_02;
  359. String? SUBDELAY_CODE_03;
  360. String? SUBDELAY_CODE_04;
  361. List<List> get dla => [
  362. [
  363. SUBDELAY_CODE_01 ?? DELAY_CODE_01,
  364. DELAY_TIME_01 == null
  365. ? null
  366. : Duration(minutes: convertTimeToMinutes(DELAY_TIME_01!))
  367. ],
  368. [
  369. SUBDELAY_CODE_02 ?? DELAY_CODE_02,
  370. DELAY_TIME_02 == null
  371. ? null
  372. : Duration(minutes: convertTimeToMinutes(DELAY_TIME_02!))
  373. ],
  374. [
  375. SUBDELAY_CODE_03 ?? DELAY_CODE_03,
  376. DELAY_TIME_03 == null
  377. ? null
  378. : Duration(minutes: convertTimeToMinutes(DELAY_TIME_03!))
  379. ],
  380. [
  381. SUBDELAY_CODE_04 ?? DELAY_CODE_04,
  382. DELAY_TIME_04 == null
  383. ? null
  384. : Duration(minutes: convertTimeToMinutes(DELAY_TIME_04!))
  385. ],
  386. ].where((e) => e.every((f) => f != null)).toList();
  387. List<String> get delaycode => [
  388. DELAY_CODE_01,
  389. DELAY_CODE_02,
  390. DELAY_CODE_03,
  391. DELAY_CODE_04
  392. ].nonNulls.toList();
  393. List<String> get delaysubcode => [
  394. SUBDELAY_CODE_01,
  395. SUBDELAY_CODE_02,
  396. SUBDELAY_CODE_03,
  397. SUBDELAY_CODE_04
  398. ].nonNulls.toList();
  399. List<Duration?> get delaytime => [
  400. DELAY_TIME_01 == null
  401. ? null
  402. : Duration(minutes: int.parse(DELAY_TIME_01!)),
  403. DELAY_TIME_02 == null
  404. ? null
  405. : Duration(minutes: int.parse(DELAY_TIME_02!)),
  406. DELAY_TIME_03 == null
  407. ? null
  408. : Duration(minutes: int.parse(DELAY_TIME_03!)),
  409. DELAY_TIME_04 == null
  410. ? null
  411. : Duration(minutes: int.parse(DELAY_TIME_04!))
  412. ].nonNulls.toList();
  413. String? PAX_BOOKED_C;
  414. String? PAX_BOOKED_Y;
  415. String? get pax_booked => (PAX_BOOKED_C != null || PAX_BOOKED_Y != null)
  416. ? "${(AC_VERSION != null && AC_VERSION!.contains("C")) ? "C${PAX_BOOKED_C ?? 0}." : ""}Y${PAX_BOOKED_Y ?? 0}"
  417. : null;
  418. String? PAX_BOOKED_TRS_C;
  419. String? PAX_BOOKED_TRS_Y;
  420. String? get pax_trs => (PAX_BOOKED_TRS_C != null || PAX_BOOKED_TRS_Y != null)
  421. ? "C${PAX_BOOKED_TRS_C ?? 0}/Y${PAX_BOOKED_TRS_Y ?? 0}"
  422. : null;
  423. String? PAD_BOOKED_C;
  424. String? PAD_BOOKED_Y;
  425. String? get pad_booked => (PAD_BOOKED_C != null || PAD_BOOKED_Y != null)
  426. ? "C${PAD_BOOKED_C ?? 0}/Y${PAD_BOOKED_Y ?? 0}"
  427. : null;
  428. String? OFFBLOCK_DT_A;
  429. String? AIRBORNE_DT_A;
  430. String? LANDING_DT_A;
  431. String? ONBLOCK_DT_A;
  432. List<Jiffy?> get blocks_a => [
  433. (OFFBLOCK_DT_A ?? "").parseyyyymmddhhmm(),
  434. (AIRBORNE_DT_A ?? "").parseyyyymmddhhmm(),
  435. (LANDING_DT_A ?? "").parseyyyymmddhhmm(),
  436. (ONBLOCK_DT_A ?? "").parseyyyymmddhhmm()
  437. ];
  438. String get flt_status {
  439. if (blocks[3] != null) {
  440. return "Arrived";
  441. } else if (blocks[2] != null) {
  442. return "Landed";
  443. } else if (blocks[1] != null) {
  444. return "Inflight";
  445. } else if (blocks[0] != null) {
  446. return "Taxiout";
  447. } else if (jdepest != null &&
  448. jarrsched != null &&
  449. jdepest!.isAfter(jdepsched!)) {
  450. return "Delayed";
  451. } else {
  452. return "Sched";
  453. }
  454. }
  455. String? OFFBLOCK_DT_F;
  456. String? AIRBORNE_DT_F;
  457. String? LANDING_DT_F;
  458. String? ONBLOCK_DT_F;
  459. List<Jiffy?> get blocks_f => [
  460. (OFFBLOCK_DT_F ?? "").parseyyyymmddhhmm(),
  461. (AIRBORNE_DT_F ?? "").parseyyyymmddhhmm(),
  462. (LANDING_DT_F ?? "").parseyyyymmddhhmm(),
  463. (ONBLOCK_DT_F ?? "").parseyyyymmddhhmm()
  464. ];
  465. String? OFFBLOCK_DT_M;
  466. String? AIRBORNE_DT_M;
  467. String? LANDING_DT_M;
  468. String? ONBLOCK_DT_M;
  469. List<Jiffy?> get blocks_m => [
  470. (OFFBLOCK_DT_M ?? "").parseyyyymmddhhmm(),
  471. (AIRBORNE_DT_M ?? "").parseyyyymmddhhmm(),
  472. (LANDING_DT_M ?? "").parseyyyymmddhhmm(),
  473. (ONBLOCK_DT_M ?? "").parseyyyymmddhhmm()
  474. ];
  475. List<Jiffy?> get blocks => [
  476. blocks_m[0] ?? blocks_a[0] ?? blocks_f[0],
  477. blocks_m[1] ?? blocks_a[1] ?? blocks_f[1],
  478. blocks_m[2] ?? blocks_a[2] ?? blocks_f[2],
  479. blocks_m[3] ?? blocks_a[3] ?? blocks_f[3]
  480. ];
  481. Jiffy? get jdep => blocks[0] ?? jdepest ?? jdepsched;
  482. Jiffy? get jarr =>
  483. blocks[3] ??
  484. blocks[2]?.add(minutes: 5) ??
  485. (eet == null ? null : blocks[1]?.addDuration(eet!).add(minutes: 8)) ??
  486. (eet == null
  487. ? null
  488. : blocks[0]?.add(minutes: 5).addDuration(eet!).add(minutes: 8)) ??
  489. (eet == null
  490. ? null
  491. : jdep?.addDuration(eet!).add(minutes: 8).add(minutes: 5)) ??
  492. jarrest ??
  493. jarrsched;
  494. String? EET;
  495. Duration? get eet => EET == null ? null : Duration(minutes: int.parse(EET!));
  496. Acleg({
  497. this.LEG_NO,
  498. this.FN_CARRIER,
  499. this.FN_NUMBER,
  500. this.FN_SUFFIX,
  501. this.DAY_OF_ORIGIN,
  502. this.AC_OWNER,
  503. this.AC_SUBTYPE,
  504. this.AC_VERSION,
  505. this.AC_REGISTRATION,
  506. this.DEP_AP_ACTUAL,
  507. this.DEP_AP_SCHED,
  508. this.DEP_DT_EST,
  509. this.DEP_SCHED_DT,
  510. this.ARR_AP_ACTUAL,
  511. this.ARR_AP_SCHED,
  512. this.ARR_DT_EST,
  513. this.ARR_SCHED_DT,
  514. this.SLOT_TIME_ACTUAL,
  515. this.LEG_TYPE,
  516. this.STATUS,
  517. this.EMPLOYER_COCKPIT,
  518. this.EMPLOYER_CABIN,
  519. this.CYCLES,
  520. this.DELAY_CODE_01,
  521. this.DELAY_CODE_02,
  522. this.DELAY_CODE_03,
  523. this.DELAY_CODE_04,
  524. this.DELAY_TIME_01,
  525. this.DELAY_TIME_02,
  526. this.DELAY_TIME_03,
  527. this.DELAY_TIME_04,
  528. this.SUBDELAY_CODE_01,
  529. this.SUBDELAY_CODE_02,
  530. this.SUBDELAY_CODE_03,
  531. this.SUBDELAY_CODE_04,
  532. this.PAX_BOOKED_C,
  533. this.PAX_BOOKED_Y,
  534. this.PAX_BOOKED_TRS_C,
  535. this.PAX_BOOKED_TRS_Y,
  536. this.PAD_BOOKED_C,
  537. this.PAD_BOOKED_Y,
  538. this.OFFBLOCK_DT_A,
  539. this.AIRBORNE_DT_A,
  540. this.LANDING_DT_A,
  541. this.ONBLOCK_DT_A,
  542. this.OFFBLOCK_DT_F,
  543. this.AIRBORNE_DT_F,
  544. this.LANDING_DT_F,
  545. this.ONBLOCK_DT_F,
  546. this.OFFBLOCK_DT_M,
  547. this.AIRBORNE_DT_M,
  548. this.LANDING_DT_M,
  549. this.ONBLOCK_DT_M,
  550. this.EET,
  551. });
  552. Acleg copyWith({
  553. String? LEG_NO,
  554. String? FN_CARRIER,
  555. String? FN_NUMBER,
  556. String? FN_SUFFIX,
  557. String? DAY_OF_ORIGIN,
  558. String? AC_OWNER,
  559. String? AC_SUBTYPE,
  560. String? AC_VERSION,
  561. String? AC_REGISTRATION,
  562. String? DEP_AP_ACTUAL,
  563. String? DEP_AP_SCHED,
  564. String? DEP_DT_EST,
  565. String? DEP_SCHED_DT,
  566. String? ARR_AP_ACTUAL,
  567. String? ARR_AP_SCHED,
  568. String? ARR_DT_EST,
  569. String? ARR_SCHED_DT,
  570. String? SLOT_TIME_ACTUAL,
  571. String? LEG_TYPE,
  572. String? STATUS,
  573. String? EMPLOYER_COCKPIT,
  574. String? EMPLOYER_CABIN,
  575. String? CYCLES,
  576. String? DELAY_CODE_01,
  577. String? DELAY_CODE_02,
  578. String? DELAY_CODE_03,
  579. String? DELAY_CODE_04,
  580. String? DELAY_TIME_01,
  581. String? DELAY_TIME_02,
  582. String? DELAY_TIME_03,
  583. String? DELAY_TIME_04,
  584. String? SUBDELAY_CODE_01,
  585. String? SUBDELAY_CODE_02,
  586. String? SUBDELAY_CODE_03,
  587. String? SUBDELAY_CODE_04,
  588. String? PAX_BOOKED_C,
  589. String? PAX_BOOKED_Y,
  590. String? PAX_BOOKED_TRS_C,
  591. String? PAX_BOOKED_TRS_Y,
  592. String? PAD_BOOKED_C,
  593. String? PAD_BOOKED_Y,
  594. String? OFFBLOCK_DT_A,
  595. String? AIRBORNE_DT_A,
  596. String? LANDING_DT_A,
  597. String? ONBLOCK_DT_A,
  598. String? OFFBLOCK_DT_F,
  599. String? AIRBORNE_DT_F,
  600. String? LANDING_DT_F,
  601. String? ONBLOCK_DT_F,
  602. String? OFFBLOCK_DT_M,
  603. String? AIRBORNE_DT_M,
  604. String? LANDING_DT_M,
  605. String? ONBLOCK_DT_M,
  606. String? EET,
  607. }) {
  608. return Acleg(
  609. LEG_NO: LEG_NO ?? this.LEG_NO,
  610. FN_CARRIER: FN_CARRIER ?? this.FN_CARRIER,
  611. FN_NUMBER: FN_NUMBER ?? this.FN_NUMBER,
  612. FN_SUFFIX: FN_SUFFIX ?? this.FN_SUFFIX,
  613. DAY_OF_ORIGIN: DAY_OF_ORIGIN ?? this.DAY_OF_ORIGIN,
  614. AC_OWNER: AC_OWNER ?? this.AC_OWNER,
  615. AC_SUBTYPE: AC_SUBTYPE ?? this.AC_SUBTYPE,
  616. AC_VERSION: AC_VERSION ?? this.AC_VERSION,
  617. AC_REGISTRATION: AC_REGISTRATION ?? this.AC_REGISTRATION,
  618. DEP_AP_ACTUAL: DEP_AP_ACTUAL ?? this.DEP_AP_ACTUAL,
  619. DEP_AP_SCHED: DEP_AP_SCHED ?? this.DEP_AP_SCHED,
  620. DEP_DT_EST: DEP_DT_EST ?? this.DEP_DT_EST,
  621. DEP_SCHED_DT: DEP_SCHED_DT ?? this.DEP_SCHED_DT,
  622. ARR_AP_ACTUAL: ARR_AP_ACTUAL ?? this.ARR_AP_ACTUAL,
  623. ARR_AP_SCHED: ARR_AP_SCHED ?? this.ARR_AP_SCHED,
  624. ARR_DT_EST: ARR_DT_EST ?? this.ARR_DT_EST,
  625. ARR_SCHED_DT: ARR_SCHED_DT ?? this.ARR_SCHED_DT,
  626. SLOT_TIME_ACTUAL: SLOT_TIME_ACTUAL ?? this.SLOT_TIME_ACTUAL,
  627. LEG_TYPE: LEG_TYPE ?? this.LEG_TYPE,
  628. STATUS: STATUS ?? this.STATUS,
  629. EMPLOYER_COCKPIT: EMPLOYER_COCKPIT ?? this.EMPLOYER_COCKPIT,
  630. EMPLOYER_CABIN: EMPLOYER_CABIN ?? this.EMPLOYER_CABIN,
  631. CYCLES: CYCLES ?? this.CYCLES,
  632. DELAY_CODE_01: DELAY_CODE_01 ?? this.DELAY_CODE_01,
  633. DELAY_CODE_02: DELAY_CODE_02 ?? this.DELAY_CODE_02,
  634. DELAY_CODE_03: DELAY_CODE_03 ?? this.DELAY_CODE_03,
  635. DELAY_CODE_04: DELAY_CODE_04 ?? this.DELAY_CODE_04,
  636. DELAY_TIME_01: DELAY_TIME_01 ?? this.DELAY_TIME_01,
  637. DELAY_TIME_02: DELAY_TIME_02 ?? this.DELAY_TIME_02,
  638. DELAY_TIME_03: DELAY_TIME_03 ?? this.DELAY_TIME_03,
  639. DELAY_TIME_04: DELAY_TIME_04 ?? this.DELAY_TIME_04,
  640. SUBDELAY_CODE_01: SUBDELAY_CODE_01 ?? this.SUBDELAY_CODE_01,
  641. SUBDELAY_CODE_02: SUBDELAY_CODE_02 ?? this.SUBDELAY_CODE_02,
  642. SUBDELAY_CODE_03: SUBDELAY_CODE_03 ?? this.SUBDELAY_CODE_03,
  643. SUBDELAY_CODE_04: SUBDELAY_CODE_04 ?? this.SUBDELAY_CODE_04,
  644. PAX_BOOKED_C: PAX_BOOKED_C ?? this.PAX_BOOKED_C,
  645. PAX_BOOKED_Y: PAX_BOOKED_Y ?? this.PAX_BOOKED_Y,
  646. PAX_BOOKED_TRS_C: PAX_BOOKED_TRS_C ?? this.PAX_BOOKED_TRS_C,
  647. PAX_BOOKED_TRS_Y: PAX_BOOKED_TRS_Y ?? this.PAX_BOOKED_TRS_Y,
  648. PAD_BOOKED_C: PAD_BOOKED_C ?? this.PAD_BOOKED_C,
  649. PAD_BOOKED_Y: PAD_BOOKED_Y ?? this.PAD_BOOKED_Y,
  650. OFFBLOCK_DT_A: OFFBLOCK_DT_A ?? this.OFFBLOCK_DT_A,
  651. AIRBORNE_DT_A: AIRBORNE_DT_A ?? this.AIRBORNE_DT_A,
  652. LANDING_DT_A: LANDING_DT_A ?? this.LANDING_DT_A,
  653. ONBLOCK_DT_A: ONBLOCK_DT_A ?? this.ONBLOCK_DT_A,
  654. OFFBLOCK_DT_F: OFFBLOCK_DT_F ?? this.OFFBLOCK_DT_F,
  655. AIRBORNE_DT_F: AIRBORNE_DT_F ?? this.AIRBORNE_DT_F,
  656. LANDING_DT_F: LANDING_DT_F ?? this.LANDING_DT_F,
  657. ONBLOCK_DT_F: ONBLOCK_DT_F ?? this.ONBLOCK_DT_F,
  658. OFFBLOCK_DT_M: OFFBLOCK_DT_M ?? this.OFFBLOCK_DT_M,
  659. AIRBORNE_DT_M: AIRBORNE_DT_M ?? this.AIRBORNE_DT_M,
  660. LANDING_DT_M: LANDING_DT_M ?? this.LANDING_DT_M,
  661. ONBLOCK_DT_M: ONBLOCK_DT_M ?? this.ONBLOCK_DT_M,
  662. EET: EET ?? this.EET,
  663. );
  664. }
  665. Map<String, dynamic> toMap() {
  666. return <String, dynamic>{
  667. 'LEG_NO': LEG_NO,
  668. 'FN_CARRIER': FN_CARRIER,
  669. 'FN_NUMBER': FN_NUMBER,
  670. 'FN_SUFFIX': FN_SUFFIX,
  671. 'DAY_OF_ORIGIN': DAY_OF_ORIGIN,
  672. 'AC_OWNER': AC_OWNER,
  673. 'AC_SUBTYPE': AC_SUBTYPE,
  674. 'AC_VERSION': AC_VERSION,
  675. 'AC_REGISTRATION': AC_REGISTRATION,
  676. 'DEP_AP_ACTUAL': DEP_AP_ACTUAL,
  677. 'DEP_AP_SCHED': DEP_AP_SCHED,
  678. 'DEP_DT_EST': DEP_DT_EST,
  679. 'DEP_SCHED_DT': DEP_SCHED_DT,
  680. 'ARR_AP_ACTUAL': ARR_AP_ACTUAL,
  681. 'ARR_AP_SCHED': ARR_AP_SCHED,
  682. 'ARR_DT_EST': ARR_DT_EST,
  683. 'ARR_SCHED_DT': ARR_SCHED_DT,
  684. 'SLOT_TIME_ACTUAL': SLOT_TIME_ACTUAL,
  685. 'LEG_TYPE': LEG_TYPE,
  686. 'STATUS': STATUS,
  687. 'EMPLOYER_COCKPIT': EMPLOYER_COCKPIT,
  688. 'EMPLOYER_CABIN': EMPLOYER_CABIN,
  689. 'CYCLES': CYCLES,
  690. 'DELAY_CODE_01': DELAY_CODE_01,
  691. 'DELAY_CODE_02': DELAY_CODE_02,
  692. 'DELAY_CODE_03': DELAY_CODE_03,
  693. 'DELAY_CODE_04': DELAY_CODE_04,
  694. 'DELAY_TIME_01': DELAY_TIME_01,
  695. 'DELAY_TIME_02': DELAY_TIME_02,
  696. 'DELAY_TIME_03': DELAY_TIME_03,
  697. 'DELAY_TIME_04': DELAY_TIME_04,
  698. 'SUBDELAY_CODE_01': SUBDELAY_CODE_01,
  699. 'SUBDELAY_CODE_02': SUBDELAY_CODE_02,
  700. 'SUBDELAY_CODE_03': SUBDELAY_CODE_03,
  701. 'SUBDELAY_CODE_04': SUBDELAY_CODE_04,
  702. 'PAX_BOOKED_C': PAX_BOOKED_C,
  703. 'PAX_BOOKED_Y': PAX_BOOKED_Y,
  704. 'PAX_BOOKED_TRS_C': PAX_BOOKED_TRS_C,
  705. 'PAX_BOOKED_TRS_Y': PAX_BOOKED_TRS_Y,
  706. 'PAD_BOOKED_C': PAD_BOOKED_C,
  707. 'PAD_BOOKED_Y': PAD_BOOKED_Y,
  708. 'OFFBLOCK_DT_A': OFFBLOCK_DT_A,
  709. 'AIRBORNE_DT_A': AIRBORNE_DT_A,
  710. 'LANDING_DT_A': LANDING_DT_A,
  711. 'ONBLOCK_DT_A': ONBLOCK_DT_A,
  712. 'OFFBLOCK_DT_F': OFFBLOCK_DT_F,
  713. 'AIRBORNE_DT_F': AIRBORNE_DT_F,
  714. 'LANDING_DT_F': LANDING_DT_F,
  715. 'ONBLOCK_DT_F': ONBLOCK_DT_F,
  716. 'OFFBLOCK_DT_M': OFFBLOCK_DT_M,
  717. 'AIRBORNE_DT_M': AIRBORNE_DT_M,
  718. 'LANDING_DT_M': LANDING_DT_M,
  719. 'ONBLOCK_DT_M': ONBLOCK_DT_M,
  720. 'EET': EET,
  721. };
  722. }
  723. factory Acleg.fromList(List datalist) {
  724. //print(datalist);
  725. if (datalist.length >= 54) {
  726. return Acleg(
  727. LEG_NO: datalist[0],
  728. FN_CARRIER: datalist[1],
  729. FN_NUMBER: datalist[2],
  730. FN_SUFFIX: datalist[3],
  731. DAY_OF_ORIGIN: datalist[4],
  732. AC_OWNER: datalist[5],
  733. AC_SUBTYPE: datalist[6],
  734. AC_VERSION: datalist[7],
  735. AC_REGISTRATION: datalist[8],
  736. DEP_AP_ACTUAL: datalist[9],
  737. DEP_AP_SCHED: datalist[10],
  738. DEP_DT_EST: datalist[11],
  739. DEP_SCHED_DT: datalist[12],
  740. ARR_AP_ACTUAL: datalist[13],
  741. ARR_AP_SCHED: datalist[14],
  742. ARR_DT_EST: datalist[15],
  743. ARR_SCHED_DT: datalist[16],
  744. SLOT_TIME_ACTUAL: datalist[17],
  745. LEG_TYPE: datalist[18],
  746. STATUS: datalist[19],
  747. EMPLOYER_COCKPIT: datalist[20],
  748. EMPLOYER_CABIN: datalist[21],
  749. CYCLES: datalist[22],
  750. DELAY_CODE_01: datalist[23],
  751. DELAY_CODE_02: datalist[24],
  752. DELAY_CODE_03: datalist[25],
  753. DELAY_CODE_04: datalist[26],
  754. DELAY_TIME_01: datalist[27],
  755. DELAY_TIME_02: datalist[28],
  756. DELAY_TIME_03: datalist[29],
  757. DELAY_TIME_04: datalist[30],
  758. SUBDELAY_CODE_01: datalist[31],
  759. SUBDELAY_CODE_02: datalist[32],
  760. SUBDELAY_CODE_03: datalist[33],
  761. SUBDELAY_CODE_04: datalist[34],
  762. PAX_BOOKED_C: datalist[35],
  763. PAX_BOOKED_Y: datalist[36],
  764. PAX_BOOKED_TRS_C: datalist[37],
  765. PAX_BOOKED_TRS_Y: datalist[38],
  766. PAD_BOOKED_C: datalist[39],
  767. PAD_BOOKED_Y: datalist[40],
  768. OFFBLOCK_DT_A: datalist[41],
  769. AIRBORNE_DT_A: datalist[42],
  770. LANDING_DT_A: datalist[43],
  771. ONBLOCK_DT_A: datalist[44],
  772. OFFBLOCK_DT_F: datalist[45],
  773. AIRBORNE_DT_F: datalist[46],
  774. LANDING_DT_F: datalist[47],
  775. ONBLOCK_DT_F: datalist[48],
  776. OFFBLOCK_DT_M: datalist[49],
  777. AIRBORNE_DT_M: datalist[50],
  778. LANDING_DT_M: datalist[51],
  779. ONBLOCK_DT_M: datalist[52],
  780. EET: datalist[53]);
  781. } else {
  782. return Acleg();
  783. }
  784. }
  785. factory Acleg.fromMap(Map<String, dynamic> map) {
  786. return Acleg(
  787. LEG_NO: map['LEG_NO'] != null ? map['LEG_NO'] as String : null,
  788. FN_CARRIER:
  789. map['FN_CARRIER'] != null ? map['FN_CARRIER'] as String : null,
  790. FN_NUMBER: map['FN_NUMBER'] != null ? map['FN_NUMBER'] as String : null,
  791. FN_SUFFIX: map['FN_SUFFIX'] != null ? map['FN_SUFFIX'] as String : null,
  792. DAY_OF_ORIGIN:
  793. map['DAY_OF_ORIGIN'] != null ? map['DAY_OF_ORIGIN'] as String : null,
  794. AC_OWNER: map['AC_OWNER'] != null ? map['AC_OWNER'] as String : null,
  795. AC_SUBTYPE:
  796. map['AC_SUBTYPE'] != null ? map['AC_SUBTYPE'] as String : null,
  797. AC_VERSION:
  798. map['AC_VERSION'] != null ? map['AC_VERSION'] as String : null,
  799. AC_REGISTRATION: map['AC_REGISTRATION'] != null
  800. ? map['AC_REGISTRATION'] as String
  801. : null,
  802. DEP_AP_ACTUAL:
  803. map['DEP_AP_ACTUAL'] != null ? map['DEP_AP_ACTUAL'] as String : null,
  804. DEP_AP_SCHED:
  805. map['DEP_AP_SCHED'] != null ? map['DEP_AP_SCHED'] as String : null,
  806. DEP_DT_EST:
  807. map['DEP_DT_EST'] != null ? map['DEP_DT_EST'] as String : null,
  808. DEP_SCHED_DT:
  809. map['DEP_SCHED_DT'] != null ? map['DEP_SCHED_DT'] as String : null,
  810. ARR_AP_ACTUAL:
  811. map['ARR_AP_ACTUAL'] != null ? map['ARR_AP_ACTUAL'] as String : null,
  812. ARR_AP_SCHED:
  813. map['ARR_AP_SCHED'] != null ? map['ARR_AP_SCHED'] as String : null,
  814. ARR_DT_EST:
  815. map['ARR_DT_EST'] != null ? map['ARR_DT_EST'] as String : null,
  816. ARR_SCHED_DT:
  817. map['ARR_SCHED_DT'] != null ? map['ARR_SCHED_DT'] as String : null,
  818. SLOT_TIME_ACTUAL: map['SLOT_TIME_ACTUAL'] != null
  819. ? map['SLOT_TIME_ACTUAL'] as String
  820. : null,
  821. LEG_TYPE: map['LEG_TYPE'] != null ? map['LEG_TYPE'] as String : null,
  822. EMPLOYER_COCKPIT: map['EMPLOYER_COCKPIT'] != null
  823. ? map['EMPLOYER_COCKPIT'] as String
  824. : null,
  825. EMPLOYER_CABIN: map['EMPLOYER_CABIN'] != null
  826. ? map['EMPLOYER_CABIN'] as String
  827. : null,
  828. // CYCLES: map['CYCLES'] != null ? map['CYCLES'] as String : null,
  829. DELAY_CODE_01:
  830. map['DELAY_CODE_01'] != null ? map['DELAY_CODE_01'] as String : null,
  831. DELAY_CODE_02:
  832. map['DELAY_CODE_02'] != null ? map['DELAY_CODE_02'] as String : null,
  833. DELAY_CODE_03:
  834. map['DELAY_CODE_03'] != null ? map['DELAY_CODE_03'] as String : null,
  835. DELAY_CODE_04:
  836. map['DELAY_CODE_04'] != null ? map['DELAY_CODE_04'] as String : null,
  837. DELAY_TIME_01:
  838. map['DELAY_TIME_01'] != null ? map['DELAY_TIME_01'] as String : null,
  839. DELAY_TIME_02:
  840. map['DELAY_TIME_02'] != null ? map['DELAY_TIME_02'] as String : null,
  841. DELAY_TIME_03:
  842. map['DELAY_TIME_03'] != null ? map['DELAY_TIME_03'] as String : null,
  843. DELAY_TIME_04:
  844. map['DELAY_TIME_04'] != null ? map['DELAY_TIME_04'] as String : null,
  845. SUBDELAY_CODE_01: map['SUBDELAY_CODE_01'] != null
  846. ? map['SUBDELAY_CODE_01'] as String
  847. : null,
  848. SUBDELAY_CODE_02: map['SUBDELAY_CODE_02'] != null
  849. ? map['SUBDELAY_CODE_02'] as String
  850. : null,
  851. SUBDELAY_CODE_03: map['SUBDELAY_CODE_03'] != null
  852. ? map['SUBDELAY_CODE_03'] as String
  853. : null,
  854. SUBDELAY_CODE_04: map['SUBDELAY_CODE_04'] != null
  855. ? map['SUBDELAY_CODE_04'] as String
  856. : null,
  857. PAX_BOOKED_C:
  858. map['PAX_BOOKED_C'] != null ? map['PAX_BOOKED_C'] as String : null,
  859. PAX_BOOKED_Y:
  860. map['PAX_BOOKED_Y'] != null ? map['PAX_BOOKED_Y'] as String : null,
  861. PAX_BOOKED_TRS_C: map['PAX_BOOKED_TRS_C'] != null
  862. ? map['PAX_BOOKED_TRS_C'] as String
  863. : null,
  864. PAX_BOOKED_TRS_Y: map['PAX_BOOKED_TRS_Y'] != null
  865. ? map['PAX_BOOKED_TRS_Y'] as String
  866. : null,
  867. PAD_BOOKED_C:
  868. map['PAD_BOOKED_C'] != null ? map['PAD_BOOKED_C'] as String : null,
  869. PAD_BOOKED_Y:
  870. map['PAD_BOOKED_Y'] != null ? map['PAD_BOOKED_Y'] as String : null,
  871. OFFBLOCK_DT_A:
  872. map['OFFBLOCK_DT_A'] != null ? map['OFFBLOCK_DT_A'] as String : null,
  873. AIRBORNE_DT_A:
  874. map['AIRBORNE_DT_A'] != null ? map['AIRBORNE_DT_A'] as String : null,
  875. LANDING_DT_A:
  876. map['LANDING_DT_A'] != null ? map['LANDING_DT_A'] as String : null,
  877. ONBLOCK_DT_A:
  878. map['ONBLOCK_DT_A'] != null ? map['ONBLOCK_DT_A'] as String : null,
  879. OFFBLOCK_DT_F:
  880. map['OFFBLOCK_DT_F'] != null ? map['OFFBLOCK_DT_F'] as String : null,
  881. AIRBORNE_DT_F:
  882. map['AIRBORNE_DT_F'] != null ? map['AIRBORNE_DT_F'] as String : null,
  883. LANDING_DT_F:
  884. map['LANDING_DT_F'] != null ? map['LANDING_DT_F'] as String : null,
  885. ONBLOCK_DT_F:
  886. map['ONBLOCK_DT_F'] != null ? map['ONBLOCK_DT_F'] as String : null,
  887. OFFBLOCK_DT_M:
  888. map['OFFBLOCK_DT_M'] != null ? map['OFFBLOCK_DT_M'] as String : null,
  889. AIRBORNE_DT_M:
  890. map['AIRBORNE_DT_M'] != null ? map['AIRBORNE_DT_M'] as String : null,
  891. LANDING_DT_M:
  892. map['LANDING_DT_M'] != null ? map['LANDING_DT_M'] as String : null,
  893. ONBLOCK_DT_M:
  894. map['ONBLOCK_DT_M'] != null ? map['ONBLOCK_DT_M'] as String : null,
  895. EET: map['EET'] != null ? map['EET'] as String : null,
  896. );
  897. }
  898. String toJson() => json.encode(toMap());
  899. factory Acleg.fromJson(String source) =>
  900. Acleg.fromMap(json.decode(source) as Map<String, dynamic>);
  901. @override
  902. String toString() {
  903. return 'Acleg(LEG_NO: $LEG_NO, FN_CARRIER: $FN_CARRIER, FN_NUMBER: $FN_NUMBER, FN_SUFFIX: $FN_SUFFIX, DAY_OF_ORIGIN: $DAY_OF_ORIGIN, AC_OWNER: $AC_OWNER, AC_SUBTYPE: $AC_SUBTYPE, AC_VERSION: $AC_VERSION, AC_REGISTRATION: $AC_REGISTRATION, DEP_AP_ACTUAL: $DEP_AP_ACTUAL, DEP_AP_SCHED: $DEP_AP_SCHED, DEP_DT_EST: $DEP_DT_EST, DEP_SCHED_DT: $DEP_SCHED_DT, ARR_AP_ACTUAL: $ARR_AP_ACTUAL, ARR_AP_SCHED: $ARR_AP_SCHED, ARR_DT_EST: $ARR_DT_EST, ARR_SCHED_DT: $ARR_SCHED_DT, SLOT_TIME_ACTUAL: $SLOT_TIME_ACTUAL, LEG_TYPE: $LEG_TYPE, EMPLOYER_COCKPIT: $EMPLOYER_COCKPIT, EMPLOYER_CABIN: $EMPLOYER_CABIN, CYCLES: $CYCLES, DELAY_CODE_01: $DELAY_CODE_01, DELAY_CODE_02: $DELAY_CODE_02, DELAY_CODE_03: $DELAY_CODE_03, DELAY_CODE_04: $DELAY_CODE_04, DELAY_TIME_01: $DELAY_TIME_01, DELAY_TIME_02: $DELAY_TIME_02, DELAY_TIME_03: $DELAY_TIME_03, DELAY_TIME_04: $DELAY_TIME_04, SUBDELAY_CODE_01: $SUBDELAY_CODE_01, SUBDELAY_CODE_02: $SUBDELAY_CODE_02, SUBDELAY_CODE_03: $SUBDELAY_CODE_03, SUBDELAY_CODE_04: $SUBDELAY_CODE_04, PAX_BOOKED_C: $PAX_BOOKED_C, PAX_BOOKED_Y: $PAX_BOOKED_Y, PAX_BOOKED_TRS_C: $PAX_BOOKED_TRS_C, PAX_BOOKED_TRS_Y: $PAX_BOOKED_TRS_Y, PAD_BOOKED_C: $PAD_BOOKED_C, PAD_BOOKED_Y: $PAD_BOOKED_Y, OFFBLOCK_DT_A: $OFFBLOCK_DT_A, AIRBORNE_DT_A: $AIRBORNE_DT_A, LANDING_DT_A: $LANDING_DT_A, ONBLOCK_DT_A: $ONBLOCK_DT_A, OFFBLOCK_DT_F: $OFFBLOCK_DT_F, AIRBORNE_DT_F: $AIRBORNE_DT_F, LANDING_DT_F: $LANDING_DT_F, ONBLOCK_DT_F: $ONBLOCK_DT_F, OFFBLOCK_DT_M: $OFFBLOCK_DT_M, AIRBORNE_DT_M: $AIRBORNE_DT_M, LANDING_DT_M: $LANDING_DT_M, ONBLOCK_DT_M: $ONBLOCK_DT_M, EET: $EET)';
  904. }
  905. @override
  906. bool operator ==(covariant Acleg other) {
  907. if (identical(this, other)) return true;
  908. return other.LEG_NO == LEG_NO &&
  909. other.FN_CARRIER == FN_CARRIER &&
  910. other.FN_NUMBER == FN_NUMBER &&
  911. other.FN_SUFFIX == FN_SUFFIX &&
  912. other.DAY_OF_ORIGIN == DAY_OF_ORIGIN &&
  913. other.AC_OWNER == AC_OWNER &&
  914. other.AC_SUBTYPE == AC_SUBTYPE &&
  915. other.AC_VERSION == AC_VERSION &&
  916. other.AC_REGISTRATION == AC_REGISTRATION &&
  917. other.DEP_AP_ACTUAL == DEP_AP_ACTUAL &&
  918. other.DEP_AP_SCHED == DEP_AP_SCHED &&
  919. other.DEP_DT_EST == DEP_DT_EST &&
  920. other.DEP_SCHED_DT == DEP_SCHED_DT &&
  921. other.ARR_AP_ACTUAL == ARR_AP_ACTUAL &&
  922. other.ARR_AP_SCHED == ARR_AP_SCHED &&
  923. other.ARR_DT_EST == ARR_DT_EST &&
  924. other.ARR_SCHED_DT == ARR_SCHED_DT &&
  925. other.SLOT_TIME_ACTUAL == SLOT_TIME_ACTUAL &&
  926. other.LEG_TYPE == LEG_TYPE &&
  927. other.EMPLOYER_COCKPIT == EMPLOYER_COCKPIT &&
  928. other.EMPLOYER_CABIN == EMPLOYER_CABIN &&
  929. other.CYCLES == CYCLES &&
  930. other.DELAY_CODE_01 == DELAY_CODE_01 &&
  931. other.DELAY_CODE_02 == DELAY_CODE_02 &&
  932. other.DELAY_CODE_03 == DELAY_CODE_03 &&
  933. other.DELAY_CODE_04 == DELAY_CODE_04 &&
  934. other.DELAY_TIME_01 == DELAY_TIME_01 &&
  935. other.DELAY_TIME_02 == DELAY_TIME_02 &&
  936. other.DELAY_TIME_03 == DELAY_TIME_03 &&
  937. other.DELAY_TIME_04 == DELAY_TIME_04 &&
  938. other.SUBDELAY_CODE_01 == SUBDELAY_CODE_01 &&
  939. other.SUBDELAY_CODE_02 == SUBDELAY_CODE_02 &&
  940. other.SUBDELAY_CODE_03 == SUBDELAY_CODE_03 &&
  941. other.SUBDELAY_CODE_04 == SUBDELAY_CODE_04 &&
  942. other.PAX_BOOKED_C == PAX_BOOKED_C &&
  943. other.PAX_BOOKED_Y == PAX_BOOKED_Y &&
  944. other.PAX_BOOKED_TRS_C == PAX_BOOKED_TRS_C &&
  945. other.PAX_BOOKED_TRS_Y == PAX_BOOKED_TRS_Y &&
  946. other.PAD_BOOKED_C == PAD_BOOKED_C &&
  947. other.PAD_BOOKED_Y == PAD_BOOKED_Y &&
  948. other.OFFBLOCK_DT_A == OFFBLOCK_DT_A &&
  949. other.AIRBORNE_DT_A == AIRBORNE_DT_A &&
  950. other.LANDING_DT_A == LANDING_DT_A &&
  951. other.ONBLOCK_DT_A == ONBLOCK_DT_A &&
  952. other.OFFBLOCK_DT_F == OFFBLOCK_DT_F &&
  953. other.AIRBORNE_DT_F == AIRBORNE_DT_F &&
  954. other.LANDING_DT_F == LANDING_DT_F &&
  955. other.ONBLOCK_DT_F == ONBLOCK_DT_F &&
  956. other.OFFBLOCK_DT_M == OFFBLOCK_DT_M &&
  957. other.AIRBORNE_DT_M == AIRBORNE_DT_M &&
  958. other.LANDING_DT_M == LANDING_DT_M &&
  959. other.ONBLOCK_DT_M == ONBLOCK_DT_M &&
  960. other.EET == EET;
  961. }
  962. @override
  963. int get hashCode {
  964. return LEG_NO.hashCode ^
  965. FN_CARRIER.hashCode ^
  966. FN_NUMBER.hashCode ^
  967. FN_SUFFIX.hashCode ^
  968. DAY_OF_ORIGIN.hashCode ^
  969. AC_OWNER.hashCode ^
  970. AC_SUBTYPE.hashCode ^
  971. AC_VERSION.hashCode ^
  972. AC_REGISTRATION.hashCode ^
  973. DEP_AP_ACTUAL.hashCode ^
  974. DEP_AP_SCHED.hashCode ^
  975. DEP_DT_EST.hashCode ^
  976. DEP_SCHED_DT.hashCode ^
  977. ARR_AP_ACTUAL.hashCode ^
  978. ARR_AP_SCHED.hashCode ^
  979. ARR_DT_EST.hashCode ^
  980. ARR_SCHED_DT.hashCode ^
  981. SLOT_TIME_ACTUAL.hashCode ^
  982. LEG_TYPE.hashCode ^
  983. EMPLOYER_COCKPIT.hashCode ^
  984. EMPLOYER_CABIN.hashCode ^
  985. CYCLES.hashCode ^
  986. DELAY_CODE_01.hashCode ^
  987. DELAY_CODE_02.hashCode ^
  988. DELAY_CODE_03.hashCode ^
  989. DELAY_CODE_04.hashCode ^
  990. DELAY_TIME_01.hashCode ^
  991. DELAY_TIME_02.hashCode ^
  992. DELAY_TIME_03.hashCode ^
  993. DELAY_TIME_04.hashCode ^
  994. SUBDELAY_CODE_01.hashCode ^
  995. SUBDELAY_CODE_02.hashCode ^
  996. SUBDELAY_CODE_03.hashCode ^
  997. SUBDELAY_CODE_04.hashCode ^
  998. PAX_BOOKED_C.hashCode ^
  999. PAX_BOOKED_Y.hashCode ^
  1000. PAX_BOOKED_TRS_C.hashCode ^
  1001. PAX_BOOKED_TRS_Y.hashCode ^
  1002. PAD_BOOKED_C.hashCode ^
  1003. PAD_BOOKED_Y.hashCode ^
  1004. OFFBLOCK_DT_A.hashCode ^
  1005. AIRBORNE_DT_A.hashCode ^
  1006. LANDING_DT_A.hashCode ^
  1007. ONBLOCK_DT_A.hashCode ^
  1008. OFFBLOCK_DT_F.hashCode ^
  1009. AIRBORNE_DT_F.hashCode ^
  1010. LANDING_DT_F.hashCode ^
  1011. ONBLOCK_DT_F.hashCode ^
  1012. OFFBLOCK_DT_M.hashCode ^
  1013. AIRBORNE_DT_M.hashCode ^
  1014. LANDING_DT_M.hashCode ^
  1015. ONBLOCK_DT_M.hashCode ^
  1016. EET.hashCode;
  1017. }
  1018. }
  1019. extension StringExtensions on String {
  1020. String capitalize() {
  1021. if (isEmpty) {
  1022. return this;
  1023. } else {
  1024. return "${this[0].toUpperCase()}${substring(1).toLowerCase()}";
  1025. }
  1026. }
  1027. String capitalizeword() {
  1028. return split(' ').map((word) => word.capitalize()).join(' ');
  1029. }
  1030. Jiffy? parseddmmyyyyhhmm() => length >= 15
  1031. ? Jiffy.parse(
  1032. "${substring(6, 10)}-${substring(3, 5)}-${substring(0, 2)} ${substring(11, 13)}:${substring(13, 15)}",
  1033. pattern: 'yyyy-MM-dd HH:mm',
  1034. isUtc: true)
  1035. : null;
  1036. Jiffy? parseyyyymmddhhmm() => length >= 16
  1037. ? Jiffy.parse(this,
  1038. pattern: 'yyyy-MM-dd HH:mm:ss',
  1039. // "${substring(6, 10)}-${substring(3, 5)}-${substring(0, 2)} ${substring(11, 13)}${substring(13, 16)}",
  1040. // pattern: 'yyyy-MM-dd HH:mm',
  1041. isUtc: true)
  1042. : null;
  1043. }
  1044. class DTInterval {
  1045. late Jiffy start;
  1046. late Jiffy end;
  1047. DTInterval(this.start, this.end);
  1048. @override
  1049. String toString() =>
  1050. "<${start.format(pattern: "ddMMMyy HH:mm")} - ${end.format(pattern: "ddMMMyy HH:mm")}>";
  1051. bool include(Jiffy x) {
  1052. return x.isSameOrAfter(start) && x.isSameOrBefore(end);
  1053. }
  1054. bool isOverlap(DTInterval x) {
  1055. return x.start.isSameOrBefore(end) && x.end.isSameOrAfter(start);
  1056. }
  1057. bool contains(DTInterval x) {
  1058. return include(x.start) && include(x.end);
  1059. }
  1060. List<DTInterval> minus(DTInterval x) {
  1061. if (!isOverlap(x)) {
  1062. return [this];
  1063. } else if (x.include(start) && x.include(end)) {
  1064. return [];
  1065. } else if (x.include(start)) {
  1066. return [DTInterval(x.end, end)];
  1067. } else if (x.include(end)) {
  1068. return [DTInterval(start, x.start)];
  1069. } else {
  1070. return [DTInterval(start, x.start), DTInterval(x.end, end)];
  1071. }
  1072. }
  1073. Duration get duration => end.dateTime.difference(start.dateTime);
  1074. bool isEmpty() {
  1075. return start.isSameOrAfter(end);
  1076. }
  1077. DTInterval toUtc() {
  1078. return DTInterval(start.toUtc(), end.toUtc());
  1079. }
  1080. }