|
|
@@ -352,107 +352,118 @@ class _RosterPageState extends ConsumerState<RosterPage> {
|
|
|
InkWell(
|
|
|
highlightColor: Colors.yellow[900],
|
|
|
onTap: () {
|
|
|
- log("Tap: ${duty.start?.Hm} ${duty.type} ${duty.data}",
|
|
|
- name: "RosterPage");
|
|
|
- switch (duty.type) {
|
|
|
- case "changed":
|
|
|
- AlertDialog(
|
|
|
- title: const Text('Notification'),
|
|
|
- content: const Text('Load and show pending notification?'),
|
|
|
- actions: [
|
|
|
- TextButton(
|
|
|
- child: const Text("Load Notification",
|
|
|
- style: TextStyle(color: Colors.red, fontSize: 16)),
|
|
|
- onPressed: () async {
|
|
|
- ref.read(isLoadingProvider.notifier).state = true;
|
|
|
-
|
|
|
- final res = await ref
|
|
|
- .read(crewlinkapiProvider)
|
|
|
- .notif(download: true, fileid: fileidnotif);
|
|
|
- ref.read(isLoadingProvider.notifier).state = false;
|
|
|
- if (res is Map && res["data"]?["id"] != null) {
|
|
|
- _showNotif();
|
|
|
- } else {
|
|
|
- AlertDialog(
|
|
|
- title: const Text('Notification'),
|
|
|
- content: Text(res?["error"] ??
|
|
|
- res?["data"]?["msg"] ??
|
|
|
- 'No pending notification found !!!'),
|
|
|
- actions: [
|
|
|
- TextButton(
|
|
|
- child: const Text("OK"),
|
|
|
- onPressed: () => context.pop())
|
|
|
- ]).show(context);
|
|
|
- }
|
|
|
- }),
|
|
|
- TextButton(
|
|
|
- child: const Text(
|
|
|
- "Discard",
|
|
|
- style: TextStyle(color: Colors.green),
|
|
|
- ),
|
|
|
- onPressed: () => context.pop())
|
|
|
- ],
|
|
|
- ).show(context);
|
|
|
- break;
|
|
|
- case "flight":
|
|
|
- context.push("/fltinfo",
|
|
|
- extra: FltinfoParams(
|
|
|
- al: duty.data["al"],
|
|
|
- fnum: duty.data["fnum"],
|
|
|
- dep: duty.data["dep"],
|
|
|
- des: duty.data["des"],
|
|
|
- jdep: duty.start,
|
|
|
- jdes: duty.end));
|
|
|
- case "dhflight":
|
|
|
- context.push("/fltinfo",
|
|
|
- extra: FltinfoParams(
|
|
|
- al: duty.data["al"],
|
|
|
- fnum: duty.data["fnum"],
|
|
|
- dep: duty.data["dep"],
|
|
|
- des: duty.data["des"],
|
|
|
- jdep: duty.start,
|
|
|
- jdes: duty.end));
|
|
|
- case "dhlimo":
|
|
|
- final pseudoleg = Pnleg(
|
|
|
- dep: duty.data["dep"],
|
|
|
- arr: duty.data["des"],
|
|
|
- depdate: duty.start?.format(pattern: "dd/MM/yyyy"),
|
|
|
- deptime: duty.start?.format(pattern: "HHmm"),
|
|
|
- arrdate: duty.end?.format(pattern: "dd/MM/yyyy"),
|
|
|
- arrtime: duty.end?.format(pattern: "HHmm"),
|
|
|
- //label: duty.data["label"],
|
|
|
- type: "G");
|
|
|
- context.push("/dutyinfo",
|
|
|
- extra: DutyinfoParams(
|
|
|
- dutytype: pseudoleg.dutytype,
|
|
|
- jdep: duty.start,
|
|
|
- jdes: duty.end,
|
|
|
- dep: duty.data["dep"],
|
|
|
- des: duty.data["des"]));
|
|
|
- break;
|
|
|
- case "ground":
|
|
|
- final pseudoleg = Pnleg(
|
|
|
+ // log("Tap: ${duty.start?.Hm} ${duty.type} ${duty.data}",name: "RosterPage");
|
|
|
+ if (duty.type == "changed") {
|
|
|
+ AlertDialog(
|
|
|
+ title: const Text('Notification'),
|
|
|
+ content: const Text('Load and show pending notification?'),
|
|
|
+ actions: [
|
|
|
+ TextButton(
|
|
|
+ child: const Text("Load Notification",
|
|
|
+ style: TextStyle(color: Colors.red, fontSize: 16)),
|
|
|
+ onPressed: () async {
|
|
|
+ ref.read(isLoadingProvider.notifier).state = true;
|
|
|
+
|
|
|
+ final res = await ref
|
|
|
+ .read(crewlinkapiProvider)
|
|
|
+ .notif(download: true, fileid: fileidnotif);
|
|
|
+ ref.read(isLoadingProvider.notifier).state = false;
|
|
|
+ if (res is Map && res["data"]?["id"] != null) {
|
|
|
+ _showNotif();
|
|
|
+ } else {
|
|
|
+ AlertDialog(
|
|
|
+ title: const Text('Notification'),
|
|
|
+ content: Text(res?["error"] ??
|
|
|
+ res?["data"]?["msg"] ??
|
|
|
+ 'No pending notification found !!!'),
|
|
|
+ actions: [
|
|
|
+ TextButton(
|
|
|
+ child: const Text("OK"),
|
|
|
+ onPressed: () => context.pop())
|
|
|
+ ]).show(context);
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ TextButton(
|
|
|
+ child: const Text(
|
|
|
+ "Discard",
|
|
|
+ style: TextStyle(color: Colors.green),
|
|
|
+ ),
|
|
|
+ onPressed: () => context.pop())
|
|
|
+ ],
|
|
|
+ ).show(context);
|
|
|
+ } else if (duty.type == "flight") {
|
|
|
+ context.push("/fltinfo",
|
|
|
+ extra: FltinfoParams(
|
|
|
+ al: duty.data["al"],
|
|
|
+ fnum: duty.data["fnum"],
|
|
|
+ dep: duty.data["dep"],
|
|
|
+ des: duty.data["des"],
|
|
|
+ jdep: duty.start,
|
|
|
+ jdes: duty.end));
|
|
|
+ } else if (duty.type == "dhflight") {
|
|
|
+ context.push("/fltinfo",
|
|
|
+ extra: FltinfoParams(
|
|
|
+ al: duty.data["al"],
|
|
|
+ fnum: duty.data["fnum"],
|
|
|
+ dep: duty.data["dep"],
|
|
|
+ des: duty.data["des"],
|
|
|
+ jdep: duty.start,
|
|
|
+ jdes: duty.end));
|
|
|
+ } else if (duty.type == "dhlimo") {
|
|
|
+ final pseudoleg = Pnleg(
|
|
|
dep: duty.data["dep"],
|
|
|
arr: duty.data["des"],
|
|
|
depdate: duty.start?.format(pattern: "dd/MM/yyyy"),
|
|
|
deptime: duty.start?.format(pattern: "HHmm"),
|
|
|
arrdate: duty.end?.format(pattern: "dd/MM/yyyy"),
|
|
|
arrtime: duty.end?.format(pattern: "HHmm"),
|
|
|
- label: duty.data["label"],
|
|
|
- //type: "G",
|
|
|
- );
|
|
|
+ //label: duty.data["label"],
|
|
|
+ type: "G");
|
|
|
+ context.push("/dutyinfo",
|
|
|
+ extra: DutyinfoParams(
|
|
|
+ dutytype: pseudoleg.dutytype,
|
|
|
+ jdep: duty.start,
|
|
|
+ jdes: duty.end,
|
|
|
+ dep: duty.data["dep"],
|
|
|
+ des: duty.data["des"]));
|
|
|
+ } else if (duty.type == "ground") {
|
|
|
+ final pseudoleg = Pnleg(
|
|
|
+ dep: duty.data["dep"],
|
|
|
+ arr: duty.data["des"],
|
|
|
+ depdate: duty.start?.format(pattern: "dd/MM/yyyy"),
|
|
|
+ deptime: duty.start?.format(pattern: "HHmm"),
|
|
|
+ arrdate: duty.end?.format(pattern: "dd/MM/yyyy"),
|
|
|
+ arrtime: duty.end?.format(pattern: "HHmm"),
|
|
|
+ label: duty.data["label"],
|
|
|
+ type: "A",
|
|
|
+ );
|
|
|
+ if (pseudoleg.dutytype == "standby") {
|
|
|
+ context.push("/dutyinfo",
|
|
|
+ extra: DutyinfoParams(
|
|
|
+ dutytype: pseudoleg.dutytype,
|
|
|
+ //label: pseudoleg.label,
|
|
|
+ jdep: pseudoleg.jdep,
|
|
|
+ jdes: pseudoleg.jarr,
|
|
|
+ //start: duty.start,
|
|
|
+ //end: duty.end,
|
|
|
+ dep: pseudoleg.dep,
|
|
|
+ des: pseudoleg.arr,
|
|
|
+ sameday: true,
|
|
|
+ ));
|
|
|
+ } else {
|
|
|
context.push("/dutyinfo",
|
|
|
extra: DutyinfoParams(
|
|
|
- dutytype: pseudoleg.dutytype,
|
|
|
- label: pseudoleg.label,
|
|
|
- jdep: duty.start,
|
|
|
- jdes: duty.end,
|
|
|
- start: duty.start,
|
|
|
- end: duty.end,
|
|
|
- dep: duty.data["dep"],
|
|
|
- des: duty.data["des"]));
|
|
|
- break;
|
|
|
- default:
|
|
|
+ // dutytype: pseudoleg.dutytype,
|
|
|
+ label: pseudoleg.label,
|
|
|
+ jdep: duty.start,
|
|
|
+ jdes: duty.end,
|
|
|
+ // start: duty.start,
|
|
|
+ // end: duty.end,
|
|
|
+ dep: duty.data["dep"],
|
|
|
+ des: duty.data["des"],
|
|
|
+ // sameday: true,
|
|
|
+ ));
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
child: WDuty(duty: duty),
|
|
|
@@ -530,7 +541,10 @@ class _RosterPageState extends ConsumerState<RosterPage> {
|
|
|
)))
|
|
|
.then((res) {
|
|
|
// if (res is Map && res["notif"]) _loadRoster();
|
|
|
- if (res is Map && res["notif"]) context.go("/crewlink/roster");
|
|
|
+
|
|
|
+ //! check if the roster is still the same otherwise call _loadRoster
|
|
|
+ if (res is Map && res["notif"])
|
|
|
+ context.pushReplacement("/crewlink/roster");
|
|
|
});
|
|
|
}
|
|
|
}
|