1
0
Fares 11 сар өмнө
parent
commit
1ba841a339

+ 2 - 2
lib/authpages/auth_magiclink.dart

@@ -19,9 +19,9 @@ class _AuthMagiclinkState extends ConsumerState<AuthMagiclink> {
   // bool _isSubmitting = false;
 
   // final _userCtrl = TextEditingController()
-  //   ..text = Hive.box("profile").get("crewlink_user") ?? "";
+  //   ..text = Hive.box("settings").get("crewlink_user") ?? "";
   // final _passCtrl = TextEditingController()
-  //   ..text = Hive.box("profile").get("crewlink_pass") ?? "";
+  //   ..text = Hive.box("settings").get("crewlink_pass") ?? "";
 
   @override
   Widget build(BuildContext context) {

+ 18 - 10
lib/core/routes.dart

@@ -23,6 +23,7 @@ import 'package:tp5/roster/view/crewlist_page.dart';
 import 'package:tp5/roster/view/roster_page.dart';
 import 'package:tp5/rosters/rosters_page.dart';
 import 'package:supabase_flutter/supabase_flutter.dart';
+import 'package:tp5/settings/settings_page.dart';
 
 final routeProvider = Provider<RouterConfig<Object>?>((ref) {
   return _routes;
@@ -107,8 +108,8 @@ final _routes = GoRouter(
         redirect: (_, state) {
           // if
           //     (state.fullPath != "/crewlink/settings" &&
-          //         (((Hive.box("profile").get("crewlink_user") ?? "") == "") ||
-          //             ((Hive.box("profile").get("crewlink_pass") ?? "") ==
+          //         (((Hive.box("settings").get("crewlink_user") ?? "") == "") ||
+          //             ((Hive.box("settings").get("crewlink_pass") ?? "") ==
           //                 ""))) {
           //   return "/crewlink/settings";
           // }
@@ -143,6 +144,13 @@ final _routes = GoRouter(
       path: '/home',
       redirect: (context, state) => '/crewlink/roster',
     ),
+    GoRoute(
+      path: '/settings',
+      builder: (context, state) {
+        final params = (state.extra as SettingsParams?) ?? SettingsParams();
+        return SettingsPage(params: params);
+      },
+    ),
     GoRoute(
       path: '/pdf',
       builder: (context, state) {
@@ -191,8 +199,8 @@ final _routes = GoRouter(
           if
               // (["/crewlink/roster"].contains(state.uri.toString())&&
               (state.fullPath != "/lido/settings" &&
-                  (((Hive.box("profile").get("lido_user") ?? "") == "") ||
-                      ((Hive.box("profile").get("lido_pass") ?? "") == ""))) {
+                  (((Hive.box("settings").get("lido_user") ?? "") == "") ||
+                      ((Hive.box("settings").get("lido_pass") ?? "") == ""))) {
             return "/lido/settings";
           }
           return null;
@@ -224,8 +232,8 @@ final _routes = GoRouter(
           if
               // (["/crewlink/roster"].contains(state.uri.toString())&&
               (state.fullPath != "/crewlink/settings" &&
-                  (((Hive.box("profile").get("crewlink_user") ?? "") == "") ||
-                      ((Hive.box("profile").get("crewlink_pass") ?? "") ==
+                  (((Hive.box("settings").get("crewlink_user") ?? "") == "") ||
+                      ((Hive.box("settings").get("crewlink_pass") ?? "") ==
                           ""))) {
             return "/crewlink/settings";
           }
@@ -253,10 +261,10 @@ final _routes = GoRouter(
                               .endOf(Unit.month)
                               .format(pattern: "ddMMMyy"),
                       crewlinkuser: params.crewlinkuser ??
-                          Hive.box("profile").get("crewlink_user") ??
+                          Hive.box("settings").get("crewlink_user") ??
                           "",
                       crewlinkpass: params.crewlinkpass ??
-                          Hive.box("profile").get("crewlink_pass") ??
+                          Hive.box("settings").get("crewlink_pass") ??
                           ""),
                 );
               }),
@@ -283,10 +291,10 @@ final _routes = GoRouter(
                       dep: params.dep ?? "",
                       des: params.des ?? "",
                       crewlinkuser: params.crewlinkuser ??
-                          Hive.box("profile").get("crewlink_user") ??
+                          Hive.box("settings").get("crewlink_user") ??
                           "",
                       crewlinkpass: params.crewlinkpass ??
-                          Hive.box("profile").get("crewlink_pass") ??
+                          Hive.box("settings").get("crewlink_pass") ??
                           ""),
                 );
               }),

+ 107 - 102
lib/fltinfo/view/fltinfo_page.dart

@@ -122,7 +122,7 @@ class _FltinfoPageState extends ConsumerState<FltinfoPage> {
         lido.add(LidoapiList.fromJson(e));
       }
     }
-    //print(lido);
+    print(res);
     setState(() {
       _loadingLido = false;
     });
@@ -426,7 +426,9 @@ class _FltinfoPageState extends ConsumerState<FltinfoPage> {
                                 (e.tlc == x.tlc) && (e.ac == x.actype)) ??
                             qualif.firstWhereOrNull((e) => e.tlc == x.tlc));
                         return WCrew(
-                          college: pn?.college,
+                          college: (["F", ""].contains(x.type))
+                              ? "DH"
+                              : (pn?.college),
                           mle: x.tlc,
                           base: pn?.base,
                           name: "${pn?.lname}, ${pn?.fname}",
@@ -707,112 +709,115 @@ class _FltinfoPageState extends ConsumerState<FltinfoPage> {
               dimension: 20,
               child: CircularProgressIndicator(),
             )
-          : ElevatedButton.icon(
-              label: const Text("Update", style: TextStyle(fontSize: 9)),
-              onPressed: () async {
-                await _loadOfpFromLido();
-              },
-              icon: const Icon(Icons.update)),
+          : lidoactivated
+              ? (ElevatedButton.icon(
+                  label: const Text("Update", style: TextStyle(fontSize: 9)),
+                  onPressed: () async {
+                    await _loadOfpFromLido();
+                  },
+                  icon: const Icon(Icons.update)))
+              : Text("Lido is not activated!"),
       bottomright: _dateLido != null
           ? Text("data retrieved ${_dateLido?.from(_now)}",
               style: GoogleFonts.robotoMono(
                   fontSize: 10, fontWeight: FontWeight.w300))
           : null,
-      child: lido.isEmpty
-          ? (lidoactivated
+      child: !lidoactivated
+          ? ElevatedButton.icon(
+              label: const Text("Activate Lido", style: TextStyle(fontSize: 9)),
+              onPressed: () {
+                context.push("/lido/settings");
+              },
+              icon: const Icon(Icons.update))
+          : (lido.isEmpty
               ? const Text("No OFPs found on lido!")
-              : ElevatedButton.icon(
-                  label: const Text("Activate Lido",
-                      style: TextStyle(fontSize: 9)),
-                  onPressed: () {
-                    context.push("/lido/settings");
-                  },
-                  icon: const Icon(Icons.update)))
-          : Column(
-              children: [
-                Column(children: [
-                  if (lido.length > 1)
-                    Row(mainAxisSize: MainAxisSize.min, children: [
-                      IconButton(
-                          iconSize: 30,
-                          onPressed: () {
-                            _lidoPos =
-                                (_lidoPos - 1 < 0 ? _lidoPos : _lidoPos - 1);
-                            setState(() {});
-                          },
-                          icon: const Icon(Icons.arrow_left)),
-                      Text("Flt ${_lidoPos + 1} / ${lido.length}"),
-                      IconButton(
-                          iconSize: 30,
-                          onPressed: () {
-                            _lidoPos = (_lidoPos + 1 >= lido.length
-                                ? _lidoPos
-                                : _lidoPos + 1);
-                            setState(() {});
-                          },
-                          icon: const Icon(Icons.arrow_right))
+              : Column(
+                  children: [
+                    Column(children: [
+                      if (lido.length > 1)
+                        Row(mainAxisSize: MainAxisSize.min, children: [
+                          IconButton(
+                              iconSize: 30,
+                              onPressed: () {
+                                _lidoPos = (_lidoPos - 1 < 0
+                                    ? _lidoPos
+                                    : _lidoPos - 1);
+                                setState(() {});
+                              },
+                              icon: const Icon(Icons.arrow_left)),
+                          Text("Flt ${_lidoPos + 1} / ${lido.length}"),
+                          IconButton(
+                              iconSize: 30,
+                              onPressed: () {
+                                _lidoPos = (_lidoPos + 1 >= lido.length
+                                    ? _lidoPos
+                                    : _lidoPos + 1);
+                                setState(() {});
+                              },
+                              icon: const Icon(Icons.arrow_right))
+                        ]),
+                      Row(
+                        mainAxisSize: MainAxisSize.min,
+                        children: [
+                          Text(
+                              "${lido[_lidoPos].leg?.aircraftOperatorIata} ${lido[_lidoPos].leg?.flightNumber} ${Jiffy.parseFromMillisecondsSinceEpoch(lido[_lidoPos].leg?.estimatedDepartureTime ?? 0).format(pattern: "ddMMMyy")} ${lido[_lidoPos].leg?.departureAirport} ${Jiffy.parseFromMillisecondsSinceEpoch(lido[_lidoPos].leg?.estimatedDepartureTime ?? 0).Hm} ${Jiffy.parseFromMillisecondsSinceEpoch(lido[_lidoPos].leg?.estimatedTimeOfArrival ?? 0).Hm} ${lido[_lidoPos].leg?.destinationAirport}"),
+                        ],
+                      )
                     ]),
-                  Row(
-                    mainAxisSize: MainAxisSize.min,
-                    children: [
-                      Text(
-                          "${lido[_lidoPos].leg?.aircraftOperatorIata} ${lido[_lidoPos].leg?.flightNumber} ${Jiffy.parseFromMillisecondsSinceEpoch(lido[_lidoPos].leg?.estimatedDepartureTime ?? 0).format(pattern: "ddMMMyy")} ${lido[_lidoPos].leg?.departureAirport} ${Jiffy.parseFromMillisecondsSinceEpoch(lido[_lidoPos].leg?.estimatedDepartureTime ?? 0).Hm} ${Jiffy.parseFromMillisecondsSinceEpoch(lido[_lidoPos].leg?.estimatedTimeOfArrival ?? 0).Hm} ${lido[_lidoPos].leg?.destinationAirport}"),
-                    ],
-                  )
-                ]),
-                Padding(
-                  padding: const EdgeInsets.all(8.0),
-                  child: Column(children: [
-                    WLidoflt(lidoapilist: lido[_lidoPos]),
-                    _loadingOFP
-                        ? const CircularProgressIndicator()
-                        : ElevatedButton.icon(
-                            onPressed: () async {
-                              // final fileid = PathTo().lidoFile(
-                              //     "${lido[_lidoPos].briefingId ?? ""}.pdf");
-
-                              final legid = lido[_lidoPos].briefingId ?? "";
-                              if (_loadingOFP == false) {
-                                setState(() {
-                                  _loadingOFP = true;
-                                });
-                                final ofp = await ref
-                                    .read(lidoapiProvider)
-                                    .ofppdf(legid: legid);
-                                setState(() {
-                                  _loadingOFP = false;
-                                });
-                                log(ofp.toString());
-                                if (((ofp["data"] is Map) &&
-                                        (ofp["data"]?["downloaded"] ?? false) ==
-                                            true) ||
-                                    (ofp["cache"] != null)) {
-                                  context.push("/pdf",
-                                      extra: PdfPageParams(
-                                          file: ofp["cache"] ??
-                                              ofp["data"]?["fileid"] ??
-                                              "",
-                                          title: legid,
-                                          initialZoom: 1));
-                                } else {
-                                  context.showError(
-                                      "Cannot download PDF File !!!");
-                                }
-                              }
-                            },
-
-                            icon: Image.asset(
-                              'assets/pdficon.png',
-                              width: 28,
-                            ), //icon data for elevated button
-                            label: const Text(
-                                "Load OFP in\n  PDF Format"), //label text
-                            // style: bottomnavstyle,
-                          ),
-                  ]),
-                )
-              ],
-            ),
+                    Padding(
+                      padding: const EdgeInsets.all(8.0),
+                      child: Column(children: [
+                        WLidoflt(lidoapilist: lido[_lidoPos]),
+                        _loadingOFP
+                            ? const CircularProgressIndicator()
+                            : ElevatedButton.icon(
+                                onPressed: () async {
+                                  // final fileid = PathTo().lidoFile(
+                                  //     "${lido[_lidoPos].briefingId ?? ""}.pdf");
+
+                                  final legid = lido[_lidoPos].briefingId ?? "";
+                                  if (_loadingOFP == false) {
+                                    setState(() {
+                                      _loadingOFP = true;
+                                    });
+                                    final ofp = await ref
+                                        .read(lidoapiProvider)
+                                        .ofppdf(legid: legid);
+                                    setState(() {
+                                      _loadingOFP = false;
+                                    });
+                                    log(ofp.toString());
+                                    if (((ofp["data"] is Map) &&
+                                            (ofp["data"]?["downloaded"] ??
+                                                    false) ==
+                                                true) ||
+                                        (ofp["cache"] != null)) {
+                                      context.push("/pdf",
+                                          extra: PdfPageParams(
+                                              file: ofp["cache"] ??
+                                                  ofp["data"]?["fileid"] ??
+                                                  "",
+                                              title: legid,
+                                              initialZoom: 1));
+                                    } else {
+                                      context.showError(
+                                          "Cannot download PDF File !!!");
+                                    }
+                                  }
+                                },
+
+                                icon: Image.asset(
+                                  'assets/pdficon.png',
+                                  width: 28,
+                                ), //icon data for elevated button
+                                label: const Text(
+                                    "Load OFP in\n  PDF Format"), //label text
+                                // style: bottomnavstyle,
+                              ),
+                      ]),
+                    )
+                  ],
+                )),
     );
   }
 }
@@ -843,7 +848,7 @@ class FltinfoParams {
 
 int collegeSort(String a, String b) {
   // Define the order based on your requirements
-  final order = ['CP', 'FO', 'PU', 'SE', 'ST', 'JU'];
+  final order = ['CP', 'FO', 'PU', 'SE', 'ST', 'JU', 'DH'];
 
   // Get the index of each element in the order list
   final indexA = order.indexOf(a);

+ 2 - 2
lib/ftl/view/ftl_page.dart

@@ -48,10 +48,10 @@ class _FtlPageState extends ConsumerState<FtlPage> {
   @override
   void initState() {
     crewlinkUser = widget.params.crewlinkuser ??
-        Hive.box("profile").get("crewlink_user") ??
+        Hive.box("settings").get("crewlink_user") ??
         "";
     crewlinkPass = widget.params.crewlinkpass ??
-        Hive.box("profile").get("crewlink_pass") ??
+        Hive.box("settings").get("crewlink_pass") ??
         "";
 
     startdate = widget.params.datestart ??

+ 150 - 16
lib/lido/lido_api.dart

@@ -64,13 +64,13 @@ class LidoApi {
   }
 
   bool credSaved() {
-    return (Hive.box("profile").get("lido_user", defaultValue: "") != "") &&
-        (Hive.box("profile").get("lido_pass", defaultValue: "") != "");
+    return (Hive.box("settings").get("lido_user", defaultValue: "") != "") &&
+        (Hive.box("settings").get("lido_pass", defaultValue: "") != "");
   }
 
-  Future login({String? user, String? pass}) async {
-    username = user ?? Hive.box("profile").get("lido_user", defaultValue: "");
-    password = pass ?? Hive.box("profile").get("lido_pass", defaultValue: "");
+  Future login({String? user, String? pass, String? newpass}) async {
+    username = user ?? Hive.box("settings").get("lido_user", defaultValue: "");
+    password = pass ?? Hive.box("settings").get("lido_pass", defaultValue: "");
     try {
       var response = await http
           .get(
@@ -92,7 +92,7 @@ class LidoApi {
             "c0-id": "0",
             "c0-param0": "string:$username",
             "c0-param1": "string:$password",
-            "c0-param2": "string:",
+            "c0-param2": "string:${newpass ?? ""}",
             "c0-param3": "string:LIDO",
             "c0-param4": "string:en",
             "batchId": "0",
@@ -116,31 +116,56 @@ class LidoApi {
               .firstMatch(response.body)
               ?.group(0) ??
           "xx";
-      // print(errorcode);
+
+      final plschangepass =
+          response.body.contains("please change your password");
+
       final changepass = RegExp(r'(?<=forcePasswdChange:)(.+)(?=,)')
               .firstMatch(response.body)
               ?.group(0) ==
           "true";
 
+      // print("lidoapi: login: errorcode: $errorcode");
+      // print("lidoapi: login: message: $message");
+      // print("lidoapi: login: changepass: $changepass");
+      // print("lidoapi: login: responsebody: ${response.body}");
+
       logged = errorcode == "null";
 
       cookieMap = (!logged) ? {} : cookieMap;
       // log("api lido 4d login \nuser:$username\npass:$password\nstatuscode${response.statusCode}\nlogged:$logged\nmsg:$message");
       log("api lido 4d login errorcode: $errorcode");
-
-//invalide username or password
-      if (errorcode == "LAS_112" && (user == null) && (pass == null)) {
-        await Hive.box("profile").delete("lido_user");
-        await Hive.box("profile").delete("lido_pass");
-        await Hive.box("profile").put("lido_user_old", username);
-        await Hive.box("profile").put("lido_pass_old", pass);
+      //invalide username or password
+      if (['"LAS_112"', '"LAS_113"'].contains(errorcode)) {
+        print("lidoapi: login: invalidate user & pass");
+        await Hive.box("settings").delete("lido_user");
+        await Hive.box("settings").delete("lido_pass");
+        if (username != "" && password != "") {
+          await Hive.box("settings").put("lido_user_old", username);
+          await Hive.box("settings").put("lido_pass_old", password);
+        } //username = "";
+        password = "";
+      }
+      final res = extractCallbackData(response.body);
+      final passwordChanged =
+          (newpass != null) && (res["errorMessage1"] != null);
+
+      // log("lidoapi: login: return: ${extractCallbackData(response.body)}");
+      if (newpass != null && passwordChanged) {
+        await Hive.box("settings").put("lido_user", username);
+        await Hive.box("settings").put("lido_pass", newpass);
+        log("lidoapi: login: newpass: $newpass");
       }
-
       return {
         'error': logged ? null : message,
-        'data': {"logged": logged, "message": message},
+        'data': {
+          "logged": logged,
+          "message": message,
+          "passwordChanged": passwordChanged
+        },
         'meta': {
           "changepass": changepass,
+          "plschangepass": plschangepass,
           "user": username,
           "pass": password,
           "cookie": cookieMap,
@@ -156,6 +181,88 @@ class LidoApi {
     }
   }
 
+  Future forgotpass({String? user}) async {
+    var response = await http.get(Uri.parse('$url/lido/las/login.jsp'));
+    cookieMap.addAll(_getcookies(response.headers["set-cookie"] ?? ""));
+    response = await http.post(
+        Uri.parse(
+            '$url/lido/las/dwr/call/plaincall/LoginBean.forgotPassword.dwr'),
+        body: {
+          "callCount": "1",
+          "nextReverseAjaxIndex": "0",
+          "c0-scriptName": "LoginBean",
+          "c0-methodName": "forgotPasswordLink",
+          "c0-id": "0",
+          "c0-param0": "string:$user",
+          "c0-param1":
+              "string:$realurl/lido/lsc/application-center-ui/startCenter",
+          "c0-param2": "string:LIDO",
+          "c0-param3": "string:en",
+          "batchId": "0",
+          "instanceId": "0",
+          "page":
+              "/lido/las/forgotPassword.jsp?DESMON_RESULT_PAGE=$realurl/briefing&DESMON_CODE=LAS_002&DESMON_LANG=en",
+          "scriptSessionId":
+              "lSUqDnaTyhevHY6vpNvPdIR~IuUygzP8a2p/kYr1m2p-BgwpWJ4*a"
+        });
+    cookieMap.addAll(_getcookies(response.headers["set-cookie"] ?? ""));
+    //print("lidoapi: forgotpass: header:  ${response.headers}");
+    //print("lidoapi: forgotpass: ${response.body}");
+    return {
+      'error':
+          response.statusCode < 300 ? null : response.statusCode.toString(),
+      'data': {},
+      'meta': {
+        "user": username,
+        "pass": password,
+        "cookie": cookieMap,
+      }
+    };
+  }
+
+  Future changePass(
+      {required String user,
+      required String pass,
+      required String token}) async {
+    var response = await http.get(Uri.parse('$url/lido/las/login.jsp'));
+    cookieMap.addAll(_getcookies(response.headers["set-cookie"] ?? ""));
+    response = await http.post(
+        Uri.parse(
+            '$url/lido/las/dwr/call/plaincall/LoginBean.forgotPassword.dwr'),
+        body: {
+          "callCount": "1",
+          "nextReverseAjaxIndex": "0",
+          "c0-scriptName": "LoginBean",
+          "c0-methodName": "changePassword",
+          "c0-id": "0",
+          "c0-param0": "string:$user",
+          "c0-param1": "string:$pass",
+          "c0-param2": "string:$token",
+          "batchId": "0",
+          "instanceId": "0",
+          "page": "/lido/las/changePassword.jsp?token=$token",
+          "scriptSessionId":
+              "lBgkwVDs5bVASGOoKyVfCkOJjxBwXBJERcp/4WXGUcp-7few1oOHw"
+        });
+    cookieMap.addAll(_getcookies(response.headers["set-cookie"] ?? ""));
+    final decodedMsg = extractCallbackData(response.body);
+    for (var e in decodedMsg.entries) {
+      decodedMsg[e.key] = e.value == "null" ? null : e.value;
+    }
+    return {
+      'error':
+          response.statusCode < 300 ? null : response.statusCode.toString(),
+      'data': {
+        "error": decodedMsg["erroeMessage1"] ?? decodedMsg["erroeMessage2"]
+      },
+      'meta': {
+        "user": username,
+        "pass": password,
+        "cookie": cookieMap,
+      }
+    };
+  }
+
   Future getDoc(String link,
       {String? mediaType, bool loginfirst = false}) async {
     try {
@@ -574,4 +681,31 @@ class LidoApi {
       print('Error downloading file: $e');
     }
   }
+
+  Map<String, String?> extractCallbackData(String inputString) {
+    // log("lidoapi: extractCallbackData: $inputString");
+    final RegExp regex =
+        RegExp(r'dwr\.engine\.remote\.handleCallback\(\"0\",\"0\",([^)]+)\)');
+    final Match? match = regex.firstMatch(inputString);
+    //log("lidoapi: extractCallbackData: match: ${match?[1]}");
+    if (match != null && match[1] != null) {
+      final String callbackData = match[1]!;
+      final Map<String, String?> jsonData = convertStringToMap(callbackData);
+      //log("lidoapi: extractCallbackData: jsonData: $jsonData");
+      return jsonData;
+    }
+    return {};
+  }
+
+  Map<String, String?> convertStringToMap(String inputString) {
+    final Map<String, String?> result = {};
+    final RegExp regex = RegExp(r'(\w+):("?.*"?)(,|})');
+    final Iterable<RegExpMatch> matches = regex.allMatches(inputString);
+    for (var match in matches) {
+      final String key = match[1]!;
+      final String value = match[2]!;
+      result[key] = value;
+    }
+    return result;
+  }
 }

+ 15 - 8
lib/lido/view/lido_form.dart

@@ -23,9 +23,9 @@ class _LidoFormState extends ConsumerState<LidoForm> {
   bool _isSubmitting = false;
 
   final _userCtrl = TextEditingController()
-    ..text = Hive.box("profile").get("lido_user") ?? "";
+    ..text = Hive.box("settings").get("lido_user") ?? "";
   final _passCtrl = TextEditingController()
-    ..text = Hive.box("profile").get("lido_pass") ?? "";
+    ..text = Hive.box("settings").get("lido_pass") ?? "";
 
   @override
   Widget build(BuildContext context) {
@@ -128,9 +128,16 @@ class _LidoFormState extends ConsumerState<LidoForm> {
                     Padding(
                       padding: const EdgeInsets.only(left: 1.0),
                       child: InkWell(
-                          onTap: () {},
+                          onTap: () async {
+                            final x = await ref.read(lidoapiProvider).login(
+                                user: _userCtrl.text,
+                                pass: _passCtrl.text,
+                                newpass: "FaresWiem08__w");
+                            print("lidoform: loginnewpass: x= $x");
+                            // await ref.read(lidoapiProvider).forgotpass();
+                          },
                           child: const Text(
-                            'Contact your company \nLido administrator.',
+                            'Click here.',
                             style: TextStyle(fontSize: 14, color: Colors.blue),
                           )),
                     ),
@@ -192,8 +199,8 @@ class _LidoFormState extends ConsumerState<LidoForm> {
       });
       print("lidoform: login: out= $out");
       if (out["data"]?["logged"] == true) {
-        await Hive.box("profile").put("lido_user", _userCtrl.text);
-        await Hive.box("profile").put("lido_pass", _passCtrl.text);
+        await Hive.box("settings").put("lido_user", _userCtrl.text);
+        await Hive.box("settings").put("lido_pass", _passCtrl.text);
 
         context.showSuccess(
             "Your Credentials are correct and saved. Now you're connected to Lido!!!");
@@ -203,8 +210,8 @@ class _LidoFormState extends ConsumerState<LidoForm> {
         }
       } else if (out["error"] != "") {
         context.showError("Unable to connect to Lido!!!\n${out["error"]}");
-        if (((Hive.box("profile").get("lido_user") ?? "") != "") &&
-            ((Hive.box("profile").get("lido_pass") ?? "") != "")) {
+        if (((Hive.box("settings").get("lido_user") ?? "") != "") &&
+            ((Hive.box("settings").get("lido_pass") ?? "") != "")) {
           // context.push("/lido/list");
         }
       } else if (out["data"]?["logged"] == false) {

+ 1 - 1
lib/main.dart

@@ -60,7 +60,7 @@ main() async {
   await Hive.openBox("crewlink");
   await Hive.openBox("lido");
   await Hive.openBox("settings");
-  await Hive.openBox("profile");
+  await Hive.openBox("settings");
 
   await PathTo().initialize();
 

+ 3 - 2
lib/roster/api/crewlink_api.dart

@@ -639,8 +639,9 @@ class CrewlinkApi {
   }
 
   bool credSaved() {
-    return (Hive.box("profile").get("crewlink_user", defaultValue: "") != "") &&
-        (Hive.box("profile").get("crewlink_pass", defaultValue: "") != "");
+    return (Hive.box("settings").get("crewlink_user", defaultValue: "") !=
+            "") &&
+        (Hive.box("settings").get("crewlink_pass", defaultValue: "") != "");
   }
 
   String storedusername = "";

+ 6 - 6
lib/roster/view/crewlink_form.dart

@@ -23,9 +23,9 @@ class _CrewlinkFormState extends ConsumerState<CrewlinkForm> {
   bool _isSubmitting = false;
 
   final _userCtrl = TextEditingController()
-    ..text = Hive.box("profile").get("crewlink_user") ?? "";
+    ..text = Hive.box("settings").get("crewlink_user") ?? "";
   final _passCtrl = TextEditingController()
-    ..text = Hive.box("profile").get("crewlink_pass") ?? "";
+    ..text = Hive.box("settings").get("crewlink_pass") ?? "";
 
   @override
   Widget build(BuildContext context) {
@@ -193,8 +193,8 @@ class _CrewlinkFormState extends ConsumerState<CrewlinkForm> {
       });
 
       if (out["data"]?["logged"] == true) {
-        await Hive.box("profile").put("crewlink_user", _userCtrl.text);
-        await Hive.box("profile").put("crewlink_pass", _passCtrl.text);
+        await Hive.box("settings").put("crewlink_user", _userCtrl.text);
+        await Hive.box("settings").put("crewlink_pass", _passCtrl.text);
 
         context.showSuccess(
             "Your Credentials are correct and saved. Now you're connected to CrewLink!!!");
@@ -204,8 +204,8 @@ class _CrewlinkFormState extends ConsumerState<CrewlinkForm> {
         }
       } else if (out["error"] != "") {
         context.showError("Unable to connect to CrewLink!!!\n${out["error"]}");
-        if (((Hive.box("profile").get("crewlink_user") ?? "") != "") &&
-            ((Hive.box("profile").get("crewlink_pass") ?? "") != "")) {
+        if (((Hive.box("settings").get("crewlink_user") ?? "") != "") &&
+            ((Hive.box("settings").get("crewlink_pass") ?? "") != "")) {
           //context.push("/crewlink/roster");
         }
       } else if (out["data"]?["logged"] == false) {

+ 7 - 4
lib/roster/view/roster_page.dart

@@ -70,15 +70,15 @@ class _RosterPageState extends ConsumerState<RosterPage> {
   @override
   void initState() {
     // getusername & pass
-    // crewlinkPass = Hive.box("profile").get("crewlink_pass");
+    // crewlinkPass = Hive.box("settings").get("crewlink_pass");
 
     crewlinkUser = widget.params.crewlinkuser ??
-        Hive.box("profile").get("crewlink_user") ??
+        Hive.box("settings").get("crewlink_user") ??
         "";
     crewlinkPass = widget.params.crewlinkpass ??
-        Hive.box("profile").get("crewlink_pass") ??
+        Hive.box("settings").get("crewlink_pass") ??
         "";
-    Future.delayed(Duration.zero, () => _loadRoster());
+    Future.delayed(Duration(milliseconds: 700), () => _loadRoster());
 
     super.initState();
   }
@@ -142,6 +142,7 @@ class _RosterPageState extends ConsumerState<RosterPage> {
     }
   }
 
+  String get tlc => crewlinkUser;
   _scrollToDate({Jiffy? date}) {
     final jdate = date ?? Jiffy.now().toUtc();
     bool found = false;
@@ -432,6 +433,7 @@ class _RosterPageState extends ConsumerState<RosterPage> {
                     des: duty.data["des"]));
           } else if (duty.type == "ground") {
             final pseudoleg = Pnleg(
+              tlc: tlc,
               dep: duty.data["dep"],
               arr: duty.data["des"],
               depdate: duty.start?.format(pattern: "dd/MM/yyyy"),
@@ -445,6 +447,7 @@ class _RosterPageState extends ConsumerState<RosterPage> {
               context.push("/dutyinfo",
                   extra: DutyinfoParams(
                     dutytype: pseudoleg.dutytype,
+                    tlc: pseudoleg.tlc,
                     //label: pseudoleg.label,
                     jdep: pseudoleg.jdep,
                     jdes: pseudoleg.jarr,

+ 1 - 1
lib/rosters/rosters_page.dart

@@ -697,7 +697,7 @@ class _RostersPageState extends ConsumerState<RostersPage> {
         favtlcs = savedfavtlcs;
       }
       if (favtlcs.isEmpty) {
-        final crewlinkuser = Hive.box("profile").get("crewlink_user");
+        final crewlinkuser = Hive.box("settings").get("crewlink_user");
         if (crewlinkuser is String && crewlinkuser.isNotEmpty) {
           favtlcs.add(crewlinkuser);
         }

+ 40 - 0
lib/settings/settings_page.dart

@@ -0,0 +1,40 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:tp5/core/basic_page.dart';
+
+class SettingsPage extends ConsumerStatefulWidget {
+  const SettingsPage({super.key, required this.params});
+  final SettingsParams params;
+
+  @override
+  ConsumerState<ConsumerStatefulWidget> createState() => _SettingsPageState();
+}
+
+class _SettingsPageState extends ConsumerState<SettingsPage> {
+  @override
+  Widget build(BuildContext context) {
+    return BasicPage(
+      title: "Settings & Profile",
+      body: Form(
+          child: Column(
+        children: [FormField(builder: (x) => TextField())],
+      )),
+    );
+  }
+}
+
+class SettingsParams {
+  const SettingsParams({
+    this.crewlinkUser,
+    this.crewlinkPass,
+    this.lidoUser,
+    this.lidoPass,
+    this.userRole,
+  });
+
+  final String? crewlinkUser;
+  final String? crewlinkPass;
+  final String? lidoUser;
+  final String? lidoPass;
+  final String? userRole;
+}

+ 1 - 1
lib/widgets/nav_drawer.dart

@@ -63,7 +63,7 @@ class NavDrawer extends StatelessWidget {
           ListTile(
             leading: const Icon(Icons.settings),
             title: const Text('Settings'),
-            onTap: () => {Navigator.of(context).pop()},
+            onTap: () => context.go("/settings"),
           ),
           ListTile(
             leading: const Icon(Icons.border_color),

+ 2 - 2
pubspec.lock

@@ -1142,10 +1142,10 @@ packages:
     dependency: "direct main"
     description:
       name: syncfusion_flutter_pdfviewer
-      sha256: "3f267a63272deda5a17d370b7a1e7ae31f1a0fd9bc1cb43d0fda8a9b8fa8fe40"
+      sha256: "98ce45bc769411a960a85f9b988afe303682830f4bbcd934fb3a11056ebe989d"
       url: "https://pub.dev"
     source: hosted
-    version: "27.1.58"
+    version: "27.2.2"
   syncfusion_flutter_signaturepad:
     dependency: transitive
     description: