dienianindya 1 год назад
Родитель
Сommit
42302cac25
68 измененных файлов: 1861 добавлений и 5033 удалений
  1. 2
    2
      android/app/build.gradle
  2. Двоичные данные
      android/app/src/main/res/mipmap-hdpi/ic_launcher.png
  3. Двоичные данные
      android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png
  4. Двоичные данные
      android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
  5. Двоичные данные
      android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png
  6. Двоичные данные
      android/app/src/main/res/mipmap-mdpi/ic_launcher.png
  7. Двоичные данные
      android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png
  8. Двоичные данные
      android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
  9. Двоичные данные
      android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png
  10. Двоичные данные
      android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  11. Двоичные данные
      android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png
  12. Двоичные данные
      android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
  13. Двоичные данные
      android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png
  14. Двоичные данные
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  15. Двоичные данные
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png
  16. Двоичные данные
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
  17. Двоичные данные
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png
  18. Двоичные данные
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  19. Двоичные данные
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png
  20. Двоичные данные
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
  21. Двоичные данные
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png
  22. Двоичные данные
      assets/icons/menu/ic_canvasing_1.png
  23. Двоичные данные
      assets/icons/menu/ic_canvasing_2.png
  24. Двоичные данные
      assets/icons/menu/ic_canvasing_3.png
  25. Двоичные данные
      assets/icons/menu/ic_canvasing_4.png
  26. Двоичные данные
      assets/icons/menu/ic_dashboardcanvasing_1.png
  27. Двоичные данные
      assets/icons/menu/ic_dashboardcanvasing_2.png
  28. Двоичные данные
      assets/icons/menu/ic_dashboardcanvasing_3.png
  29. Двоичные данные
      assets/icons/menu/ic_filing_1.png
  30. Двоичные данные
      assets/icons/menu/ic_history.png
  31. Двоичные данные
      canvasing_keystore.jks
  32. 0
    312
      lib/Screens/ForgotPassword/forgotPassword_screen.dart
  33. 80
    267
      lib/Screens/Home/home_screen.dart
  34. 1
    1
      lib/Screens/Login/inputWidget.dart
  35. 33
    18
      lib/Screens/Login/login_screen.dart
  36. 2
    1
      lib/Screens/Menu/About/about_screen.dart
  37. 0
    36
      lib/Screens/Menu/Absensi/RequestHttp/checkIn_post.dart
  38. 0
    36
      lib/Screens/Menu/Absensi/RequestHttp/checkOut_post.dart
  39. 0
    494
      lib/Screens/Menu/Absensi/absensi_history_screen.dart
  40. 0
    986
      lib/Screens/Menu/Absensi/absensi_screen.dart
  41. 0
    39
      lib/Screens/Menu/AjukanCuti/RequestHttp/detailCuti_post.dart
  42. 0
    39
      lib/Screens/Menu/AjukanCuti/RequestHttp/historyCuti_post.dart
  43. 0
    39
      lib/Screens/Menu/AjukanCuti/RequestHttp/jenisCuti_post.dart
  44. 0
    49
      lib/Screens/Menu/AjukanCuti/RequestHttp/pengajuanCuti_post.dart
  45. 0
    781
      lib/Screens/Menu/AjukanCuti/ajukancuti_screen.dart
  46. 0
    89
      lib/Screens/Menu/AjukanCuti/backgroundHistory.dart
  47. 626
    0
      lib/Screens/Menu/Canvasing/canvasingDetail_screen.dart
  48. 102
    96
      lib/Screens/Menu/Canvasing/canvasing_screen.dart
  49. 44
    0
      lib/Screens/Menu/Canvasing/filingData_post.dart
  50. 628
    0
      lib/Screens/Menu/Canvasing/filing_screen.dart
  51. 8
    7
      lib/Screens/Menu/Canvasing/getAll_post.dart
  52. 10
    10
      lib/Screens/Menu/Canvasing/navigate_post.dart
  53. 9
    8
      lib/Screens/Menu/Canvasing/startFiling_post.dart
  54. 34
    0
      lib/Screens/Menu/Canvasing/updateGPS_post.dart
  55. 155
    0
      lib/Screens/Menu/Dashboard/dashboard_screen.dart
  56. 10
    7
      lib/Screens/Menu/History/getHistory_post.dart
  57. 83
    79
      lib/Screens/Menu/History/history_screen.dart
  58. 0
    39
      lib/Screens/Menu/Reimburse/RequestHttp/categoryReimburse_post.dart
  59. 0
    34
      lib/Screens/Menu/Reimburse/RequestHttp/historyReimburse_post.dart
  60. 0
    49
      lib/Screens/Menu/Reimburse/RequestHttp/pengajuanReimburse_post.dart
  61. 0
    866
      lib/Screens/Menu/Reimburse/reimburse_screen.dart
  62. 0
    36
      lib/Screens/Menu/SlipGaji/RequestHttp/detailSlipGaji_post.dart
  63. 0
    36
      lib/Screens/Menu/SlipGaji/RequestHttp/downloadSlipGaji_post.dart
  64. 0
    575
      lib/Screens/Menu/SlipGaji/slipgaji_screen.dart
  65. 1
    1
      lib/Screens/Splash/splash_screen.dart
  66. 0
    0
      lib/Screens/background.dart
  67. 32
    0
      pubspec.lock
  68. 1
    1
      pubspec.yaml

+ 2
- 2
android/app/build.gradle Просмотреть файл

@@ -54,9 +54,9 @@ android {
54 54
 
55 55
     signingConfigs {
56 56
         release {
57
-            //storeFile file('D:/Android Studio Projects/ess/ess_keystore.jks')
57
+            storeFile file('D:/Android Studio Projects/poc/canvasing_keystore.jks')
58 58
             storePassword '123123'
59
-            keyAlias 'ess_keystore'
59
+            keyAlias 'canvasing_keystore'
60 60
             keyPassword '123123'
61 61
         }
62 62
     }

Двоичные данные
android/app/src/main/res/mipmap-hdpi/ic_launcher.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-mdpi/ic_launcher.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png Просмотреть файл


Двоичные данные
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png Просмотреть файл


Двоичные данные
assets/icons/menu/ic_canvasing_1.png Просмотреть файл


Двоичные данные
assets/icons/menu/ic_canvasing_2.png Просмотреть файл


Двоичные данные
assets/icons/menu/ic_canvasing_3.png Просмотреть файл


Двоичные данные
assets/icons/menu/ic_canvasing_4.png Просмотреть файл


Двоичные данные
assets/icons/menu/ic_dashboardcanvasing_1.png Просмотреть файл


Двоичные данные
assets/icons/menu/ic_dashboardcanvasing_2.png Просмотреть файл


Двоичные данные
assets/icons/menu/ic_dashboardcanvasing_3.png Просмотреть файл


Двоичные данные
assets/icons/menu/ic_filing_1.png Просмотреть файл


Двоичные данные
assets/icons/menu/ic_history.png Просмотреть файл


Двоичные данные
canvasing_keystore.jks Просмотреть файл


+ 0
- 312
lib/Screens/ForgotPassword/forgotPassword_screen.dart Просмотреть файл

@@ -1,312 +0,0 @@
1
-import 'dart:convert';
2
-
3
-import 'package:flutter/material.dart';
4
-import 'package:fluttertoast/fluttertoast.dart';
5
-import 'package:google_fonts/google_fonts.dart';
6
-import 'package:employee_selfservice_mobile/Screens/ForgotPassword/resetPassword_post.dart';
7
-import 'package:employee_selfservice_mobile/Screens/Login/background.dart';
8
-import 'package:employee_selfservice_mobile/Screens/Login/inputWidget.dart';
9
-import 'package:employee_selfservice_mobile/Screens/Login/login_screen.dart';
10
-import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
11
-
12
-class ForgotPasswordView extends StatefulWidget {
13
-  @override
14
-  _ForgotPasswordView createState() => _ForgotPasswordView();
15
-}
16
-
17
-class _ForgotPasswordView extends State<ForgotPasswordView> {
18
-  @override
19
-  Widget build(BuildContext context) {
20
-    return Scaffold(
21
-        resizeToAvoidBottomInset: false,
22
-        backgroundColor: Colors.white,
23
-        body: Stack(
24
-          children: <Widget>[
25
-            Background(),
26
-            ForgotPasswordScreen(),
27
-          ],
28
-        ));
29
-  }
30
-}
31
-
32
-class ForgotPasswordScreen extends StatelessWidget {
33
-  const ForgotPasswordScreen({Key? key}) : super(key: key);
34
-
35
-  @override
36
-  Widget build(BuildContext context) {
37
-    ProgressDialog loading = ProgressDialog(context);
38
-    loading = ProgressDialog(context,
39
-        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
40
-    loading.style(
41
-        message: 'Please Wait .....',
42
-        borderRadius: 5,
43
-        backgroundColor: Colors.white,
44
-        progressWidget: CircularProgressIndicator(),
45
-        elevation: 10.0,
46
-        padding: EdgeInsets.all(10),
47
-        insetAnimCurve: Curves.easeInOut,
48
-        progress: 0.0,
49
-        maxProgress: 100.0,
50
-        progressTextStyle: TextStyle(
51
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
52
-        messageTextStyle: TextStyle(
53
-            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
54
-    return Column(
55
-      children: <Widget>[
56
-        Padding(
57
-          padding:
58
-              EdgeInsets.only(top: MediaQuery.of(context).size.height / 2.45),
59
-        ),
60
-        Column(
61
-          children: <Widget>[
62
-            Column(
63
-              crossAxisAlignment: CrossAxisAlignment.center,
64
-              children: <Widget>[
65
-                Padding(
66
-                  padding: EdgeInsets.only(top: 0),
67
-                  child: Text(
68
-                    "Forgot Password",
69
-                    style: GoogleFonts.knewave(
70
-                        color: Colors.blueAccent, fontSize: 25),
71
-                  ),
72
-                ),
73
-              ],
74
-            ),
75
-            Column(
76
-              crossAxisAlignment: CrossAxisAlignment.start,
77
-              children: <Widget>[
78
-                Padding(
79
-                  padding: EdgeInsets.only(left: 40, bottom: 5, top: 20),
80
-                  child: Text(
81
-                    "Email",
82
-                    style: TextStyle(fontSize: 16, color: Colors.black87),
83
-                  ),
84
-                ),
85
-                Stack(
86
-                  alignment: Alignment.bottomRight,
87
-                  children: <Widget>[
88
-                    InputWidgetEmail(20.0, 20.0),
89
-                    Padding(
90
-                      padding: EdgeInsets.only(right: 15),
91
-                      child: Row(
92
-                        children: <Widget>[
93
-                          Expanded(
94
-                              child: Padding(
95
-                            padding: EdgeInsets.only(top: 0),
96
-                          )),
97
-                          InkWell(
98
-                            child: Container(
99
-                              padding: EdgeInsets.all(10),
100
-                              decoration: ShapeDecoration(
101
-                                shape: CircleBorder(),
102
-                                gradient: LinearGradient(
103
-                                    colors: Gradients2,
104
-                                    begin: Alignment.topLeft,
105
-                                    end: Alignment.bottomRight),
106
-                              ),
107
-                              child: ImageIcon(
108
-                                AssetImage("assets/images/ic_forward.png"),
109
-                                size: 40,
110
-                                color: Colors.white,
111
-                              ),
112
-                            ),
113
-                            onTap: () async {
114
-                              if (emailController.text.toString().isEmpty){
115
-                                Fluttertoast.showToast(
116
-                                    msg: "Email Required",
117
-                                    toastLength: Toast.LENGTH_SHORT,
118
-                                    gravity: ToastGravity.CENTER,
119
-                                    timeInSecForIosWeb: 1,
120
-                                    textColor: Colors.white,
121
-                                    fontSize: 16.0);
122
-                              } else {
123
-                                await loading.show();
124
-                                ResetPassword_Post.connectToAPI(emailController.text.toString())
125
-                                    .then((valueResult) async{
126
-                                  Map<String, dynamic> object = json.decode(valueResult);
127
-                                  if (object.containsKey("result").toString() == "true") {
128
-                                    String status = object['result']['status'].toString();
129
-                                    String message = object['result']['message'].toString();
130
-                                    if (status == "success") {
131
-                                      emailController.clear();
132
-                                      await loading.hide();
133
-                                      Widget okButton = TextButton(
134
-                                        child: Text("OK"),
135
-                                        onPressed: () {
136
-                                          Navigator.of(context, rootNavigator: true).pop();
137
-                                          Navigator.pushAndRemoveUntil(
138
-                                              context,
139
-                                              MaterialPageRoute(
140
-                                                  builder: (context) => LoginView()),
141
-                                                  (route) => false);
142
-                                        },
143
-                                      );
144
-
145
-                                      // set up the AlertDialog
146
-                                      AlertDialog alert = AlertDialog(
147
-                                        title: Text("Employee Self Service"),
148
-                                        //content: Text(message),
149
-                                        content: Text("Link to reset password has been sent to your email address"),
150
-                                        actions: [
151
-                                          okButton,
152
-                                        ],
153
-                                      );
154
-                                      // show the dialog
155
-                                      showDialog(
156
-                                        context: context,
157
-                                        barrierDismissible: false,
158
-                                        builder: (BuildContext context) {
159
-                                          return alert;
160
-                                        },
161
-                                      );
162
-                                    } else if (status == "failed") {
163
-                                      await loading.hide();
164
-                                      Widget okButton = TextButton(
165
-                                        child: Text("Back"),
166
-                                        onPressed: () {
167
-                                          Navigator.of(context, rootNavigator: true).pop();
168
-                                        },
169
-                                      );
170
-
171
-                                      // set up the AlertDialog
172
-                                      AlertDialog alert = AlertDialog(
173
-                                        title: Text("Employee Self Service"),
174
-                                        //content: Text(message),
175
-                                        content: Text("Your email has not been registered"),
176
-                                        actions: [
177
-                                          okButton,
178
-                                        ],
179
-                                      );
180
-                                      // show the dialog
181
-                                      showDialog(
182
-                                        context: context,
183
-                                        barrierDismissible: false,
184
-                                        builder: (BuildContext context) {
185
-                                          return alert;
186
-                                        },
187
-                                      );
188
-                                      /*Fluttertoast.showToast(
189
-                                          msg: message,
190
-                                          toastLength: Toast.LENGTH_SHORT,
191
-                                          gravity: ToastGravity.CENTER,
192
-                                          timeInSecForIosWeb: 1,
193
-                                          textColor: Colors.white,
194
-                                          fontSize: 16.0);*/
195
-                                    }
196
-                                  } else {
197
-                                    Fluttertoast.showToast(
198
-                                        msg: "Server Response Error",
199
-                                        toastLength: Toast.LENGTH_SHORT,
200
-                                        gravity: ToastGravity.CENTER,
201
-                                        timeInSecForIosWeb: 1,
202
-                                        textColor: Colors.white,
203
-                                        fontSize: 16.0);
204
-                                    await loading.hide();
205
-                                  }
206
-                                });
207
-                              }
208
-                            },
209
-                          )
210
-                        ],
211
-                      ),
212
-                    ),
213
-                  ],
214
-                ),
215
-              ],
216
-            ),
217
-            Padding(
218
-              padding: EdgeInsets.only(bottom: 10),
219
-            ),
220
-          ],
221
-        )
222
-      ],
223
-    );
224
-  }
225
-}
226
-
227
-Widget roundedRectButton(
228
-    String title, List<Color> gradient, bool isEndIconVisible) {
229
-  return Builder(builder: (BuildContext mContext) {
230
-    return Align(
231
-      alignment: Alignment.centerLeft,
232
-      child: Stack(
233
-        children: <Widget>[
234
-          Container(
235
-            alignment: Alignment.centerRight,
236
-            width: MediaQuery.of(mContext).size.width / 2.5,
237
-            decoration: ShapeDecoration(
238
-              shape: RoundedRectangleBorder(
239
-                  borderRadius: BorderRadius.only(
240
-                      topRight: Radius.circular(20.0),
241
-                      bottomRight: Radius.circular(20.0))),
242
-              gradient: LinearGradient(
243
-                  colors: gradient,
244
-                  begin: Alignment.topLeft,
245
-                  end: Alignment.bottomRight),
246
-            ),
247
-            child: Text(title,
248
-                style: TextStyle(
249
-                    color: Colors.white,
250
-                    fontSize: 15,
251
-                    fontWeight: FontWeight.w500)),
252
-            padding: EdgeInsets.all(10),
253
-          ),
254
-          Visibility(
255
-            visible: isEndIconVisible,
256
-            child: Padding(
257
-                padding: EdgeInsets.only(right: 10),
258
-                child: ImageIcon(
259
-                  AssetImage("assets/images/ic_forward.png"),
260
-                  size: 30,
261
-                  color: Colors.white,
262
-                )),
263
-          ),
264
-        ],
265
-      ),
266
-    );
267
-  });
268
-}
269
-
270
-//Alert Dialog
271
-showAlertDialog(BuildContext context) {
272
-  // set up the button
273
-  Widget okButton = TextButton(
274
-    child: Text("OK"),
275
-    onPressed: () {
276
-      Navigator.of(context, rootNavigator: true).pop();
277
-      Navigator.pushAndRemoveUntil(
278
-          context,
279
-          MaterialPageRoute(
280
-              builder: (context) => LoginView()),
281
-              (route) => false);
282
-    },
283
-  );
284
-
285
-  // set up the AlertDialog
286
-  AlertDialog alert = AlertDialog(
287
-    title: Text("Employee Self Service"),
288
-    content: Text("Please check your email."),
289
-    actions: [
290
-      okButton,
291
-    ],
292
-  );
293
-
294
-  // show the dialog
295
-  showDialog(
296
-    context: context,
297
-    barrierDismissible: false,
298
-    builder: (BuildContext context) {
299
-      return alert;
300
-    },
301
-  );
302
-}
303
-
304
-const List<Color> Gradients1 = [
305
-  Color(0xFF0EDED2),
306
-  Color(0xFF03A0FE),
307
-];
308
-
309
-const List<Color> Gradients2 = [
310
-  Color(0xFFFF9945),
311
-  Color(0xFFFc6076),
312
-];

+ 80
- 267
lib/Screens/Home/home_screen.dart Просмотреть файл

@@ -1,37 +1,21 @@
1 1
 import 'dart:async';
2
-import 'dart:convert';
3
-import 'dart:typed_data';
4
-
5 2
 import 'package:connectivity_plus/connectivity_plus.dart';
6 3
 import 'package:double_back_to_close/double_back_to_close.dart';
4
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/canvasing_screen.dart';
5
+import 'package:employee_selfservice_mobile/Screens/Menu/Dashboard/dashboard_screen.dart';
6
+import 'package:employee_selfservice_mobile/Screens/Menu/History/history_screen.dart';
7 7
 import 'package:flutter/cupertino.dart';
8 8
 import 'package:flutter/material.dart';
9
-import 'package:fluttertoast/fluttertoast.dart';
10 9
 import 'package:focus_detector/focus_detector.dart';
11 10
 import 'package:google_fonts/google_fonts.dart';
12 11
 import 'package:employee_selfservice_mobile/Screens/Menu/About/about_screen.dart';
13
-import 'package:employee_selfservice_mobile/Screens/Menu/Absensi/absensi_screen.dart';
14
-import 'package:employee_selfservice_mobile/Screens/Menu/AjukanCuti/ajukancuti_screen.dart';
15
-import 'package:employee_selfservice_mobile/Screens/Menu/Reimburse/reimburse_screen.dart';
16 12
 import 'package:employee_selfservice_mobile/Screens/Settings/settings_screen.dart';
17 13
 import 'package:lottie/lottie.dart';
18
-import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
19
-import 'package:shared_preferences/shared_preferences.dart';
20 14
 import 'dart:developer' as logDev;
21
-import '../Settings/RequestHttp/getDetail_post.dart';
22
-import '../Settings/RequestHttp/getProfileImage_post.dart';
23 15
 import 'package:internet_connection_checker/internet_connection_checker.dart';
24 16
 
25
-late String nameShared;
26
-String name = "",
27
-    statusDetail = "",
28
-    dateOfBirth = "",
29
-    phone = "",
30
-    email = "",
31
-    address = "",
32
-    position = "";
33
-var _imageToShow;
34 17
 
18
+var _imageToShow;
35 19
 
36 20
 class HomeView extends StatefulWidget {
37 21
   @override
@@ -43,15 +27,12 @@ class _HomeView extends State<HomeView> {
43 27
   bool isDeviceConnected = false;
44 28
   bool isAlertSet = false;
45 29
 
46
-  //var _imageToShow;
47
-
48 30
   @override
49 31
   initState() {
50 32
     getConnectivity();
51 33
     /*getDetail();*/
52 34
     _imageToShow = AssetImage('assets/images/ic_pp_2.png');
53 35
     WidgetsBinding.instance.addPostFrameCallback((_) {
54
-      //getProfileImage();
55 36
       _imageToShow = AssetImage('assets/icons/ic_pp_2.png');
56 37
     });
57 38
     super.initState();
@@ -74,130 +55,6 @@ class _HomeView extends State<HomeView> {
74 55
     super.dispose();
75 56
   }
76 57
 
77
-  //Get Profile image
78
-  /*getProfileImage() async {
79
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
80
-    final session = prefs.getString('session');
81
-
82
-    ProgressDialog loading = ProgressDialog(context);
83
-    loading = ProgressDialog(context,
84
-        type: ProgressDialogType.normal,
85
-        isDismissible: false,
86
-        showLogs: true);
87
-    loading.style(
88
-        message: 'Please Wait .....',
89
-        borderRadius: 5,
90
-        backgroundColor: Colors.white,
91
-        progressWidget: CircularProgressIndicator(),
92
-        elevation: 10.0,
93
-        padding: EdgeInsets.all(10),
94
-        insetAnimCurve: Curves.easeInOut,
95
-        progress: 0.0,
96
-        maxProgress: 100.0,
97
-        progressTextStyle: TextStyle(
98
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
99
-        messageTextStyle: TextStyle(
100
-            color: Colors.black,
101
-            fontSize: 15.0,
102
-            fontWeight: FontWeight.w600));
103
-
104
-    await loading.show();
105
-
106
-    GetProfileImage_Post.connectToAPI(session!).then((valueResult) async {
107
-      Map<String, dynamic> object = json.decode(valueResult);
108
-      if (object.containsKey("result").toString() == "true") {
109
-        String status = object['result']['status'].toString();
110
-        logDev.log(status, name: "STATUS GET PROFILE");
111
-        if (status == "success") {
112
-          String photo = object['result']['photo'].toString();
113
-          if (photo == "false") {
114
-            setState(() {
115
-              _imageToShow = AssetImage('assets/icons/ic_pp_2.png');
116
-            });
117
-          } else if (photo != "false") {
118
-            Uint8List decodedBytes = Base64Decoder().convert(photo);
119
-            setState(() {
120
-              _imageToShow = Image.memory(decodedBytes, gaplessPlayback: true).image;
121
-            });
122
-          }
123
-        } else if (status == "failed") {
124
-          String message = object['result']['message'].toString();
125
-          Fluttertoast.showToast(
126
-              msg: message,
127
-              toastLength: Toast.LENGTH_LONG,
128
-              gravity: ToastGravity.CENTER,
129
-              timeInSecForIosWeb: 1,
130
-              textColor: Colors.white,
131
-              fontSize: 16.0);
132
-        }
133
-      } else {
134
-        Fluttertoast.showToast(
135
-            msg: "Server Response Error",
136
-            toastLength: Toast.LENGTH_SHORT,
137
-            gravity: ToastGravity.CENTER,
138
-            timeInSecForIosWeb: 1,
139
-            textColor: Colors.white,
140
-            fontSize: 16.0);
141
-      }
142
-      await loading.hide();
143
-    });
144
-    return _imageToShow;
145
-  }*/
146
-
147
-  //GetDetail
148
-  getDetail() async {
149
-    GetDetail_Post.connectToAPI().then((valueResult) async {
150
-      Map<String, dynamic> object = json.decode(valueResult);
151
-      if (object.containsKey("result").toString() == "true") {
152
-        statusDetail = object['result']['status'].toString();
153
-        String message = object['result']['message'].toString();
154
-        if (statusDetail == "failed" || message == "User Not Found") {
155
-          Fluttertoast.showToast(
156
-              msg: message + ", Please login again!",
157
-              toastLength: Toast.LENGTH_SHORT,
158
-              gravity: ToastGravity.CENTER,
159
-              timeInSecForIosWeb: 1,
160
-              textColor: Colors.white,
161
-              fontSize: 16.0);
162
-        } else if (statusDetail != "failed") {
163
-          name = object['result']['name'].toString();
164
-          dateOfBirth = object['result']['date_of_birth'].toString();
165
-          phone = object['result']['phone'].toString();
166
-          email = object['result']['email'].toString();
167
-          address = object['result']['address'].toString();
168
-          position = object['result']['position'].toString();
169
-
170
-          var prefs = await SharedPreferences.getInstance();
171
-          if (position == "false") {
172
-            position = "-";
173
-            await prefs.setString('position', position);
174
-          } else {
175
-            await prefs.setString('position', position);
176
-          }
177
-        }
178
-      } else {
179
-        Fluttertoast.showToast(
180
-            msg: "Server Response Error",
181
-            toastLength: Toast.LENGTH_SHORT,
182
-            gravity: ToastGravity.CENTER,
183
-            timeInSecForIosWeb: 1,
184
-            textColor: Colors.white,
185
-            fontSize: 16.0);
186
-      }
187
-    });
188
-  }
189
-
190
-  int _selectedIndex = 0;
191
-
192
-  void _onItemTapped(int index) {
193
-    setState(() {
194
-      _selectedIndex = index;
195
-      if (index == 0) {
196
-
197
-      }
198
-    });
199
-  }
200
-
201 58
   @override
202 59
   Widget build(BuildContext context) {
203 60
     return MaterialApp(
@@ -273,7 +130,8 @@ class BottomNavBar extends StatefulWidget {
273 130
 class _BottomNavBarState extends State<BottomNavBar> {
274 131
   List<Widget> _widgetOptions = <Widget>[
275 132
     HomeScreen(),
276
-    SettingsScreen(),
133
+    HomeScreen(),
134
+    HomeScreen(),
277 135
   ];
278 136
 
279 137
   int _selectedIndex = 0;
@@ -316,53 +174,7 @@ class HomeScreen extends StatefulWidget {
316 174
 }
317 175
 
318 176
 class _HomeScreenState extends State<HomeScreen> {
319
-  //Get Profile image
320
-  /*getProfileImage() async {
321
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
322
-    final session = prefs.getString('session');
323
-
324
-    GetProfileImage_Post.connectToAPI(session!).then((valueResult) async {
325
-      Map<String, dynamic> object = json.decode(valueResult);
326
-      if (object.containsKey("result").toString() == "true") {
327
-        String status = object['result']['status'].toString();
328
-        logDev.log(status, name: "STATUS GET PROFILE");
329
-        if (status == "success") {
330
-          String photo = object['result']['photo'].toString();
331
-          if (photo == "false") {
332
-            setState(() {
333
-              _imageToShow = AssetImage('assets/icons/ic_pp_2.png');
334
-            });
335
-          } else if (photo != "false") {
336
-            Uint8List decodedBytes = Base64Decoder().convert(photo);
337
-            //logDev.log(decodedBytes.toString(), name: "DECODED BYTES photo");
338
-            setState(() {
339
-              _imageToShow = Image.memory(decodedBytes, gaplessPlayback: true).image;
340
-            });
341
-          }
342
-        } else if (status == "failed") {
343
-          String message = object['result']['message'].toString();
344
-          Fluttertoast.showToast(
345
-              msg: message,
346
-              toastLength: Toast.LENGTH_LONG,
347
-              gravity: ToastGravity.CENTER,
348
-              timeInSecForIosWeb: 1,
349
-              textColor: Colors.white,
350
-              fontSize: 16.0);
351
-        }
352
-      } else {
353
-        Fluttertoast.showToast(
354
-            msg: "Server Response Error",
355
-            toastLength: Toast.LENGTH_SHORT,
356
-            gravity: ToastGravity.CENTER,
357
-            timeInSecForIosWeb: 1,
358
-            textColor: Colors.white,
359
-            fontSize: 16.0);
360
-      }
361
-    });
362
-    return _imageToShow;
363
-  }*/
364
-
365
-  @override
177
+    @override
366 178
   Widget build(BuildContext context) {
367 179
     var size = MediaQuery
368 180
         .of(context)
@@ -458,7 +270,7 @@ class _HomeScreenState extends State<HomeScreen> {
458 270
                                   decoration: BoxDecoration(
459 271
                                     color: Colors.black,
460 272
                                     image: DecorationImage(
461
-                                      image: _imageToShow,
273
+                                      image: AssetImage('assets/icons/ic_pp_2.png'),
462 274
                                       fit: BoxFit.cover,
463 275
                                     ),
464 276
                                     shape: BoxShape.circle,
@@ -492,7 +304,7 @@ class _HomeScreenState extends State<HomeScreen> {
492 304
                                           Container(
493 305
                                             width: size.width * 0.18,
494 306
                                             child: Image.asset(
495
-                                                "assets/icons/menu/ic_absensi_3.png",
307
+                                                "assets/icons/menu/ic_canvasing_3.png",
496 308
                                                 fit: BoxFit.contain)
497 309
                                           ),
498 310
                                           Container(
@@ -514,85 +326,86 @@ class _HomeScreenState extends State<HomeScreen> {
514 326
                                       context,
515 327
                                       MaterialPageRoute(
516 328
                                           builder: (context) =>
517
-                                              AbsensiScreen()));
329
+                                              CanvasingScreen()));
518 330
                                 }),
519 331
                             InkWell(
520
-                              child: Container(
521
-                                width: size.width,
522
-                                height: size.height,
523
-                                decoration: BoxDecoration(
524
-                                    color: Color(0xFFD0D0D0),
525
-                                    borderRadius: BorderRadius.circular(5)),
526
-                                child: Column(
527
-                                  crossAxisAlignment: CrossAxisAlignment.center,
528
-                                  mainAxisAlignment: MainAxisAlignment.center,
529
-                                  children: <Widget>[
530
-                                    Container(
531
-                                      width: size.width * 0.18,
532
-                                      child: Image.asset(
533
-                                        "assets/icons/menu/ic_cuti_4.png",
534
-                                        fit: BoxFit.contain),
535
-                                    ),
536
-                                    Container(
537
-                                      margin: EdgeInsets.only(top: 5),
538
-                                      child: Text(
539
-                                        'Leaves',
540
-                                        textAlign: TextAlign.center,
541
-                                        style: GoogleFonts.acme(
542
-                                            fontSize: size.width * 0.045,
543
-                                            color: Colors.black),
332
+                                child: Container(
333
+                                    width: size.width,
334
+                                    height: size.height,
335
+                                    decoration: BoxDecoration(
336
+                                        color: Color(0xFFD0D0D0),
337
+                                        borderRadius: BorderRadius.circular(5)),
338
+                                    child: Center(
339
+                                      child: Column(
340
+                                        crossAxisAlignment: CrossAxisAlignment.center,
341
+                                        mainAxisAlignment: MainAxisAlignment.center,
342
+                                        children: <Widget>[
343
+                                          Container(
344
+                                              width: size.width * 0.18,
345
+                                              child: Image.asset(
346
+                                                  "assets/icons/menu/ic_dashboardcanvasing_1.png",
347
+                                                  fit: BoxFit.contain)
348
+                                          ),
349
+                                          Container(
350
+                                            margin: EdgeInsets.only(top: 5),
351
+                                            child: Text(
352
+                                              'Dashboard Canvasing',
353
+                                              textAlign: TextAlign.center,
354
+                                              style: GoogleFonts.acme(
355
+                                                  fontSize: size.width * 0.045,
356
+                                                  color: Colors.black),
357
+                                            ),
358
+                                          )
359
+                                        ],
544 360
                                       ),
545 361
                                     )
546
-                                  ],
547 362
                                 ),
548
-                              ),
549
-                              onTap: () {
550
-                                Navigator.push(
551
-                                    context,
552
-                                    MaterialPageRoute(
553
-                                        builder: (context) =>
554
-                                            AjukanCutiScreen()));
555
-                              },
556
-                            ),
363
+                                onTap: () {
364
+                                  Navigator.push(
365
+                                      context,
366
+                                      MaterialPageRoute(
367
+                                          builder: (context) =>
368
+                                              DashboardScreen()));
369
+                                }),
557 370
                             InkWell(
558
-                              child: Container(
559
-                                width: size.width,
560
-                                height: size.height,
561
-                                decoration: BoxDecoration(
562
-                                    color: Color(0xFFD0D0D0),
563
-                                    borderRadius: BorderRadius.circular(5)),
564
-                                child: Column(
565
-                                  crossAxisAlignment: CrossAxisAlignment.center,
566
-                                  mainAxisAlignment: MainAxisAlignment.center,
567
-                                  children: <Widget>[
568
-                                    Container(
569
-                                      width: size.width * 0.18,
570
-                                      child: Image.asset(
571
-                                        "assets/icons/menu/ic_reimburse_4.png",
572
-                                        fit: BoxFit.contain,
573
-                                      ),
574
-                                    ),
575
-                                    Container(
576
-                                      margin: EdgeInsets.only(top: 5),
577
-                                      child: Text(
578
-                                        'Reimburse',
579
-                                        textAlign: TextAlign.center,
580
-                                        style: GoogleFonts.acme(
581
-                                            fontSize: size.width * 0.045,
582
-                                            color: Colors.black),
371
+                                child: Container(
372
+                                    width: size.width,
373
+                                    height: size.height,
374
+                                    decoration: BoxDecoration(
375
+                                        color: Color(0xFFD0D0D0),
376
+                                        borderRadius: BorderRadius.circular(5)),
377
+                                    child: Center(
378
+                                      child: Column(
379
+                                        crossAxisAlignment: CrossAxisAlignment.center,
380
+                                        mainAxisAlignment: MainAxisAlignment.center,
381
+                                        children: <Widget>[
382
+                                          Container(
383
+                                              width: size.width * 0.18,
384
+                                              child: Image.asset(
385
+                                                  "assets/icons/menu/ic_history.png",
386
+                                                  fit: BoxFit.contain)
387
+                                          ),
388
+                                          Container(
389
+                                            margin: EdgeInsets.only(top: 5),
390
+                                            child: Text(
391
+                                              'History Canvasing',
392
+                                              textAlign: TextAlign.center,
393
+                                              style: GoogleFonts.acme(
394
+                                                  fontSize: size.width * 0.045,
395
+                                                  color: Colors.black),
396
+                                            ),
397
+                                          )
398
+                                        ],
583 399
                                       ),
584 400
                                     )
585
-                                  ],
586 401
                                 ),
587
-                              ),
588
-                              onTap: () {
589
-                                Navigator.push(
590
-                                    context,
591
-                                    MaterialPageRoute(
592
-                                        builder: (context) =>
593
-                                            ReimburseScreen()));
594
-                              },
595
-                            ),
402
+                                onTap: () {
403
+                                  Navigator.push(
404
+                                      context,
405
+                                      MaterialPageRoute(
406
+                                          builder: (context) =>
407
+                                              HistoryScreen()));
408
+                                }),
596 409
                             InkWell(
597 410
                               child: Container(
598 411
                                 width: size.width,

+ 1
- 1
lib/Screens/Login/inputWidget.dart Просмотреть файл

@@ -33,7 +33,7 @@ class InputWidgetEmail extends StatelessWidget {
33 33
                     minWidth: 40,
34 34
                     minHeight: 40,
35 35
                   ),
36
-                  hintText: "hris_selfservice@example.com",
36
+                  hintText: "username",
37 37
                   hintStyle: TextStyle(color: Color(0xFFE1E1E1), fontSize: 16)),
38 38
               validator: (text) {
39 39
                 if (text!.contains('@') && text.isNotEmpty) {

+ 33
- 18
lib/Screens/Login/login_screen.dart Просмотреть файл

@@ -1,11 +1,8 @@
1 1
 import 'dart:async';
2
-import 'dart:convert';
3
-import 'package:firebase_messaging/firebase_messaging.dart';
4 2
 import 'package:flutter/material.dart';
5 3
 import 'package:flutter/services.dart';
6 4
 import 'package:fluttertoast/fluttertoast.dart';
7 5
 import 'package:google_fonts/google_fonts.dart';
8
-import 'package:employee_selfservice_mobile/Screens/ForgotPassword/forgotPassword_screen.dart';
9 6
 import 'package:employee_selfservice_mobile/Screens/Login/background.dart';
10 7
 import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
11 8
 import 'package:shared_preferences/shared_preferences.dart';
@@ -13,9 +10,6 @@ import '../Home/home_screen.dart';
13 10
 import 'inputWidget.dart';
14 11
 import 'dart:developer' as logDev;
15 12
 
16
-import 'login_post.dart';
17
-
18
-
19 13
 class LoginView extends StatefulWidget {
20 14
   @override
21 15
   _LoginView createState() => _LoginView();
@@ -104,8 +98,8 @@ class _LoginScreenState extends State<LoginScreen> {
104 98
                   Padding(
105 99
                     padding: EdgeInsets.only(left: 40, bottom: 5, top: 20),
106 100
                     child: Text(
107
-                      "Email",
108
-                      style: TextStyle(fontSize: 16, color: Colors.black87),
101
+                      "Username",
102
+                      style: TextStyle(fontSize: 16, color: Colors.black87, fontWeight: FontWeight.bold),
109 103
                     ),
110 104
                   ),
111 105
                   Stack(
@@ -125,7 +119,7 @@ class _LoginScreenState extends State<LoginScreen> {
125 119
                     padding: EdgeInsets.only(left: 40, bottom: 5),
126 120
                     child: Text(
127 121
                       "Password",
128
-                      style: TextStyle(fontSize: 16, color: Colors.black87),
122
+                      style: TextStyle(fontSize: 16, color: Colors.black87, fontWeight: FontWeight.bold),
129 123
                     ),
130 124
                   ),
131 125
                   Stack(
@@ -160,16 +154,37 @@ class _LoginScreenState extends State<LoginScreen> {
160 154
                                 if (!validateForm(context)) {
161 155
                                   return;
162 156
                                 } else {
163
-                                  Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => HomeView()));
157
+                                  //Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => HomeView()));
158
+                                  if (emailController.text.toString() == "user1"){
159
+                                    var prefs = await SharedPreferences.getInstance();
160
+                                    await prefs.setInt('user_id', 2);
161
+                                    emailController.clear();
162
+                                    passwordController.clear();
163
+                                    Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => HomeView()));
164
+                                  } else if (emailController.text.toString() == "user2"){
165
+                                    var prefs = await SharedPreferences.getInstance();
166
+                                    await prefs.setInt('user_id', 6);
167
+                                    emailController.clear();
168
+                                    passwordController.clear();
169
+                                    Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => HomeView()));
170
+                                  } else {
171
+                                    Fluttertoast.showToast(
172
+                                        msg: "Wrong Username or Password!",
173
+                                        toastLength: Toast.LENGTH_SHORT,
174
+                                        gravity: ToastGravity.CENTER,
175
+                                        timeInSecForIosWeb: 1,
176
+                                        textColor: Colors.white,
177
+                                        fontSize: 16.0);
178
+                                  }
164 179
                                 }
165 180
                               },
166 181
                             )
167 182
                           ],
168 183
                         ),
169 184
                       ),
170
-                      Padding(
185
+                      /*Padding(
171 186
                           padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom)
172
-                      )
187
+                      )*/
173 188
                     ],
174 189
                   ),
175 190
                 ],
@@ -177,15 +192,15 @@ class _LoginScreenState extends State<LoginScreen> {
177 192
               Padding(
178 193
                 padding: EdgeInsets.only(bottom: 10),
179 194
               ),
180
-              InkWell(
195
+              /*InkWell(
181 196
                   child:
182 197
                   roundedRectButton("Forgot Password?", Gradients1, false),
183
-                  onTap: () {
198
+                  onTap: () async {
184 199
                     Navigator.push(
185 200
                         context,
186 201
                         MaterialPageRoute(
187 202
                             builder: (context) => ForgotPasswordView()));
188
-                  })
203
+                  })*/
189 204
             ],
190 205
           )
191 206
         ],
@@ -255,14 +270,14 @@ bool validateForm(BuildContext context) {
255 270
     /*final snackBar = SnackBar(content: Text("Email Required"));
256 271
     ScaffoldMessenger.of(context).showSnackBar(snackBar);*/
257 272
     Fluttertoast.showToast(
258
-        msg: "Email Required",
273
+        msg: "Username Required",
259 274
         toastLength: Toast.LENGTH_SHORT,
260 275
         gravity: ToastGravity.CENTER,
261 276
         timeInSecForIosWeb: 1,
262 277
         textColor: Colors.white,
263 278
         fontSize: 16.0);
264 279
     result = false;
265
-  } else if (!emailController.text.toString().contains("@")) {
280
+  } /*else if (!emailController.text.toString().contains("@")) {
266 281
     Fluttertoast.showToast(
267 282
         msg: "Incorrect email format",
268 283
         toastLength: Toast.LENGTH_SHORT,
@@ -271,7 +286,7 @@ bool validateForm(BuildContext context) {
271 286
         textColor: Colors.white,
272 287
         fontSize: 16.0);
273 288
     result = false;
274
-  } else if (passwordController.text.toString().isEmpty) {
289
+  }*/ else if (passwordController.text.toString().isEmpty) {
275 290
     Fluttertoast.showToast(
276 291
         msg: "Password Required",
277 292
         toastLength: Toast.LENGTH_SHORT,

+ 2
- 1
lib/Screens/Menu/About/about_screen.dart Просмотреть файл

@@ -1,7 +1,8 @@
1 1
 import 'package:flutter/material.dart';
2 2
 import 'package:google_fonts/google_fonts.dart';
3 3
 
4
-import '../SlipGaji/background.dart';
4
+import '../../background.dart';
5
+
5 6
 
6 7
 class AboutScreen extends StatefulWidget {
7 8
   const AboutScreen({Key? key}) : super(key: key);

+ 0
- 36
lib/Screens/Menu/Absensi/RequestHttp/checkIn_post.dart Просмотреть файл

@@ -1,36 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:http/http.dart' as http;
4
-import 'package:employee_selfservice_mobile/constants.dart';
5
-import 'dart:developer' as developer;
6
-
7
-import 'package:shared_preferences/shared_preferences.dart';
8
-
9
-class CheckIn_Post {
10
-  late String session;
11
-  late String coordinate;
12
-
13
-  CheckIn_Post({required this.session});
14
-
15
-  static Future<String> connectToAPI(String coordinate) async {
16
-    String URL = baseURL + "/api/v1/check_in";
17
-
18
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
19
-    final session = prefs.getString('session');
20
-
21
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
22
-      "data": [
23
-        {
24
-          "session" : session,
25
-          "coordinate" : coordinate
26
-        }
27
-      ]
28
-    }), headers: {
29
-      "Content-Type": "application/json",
30
-      "Api-key": apiKey
31
-    });
32
-
33
-    developer.log(sendData.body, name: "Get Check In Result");
34
-    return sendData.body;
35
-  }
36
-}

+ 0
- 36
lib/Screens/Menu/Absensi/RequestHttp/checkOut_post.dart Просмотреть файл

@@ -1,36 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:http/http.dart' as http;
4
-import 'package:employee_selfservice_mobile/constants.dart';
5
-import 'dart:developer' as developer;
6
-
7
-import 'package:shared_preferences/shared_preferences.dart';
8
-
9
-class CheckOut_Post {
10
-  late String session;
11
-  late String coordinate;
12
-
13
-  CheckOut_Post({required this.session});
14
-
15
-  static Future<String> connectToAPI(String coordinate) async {
16
-    String URL = baseURL + "/api/v1/check_out";
17
-
18
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
19
-    final session = prefs.getString('session');
20
-
21
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
22
-      "data": [
23
-        {
24
-          "session": session,
25
-          "coordinate" : coordinate
26
-        }
27
-      ]
28
-    }), headers: {
29
-      "Content-Type": "application/json",
30
-      "Api-key": apiKey
31
-    });
32
-
33
-    //developer.log(sendData.body, name: "Get Check Out Result");
34
-    return sendData.body;
35
-  }
36
-}

+ 0
- 494
lib/Screens/Menu/Absensi/absensi_history_screen.dart Просмотреть файл

@@ -1,494 +0,0 @@
1
-import 'dart:convert';
2
-import 'package:firebase_core/firebase_core.dart';
3
-import 'package:firebase_crashlytics/firebase_crashlytics.dart';
4
-import 'package:flutter/material.dart';
5
-import 'package:google_fonts/google_fonts.dart';
6
-import 'package:employee_selfservice_mobile/constants.dart';
7
-import 'package:intl/intl.dart';
8
-import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
9
-import 'dart:developer' as logDev;
10
-
11
-import '../AjukanCuti/backgroundHistory.dart';
12
-import 'RequestHttp/historyAbsensi_post.dart';
13
-
14
-class HistoryAbsensi extends StatefulWidget {
15
-  const HistoryAbsensi({Key? key}) : super(key: key);
16
-
17
-  @override
18
-  State<HistoryAbsensi> createState() => _HistoryAbsensi();
19
-}
20
-
21
-class _HistoryAbsensi extends State<HistoryAbsensi> {
22
-  late List <String> id_List;
23
-  late List <String> employee_name_List;
24
-  late List <String> check_in_List;
25
-  late List <String> check_out_List;
26
-  late List <String> worked_hours_List;
27
-
28
-  late List <String> dayDate_List;
29
-  late List <String> date_List;
30
-  late List <String> month_List;
31
-
32
-  //late List <String> workingHours_List;
33
-  late List <String> showCheckIn_List;
34
-  late List <String> showCheckOut_List;
35
-
36
-  int HistoryLength = 0;
37
-
38
-  //List Visibility Double Date
39
-  late List <bool> visibilityDate2;
40
-
41
-  late List <String> dayDate_list_2;
42
-  late List <String> date_list_2;
43
-  late List <String> month_list_2;
44
-
45
-
46
-  @override
47
-  initState() {
48
-    super.initState();
49
-    id_List = [""];
50
-    employee_name_List = [""];
51
-    check_in_List = [""];
52
-    check_out_List = [""];
53
-    worked_hours_List = [""];
54
-
55
-    dayDate_List = [""];
56
-    date_List = [""];
57
-    month_List = [""];
58
-
59
-    //workingHours_List = [""];
60
-    showCheckIn_List = [""];
61
-    showCheckOut_List = [""];
62
-
63
-    visibilityDate2 = [false];
64
-    dayDate_list_2 = [""];
65
-    date_list_2 = [""];
66
-    month_list_2 = [""];
67
-
68
-    WidgetsBinding.instance.addPostFrameCallback((_) async {
69
-      getHistoryData();
70
-    });
71
-  }
72
-
73
-  getHistoryData() async {
74
-    ProgressDialog loading = ProgressDialog(context);
75
-    loading = ProgressDialog(context,
76
-        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
77
-    loading.style(
78
-        message: 'Please Wait .....',
79
-        borderRadius: 3,
80
-        backgroundColor: Colors.white,
81
-        progressWidget: CircularProgressIndicator(),
82
-        elevation: 10.0,
83
-        padding: EdgeInsets.all(10),
84
-        insetAnimCurve: Curves.easeInOut,
85
-        progress: 0.0,
86
-        maxProgress: 100.0,
87
-        progressTextStyle: TextStyle(
88
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
89
-        messageTextStyle: TextStyle(
90
-            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
91
-
92
-    await loading.show();
93
-    HistoryAbsensi_Post.connectToAPI().then((valueResult) async {
94
-      Map<String, dynamic> object = jsonDecode(valueResult);
95
-      if (object.containsKey("result").toString() == "true") {
96
-        String result = object['result'].toString();
97
-        if (result.contains("failed")) {
98
-          await loading.hide();
99
-          alertDialogFailedRetrievedData(context);
100
-        } else {
101
-          List <dynamic> historyAbsensi = object['result'];
102
-          await loading.hide();
103
-          setState(() {
104
-            for (int i = 0; i < historyAbsensi.length; i++){
105
-              String id = historyAbsensi[i]['id'].toString();
106
-              String employee_name = historyAbsensi[i]['employee_name'].toString();
107
-              String check_in = historyAbsensi[i]['check_in'].toString();
108
-              String check_out = historyAbsensi[i]['check_out'].toString();
109
-              String worked_hours = historyAbsensi[i]['worked_hours'].toString();
110
-              //String coordinate = historyAbsensi[i]['coordinate'].toString();
111
-
112
-              double hours = double.parse(worked_hours);
113
-
114
-              //Jika Sudah Checkin
115
-              if (check_in != "false"){
116
-                //Convert UTC to Local Time - Check In Time
117
-                DateTime checkInTime = DateFormat("yyyy-MM-dd HH:mm:ss").parse(check_in, true);
118
-                String showCheckInTime = checkInTime.toLocal().toString().substring(11, 19);
119
-                showCheckIn_List.add(showCheckInTime.substring(0,5));
120
-                //Jika belum check in
121
-              } else if (check_in == "false"){
122
-                String show_check_in = "-";
123
-                showCheckIn_List.add(show_check_in);
124
-              }
125
-
126
-              //Jika Sudah Checkout
127
-              if (check_out != "false"){
128
-                //Convert UTC to Local Time - Check Out Time
129
-                DateTime checkOutTime = DateFormat("yyyy-MM-dd HH:mm:ss").parse(check_out, true);
130
-                String showCheckOutTime = checkOutTime.toLocal().toString().substring(11, 19);
131
-                showCheckOut_List.add(showCheckOutTime.substring(0,5));
132
-                //Jika tanggal check in sama dengan tanggal check out
133
-                if (check_in.substring(0, 10) == check_out.substring(0,10)){
134
-                  //Get Day Check In
135
-                  String dayDateIn = DateFormat('EEEE').format(DateTime.parse(check_in));
136
-                  String dateIn = DateFormat('dd').format(DateTime.parse(check_in));
137
-                  String monthIn = DateFormat('MMM').format(DateTime.parse(check_in));
138
-                  dayDate_List.add(dayDateIn.substring(0,3));
139
-                  date_List.add(dateIn);
140
-                  month_List.add(monthIn);
141
-
142
-                  dayDate_list_2.add("");
143
-                  date_list_2.add("");
144
-                  month_list_2.add("");
145
-
146
-                  visibilityDate2.add(false);
147
-
148
-                  //Jika tangagal check in tidak sama dengan tanggal checkout
149
-                } else if (check_in.substring(0, 10) != check_out.substring(0,10)){
150
-                  //Get Day Check In & Check Out
151
-                  String dayDateIn = DateFormat('EEEE').format(DateTime.parse(check_in));
152
-                  String dateIn = DateFormat('dd').format(DateTime.parse(check_in));
153
-                  String monthIn = DateFormat('MMM').format(DateTime.parse(check_in));
154
-
155
-                  String dayDateOut = DateFormat('EEEE').format(DateTime.parse(check_out));
156
-                  String dateOut = DateFormat('dd').format(DateTime.parse(check_out));
157
-                  String monthOut = DateFormat('MMM').format(DateTime.parse(check_out));
158
-
159
-                  dayDate_List.add(dayDateIn.substring(0,3));
160
-                  date_List.add(dateIn);
161
-                  month_List.add(monthIn);
162
-
163
-                  dayDate_list_2.add(dayDateOut.substring(0,3));
164
-                  date_list_2.add(dateOut);
165
-                  month_list_2.add(monthOut);
166
-
167
-                  visibilityDate2.add(true);
168
-                }
169
-                //Jika belum checkout
170
-              } else if (check_out == "false"){
171
-                String show_check_out = "-";
172
-                showCheckOut_List.add(show_check_out);
173
-
174
-                String dayDateIn = DateFormat('EEEE').format(DateTime.parse(check_in));
175
-                String dateIn = DateFormat('dd').format(DateTime.parse(check_in));
176
-                String monthIn = DateFormat('MMM').format(DateTime.parse(check_in));
177
-                dayDate_List.add(dayDateIn.substring(0,3));
178
-                date_List.add(dateIn);
179
-                month_List.add(monthIn);
180
-
181
-                visibilityDate2.add(false);
182
-
183
-                dayDate_list_2.add("");
184
-                date_list_2.add("");
185
-                month_list_2.add("");
186
-              }
187
-
188
-              /*if (check_in == "true" && check_out == "false"){
189
-                visibilityDate2.add(false);
190
-              } else if (check_in == "false" && check_out == "false"){
191
-                visibilityDate2.add(false);
192
-              } else if (check_in == "true" && check_out == "true"){
193
-                visibilityDate2.add(true);
194
-              }*/
195
-
196
-              id_List.add(id);
197
-              employee_name_List.add(employee_name);
198
-              check_in_List.add(check_in);
199
-              check_out_List.add(check_out);
200
-              worked_hours_List.add(hours.toStringAsFixed(3));
201
-            }
202
-
203
-            id_List.removeAt(0);
204
-            employee_name_List.removeAt(0);
205
-            check_in_List.removeAt(0);
206
-            check_out_List.removeAt(0);
207
-            worked_hours_List.removeAt(0);
208
-
209
-            dayDate_List.removeAt(0);
210
-            date_List.removeAt(0);
211
-            month_List.removeAt(0);
212
-
213
-            //workingHours_List.removeAt(0);
214
-            showCheckIn_List.removeAt(0);
215
-            showCheckOut_List.removeAt(0);
216
-
217
-            visibilityDate2.removeAt(0);
218
-            logDev.log(visibilityDate2.toString(), name: "VISIBILITY DATE");
219
-            dayDate_list_2.removeAt(0);
220
-            date_list_2.removeAt(0);
221
-            month_list_2.removeAt(0);
222
-
223
-            HistoryLength = historyAbsensi.length;
224
-          });
225
-        }
226
-      } else {
227
-        alertDialogFailedRetrievedData(context);
228
-        await loading.hide();
229
-      }
230
-    });
231
-  }
232
-
233
-  @override
234
-  Widget build(BuildContext context) {
235
-    var size = MediaQuery.of(context).size;
236
-    return Scaffold(
237
-      body: Stack(
238
-          children: [
239
-            Column(
240
-              children: <Widget>[
241
-                Stack(
242
-                  children: [
243
-                    WavyHeader(),
244
-                    Container(
245
-                        margin: EdgeInsets.only(
246
-                            top: (size.height / 6) - 20),
247
-                        padding: EdgeInsets.fromLTRB(0, 5, 25, 5),
248
-                        child: Row(
249
-                          mainAxisAlignment: MainAxisAlignment.end,
250
-                          crossAxisAlignment: CrossAxisAlignment.end,
251
-                          children: [
252
-                            Text(
253
-                              'Attendance History\t\t',
254
-                              maxLines: 1,
255
-                              style: GoogleFonts.luckiestGuy(
256
-                                fontSize: 28,
257
-                                color: Color(0xFF4858A7),
258
-                                //fontWeight: FontWeight.bold,
259
-                                fontStyle: FontStyle.italic,
260
-                              ),
261
-                            ),
262
-                            Image.asset(
263
-                              'assets/images/ic_history.png',
264
-                              width: 40,
265
-                              height: 40,
266
-                            ),
267
-                          ],
268
-                        )
269
-                    ),
270
-                  ],
271
-                ),
272
-              ],
273
-            ),
274
-            Container(
275
-              margin: EdgeInsets.only(top: (MediaQuery.of(context).size.height / 6) + 40,
276
-                  left: 5, right: 5, bottom: 10),
277
-              child: ListView.builder(
278
-                scrollDirection: Axis.vertical,
279
-                shrinkWrap: true,
280
-                itemCount: HistoryLength,
281
-                itemBuilder: (context, int i) {
282
-                  return Container(
283
-                    margin: EdgeInsets.fromLTRB(5, 5, 5, 5),
284
-                    child: InkWell(
285
-                      child: Card(
286
-                        elevation: 8,
287
-                        child: Container(
288
-                          padding: EdgeInsets.all(10),
289
-                          child: Row(
290
-                            children: [
291
-                              Expanded(
292
-                                flex: 3,
293
-                                child:
294
-                                Container(
295
-                                  alignment: Alignment.center,
296
-                                  padding: EdgeInsets.all(5),
297
-                                  decoration: BoxDecoration(
298
-                                      border: Border.all(color: Colors.black),
299
-                                      borderRadius: BorderRadius.all(Radius.circular(3)),
300
-                                  ),
301
-                                  child: Row(
302
-                                    crossAxisAlignment: CrossAxisAlignment.center,
303
-                                    mainAxisAlignment: MainAxisAlignment.center,
304
-                                    children: [
305
-                                      Column(
306
-                                        children: [
307
-                                          Text(dayDate_List[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center,),
308
-                                          Text(date_List[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center),
309
-                                          Text(month_List[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center),
310
-                                        ],
311
-                                      ),
312
-                                      Visibility(
313
-                                        visible: visibilityDate2[i],
314
-                                        child: Column(
315
-                                          children: [
316
-                                            Text("\t|\t", style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center,),
317
-                                            Text("\t|\t", style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center),
318
-                                            Text("\t|\t", style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center),
319
-                                          ],
320
-                                        ),
321
-                                      ),
322
-                                      Visibility(
323
-                                        visible: visibilityDate2[i],
324
-                                        child: Column(
325
-                                          children: [
326
-                                            Text(dayDate_list_2[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center,),
327
-                                            Text(date_list_2[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center),
328
-                                            Text(month_list_2[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center),
329
-                                          ],
330
-                                        ),
331
-                                      ),
332
-                                      /*Expanded(
333
-                                          flex: 1,
334
-                                          child: Column(
335
-                                          mainAxisAlignment: MainAxisAlignment.center,
336
-                                          crossAxisAlignment: CrossAxisAlignment.center,
337
-                                          children: [
338
-                                            Text(dayDate_List[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.right,),
339
-                                            Text(date_List[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.right),
340
-                                            Text(month_List[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.right),
341
-                                          ],
342
-                                          )
343
-                                      ),
344
-                                      Expanded(
345
-                                          flex: 1,
346
-                                          child: Visibility(
347
-                                            visible: visibilityDate2[i],
348
-                                            child: Column(
349
-                                              children: [
350
-                                                Text("|", style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center,),
351
-                                                Text("|", style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center),
352
-                                                Text("|", style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.center),
353
-                                              ],
354
-                                            ),
355
-                                          )
356
-                                      ),
357
-                                      Expanded(
358
-                                          flex: 1,
359
-                                          child: Visibility(
360
-                                            visible: visibilityDate2[i],
361
-                                            child: Column(
362
-                                              children: [
363
-                                                Text(dayDate_list_2[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.left,),
364
-                                                Text(date_list_2[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.left),
365
-                                                Text(month_list_2[i], style: GoogleFonts.fredoka(fontSize: 15, color: Colors.blueGrey), textAlign: TextAlign.left),
366
-                                              ],
367
-                                            ),
368
-                                          ))*/
369
-                                    ],
370
-                                  ),
371
-                                )
372
-                              ),
373
-                              Expanded(
374
-                                flex: 2,
375
-                                child: Column(
376
-                                  children: [
377
-                                    Text("Check In", style: GoogleFonts.fredoka(fontSize: 16),textAlign: TextAlign.center),
378
-                                    Text(showCheckIn_List[i], style: GoogleFonts.barlowSemiCondensed(fontSize: 16),textAlign: TextAlign.center),
379
-                                  ],
380
-                                ),
381
-                              ),
382
-                              Expanded(
383
-                                flex: 2,
384
-                                child: Column(
385
-                                  children: [
386
-                                    Text("Check Out", style: GoogleFonts.fredoka(fontSize: 16),textAlign: TextAlign.center),
387
-                                    Text(showCheckOut_List[i], style: GoogleFonts.barlowSemiCondensed(fontSize: 16),textAlign: TextAlign.center),
388
-                                  ],
389
-                                ),
390
-                              ),
391
-                              Expanded(
392
-                                flex: 2,
393
-                                child: Column(
394
-                                  children: [
395
-                                    Text("Working\nHours", style: GoogleFonts.fredoka(fontSize: 16), textAlign: TextAlign.center),
396
-                                    Text(worked_hours_List[i], style: GoogleFonts.barlowSemiCondensed(fontSize: 16),textAlign: TextAlign.center),
397
-                                  ],
398
-                                ),
399
-                              ),
400
-                            ],
401
-                          ),
402
-                        ),
403
-                      ),
404
-                      onTap: (){
405
-                        setState(() {
406
-                          //visible[i] = !visible[i];
407
-                        });
408
-                      },
409
-                    ),
410
-                  );
411
-                },
412
-              ),
413
-            )
414
-          ]),
415
-    );
416
-  }
417
-}
418
-
419
-alertDialogFailedRetrievedData(BuildContext context) {
420
-  Widget okButton = TextButton(
421
-    child: Text("Refresh"),
422
-    onPressed: () {
423
-      Navigator.of(context, rootNavigator: true).pop();
424
-      Navigator.pushReplacement(
425
-          context, MaterialPageRoute(builder: (context) => HistoryAbsensi()));
426
-    },
427
-  );
428
-
429
-  Widget noButton = TextButton(
430
-    child: Text("Back"),
431
-    onPressed: () {
432
-      Navigator.of(context, rootNavigator: true).pop();
433
-      Navigator.pop(context);
434
-    },
435
-  );
436
-
437
-  // set up the AlertDialog
438
-  AlertDialog alert = AlertDialog(
439
-    title: Text(appName),
440
-    content: Text("Failed to Retrieve Data"),
441
-    actions: [
442
-      noButton,
443
-      okButton,
444
-    ],
445
-  );
446
-
447
-  // show the dialog
448
-  showDialog(
449
-    context: context,
450
-    barrierDismissible: false,
451
-    builder: (BuildContext context) {
452
-      return alert;
453
-    },
454
-  );
455
-}
456
-
457
-alertDialogFailedResponse(BuildContext context){
458
-  Widget okButton = TextButton(
459
-    child: Text("Refresh"),
460
-    onPressed: () {
461
-      Navigator.of(context, rootNavigator: true).pop();
462
-      Navigator.pushReplacement(context, MaterialPageRoute(
463
-          builder: (context) => HistoryAbsensi()));
464
-    },
465
-  );
466
-
467
-  Widget noButton = TextButton(
468
-    child: Text("Back"),
469
-    onPressed: () {
470
-      Navigator.of(context, rootNavigator: true).pop();
471
-      Navigator.pop(context);
472
-
473
-    },
474
-  );
475
-
476
-  // set up the AlertDialog
477
-  AlertDialog alert = AlertDialog(
478
-    title: Text(appName),
479
-    content: Text("Server Response Error"),
480
-    actions: [
481
-      noButton,
482
-      okButton,
483
-    ],
484
-  );
485
-
486
-  // show the dialog
487
-  showDialog(
488
-    context: context,
489
-    barrierDismissible: false,
490
-    builder: (BuildContext context) {
491
-      return alert;
492
-    },
493
-  );
494
-}

+ 0
- 986
lib/Screens/Menu/Absensi/absensi_screen.dart Просмотреть файл

@@ -1,986 +0,0 @@
1
-import 'dart:async';
2
-import 'dart:convert';
3
-
4
-import 'package:app_settings/app_settings.dart';
5
-import 'package:flutter/material.dart';
6
-import 'package:flutter_map/plugin_api.dart';
7
-import 'package:geolocator/geolocator.dart';
8
-import 'package:google_fonts/google_fonts.dart';
9
-import 'package:employee_selfservice_mobile/Screens/Menu/Absensi/RequestHttp/checkIn_post.dart';
10
-import 'package:employee_selfservice_mobile/Screens/Menu/Absensi/RequestHttp/checkStatus_post.dart';
11
-import 'package:employee_selfservice_mobile/Screens/Menu/Absensi/absensi_history_screen.dart';
12
-import 'package:intl/intl.dart';
13
-import 'package:latlong2/latlong.dart' as latlong;
14
-import 'package:location/location.dart' as loc;
15
-import 'dart:developer' as logDev;
16
-
17
-import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
18
-import 'package:sliding_up_panel/sliding_up_panel.dart';
19
-
20
-import 'RequestHttp/checkOut_post.dart';
21
-import 'RequestHttp/historyAbsensi_post.dart';
22
-
23
-class AbsensiScreen extends StatefulWidget {
24
-  const AbsensiScreen({Key? key}) : super(key: key);
25
-
26
-  @override
27
-  State<AbsensiScreen> createState() => _AbsensiScreenState();
28
-}
29
-
30
-class _AbsensiScreenState extends State<AbsensiScreen> {
31
-  //Visibility Button Check In & Check Out
32
-  bool visibleCheckIn = false;
33
-  bool visibleCheckOut = false;
34
-
35
-  latlong.LatLng point = latlong.LatLng(-6.183580253674716, 106.93103973792664);
36
-  late Position position;
37
-
38
-  late String showCheckIn_List;
39
-  late String showCheckOut_List;
40
-
41
-  MapController _mapController = MapController();
42
-
43
-  @override
44
-  void initState() {
45
-    showCheckIn_List = "";
46
-    showCheckOut_List = "";
47
-
48
-    WidgetsBinding.instance.addPostFrameCallback((_) {
49
-      determinePosition();
50
-    });
51
-    super.initState();
52
-  }
53
-
54
-  determinePosition() async {
55
-    StreamSubscription<ServiceStatus> serviceStatusStream = Geolocator.getServiceStatusStream().listen(
56
-            (ServiceStatus status) {
57
-          print(status);
58
-        });
59
-
60
-    ProgressDialog loading = ProgressDialog(context);
61
-    loading = ProgressDialog(context,
62
-        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
63
-    loading.style(
64
-        message: 'Please Wait .....',
65
-        borderRadius: 3,
66
-        backgroundColor: Colors.white,
67
-        progressWidget: CircularProgressIndicator(),
68
-        elevation: 10.0,
69
-        padding: EdgeInsets.all(10),
70
-        insetAnimCurve: Curves.easeInOut,
71
-        progress: 0.0,
72
-        maxProgress: 100.0,
73
-        progressTextStyle: TextStyle(
74
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
75
-        messageTextStyle: TextStyle(
76
-            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
77
-
78
-    await loading.show();
79
-
80
-    bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
81
-    logDev.log(serviceEnabled.toString(), name: "ON/OFF LOCATION SERVICE");
82
-    if (!serviceEnabled) {
83
-      //return Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => AbsensiScreen()));
84
-      //await loading.hide();
85
-      //alertDialogEnableLocaionServices(context);
86
-      return Future.error('Location services are disabled.');
87
-    }
88
-
89
-    LocationPermission permission = await Geolocator.checkPermission();
90
-
91
-    if (permission == LocationPermission.deniedForever) {
92
-      await loading.hide();
93
-      //return Future.error('Location permissions are permanently denied, we cannot request permissions.');
94
-      return alertDialogPermissionDeniedForever(context);
95
-    } else if (permission == LocationPermission.denied) {
96
-      permission = await Geolocator.requestPermission();
97
-      if (permission != LocationPermission.whileInUse && permission != LocationPermission.always) {
98
-        await loading.hide();
99
-        //return Future.error('Location permissions are denied (actual value: $permission).');
100
-        return alertDialogPermissionDenied(context);
101
-      }
102
-    }
103
-
104
-    position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
105
-    logDev.log(position.toString(), name: "Position GEOLOCATOR");
106
-    if (position.isMocked) {
107
-      await loading.hide();
108
-      setState(() {
109
-        alertDialogFakeGPSDetected(context);
110
-      });
111
-    } else {
112
-      point = latlong.LatLng(position.latitude, position.longitude);
113
-      logDev.log(point.toString(), name: "POINT GEOLOCATOR");
114
-      _mapController.move(point, 18);
115
-
116
-      //Check Status
117
-      CheckStatus_Post.connectToAPI().then((valueResult) async {
118
-        Map<String, dynamic> object = json.decode(valueResult);
119
-        if (object.containsKey("result").toString() == "true") {
120
-          String result = object['result'].toString();
121
-          logDev.log(result, name: "Status Absensi Result");
122
-          if (result.contains("not_checked_in")) {
123
-            setState(() {
124
-              visibleCheckIn = !visibleCheckIn;
125
-              visibleCheckOut = visibleCheckOut;
126
-            });
127
-            await loading.hide();
128
-          } else if (result.contains("checked_in")) {
129
-            setState(() {
130
-              visibleCheckIn = visibleCheckIn;
131
-              visibleCheckOut = !visibleCheckOut;
132
-            });
133
-            await loading.hide();
134
-          } else {
135
-            setState(() {
136
-              alertDialogFailedResponse(context);
137
-            });
138
-            await loading.hide();
139
-          }
140
-        } else {
141
-          setState(() {
142
-            alertDialogFailedResponse(context);
143
-          });
144
-          await loading.hide();
145
-        }
146
-        await loading.hide();
147
-      });
148
-
149
-      //History
150
-      HistoryAbsensi_Post.connectToAPI().then((valueResult) async {
151
-        Map<String, dynamic> object = jsonDecode(valueResult);
152
-        if (object.containsKey("result").toString() == "true") {
153
-          String result = object['result'].toString();
154
-          if (result.contains("failed")) {
155
-            await loading.hide();
156
-            alertDialogFailedRetrievedData(context);
157
-          } else {
158
-            List <dynamic> historyAbsensi = object['result'];
159
-            await loading.hide();
160
-            setState(() {
161
-              String check_in = historyAbsensi[0]['check_in'].toString();
162
-              String check_out = historyAbsensi[0]['check_out'].toString();
163
-              logDev.log(historyAbsensi[0]['check_in'].toString(), name: "CHECK IN TIME");
164
-
165
-              if (check_in != "false") {
166
-                //Convert UTC to Local Time - Check In Time
167
-                DateTime checkInTime = DateFormat("yyyy-MM-dd HH:mm:ss").parse(
168
-                    check_in, true);
169
-                String checkInTimeLocal = checkInTime.toLocal().toString();
170
-                String showCheckInTime = checkInTimeLocal.substring(11, 19);
171
-                //logDev.log(showCheckInTime.substring(0,5), name: "SHOW CHECK IN TIME");
172
-                showCheckIn_List = showCheckInTime.substring(0, 5);
173
-              } else if (check_in == "false") {
174
-                String show_check_in = "-";
175
-                showCheckIn_List = show_check_in;
176
-              }
177
-
178
-              if (check_out != "false") {
179
-                //Convert UTC to Local Time - Check Out Time
180
-                DateTime checkOutTime = DateFormat("yyyy-MM-dd HH:mm:ss").parse(
181
-                    check_out, true);
182
-                String checkOutTimeLocal = checkOutTime.toLocal().toString();
183
-                String showCheckOutTime = checkOutTimeLocal.substring(11, 19);
184
-                //logDev.log(showCheckOutTime, name: "SHOW CHECK OUT TIME");
185
-                showCheckOut_List = showCheckOutTime.substring(0, 5);
186
-              } else if (check_out == "false") {
187
-                String show_check_out = "-";
188
-                showCheckOut_List = show_check_out;
189
-              }
190
-            });
191
-          }
192
-        } else {
193
-          alertDialogFailedRetrievedData(context);
194
-        }
195
-      });
196
-
197
-    }
198
-  }
199
-
200
-  updatePosition() async {
201
-    ProgressDialog loading = ProgressDialog(context);
202
-    loading = ProgressDialog(context,
203
-        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
204
-    loading.style(
205
-        message: 'Please Wait .....',
206
-        borderRadius: 3,
207
-        backgroundColor: Colors.white,
208
-        progressWidget: CircularProgressIndicator(),
209
-        elevation: 10.0,
210
-        padding: EdgeInsets.all(10),
211
-        insetAnimCurve: Curves.easeInOut,
212
-        progress: 0.0,
213
-        maxProgress: 100.0,
214
-        progressTextStyle: TextStyle(
215
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
216
-        messageTextStyle: TextStyle(
217
-            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
218
-
219
-    bool serviceEnabled;
220
-    LocationPermission permission;
221
-
222
-    serviceEnabled = await Geolocator.isLocationServiceEnabled();
223
-    if (!serviceEnabled) {
224
-      await loading.hide();
225
-      return Future.error('Location services are disabled.');
226
-    }
227
-
228
-    permission = await Geolocator.checkPermission();
229
-
230
-    if (permission == LocationPermission.deniedForever) {
231
-      await loading.hide();
232
-      return alertDialogPermissionDeniedForever(context);
233
-    } else if (permission == LocationPermission.denied) {
234
-      permission = await Geolocator.requestPermission();
235
-      if (permission != LocationPermission.whileInUse && permission != LocationPermission.always) {
236
-        await loading.hide();
237
-        return alertDialogPermissionDenied(context);
238
-      }
239
-    }
240
-
241
-    position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
242
-    if (position.isMocked) {
243
-      await loading.hide();
244
-      setState(() {
245
-        alertDialogFakeGPSDetected(context);
246
-      });
247
-    } else {
248
-      await loading.hide();
249
-      setState((){
250
-        point = latlong.LatLng(position.latitude, position.longitude);
251
-        logDev.log(point.toString(), name: "UPDATE POINT GEOLOCATOR");
252
-        _mapController.move(point, 18);
253
-      });
254
-    }
255
-  }
256
-
257
-  goCheckIn() async {
258
-    ProgressDialog loading = ProgressDialog(context);
259
-    loading = ProgressDialog(context,
260
-        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
261
-    loading.style(
262
-        message: 'Please Wait .....',
263
-        borderRadius: 3,
264
-        backgroundColor: Colors.white,
265
-        progressWidget: CircularProgressIndicator(),
266
-        elevation: 10.0,
267
-        padding: EdgeInsets.all(10),
268
-        insetAnimCurve: Curves.easeInOut,
269
-        progress: 0.0,
270
-        maxProgress: 100.0,
271
-        progressTextStyle: TextStyle(
272
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
273
-        messageTextStyle: TextStyle(
274
-            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
275
-
276
-    await loading.show();
277
-    position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
278
-    if (position.isMocked) {
279
-      await loading.hide();
280
-      setState(() {
281
-        alertDialogFakeGPSDetected(context);
282
-      });
283
-    } else {
284
-      await loading.hide();
285
-      setState((){
286
-        point = latlong.LatLng(position.latitude, position.longitude);
287
-        _mapController.move(point, 18);
288
-      });
289
-    }
290
-    String coordinate = point.latitude.toString()+", "+ point.longitude.toString();
291
-
292
-    CheckIn_Post.connectToAPI(coordinate).then((valueResult) async {
293
-      Map<String, dynamic> object = json.decode(valueResult);
294
-      if (object.containsKey("result").toString() == "true") {
295
-        String result = object['result'].toString();
296
-        logDev.log(result, name: "Check In Result");
297
-        if (result.contains("failed")) {
298
-          await loading.hide();
299
-          setState(() {
300
-            alertDialogFailedRetrievedData(context);
301
-          });
302
-        } else if (result.contains("Anda sudah check in")) {
303
-          await loading.hide();
304
-          setState(() {
305
-            alertDialogFailedCheckIn(context);
306
-          });
307
-        } else {
308
-          await loading.hide();
309
-          setState(() {
310
-            alertDialogSuccessCheckIn(context);
311
-          });
312
-        }
313
-      } else {
314
-        setState(() {
315
-          alertDialogFailedResponse(context);
316
-        });
317
-        await loading.hide();
318
-      }
319
-    });
320
-  }
321
-
322
-  goCheckOut() async {
323
-    ProgressDialog loading = ProgressDialog(context);
324
-    loading = ProgressDialog(context,
325
-        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
326
-    loading.style(
327
-        message: 'Please Wait .....',
328
-        borderRadius: 3,
329
-        backgroundColor: Colors.white,
330
-        progressWidget: CircularProgressIndicator(),
331
-        elevation: 10.0,
332
-        padding: EdgeInsets.all(10),
333
-        insetAnimCurve: Curves.easeInOut,
334
-        progress: 0.0,
335
-        maxProgress: 100.0,
336
-        progressTextStyle: TextStyle(
337
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
338
-        messageTextStyle: TextStyle(
339
-            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
340
-
341
-    await loading.show();
342
-
343
-    position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
344
-    if (position.isMocked) {
345
-      await loading.hide();
346
-      setState(() {
347
-        alertDialogFakeGPSDetected(context);
348
-      });
349
-    } else {
350
-      await loading.hide();
351
-      setState((){
352
-        point = latlong.LatLng(position.latitude, position.longitude);
353
-        _mapController.move(point, 18);
354
-      });
355
-    }
356
-    String coordinate = point.latitude.toString()+", "+ point.longitude.toString();
357
-
358
-    CheckOut_Post.connectToAPI(coordinate).then((valueResult) async {
359
-      Map<String, dynamic> object = json.decode(valueResult);
360
-      if (object.containsKey("result").toString() == "true") {
361
-        String result = object['result'].toString();
362
-        logDev.log(result, name: "Check Out Result");
363
-        if (result.contains("failed")) {
364
-          await loading.hide();
365
-          setState(() {
366
-            alertDialogFailedRetrievedData(context);
367
-          });
368
-        } else if (result.contains("Anda belum check in")) {
369
-          await loading.hide();
370
-          setState(() {
371
-            alertDialogFailedCheckOut(context);
372
-          });
373
-        } else {
374
-          await loading.hide();
375
-          setState(() {
376
-            alertDialogSuccessCheckOut(context);
377
-          });
378
-        }
379
-      } else {
380
-        setState(() {
381
-          alertDialogFailedResponse(context);
382
-        });
383
-        await loading.hide();
384
-      }
385
-    });
386
-  }
387
-
388
-  PanelController _panelController = PanelController();
389
-
390
-  void togglePanel() => _panelController.isPanelOpen
391
-      ? _panelController.close()
392
-      : _panelController.open();
393
-
394
-  @override
395
-  Widget build(BuildContext context) {
396
-    var size = MediaQuery.of(context).size;
397
-    return Scaffold(
398
-      body: SlidingUpPanel(
399
-        controller: _panelController,
400
-        parallaxEnabled: true,
401
-        maxHeight: size.height * 0.5,
402
-        minHeight: size.height * 0.3,
403
-        body: Container (
404
-          child: Stack(
405
-            children: [
406
-              FlutterMap(
407
-                mapController: _mapController,
408
-                options: new MapOptions(
409
-                    onTap: (p, point) async {}, center: point, zoom: 15),
410
-                children: [
411
-                  TileLayer(
412
-                    minZoom: 1,
413
-                    maxZoom: 22,
414
-                    maxNativeZoom: 18,
415
-                    minNativeZoom: 1,
416
-                    backgroundColor: Colors.black54,
417
-                    urlTemplate:
418
-                    'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
419
-                    subdomains: ['a', 'b', 'c'],
420
-                  ),
421
-                  MarkerLayer(markers: [
422
-                    Marker(
423
-                        width: 135,
424
-                        height: 135,
425
-                        point: point,
426
-                        builder: (ctx) => Container(
427
-                          child: Icon(
428
-                            Icons.location_on,
429
-                            color: Colors.red,
430
-                          ),
431
-                        ))
432
-                  ])
433
-                ],
434
-              ),
435
-              Container(
436
-                alignment: AlignmentDirectional.bottomEnd,
437
-                child: Container(
438
-                  margin: EdgeInsets.fromLTRB(10, 15, 0, (size.height*0.3) + 15),
439
-                  child: RawMaterialButton(
440
-                    onPressed: () {
441
-                      setState(() {
442
-                        updatePosition();
443
-                      });
444
-                    },
445
-                    elevation: 5.0,
446
-                    fillColor: Colors.white,
447
-                    child: Image.asset('assets/images/location1.png',
448
-                        height: 40, width: 40),
449
-                    padding: EdgeInsets.all(5.0),
450
-                    shape: CircleBorder(),
451
-                  ),
452
-                ),
453
-              ),
454
-            ],
455
-          ),
456
-        ),
457
-        panel: Center(
458
-          child: Column(
459
-            children: [
460
-              GestureDetector(
461
-                onTap: togglePanel,
462
-                child: Center(
463
-                  child: Container(
464
-                    margin: EdgeInsets.only(top: 15),
465
-                    height: 5,
466
-                      width: size.width * 0.1,
467
-                      decoration: BoxDecoration(
468
-                        borderRadius: BorderRadius.circular(10),
469
-                        color: Colors.grey
470
-                      ),
471
-                  ),
472
-                ),
473
-              ),
474
-              Container(
475
-                margin: EdgeInsets.only(top: 15),
476
-                child: Center(
477
-                  child: Text(
478
-                    'ATTENDANCE',
479
-                    maxLines: 1,
480
-                    style: GoogleFonts.luckiestGuy(
481
-                      fontSize: 28,
482
-                      color: Color(0xFF4858A7),
483
-                      fontStyle: FontStyle.italic,
484
-                    ),
485
-                  ),
486
-                ),
487
-              ),
488
-              Container(
489
-                width: double.infinity,
490
-                margin: EdgeInsets.fromLTRB(10, 15, 10, 10),
491
-                decoration:
492
-                BoxDecoration(border: Border.all(color: Colors.black), borderRadius: BorderRadius.all(Radius.circular(15))),
493
-                child: Column(
494
-                  children: <Widget>[
495
-                    Container(
496
-                      child: Text(
497
-                        "Last Attendance",
498
-                        style: GoogleFonts.patrickHand(
499
-                            fontSize: 21, color: Colors.white),
500
-                      ),
501
-                      width: double.infinity,
502
-                      alignment: Alignment.center,
503
-                      decoration: BoxDecoration(
504
-                          gradient: LinearGradient(
505
-                              begin: Alignment.topRight,
506
-                              end: Alignment.bottomRight,
507
-                              colors: [
508
-                                /*Color(0xFFD21404),
509
-                              Color(0xFFFD7267),*/
510
-                                Color(0xFF4858A7),
511
-                                Color(0xFF6474C6),
512
-                              ]),
513
-                          border: Border.all(color: Colors.black), borderRadius: BorderRadius.only(topLeft: Radius.circular(15), topRight: Radius.circular(15))),
514
-                    ),
515
-                    Container(
516
-                      width: double.infinity,
517
-                      padding: EdgeInsets.all(15),
518
-                      decoration:
519
-                      BoxDecoration(border: Border.all(color: Colors.black), borderRadius: BorderRadius.only(bottomLeft: Radius.circular(15), bottomRight: Radius.circular(15))),
520
-                      child: Column(
521
-                        children: [
522
-                          Row(
523
-                            mainAxisAlignment: MainAxisAlignment.spaceAround,
524
-                            children: [
525
-                              Expanded(
526
-                                  flex: 5,
527
-                                  child: Column(
528
-                                    children: [
529
-                                      Text('Check In',
530
-                                          style: GoogleFonts.fredoka(
531
-                                              fontSize: 19)),
532
-                                      Text(showCheckIn_List,
533
-                                          style: GoogleFonts.barlowSemiCondensed(
534
-                                              fontSize: 19)),
535
-                                    ],
536
-                                  )),
537
-                              Expanded(
538
-                                  flex: 5,
539
-                                  child: Column(
540
-                                    children: [
541
-                                      Text('Check Out',
542
-                                          style: GoogleFonts.fredoka(
543
-                                              fontSize: 19)),
544
-                                      Text(showCheckOut_List,
545
-                                          style: GoogleFonts.barlowSemiCondensed(
546
-                                              fontSize: 19)),
547
-                                    ],
548
-                                  )),
549
-                            ],
550
-                          ),
551
-                          Row(
552
-                            children: [
553
-                              Visibility(
554
-                                visible: visibleCheckIn,
555
-                                child: Container(
556
-                                  margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
557
-                                  width: size.width - 54,
558
-                                  child: ElevatedButton(
559
-                                    onPressed: () {
560
-                                      goCheckIn();
561
-                                    },
562
-                                    child: Text('Check In'),
563
-                                    style: ButtonStyle(
564
-                                        backgroundColor: MaterialStateProperty.all(
565
-                                            Color(0xFF6474C6))),
566
-                                  ),
567
-                                ),
568
-                              ),
569
-                              Visibility(
570
-                                visible: visibleCheckOut,
571
-                                child: Container(
572
-                                  margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
573
-                                  width: size.width - 54,
574
-                                  child: ElevatedButton(
575
-                                    onPressed: () {
576
-                                      goCheckOut();
577
-                                    },
578
-                                    child: Text('Check Out'),
579
-                                    style: ButtonStyle(
580
-                                        backgroundColor: MaterialStateProperty.all(
581
-                                            Color(0xFF6474C6))),
582
-                                  ),
583
-                                ),
584
-                              ),
585
-                            ],
586
-                          )
587
-                        ],
588
-                      ),
589
-                    )
590
-                  ],
591
-                ),
592
-              ),
593
-              Container(
594
-                margin: EdgeInsets.fromLTRB(10, 15, 10, 15),
595
-                child: InkWell(
596
-                  child: Container(
597
-                      padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
598
-                      width: double.infinity,
599
-                      decoration: BoxDecoration(
600
-                          borderRadius: BorderRadius.circular(5),
601
-                          gradient: LinearGradient(colors: [
602
-                            Color(0xFF2D4059),
603
-                            Color(0xFF2D4059),
604
-                            /*Color(0xFFEAFFD0),
605
-                                  Color(0xFF95E1D3),*/
606
-                          ])),
607
-                      child: Row(
608
-                        mainAxisAlignment: MainAxisAlignment.center,
609
-                        children: [
610
-                          Text(' See Attendance History   \t\t',
611
-                              textAlign: TextAlign.center,
612
-                              style: TextStyle(
613
-                                  color: Colors.white,
614
-                                  fontSize: 17,
615
-                                  fontWeight: FontWeight.w500)),
616
-                          Image.asset(
617
-                            'assets/images/ic_arrow_white.png',
618
-                            width: 30,
619
-                            height: 30,
620
-                          )
621
-                        ],
622
-                      )),
623
-                  onTap: () {
624
-                    Navigator.push(
625
-                        context,
626
-                        MaterialPageRoute(
627
-                            builder: (context) => HistoryAbsensi()));
628
-                  },
629
-                ),
630
-              )
631
-            ],
632
-          ),
633
-        ),
634
-
635
-       borderRadius: BorderRadius.only(topLeft: Radius.circular(15), topRight: Radius.circular(15)),
636
-      ),
637
-    );
638
-  }
639
-}
640
-
641
-alertDialogFailedRetrievedData(BuildContext context) {
642
-  Widget okButton = TextButton(
643
-    child: Text("Refresh"),
644
-    onPressed: () {
645
-      Navigator.of(context, rootNavigator: true).pop();
646
-      Navigator.pushReplacement(
647
-          context, MaterialPageRoute(builder: (context) => AbsensiScreen()));
648
-    },
649
-  );
650
-
651
-  Widget noButton = TextButton(
652
-    child: Text("Back"),
653
-    onPressed: () {
654
-      Navigator.of(context, rootNavigator: true).pop();
655
-      Navigator.pop(context);
656
-    },
657
-  );
658
-
659
-  // set up the AlertDialog
660
-  AlertDialog alert = AlertDialog(
661
-    title: Text("Employee Self Service"),
662
-    content: Text("Failed to Retrieve Data"),
663
-    actions: [
664
-      noButton,
665
-      okButton,
666
-    ],
667
-  );
668
-
669
-  // show the dialog
670
-  showDialog(
671
-    context: context,
672
-    barrierDismissible: false,
673
-    builder: (BuildContext context) {
674
-      return alert;
675
-    },
676
-  );
677
-}
678
-
679
-alertDialogFailedResponse(BuildContext context) {
680
-  Widget okButton = TextButton(
681
-    child: Text("Refresh"),
682
-    onPressed: () {
683
-      Navigator.of(context, rootNavigator: true).pop();
684
-      Navigator.pushReplacement(
685
-          context, MaterialPageRoute(builder: (context) => AbsensiScreen()));
686
-    },
687
-  );
688
-
689
-  Widget noButton = TextButton(
690
-    child: Text("Back"),
691
-    onPressed: () {
692
-      Navigator.of(context, rootNavigator: true).pop();
693
-      Navigator.pop(context);
694
-    },
695
-  );
696
-
697
-  // set up the AlertDialog
698
-  AlertDialog alert = AlertDialog(
699
-    title: Text("Employee Self Service"),
700
-    content: Text("Server Response Error"),
701
-    actions: [
702
-      noButton,
703
-      okButton,
704
-    ],
705
-  );
706
-
707
-  // show the dialog
708
-  showDialog(
709
-    context: context,
710
-    barrierDismissible: false,
711
-    builder: (BuildContext context) {
712
-      return alert;
713
-    },
714
-  );
715
-}
716
-
717
-alertDialogSuccessCheckIn(BuildContext context) {
718
-  Widget okButton = TextButton(
719
-    child: Text("Ok"),
720
-    onPressed: () {
721
-      Navigator.of(context, rootNavigator: true).pop();
722
-      Navigator.pushReplacement(
723
-          context, MaterialPageRoute(builder: (context) => AbsensiScreen()));
724
-    },
725
-  );
726
-
727
-  // set up the AlertDialog
728
-  AlertDialog alert = AlertDialog(
729
-    title: Text("Employee Self Service"),
730
-    content: Text("Successfully Checked In"),
731
-    actions: [
732
-      okButton,
733
-    ],
734
-  );
735
-
736
-  // show the dialog
737
-  showDialog(
738
-    context: context,
739
-    barrierDismissible: false,
740
-    builder: (BuildContext context) {
741
-      return alert;
742
-    },
743
-  );
744
-}
745
-
746
-alertDialogSuccessCheckOut(BuildContext context) {
747
-  Widget okButton = TextButton(
748
-    child: Text("Ok"),
749
-    onPressed: () {
750
-      Navigator.of(context, rootNavigator: true).pop();
751
-      Navigator.pushReplacement(
752
-          context, MaterialPageRoute(builder: (context) => AbsensiScreen()));
753
-    },
754
-  );
755
-
756
-  // set up the AlertDialog
757
-  AlertDialog alert = AlertDialog(
758
-    title: Text("Employee Self Service"),
759
-    content: Text("Successfully Checked Out"),
760
-    actions: [
761
-      okButton,
762
-    ],
763
-  );
764
-
765
-  // show the dialog
766
-  showDialog(
767
-    context: context,
768
-    barrierDismissible: false,
769
-    builder: (BuildContext context) {
770
-      return alert;
771
-    },
772
-  );
773
-}
774
-
775
-alertDialogFailedCheckIn(BuildContext context) {
776
-  Widget okButton = TextButton(
777
-    child: Text("Ok"),
778
-    onPressed: () {
779
-      Navigator.of(context, rootNavigator: true).pop();
780
-      Navigator.pushReplacement(
781
-          context, MaterialPageRoute(builder: (context) => AbsensiScreen()));
782
-    },
783
-  );
784
-
785
-  // set up the AlertDialog
786
-  AlertDialog alert = AlertDialog(
787
-    title: Text("Employee Self Service"),
788
-    content: Text("You've already checked in"),
789
-    actions: [
790
-      okButton,
791
-    ],
792
-  );
793
-
794
-  // show the dialog
795
-  showDialog(
796
-    context: context,
797
-    barrierDismissible: false,
798
-    builder: (BuildContext context) {
799
-      return alert;
800
-    },
801
-  );
802
-}
803
-
804
-alertDialogFailedCheckOut(BuildContext context) {
805
-  Widget okButton = TextButton(
806
-    child: Text("Ok"),
807
-    onPressed: () {
808
-      Navigator.of(context, rootNavigator: true).pop();
809
-      Navigator.pushReplacement(
810
-          context, MaterialPageRoute(builder: (context) => AbsensiScreen()));
811
-    },
812
-  );
813
-
814
-  // set up the AlertDialog
815
-  AlertDialog alert = AlertDialog(
816
-    title: Text("Employee Self Service"),
817
-    content: Text("You haven't checked in"),
818
-    actions: [
819
-      okButton,
820
-    ],
821
-  );
822
-
823
-  // show the dialog
824
-  showDialog(
825
-    context: context,
826
-    barrierDismissible: false,
827
-    builder: (BuildContext context) {
828
-      return alert;
829
-    },
830
-  );
831
-}
832
-
833
-alertDialogFakeGPSDetected(BuildContext context) {
834
-  Widget okButton = TextButton(
835
-    child: Text("Refresh"),
836
-    onPressed: () {
837
-      Navigator.of(context, rootNavigator: true).pop();
838
-      Navigator.pushReplacement(
839
-          context, MaterialPageRoute(builder: (context) => AbsensiScreen()));
840
-    },
841
-  );
842
-
843
-  // set up the AlertDialog
844
-  AlertDialog alert = AlertDialog(
845
-    title: Text("Employee Self Service"),
846
-    content: Text("Fake GPS Detected, Please Use Default GPS!"),
847
-    actions: [
848
-      okButton,
849
-    ],
850
-  );
851
-
852
-  // show the dialog
853
-  showDialog(
854
-    context: context,
855
-    barrierDismissible: false,
856
-    builder: (BuildContext context) {
857
-      return alert;
858
-    },
859
-  );
860
-}
861
-
862
-alertDialogPermissionDenied(BuildContext context) {
863
-  Widget okButton = TextButton(
864
-    child: Text("Refresh"),
865
-    onPressed: () {
866
-      Navigator.of(context, rootNavigator: true).pop();
867
-      Navigator.pushReplacement(
868
-          context, MaterialPageRoute(builder: (context) => AbsensiScreen()));
869
-    },
870
-  );
871
-
872
-  Widget noButton = TextButton(
873
-    child: Text("Back"),
874
-    onPressed: () {
875
-      Navigator.of(context, rootNavigator: true).pop();
876
-      Navigator.pop(context);
877
-    },
878
-  );
879
-
880
-  // set up the AlertDialog
881
-  AlertDialog alert = AlertDialog(
882
-    title: Text("Employee Self Service"),
883
-    content:
884
-        Text("Location permissions are denied, we cannot request permissions"),
885
-    actions: [
886
-      noButton,
887
-      okButton,
888
-    ],
889
-  );
890
-
891
-  // show the dialog
892
-  showDialog(
893
-    context: context,
894
-    barrierDismissible: false,
895
-    builder: (BuildContext context) {
896
-      return alert;
897
-    },
898
-  );
899
-}
900
-
901
-alertDialogPermissionDeniedForever(BuildContext context) {
902
-  Widget noButton = TextButton(
903
-    child: Text("Back"),
904
-    onPressed: () {
905
-      Navigator.of(context, rootNavigator: true).pop();
906
-      Navigator.pop(context);
907
-    },
908
-  );
909
-
910
-  // set up the AlertDialog
911
-  AlertDialog alert = AlertDialog(
912
-    title: Text("Employee Self Service"),
913
-    content: Text(
914
-        "Location permissions are permanently denied, we cannot request permissions. Please configure it in your device settings."),
915
-    actions: [noButton],
916
-  );
917
-
918
-  // show the dialog
919
-  showDialog(
920
-    context: context,
921
-    barrierDismissible: false,
922
-    builder: (BuildContext context) {
923
-      return alert;
924
-    },
925
-  );
926
-}
927
-
928
-alertDialogEnableLocaionServices(BuildContext context) {
929
-  ProgressDialog loading = ProgressDialog(context);
930
-  loading = ProgressDialog(context,
931
-      type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
932
-  loading.style(
933
-      message: 'Please Wait .....',
934
-      borderRadius: 3,
935
-      backgroundColor: Colors.white,
936
-      progressWidget: CircularProgressIndicator(),
937
-      elevation: 10.0,
938
-      padding: EdgeInsets.all(10),
939
-      insetAnimCurve: Curves.easeInOut,
940
-      progress: 0.0,
941
-      maxProgress: 100.0,
942
-      progressTextStyle: TextStyle(
943
-          color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
944
-      messageTextStyle: TextStyle(
945
-          color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
946
-
947
-  Widget okButton = TextButton(
948
-    child: Text("Open Settings"),
949
-    onPressed: () {
950
-      //AppSettings.openLocationSettings();
951
-      Navigator.of(context, rootNavigator: true).pop();
952
-      loading.hide();
953
-     /* Navigator.pushReplacement(
954
-          context, MaterialPageRoute(builder: (context) => AbsensiScreen()));*/
955
-    },
956
-  );
957
-
958
-  Widget noButton = TextButton(
959
-    child: Text("No, thanks"),
960
-    onPressed: () {
961
-      Navigator.of(context, rootNavigator: true).pop();
962
-      Navigator.pop(context);
963
-      loading.hide();
964
-    },
965
-  );
966
-
967
-  // set up the AlertDialog
968
-  AlertDialog alert = AlertDialog(
969
-    title: Text("Employee Self Service"),
970
-    content:
971
-    Text("For a better experience, please turn on your device location"),
972
-    actions: [
973
-      noButton,
974
-      okButton,
975
-    ],
976
-  );
977
-
978
-  // show the dialog
979
-  showDialog(
980
-    context: context,
981
-    barrierDismissible: false,
982
-    builder: (BuildContext context) {
983
-      return alert;
984
-    },
985
-  );
986
-}

+ 0
- 39
lib/Screens/Menu/AjukanCuti/RequestHttp/detailCuti_post.dart Просмотреть файл

@@ -1,39 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:http/http.dart' as http;
4
-import 'package:employee_selfservice_mobile/constants.dart';
5
-import 'dart:developer' as developer;
6
-
7
-import 'package:shared_preferences/shared_preferences.dart';
8
-
9
-class DetailCuti_Post {
10
-  late String session;
11
-
12
-  DetailCuti_Post({required this.session});
13
-
14
-  static Future<String> connectToAPI() async {
15
-    String URL = baseURL + "/api/v1/detail_cuti";
16
-
17
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
18
-    final session = prefs.getString('session');
19
-
20
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
21
-      "data": [
22
-        {
23
-          "session": session
24
-        }
25
-      ]
26
-    }), headers: {
27
-      "Content-Type": "application/json",
28
-      "Api-key": apiKey
29
-    });
30
-
31
-    developer.log(sendData.body, name: "Get Jenis Cuti Result");
32
-    return sendData.body;
33
-
34
-    /*var jsonObject = json.decode(sendData.body);
35
-    developer.log(jsonObject.toString(), name: 'Log');*/
36
-    // return jsonObject;
37
-    // return LoginPostResult.createPostResult(jsonObject);
38
-  }
39
-}

+ 0
- 39
lib/Screens/Menu/AjukanCuti/RequestHttp/historyCuti_post.dart Просмотреть файл

@@ -1,39 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:http/http.dart' as http;
4
-import 'package:employee_selfservice_mobile/constants.dart';
5
-import 'dart:developer' as developer;
6
-
7
-import 'package:shared_preferences/shared_preferences.dart';
8
-
9
-class HistoryCuti_Post {
10
-  late String session;
11
-
12
-  HistoryCuti_Post({required this.session});
13
-
14
-  static Future<String> connectToAPI() async {
15
-    String URL = baseURL + "/api/v1/list_cuti";
16
-
17
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
18
-    final session = prefs.getString('session');
19
-
20
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
21
-      "data": [
22
-        {
23
-          "session": session
24
-        }
25
-      ]
26
-    }), headers: {
27
-      "Content-Type": "application/json",
28
-      "Api-key": apiKey
29
-    });
30
-
31
-    //developer.log(sendData.body, name: "Get Jenis Cuti Result");
32
-    return sendData.body;
33
-
34
-    /*var jsonObject = json.decode(sendData.body);
35
-    developer.log(jsonObject.toString(), name: 'Log');*/
36
-    // return jsonObject;
37
-    // return LoginPostResult.createPostResult(jsonObject);
38
-  }
39
-}

+ 0
- 39
lib/Screens/Menu/AjukanCuti/RequestHttp/jenisCuti_post.dart Просмотреть файл

@@ -1,39 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:http/http.dart' as http;
4
-import 'package:employee_selfservice_mobile/constants.dart';
5
-import 'dart:developer' as developer;
6
-
7
-import 'package:shared_preferences/shared_preferences.dart';
8
-
9
-class JenisCuti_Post {
10
-  late String session;
11
-
12
-  JenisCuti_Post({required this.session});
13
-
14
-  static Future<String> connectToAPI() async {
15
-    String URL = baseURL + "/api/v1/jenis_cuti";
16
-
17
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
18
-    final session = prefs.getString('session');
19
-
20
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
21
-      "data": [
22
-        {
23
-          "session": session
24
-        }
25
-      ]
26
-    }), headers: {
27
-      "Content-Type": "application/json",
28
-      "Api-key": apiKey
29
-    });
30
-
31
-    developer.log(sendData.body, name: "Get Jenis Cuti Result");
32
-    return sendData.body;
33
-
34
-    /*var jsonObject = json.decode(sendData.body);
35
-    developer.log(jsonObject.toString(), name: 'Log');*/
36
-    // return jsonObject;
37
-    // return LoginPostResult.createPostResult(jsonObject);
38
-  }
39
-}

+ 0
- 49
lib/Screens/Menu/AjukanCuti/RequestHttp/pengajuanCuti_post.dart Просмотреть файл

@@ -1,49 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:http/http.dart' as http;
4
-import 'package:employee_selfservice_mobile/constants.dart';
5
-import 'dart:developer' as developer;
6
-
7
-import 'package:shared_preferences/shared_preferences.dart';
8
-
9
-class PengajuanCuti_Post {
10
-  late String session;
11
-  late String tipe;
12
-  late String date_from;
13
-  late String date_to;
14
-  late String deskripsi;
15
-  late List<String> file;
16
-
17
-  PengajuanCuti_Post({required this.session});
18
-
19
-  static Future<String> connectToAPI(String tipe, String date_from, String date_to, String deskripsi, List<String> file) async {
20
-    String URL = baseURL + "/api/v1/pengajuan_cuti";
21
-
22
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
23
-    final session = prefs.getString('session');
24
-
25
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
26
-      "data": [
27
-        {
28
-          "session": session,
29
-          "tipe" : tipe,
30
-          "date_from" : date_from,
31
-          "date_to" : date_to,
32
-          "deskripsi" : deskripsi,
33
-          "file" : file
34
-        }
35
-      ]
36
-    }), headers: {
37
-      "Content-Type": "application/json",
38
-      "Api-key": apiKey
39
-    });
40
-
41
-    developer.log(sendData.body, name: "Get Jenis Cuti Result");
42
-    return sendData.body;
43
-
44
-    /*var jsonObject = json.decode(sendData.body);
45
-    developer.log(jsonObject.toString(), name: 'Log');*/
46
-    // return jsonObject;
47
-    // return LoginPostResult.createPostResult(jsonObject);
48
-  }
49
-}

+ 0
- 781
lib/Screens/Menu/AjukanCuti/ajukancuti_screen.dart Просмотреть файл

@@ -1,781 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:io';
3
-import 'package:file_picker/file_picker.dart';
4
-import 'package:flutter/cupertino.dart';
5
-import 'package:flutter/material.dart';
6
-import 'package:flutter/rendering.dart';
7
-import 'package:fluttertoast/fluttertoast.dart';
8
-import 'package:google_fonts/google_fonts.dart';
9
-import 'package:employee_selfservice_mobile/Screens/Menu/AjukanCuti/RequestHttp/jenisCuti_post.dart';
10
-import 'package:employee_selfservice_mobile/Screens/Menu/AjukanCuti/RequestHttp/pengajuanCuti_post.dart';
11
-import 'package:employee_selfservice_mobile/Screens/Menu/AjukanCuti/history_cuti.dart';
12
-import 'package:intl/intl.dart';
13
-import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
14
-
15
-import 'dart:developer' as logDev;
16
-import '../SlipGaji/background.dart';
17
-
18
-List<String> fileAttach = [""];
19
-TextEditingController deskripsiTeksController = TextEditingController();
20
-
21
-class AjukanCutiScreen extends StatefulWidget {
22
-  const AjukanCutiScreen({Key? key}) : super(key: key);
23
-
24
-  @override
25
-  State<AjukanCutiScreen> createState() => _AjukanCutiScreenState();
26
-}
27
-
28
-class _AjukanCutiScreenState extends State<AjukanCutiScreen> {
29
-  var selectedType;
30
-
31
-  String _fileText = "";
32
-  String _totalFile= "";
33
-
34
-  bool visibleDateFrom = false;
35
-  bool visibleDateTo = false;
36
-
37
-  late List <String> idCutiType;
38
-  late List <String> cutiType;
39
-
40
-  DateTime dateFrom = DateTime.now();
41
-  DateTime dateTo = DateTime.now();
42
-
43
-  late String formattedDateFrom = "";
44
-  late String formattedDateTo = "";
45
-  late String idCuti;
46
-
47
-  initState(){
48
-    deskripsiTeksController.clear();
49
-    cutiType = [""];
50
-    idCutiType = [""];
51
-
52
-    formattedDateFrom = "";
53
-    visibleDateFrom = false;
54
-    formattedDateTo = "";
55
-    visibleDateTo = false;
56
-    deskripsiTeksController.clear();
57
-
58
-    WidgetsBinding.instance.addPostFrameCallback((_) {
59
-      cutiType = getJenisCuti();
60
-    });
61
-    super.initState();
62
-  }
63
-
64
-  getJenisCuti () async {
65
-    ProgressDialog loading = ProgressDialog(context);
66
-    loading = ProgressDialog(context,
67
-        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
68
-    loading.style(
69
-        message: 'Please Wait .....',
70
-        borderRadius: 3,
71
-        backgroundColor: Colors.white,
72
-        progressWidget: CircularProgressIndicator(),
73
-        elevation: 10.0,
74
-        padding: EdgeInsets.all(10),
75
-        insetAnimCurve: Curves.easeInOut,
76
-        progress: 0.0,
77
-        maxProgress: 100.0,
78
-        progressTextStyle: TextStyle(
79
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
80
-        messageTextStyle: TextStyle(
81
-            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
82
-
83
-    await loading.show();
84
-    JenisCuti_Post.connectToAPI().then((valueResult) async {
85
-      Map<String, dynamic> object = json.decode(valueResult);
86
-      if (object.containsKey("result").toString() == "true"){
87
-        String result = object['result'].toString();
88
-        logDev.log(result, name: "Jenis Cuti Result");
89
-        if (result.contains("Failed")) {
90
-          await loading.hide();
91
-          setState(() {
92
-            cutiType = [""];
93
-            alertDialogFailedRetrievedData(context);
94
-          });
95
-        } else {
96
-          List <dynamic> jenis = object['result']['jenis'];
97
-          setState(() {
98
-            idCutiType.removeAt(0);
99
-            cutiType.removeAt(0);
100
-            for (int i = 0; i < jenis.length; i++){
101
-              String id = jenis[i]['id'].toString();
102
-              String text = jenis[i]['text'].toString();
103
-              idCutiType.add(id);
104
-              cutiType.add(text);
105
-            }
106
-          });
107
-          await loading.hide();
108
-        }
109
-      } else {
110
-        setState((){
111
-          cutiType = [""];
112
-          alertDialogFailedResponse(context);
113
-          /*Fluttertoast.showToast(
114
-              msg: "Server Response Error",
115
-              toastLength: Toast.LENGTH_SHORT,
116
-              gravity: ToastGravity.CENTER,
117
-              timeInSecForIosWeb: 1,
118
-              textColor: Colors.white,
119
-              fontSize: 16.0);*/
120
-        });
121
-        await loading.hide();
122
-      }
123
-    });
124
-    return cutiType;
125
-  }
126
-
127
-  @override
128
-  Widget build(BuildContext context) {
129
-    var size = MediaQuery.sizeOf(context);
130
-    return Scaffold(
131
-      body: SingleChildScrollView(
132
-          child: Column(
133
-        children: <Widget>[
134
-          Stack(
135
-            children: [
136
-              WavyHeader(),
137
-              Container(
138
-                  margin: EdgeInsets.only(top: MediaQuery.of(context).size.height/6 - 20),
139
-                  padding: EdgeInsets.fromLTRB(20, 5, 25, 5),
140
-                  child: Row(
141
-                    mainAxisAlignment: MainAxisAlignment.end,
142
-                    crossAxisAlignment: CrossAxisAlignment.end,
143
-                    children: [
144
-                      Text(
145
-                        'Leaves\t\t',
146
-                        maxLines: 1,
147
-                        style: GoogleFonts.luckiestGuy(
148
-                          fontSize: 28,
149
-                          color: Color(0xFF4858A7),
150
-                          fontStyle: FontStyle.italic,
151
-                        ),
152
-                      ),
153
-                      Image.asset(
154
-                        'assets/icons/menu/ic_cuti.png',
155
-                        width: 40,
156
-                        height: 40,
157
-                      ),
158
-                    ],
159
-                  )),
160
-              SafeArea(
161
-                child: Container(
162
-                  width: MediaQuery.of(context).size.width,
163
-                  margin: EdgeInsets.only(
164
-                    top: MediaQuery.of(context).size.height / 5,
165
-                    left: 10,
166
-                    right: 10,
167
-                    bottom : 15,
168
-                  ),
169
-                  child: Column(
170
-                    children: [
171
-                      InkWell(
172
-                        child: Container(
173
-                            margin: EdgeInsets.only(top: 15, bottom: 15),
174
-                            padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
175
-                            width: double.infinity,
176
-                            decoration: BoxDecoration(
177
-                                borderRadius: BorderRadius.circular(5),
178
-                                gradient: LinearGradient(colors: [
179
-                                  Color(0xFF2D4059),
180
-                                  Color(0xFF2D4059),
181
-                                  /*Color(0xFFEAFFD0),
182
-                                  Color(0xFF95E1D3),*/
183
-                                ])),
184
-                            child: Row(
185
-                              mainAxisAlignment: MainAxisAlignment.center,
186
-                              children: [
187
-                                Text(' See Leaves History\t\t',
188
-                                    textAlign: TextAlign.center,
189
-                                    style: TextStyle(
190
-                                        color: Colors.white,
191
-                                        fontSize: 17,
192
-                                        fontWeight: FontWeight.w500)),
193
-                                Image.asset(
194
-                                  'assets/images/ic_arrow_white.png',
195
-                                  width: 30,
196
-                                  height: 30,
197
-                                )
198
-                              ],
199
-                            )),
200
-                        onTap: () {
201
-                          deskripsiTeksController.clear();
202
-                          visibleDateFrom = !visibleDateFrom;
203
-                          visibleDateTo = !visibleDateTo;
204
-                          Navigator.push(context, MaterialPageRoute(
205
-                              builder: (context) => HistoryCuti()));
206
-                        },
207
-                      ),
208
-                      Container(
209
-                        child: Card(
210
-                          elevation: 10,
211
-                          child: Container(
212
-                            decoration: BoxDecoration(
213
-                                color: Color(0XFFFAF7EE),
214
-                                borderRadius: BorderRadius.circular(10)),
215
-                            child: Column(
216
-                              children: [
217
-                                Container(
218
-                                  margin: EdgeInsets.only(
219
-                                      left: 10, right: 10, top: 15, bottom: 10),
220
-                                  child: Text('Leaves Submission', style:
221
-                                  GoogleFonts.josefinSans(fontSize: 18, fontWeight: FontWeight.bold, decoration: TextDecoration.underline,
222
-                                  decorationStyle: TextDecorationStyle.dashed),),
223
-                                ),
224
-                                Container(
225
-                                  margin: EdgeInsets.only(
226
-                                      left: 10, right: 10, top: 10, bottom: 10),
227
-                                  child: Column(
228
-                                    children: [
229
-                                      Align(
230
-                                          alignment: Alignment.centerLeft,
231
-                                          child: Text(
232
-                                            'Type',
233
-                                            style: GoogleFonts.inconsolata(
234
-                                                fontSize: 16, fontWeight: FontWeight.bold),
235
-                                          )),
236
-                                      Container(
237
-                                        margin: EdgeInsets.only(top: 7),
238
-                                        decoration: BoxDecoration(
239
-                                            color:
240
-                                                CupertinoColors.systemGrey2,
241
-                                            borderRadius:
242
-                                                BorderRadius.circular(5)),
243
-                                        child: DropdownButton(
244
-                                          menuMaxHeight: size.height * 0.31,
245
-                                          dropdownColor: Colors.grey.shade300,
246
-                                          value: this.selectedType,
247
-                                          isExpanded: true,
248
-                                          underline: SizedBox(),
249
-                                          hint: Text(
250
-                                            '\t\t\tChoose Leaves Type',
251
-                                            style: TextStyle(
252
-                                                color: Colors.black54),
253
-                                          ),
254
-                                          onChanged: (value) {
255
-                                            logDev.log(value.toString(), name: "VALUENYA");
256
-                                            //print(value);
257
-                                            setState(() {
258
-                                              selectedType = value!;
259
-                                              for (int i = 0; i < cutiType.length; i++){
260
-                                                if (selectedType == cutiType.elementAt(i)){
261
-                                                  idCuti = idCutiType.elementAt(i);
262
-                                                }
263
-                                              }
264
-                                            });
265
-                                          },
266
-                                          items: cutiType
267
-                                              .map((e) => DropdownMenuItem(
268
-                                                    value: e,
269
-                                                    child:
270
-                                                        Text("\t\t\t" + e)),
271
-                                              ).toList(),
272
-                                        ),
273
-                                      ),
274
-                                    ],
275
-                                  ),
276
-                                ),
277
-                                Container(
278
-                                  margin: EdgeInsets.only(
279
-                                      left: 10, right: 10, top: 10, bottom: 10),
280
-                                  child: Column(
281
-                                    children: [
282
-                                      Align(
283
-                                          alignment: Alignment.centerLeft,
284
-                                          child: Text('From',
285
-                                                style: GoogleFonts.inconsolata(
286
-                                                    fontSize: 16, fontWeight: FontWeight.bold),
287
-                                              )
288
-                                          ),
289
-                                      ElevatedButton(
290
-                                              onPressed: () async {
291
-                                                DateTime? newDate =
292
-                                                    await showDatePicker(
293
-                                                        context: context,
294
-                                                        initialDate: dateFrom,
295
-                                                        firstDate:
296
-                                                            DateTime(1900),
297
-                                                        lastDate:
298
-                                                            DateTime(2100));
299
-                                                final DateFormat formatter = DateFormat('yyyy-MM-dd');
300
-                                                if (newDate == null) {
301
-                                                  return;
302
-                                                } else {
303
-                                                  setState(() {
304
-                                                    if (visibleDateFrom == false){
305
-                                                      visibleDateFrom = !visibleDateFrom;
306
-                                                    }
307
-                                                    formattedDateFrom = formatter.format(newDate);
308
-                                                    //dateFrom = formattedFrom as DateTime;
309
-                                                  });
310
-                                                }
311
-                                              },
312
-                                              /*style: ElevatedButton.styleFrom(
313
-                                                  backgroundColor:
314
-                                                      CupertinoColors
315
-                                                          .systemGrey2),*/
316
-                                              child: Container(
317
-                                                width: double.infinity,
318
-                                                child: Text(
319
-                                                  "Choose Date",
320
-                                                  style: TextStyle(
321
-                                                      color: Colors.white,
322
-                                                      fontSize: 16,
323
-                                                      fontWeight:
324
-                                                          FontWeight.w400),
325
-                                                ),
326
-                                              ),
327
-                                            ),
328
-                                      Visibility(
329
-                                              visible: visibleDateFrom,
330
-                                              child: Container(
331
-                                                alignment: Alignment.centerLeft,
332
-                                                margin: EdgeInsets.only(
333
-                                                    left: 15,
334
-                                                    right: 15,
335
-                                                    bottom: 5),
336
-                                                child: Text(formattedDateFrom,
337
-                                                  overflow:
338
-                                                      TextOverflow.ellipsis,
339
-                                                  maxLines: 1,
340
-                                                  style: TextStyle(
341
-                                                      color: Colors.black54),
342
-                                                ),
343
-                                              ),
344
-                                            ),
345
-                                    ],
346
-                                  ),
347
-                                ),
348
-                                Container(
349
-                                  margin: EdgeInsets.only(
350
-                                      left: 10, right: 10, top: 10, bottom: 10),
351
-                                  child: Column(
352
-                                    children: [
353
-                                      Align(
354
-                                          alignment: Alignment.centerLeft,
355
-                                          child: Text(
356
-                                                'To',
357
-                                                style: GoogleFonts.inconsolata(
358
-                                                    fontSize: 16, fontWeight: FontWeight.bold),
359
-                                              ),
360
-                                      ),
361
-                                      Column(
362
-                                        children: [
363
-                                          ElevatedButton(
364
-                                            onPressed: () async {DateTime? newDate = await showDatePicker(context: context, initialDate: dateTo, firstDate: DateTime(1900),
365
-                                                lastDate: DateTime(2100));
366
-                                                final DateFormat formatter = DateFormat('yyyy-MM-dd');
367
-                                                if (newDate == null) {
368
-                                                  return;
369
-                                                } else {
370
-                                                  setState(() {
371
-                                                    if (visibleDateTo == false){
372
-                                                      visibleDateTo = !visibleDateTo;
373
-                                                    }
374
-                                                    formattedDateTo = formatter.format(newDate);
375
-                                                  });
376
-                                                }
377
-                                              },
378
-                                              /*style: ElevatedButton.styleFrom(
379
-                                                  backgroundColor:
380
-                                                      CupertinoColors
381
-                                                          .systemGrey2),*/
382
-                                              child: Container(
383
-                                                width: double.infinity,
384
-                                                child: Text(
385
-                                                  "Choose Date",
386
-                                                  style: TextStyle(
387
-                                                      color: Colors.white,
388
-                                                      fontSize: 16,
389
-                                                      fontWeight:
390
-                                                          FontWeight.w400),
391
-                                                ),
392
-                                              ),
393
-                                            ),
394
-                                          Visibility(
395
-                                            visible: visibleDateTo,
396
-                                            child: Container(
397
-                                              alignment: Alignment.centerLeft,
398
-                                              margin: EdgeInsets.only(
399
-                                                  left: 15,
400
-                                                  right: 15,
401
-                                                  bottom: 5),
402
-                                              child: Text(formattedDateTo,
403
-                                                overflow:
404
-                                                    TextOverflow.ellipsis,
405
-                                                maxLines: 1,
406
-                                                style: TextStyle(
407
-                                                    color: Colors.black54),
408
-                                              ),
409
-                                            ),
410
-                                          )
411
-                                        ],
412
-                                      ),
413
-                                    ],
414
-                                  ),
415
-                                ),
416
-                                Container(
417
-                                  margin: EdgeInsets.only(
418
-                                      left: 10, right: 10, top: 10, bottom: 10),
419
-                                  child: Column(
420
-                                    children: [
421
-                                      Align(
422
-                                          alignment: Alignment.centerLeft,
423
-                                          child: Text(
424
-                                            'Description',
425
-                                            style: GoogleFonts.inconsolata(
426
-                                                fontSize: 16, fontWeight: FontWeight.bold),
427
-                                          )),
428
-                                      Container(
429
-                                        margin: EdgeInsets.only(top: 7),
430
-                                        decoration: BoxDecoration(
431
-                                            color: Colors.white,
432
-                                            borderRadius:
433
-                                                BorderRadius.circular(5)),
434
-                                        child: Padding(
435
-                                          padding: EdgeInsets.only(
436
-                                              left: 10,
437
-                                              right: 10,
438
-                                              top: 5,
439
-                                              bottom: 5),
440
-                                          child: TextFormField(
441
-                                              keyboardType: TextInputType.multiline,
442
-                                              maxLines: null,
443
-                                              textInputAction: TextInputAction.done,
444
-                                              controller: deskripsiTeksController,
445
-                                              decoration: InputDecoration(
446
-                                                  border:
447
-                                                      InputBorder.none,
448
-                                                  hintText: "description")),
449
-                                        )
450
-                                      ),
451
-                                    ],
452
-                                  ),
453
-                                ),
454
-                                Container(
455
-                                  margin: EdgeInsets.only(
456
-                                      left: 10, right: 10, top: 10),
457
-                                  child: Column(
458
-                                    children: [
459
-                                      Align(
460
-                                        alignment: Alignment.centerLeft,
461
-                                        child: Text(
462
-                                          'Attachment',
463
-                                          style: GoogleFonts.inconsolata(
464
-                                              fontSize: 16, fontWeight: FontWeight.bold),
465
-                                        ),
466
-                                      ),
467
-                                      Container(
468
-                                        child: ElevatedButton(
469
-                                          onPressed: () {
470
-                                            _pickMultipleFiles();
471
-                                          },
472
-                                          /*style: ElevatedButton.styleFrom(
473
-                                                    backgroundColor:
474
-                                                        CupertinoColors
475
-                                                            .systemGrey2),*/
476
-                                          child: Container(
477
-                                            width: double.infinity,
478
-                                            child: Text("Choose File",
479
-                                                style: TextStyle(
480
-                                                    color: Colors.white,
481
-                                                    fontSize: 16,
482
-                                                    fontWeight:
483
-                                                    FontWeight.w400)),
484
-                                          ),
485
-                                        ),
486
-                                      ),
487
-                                      Container(
488
-                                        alignment:
489
-                                        Alignment.centerLeft,
490
-                                        margin: EdgeInsets.only(
491
-                                            left: 15,
492
-                                            right: 15,
493
-                                            bottom: 10),
494
-                                        child: Text(_totalFile + _fileText,
495
-                                          overflow:
496
-                                          TextOverflow.ellipsis,
497
-                                          /*maxLines: 7,*/
498
-                                          style: TextStyle(
499
-                                              color: Colors.black54),
500
-                                        ),
501
-                                      ),
502
-                                    ],
503
-                                  ),
504
-                                ),
505
-                                InkWell(
506
-                                  child: Container(
507
-                                    margin: EdgeInsets.only(left: 10, right: 10, bottom: 15),
508
-                                    padding: EdgeInsets.fromLTRB(
509
-                                        10, 10, 10, 10),
510
-                                    width: double.infinity,
511
-                                    decoration: BoxDecoration(
512
-                                        borderRadius:
513
-                                        BorderRadius.circular(5),
514
-                                        gradient: LinearGradient(colors: [
515
-                                          Color(0xFFFF9945),
516
-                                          Color(0xFFFc6076)
517
-                                        ])),
518
-                                    child: Text('Submit',
519
-                                        textAlign: TextAlign.center,
520
-                                        style: TextStyle(
521
-                                            color: Colors.white,
522
-                                            fontSize: 17,
523
-                                            fontWeight: FontWeight.w500)),
524
-                                  ),
525
-                                  onTap: () async {
526
-                                    ProgressDialog loading = ProgressDialog(context);
527
-                                    loading = ProgressDialog(context,
528
-                                        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
529
-                                    loading.style(
530
-                                        message: 'Please Wait .....',
531
-                                        borderRadius: 3,
532
-                                        backgroundColor: Colors.white,
533
-                                        progressWidget: CircularProgressIndicator(),
534
-                                        elevation: 10.0,
535
-                                        padding: EdgeInsets.all(10),
536
-                                        insetAnimCurve: Curves.easeInOut,
537
-                                        progress: 0.0,
538
-                                        maxProgress: 100.0,
539
-                                        progressTextStyle: TextStyle(
540
-                                            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
541
-                                        messageTextStyle: TextStyle(
542
-                                            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
543
-
544
-                                    //loading.show();
545
-
546
-                                    if (!validateFormCuti(context)){
547
-                                      return;
548
-                                    } else if (validateFormCuti(context)){
549
-                                      await loading.show();
550
-                                      PengajuanCuti_Post.connectToAPI(idCuti, formattedDateFrom,
551
-                                          formattedDateTo, deskripsiTeksController.text.toString(), fileAttach)
552
-                                          .then((valueResult) async {
553
-                                        Map<String, dynamic> object = json.decode(valueResult);
554
-                                        logDev.log(fileAttach.toString(), name: "Attachment File Upload");
555
-                                        if (object.containsKey("result").toString() == "true") {
556
-                                          /*String employee = object['result']['employee'].toString();
557
-                                              String tipe = object['result']['tipe'].toString();
558
-                                              String from = object['result']['from'].toString();
559
-                                              String to = object['result']['to'].toString();
560
-                                              String deskripsi = object['result']['deskripsi'].toString();
561
-                                              String attachment = object['result']['attachment'].toString();*/
562
-                                          await loading.hide();
563
-                                          deskripsiTeksController.clear();
564
-                                          Widget okButton = TextButton(
565
-                                            child: Text("OK"),
566
-                                            onPressed: () {
567
-                                              Navigator.of(context, rootNavigator: true).pop();
568
-                                              Navigator.pushReplacement(context, MaterialPageRoute(
569
-                                                  builder: (context) => AjukanCutiScreen()));
570
-                                            },
571
-                                          );
572
-
573
-                                          // set up the AlertDialog
574
-                                          AlertDialog alert = AlertDialog(
575
-                                            title: Text("Employee Self Service"),
576
-                                            content: Text("Success Submit Leaves"),
577
-                                            actions: [
578
-                                              okButton,
579
-                                            ],
580
-                                          );
581
-
582
-                                          // show the dialog
583
-                                          showDialog(
584
-                                            context: context,
585
-                                            builder: (BuildContext context) {
586
-                                              return alert;
587
-                                            },
588
-                                          );
589
-                                          /* deskripsiTeksController.clear();
590
-                                                formattedDateFrom = "";
591
-                                                formattedDateTo = "";
592
-                                                visibleDateFrom = false;
593
-                                                visibleDateFrom = false;*/
594
-                                        } else if (object.containsKey("error").toString() == "true") {
595
-                                          String errorMessage = object['error']['data']['message']
596
-                                              .toString();
597
-                                          await loading.hide();
598
-                                          Widget okButton = TextButton(
599
-                                            child: Text("OK"),
600
-                                            onPressed: () {
601
-                                              Navigator.of(context, rootNavigator: true).pop();
602
-                                            },
603
-                                          );
604
-
605
-                                          // set up the AlertDialog
606
-                                          AlertDialog alert = AlertDialog(
607
-                                            title: Text("Employee Self Service"),
608
-                                            content: Text(errorMessage),
609
-                                            actions: [
610
-                                              okButton,
611
-                                            ],
612
-                                          );
613
-
614
-                                          // show the dialog
615
-                                          showDialog(
616
-                                            context: context,
617
-                                            builder: (BuildContext context) {
618
-                                              return alert;
619
-                                            },
620
-                                          );
621
-                                        }
622
-                                      });
623
-                                    }
624
-                                  },
625
-                                )
626
-                              ],
627
-                            ),
628
-                          ),
629
-                        ),
630
-                      ),
631
-                    ],
632
-                  ),
633
-                ),
634
-              ),
635
-            ],
636
-          ),
637
-        ],
638
-      )),
639
-    );
640
-  }
641
-
642
-  void _pickMultipleFiles() async {
643
-    FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true);
644
-
645
-    if (_fileText != ""){
646
-      _fileText = "";
647
-    }
648
-
649
-    if (result != null) {
650
-      List<File> files = result.paths.map((path) => File(path!)).toList();
651
-      for (int i = 0; i< files.length; i++){
652
-        String fileName = files[i].path.split('/').last;
653
-        _fileText = _fileText + "\n" + fileName;
654
-
655
-        List<int> fileInBytes = files[i].readAsBytesSync();
656
-        String toBase64 = base64Encode(fileInBytes);
657
-        fileAttach.add(toBase64);
658
-      }
659
-      fileAttach.removeAt(0);
660
-      logDev.log(fileAttach.length.toString(), name: "Length File Attach");
661
-      logDev.log(files.toString(), name: "Files Picked");
662
-
663
-      setState(() {
664
-        _fileText;
665
-        _totalFile = "Total File : " + files.length.toString();
666
-      });
667
-    } else {
668
-      // User canceled the picker
669
-    }
670
-  }
671
-
672
-  bool validateFormCuti(BuildContext context) {
673
-    bool result = true;
674
-    if (selectedType == null) {
675
-      Fluttertoast.showToast(
676
-          msg: " Type Not Selected",
677
-          toastLength: Toast.LENGTH_SHORT,
678
-          gravity: ToastGravity.CENTER,
679
-          timeInSecForIosWeb: 1,
680
-          textColor: Colors.white,
681
-          fontSize: 16.0);
682
-      result = false;
683
-    } else if  (formattedDateFrom == "" || formattedDateTo == "") {
684
-      Fluttertoast.showToast(
685
-          msg: "Time Off Date Not Selected",
686
-          toastLength: Toast.LENGTH_SHORT,
687
-          gravity: ToastGravity.CENTER,
688
-          timeInSecForIosWeb: 1,
689
-          textColor: Colors.white,
690
-          fontSize: 16.0);
691
-      result = false;
692
-    } else if (deskripsiTeksController.text.toString().isEmpty) {
693
-      Fluttertoast.showToast(
694
-          msg: "Description Required!",
695
-          toastLength: Toast.LENGTH_SHORT,
696
-          gravity: ToastGravity.CENTER,
697
-          timeInSecForIosWeb: 1,
698
-          textColor: Colors.white,
699
-          fontSize: 16.0);
700
-      result = false;
701
-    }
702
-
703
-    return result;
704
-  }
705
-}
706
-
707
-alertDialogFailedRetrievedData(BuildContext context){
708
-  Widget okButton = TextButton(
709
-    child: Text("Refresh"),
710
-    onPressed: () {
711
-      Navigator.of(context, rootNavigator: true).pop();
712
-      Navigator.pushReplacement(context, MaterialPageRoute(
713
-          builder: (context) => AjukanCutiScreen()));
714
-    },
715
-  );
716
-
717
-  Widget noButton = TextButton(
718
-    child: Text("Back"),
719
-    onPressed: () {
720
-      Navigator.of(context, rootNavigator: true).pop();
721
-      Navigator.pop(context);
722
-
723
-    },
724
-  );
725
-
726
-  // set up the AlertDialog
727
-  AlertDialog alert = AlertDialog(
728
-    title: Text("Employee Self Service"),
729
-    content: Text("Failed to Retrieve Data"),
730
-    actions: [
731
-      noButton,
732
-      okButton,
733
-    ],
734
-  );
735
-
736
-  // show the dialog
737
-  showDialog(
738
-    context: context,
739
-    builder: (BuildContext context) {
740
-      return alert;
741
-    },
742
-  );
743
-}
744
-
745
-alertDialogFailedResponse(BuildContext context){
746
-  Widget okButton = TextButton(
747
-    child: Text("Refresh"),
748
-    onPressed: () {
749
-      Navigator.of(context, rootNavigator: true).pop();
750
-      Navigator.pushReplacement(context, MaterialPageRoute(
751
-          builder: (context) => AjukanCutiScreen()));
752
-    },
753
-  );
754
-
755
-  Widget noButton = TextButton(
756
-    child: Text("Back"),
757
-    onPressed: () {
758
-      Navigator.of(context, rootNavigator: true).pop();
759
-      Navigator.pop(context);
760
-
761
-    },
762
-  );
763
-
764
-  // set up the AlertDialog
765
-  AlertDialog alert = AlertDialog(
766
-    title: Text("Employee Self Service"),
767
-    content: Text("Server Response Error"),
768
-    actions: [
769
-      noButton,
770
-      okButton,
771
-    ],
772
-  );
773
-
774
-  // show the dialog
775
-  showDialog(
776
-    context: context,
777
-    builder: (BuildContext context) {
778
-      return alert;
779
-    },
780
-  );
781
-}

+ 0
- 89
lib/Screens/Menu/AjukanCuti/backgroundHistory.dart Просмотреть файл

@@ -1,89 +0,0 @@
1
-import 'package:flutter/material.dart';
2
-
3
-class Background extends StatelessWidget {
4
-  const Background({Key? key}) : super(key: key);
5
-
6
-  @override
7
-  Widget build(BuildContext context) {
8
-    return Scaffold(
9
-      resizeToAvoidBottomInset: false,
10
-      backgroundColor: Colors.white,
11
-      body: Column(
12
-        children: <Widget>[
13
-          new Stack(
14
-            children: <Widget>[
15
-              WavyHeader()
16
-            ],
17
-          ),
18
-        ],
19
-      ),
20
-    );
21
-  }
22
-}
23
-
24
-const List<Color> orangeGradients = [
25
-  /*Color(0xFFD21404),
26
-  Color(0xFFFD7267)*/
27
-  Color(0xFF4858A7),
28
-  Color(0xFF6474C6),
29
-];
30
-
31
-const List<Color> aquaGradients = [
32
-  Color(0xFF8EF7DA),
33
-  Color(0xFF5AEAF1),
34
-  Colors.blueAccent,
35
-];
36
-
37
-class WavyHeader extends StatelessWidget {
38
-  @override
39
-  Widget build(BuildContext context) {
40
-    return ClipPath(
41
-      clipper: TopWaveClipper(),
42
-      child: Container(
43
-        decoration: BoxDecoration(
44
-          gradient: LinearGradient(
45
-              colors: orangeGradients,
46
-              begin: Alignment.topLeft,
47
-              end: Alignment.center),
48
-        ),
49
-        height: MediaQuery.of(context).size.height / 2.5,
50
-      ),
51
-    );
52
-  }
53
-}
54
-
55
-class TopWaveClipper extends CustomClipper<Path> {
56
-  @override
57
-  Path getClip(Size size) {
58
-    // This is where we decide what part of our image is going to be visible.
59
-    var path = Path();
60
-    path.lineTo(0.0, 0.0);
61
-
62
-    var firstControlPoint = new Offset(0, size.height - 30);
63
-    var firstEndPoint = new Offset(0, size.height / 2);
64
-
65
-    path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
66
-        firstEndPoint.dx, firstEndPoint.dy);
67
-
68
-    var secondControlPoint = Offset(size.width / 5, size.height / 4);
69
-    var secondEndPoint = Offset(size.width / 1.5, size.height / 5);
70
-    path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
71
-        secondEndPoint.dx, secondEndPoint.dy);
72
-
73
-    var thirdControlPoint =
74
-    Offset(size.width - (size.width / 9), size.height / 6);
75
-    var thirdEndPoint = Offset(size.width, 0.0);
76
-    path.quadraticBezierTo(thirdControlPoint.dx, thirdControlPoint.dy,
77
-        thirdEndPoint.dx, thirdEndPoint.dy);
78
-
79
-    ///move from bottom right to top
80
-    path.lineTo(size.width, 0.0);
81
-
82
-    ///finally close the path by reaching start point from top right corner
83
-    path.close();
84
-    return path;
85
-  }
86
-
87
-  @override
88
-  bool shouldReclip(CustomClipper<Path> oldClipper) => false;
89
-}

+ 626
- 0
lib/Screens/Menu/Canvasing/canvasingDetail_screen.dart Просмотреть файл

@@ -0,0 +1,626 @@
1
+import 'dart:async';
2
+import 'dart:convert';
3
+import 'dart:ffi';
4
+
5
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/filing_screen.dart';
6
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/navigate_post.dart';
7
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/startFiling_post.dart';
8
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/updateGPS_post.dart';
9
+import 'package:flutter/material.dart';
10
+import 'package:flutter_map/plugin_api.dart';
11
+import 'package:geolocator/geolocator.dart';
12
+import 'package:latlong2/latlong.dart' as latlong;
13
+import 'package:location/location.dart' as loc;
14
+import 'dart:developer' as logDev;
15
+
16
+import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
17
+import 'package:shared_preferences/shared_preferences.dart';
18
+import 'package:sliding_up_panel/sliding_up_panel.dart';
19
+
20
+class CanvasingDetail extends StatefulWidget {
21
+  const CanvasingDetail({Key? key}) : super(key: key);
22
+
23
+  @override
24
+  State<CanvasingDetail> createState() => _CanvasingDetail();
25
+}
26
+
27
+class _CanvasingDetail extends State<CanvasingDetail> {
28
+  late latlong.LatLng point = latlong.LatLng(-6.183580253674716, 106.93103973792664);
29
+  late Position position;
30
+
31
+  MapController _mapController = MapController();
32
+
33
+  @override
34
+  void initState() {
35
+    determinePosition();
36
+    WidgetsBinding.instance.addPostFrameCallback((_) {
37
+      initTimer();
38
+    });
39
+    super.initState();
40
+  }
41
+
42
+  Timer? timer;
43
+  void initTimer(){
44
+    if (timer != null && timer!.isActive) return;
45
+    timer = Timer.periodic(Duration(seconds: 10), (timer) {
46
+      setState(() {
47
+        updatePosition();
48
+      });
49
+    });
50
+  }
51
+
52
+  @override
53
+  void dispose() {
54
+    timer?.cancel();
55
+    super.dispose();
56
+  }
57
+
58
+  determinePosition() async {
59
+    StreamSubscription<ServiceStatus> serviceStatusStream = Geolocator.getServiceStatusStream().listen(
60
+            (ServiceStatus status) {
61
+          print(status);
62
+        });
63
+
64
+    ProgressDialog loading = ProgressDialog(context);
65
+    loading = ProgressDialog(context, type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
66
+    loading.style(
67
+        message: 'Please Wait .....',
68
+        borderRadius: 3,
69
+        backgroundColor: Colors.white,
70
+        progressWidget: CircularProgressIndicator(),
71
+        elevation: 10.0,
72
+        padding: EdgeInsets.all(10),
73
+        insetAnimCurve: Curves.easeInOut,
74
+        progress: 0.0,
75
+        maxProgress: 100.0,
76
+        progressTextStyle: TextStyle(color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
77
+        messageTextStyle: TextStyle(color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
78
+
79
+    await loading.show();
80
+
81
+    bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
82
+    logDev.log(serviceEnabled.toString(), name: "ON/OFF LOCATION SERVICE");
83
+    if (!serviceEnabled) {
84
+      return Future.error('Location services are disabled.');
85
+    }
86
+
87
+    LocationPermission permission = await Geolocator.checkPermission();
88
+
89
+    if (permission == LocationPermission.deniedForever) {
90
+      await loading.hide();
91
+      //return Future.error('Location permissions are permanently denied, we cannot request permissions.');
92
+      return alertDialogPermissionDeniedForever(context);
93
+    } else if (permission == LocationPermission.denied) {
94
+      permission = await Geolocator.requestPermission();
95
+      if (permission != LocationPermission.whileInUse && permission != LocationPermission.always) {
96
+        await loading.hide();
97
+        //return Future.error('Location permissions are denied (actual value: $permission).');
98
+        return alertDialogPermissionDenied(context);
99
+      }
100
+    }
101
+
102
+    final SharedPreferences prefs = await SharedPreferences.getInstance();
103
+    String? idDetail = prefs.getString('idDetail');
104
+    int? user_id = prefs.getInt('user_id');
105
+
106
+      Navigate_Post.connectToAPI(idDetail!, user_id!).then((valueResult) async {
107
+        Map<String, dynamic> object = json.decode(valueResult);
108
+        if (object.containsKey("result").toString() == "true") {
109
+          String result = object['result'].toString();
110
+          String status = object['result']['status'].toString();
111
+          logDev.log(result, name: "Status??");
112
+          if (status.contains("success")){
113
+            String mapsPoint =  object['result']['maps'].toString();
114
+            double? lat = double.tryParse(mapsPoint.split(",")[0]);
115
+            double? long = double.tryParse(mapsPoint.split(",")[1]);
116
+            logDev.log(mapsPoint, name: "titik lokasinya");
117
+              position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
118
+              logDev.log(position.toString(), name: "Position GEOLOCATOR");
119
+              if (position.isMocked) {
120
+                await loading.hide();
121
+                setState(() {
122
+                  alertDialogFakeGPSDetected(context);
123
+                });
124
+              } else {
125
+                setState(() {
126
+                  point = latlong.LatLng(lat!,long!);
127
+                  logDev.log(point.toString(), name: "POINT GEOLOCATOR");
128
+                  _mapController.move(point, 18);
129
+                });
130
+              }
131
+              await loading.hide();
132
+            await loading.hide();
133
+          } else if (status.contains("failed")){
134
+            setState(() {
135
+              alertDialogFailedResponse(context);
136
+            });
137
+            await loading.hide();
138
+          }
139
+        } else {
140
+          setState(() {
141
+            alertDialogFailedResponse(context);
142
+          });
143
+          await loading.hide();
144
+        }
145
+        await loading.hide();
146
+      });
147
+      logDev.log("DAH SELESE BUiLD NAVIGATENYA!", name: "UDAH?");
148
+
149
+    }
150
+
151
+  Future<void> updatePosition() async {
152
+    logDev.log("NAH BARU MULAI!", name: "MULAI?");
153
+    ProgressDialog loading = ProgressDialog(context);
154
+    loading = ProgressDialog(context,
155
+        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
156
+    loading.style(
157
+        message: 'Please Wait .....',
158
+        borderRadius: 3,
159
+        backgroundColor: Colors.white,
160
+        progressWidget: CircularProgressIndicator(),
161
+        elevation: 10.0,
162
+        padding: EdgeInsets.all(10),
163
+        insetAnimCurve: Curves.easeInOut,
164
+        progress: 0.0,
165
+        maxProgress: 100.0,
166
+        progressTextStyle: TextStyle(
167
+            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
168
+        messageTextStyle: TextStyle(
169
+            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
170
+
171
+    bool serviceEnabled;
172
+    LocationPermission permission;
173
+
174
+    serviceEnabled = await Geolocator.isLocationServiceEnabled();
175
+    if (!serviceEnabled) {
176
+      await loading.hide();
177
+      return Future.error('Location services are disabled.');
178
+    }
179
+
180
+    permission = await Geolocator.checkPermission();
181
+
182
+    if (permission == LocationPermission.deniedForever) {
183
+      await loading.hide();
184
+      return alertDialogPermissionDeniedForever(context);
185
+    } else if (permission == LocationPermission.denied) {
186
+      permission = await Geolocator.requestPermission();
187
+      if (permission != LocationPermission.whileInUse && permission != LocationPermission.always) {
188
+        await loading.hide();
189
+        return alertDialogPermissionDenied(context);
190
+      }
191
+    }
192
+
193
+    position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
194
+    if (position.isMocked) {
195
+      await loading.hide();
196
+      setState(() {
197
+        alertDialogFakeGPSDetected(context);
198
+      });
199
+    } else {
200
+      await loading.hide();
201
+      final SharedPreferences prefs = await SharedPreferences.getInstance();
202
+      String? idDetail = prefs.getString('idDetail');
203
+      int? user_id = prefs.getInt('user_id');
204
+
205
+      point = latlong.LatLng(position.latitude, position.longitude);
206
+      logDev.log(point.toString(), name: "UPDATE POINT GEOLOCATOR");
207
+      _mapController.move(point, 18);
208
+      position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
209
+      String titik = position.latitude.toString() + "," + position.longitude.toString();
210
+      logDev.log(titik, name: "TITIK UPDATE");
211
+
212
+      setState(() {
213
+        UpdateGPS_Post.connectToAPI(idDetail!, titik, user_id!).then((valueResult) async {
214
+          Map<String, dynamic> object = json.decode(valueResult);
215
+          if (object.containsKey("result").toString() == "true") {
216
+            String status = object['result']['status'].toString();
217
+            if (status.contains("success")){
218
+              String mapsPoint =  object['result']['maps'].toString();
219
+              logDev.log(mapsPoint, name: "titik lokasinya");
220
+              position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
221
+              logDev.log(position.toString(), name: "Position GEOLOCATOR");
222
+              if (position.isMocked) {
223
+                await loading.hide();
224
+                setState(() {
225
+                  alertDialogFakeGPSDetected(context);
226
+                });
227
+              } else {
228
+                setState(() {
229
+                  point = latlong.LatLng(double.parse(mapsPoint.split(",")[0]), double.parse(mapsPoint.split(",")[1]));
230
+                  logDev.log(point.toString(), name: "POINT GEOLOCATOR");
231
+                  _mapController.move(point, 18);
232
+                });
233
+              }
234
+              await loading.hide();
235
+            } else if (status.contains("failed")){
236
+              setState(() {
237
+                alertDialogFailedResponse(context);
238
+              });
239
+              await loading.hide();
240
+            }
241
+          } else {
242
+            setState(() {
243
+              alertDialogFailedResponse(context);
244
+            });
245
+            await loading.hide();
246
+          }
247
+          await loading.hide();
248
+        });
249
+      });
250
+    }
251
+  }
252
+
253
+  PanelController _panelController = PanelController();
254
+
255
+  void togglePanel() => _panelController.isPanelOpen
256
+      ? _panelController.close()
257
+      : _panelController.open();
258
+
259
+  @override
260
+  Widget build(BuildContext context) {
261
+    var size = MediaQuery.of(context).size;
262
+    return Scaffold(
263
+      body: SlidingUpPanel(
264
+        controller: _panelController,
265
+        parallaxEnabled: true,
266
+        maxHeight: size.height * 0.2,
267
+        minHeight: size.height * 0.2,
268
+        body: Container (
269
+          child: Stack(
270
+            children: [
271
+              FlutterMap(
272
+                mapController: _mapController,
273
+                options: new MapOptions(
274
+                    onTap: (p, point) async {}, center: point, zoom: 15),
275
+                children: [
276
+                  TileLayer(
277
+                    minZoom: 1,
278
+                    maxZoom: 22,
279
+                    maxNativeZoom: 18,
280
+                    minNativeZoom: 1,
281
+                    backgroundColor: Colors.black54,
282
+                    urlTemplate:
283
+                    'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
284
+                    subdomains: ['a', 'b', 'c'],
285
+                  ),
286
+                  MarkerLayer(markers: [
287
+                    Marker(
288
+                        width: 135,
289
+                        height: 135,
290
+                        point: point,
291
+                        builder: (ctx) => Container(
292
+                          child: Icon(
293
+                            Icons.location_on,
294
+                            color: Colors.red,
295
+                          ),
296
+                        ))
297
+                  ])
298
+                ],
299
+              ),
300
+              Container(
301
+                alignment: AlignmentDirectional.bottomEnd,
302
+                child: Container(
303
+                  margin: EdgeInsets.fromLTRB(10, 15, 0, (size.height*0.3) + 15),
304
+                  child: RawMaterialButton(
305
+                    onPressed: () {
306
+                      setState(() {
307
+                        updatePosition();
308
+                      });
309
+                    },
310
+                    elevation: 5.0,
311
+                    fillColor: Colors.white,
312
+                    child: Image.asset('assets/images/location1.png',
313
+                        height: 40, width: 40),
314
+                    padding: EdgeInsets.all(5.0),
315
+                    shape: CircleBorder(),
316
+                  ),
317
+                ),
318
+              ),
319
+            ],
320
+          ),
321
+        ),
322
+        panel: Center(
323
+          child: Column(
324
+            children: [
325
+              GestureDetector(
326
+                onTap: togglePanel,
327
+                child: Center(
328
+                  child: Container(
329
+                    margin: EdgeInsets.only(top: 15),
330
+                    height: 5,
331
+                    width: size.width * 0.1,
332
+                    decoration: BoxDecoration(
333
+                        borderRadius: BorderRadius.circular(10),
334
+                        color: Colors.grey
335
+                    ),
336
+                  ),
337
+                ),
338
+              ),
339
+              Container(
340
+                width: double.infinity,
341
+                margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
342
+                //decoration: BoxDecoration(border: Border.all(color: Colors.black), borderRadius: BorderRadius.all(Radius.circular(15))),
343
+                child: Column(
344
+                  children: <Widget>[
345
+
346
+                  ],
347
+                ),
348
+              ),
349
+              Container(
350
+                margin: EdgeInsets.fromLTRB(10, 15, 10, 15),
351
+                child: InkWell(
352
+                  child: Container(
353
+                      padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
354
+                      width: double.infinity,
355
+                      decoration: BoxDecoration(
356
+                          borderRadius: BorderRadius.circular(5),
357
+                          gradient: LinearGradient(colors: [
358
+                            Color(0xFF2D4059),
359
+                            Color(0xFF2D4059),
360
+                          ])),
361
+                      child: Row(
362
+                        mainAxisAlignment: MainAxisAlignment.center,
363
+                        children: [
364
+                          Text('Start Filing\t\t',
365
+                              textAlign: TextAlign.center,
366
+                              style: TextStyle(
367
+                                  color: Colors.white,
368
+                                  fontSize: 17,
369
+                                  fontWeight: FontWeight.w500)),
370
+                          Image.asset(
371
+                            'assets/images/ic_arrow_white.png',
372
+                            width: 30,
373
+                            height: 30,
374
+                          )
375
+                        ],
376
+                      )),
377
+                  onTap: () async {
378
+                    final SharedPreferences prefs = await SharedPreferences.getInstance();
379
+                    String? idDetail = prefs.getString('idDetail');
380
+                    int? user_id = prefs.getInt('user_id');
381
+
382
+                    StartFiling_Post.connectToAPI(idDetail!, user_id!).then((valueResult) async {
383
+                      Navigator.push(context, MaterialPageRoute(builder: (context) => FilingScreen()));
384
+                    });
385
+
386
+                  },
387
+                ),
388
+              )
389
+            ],
390
+          ),
391
+        ),
392
+
393
+        borderRadius: BorderRadius.only(topLeft: Radius.circular(15), topRight: Radius.circular(15)),
394
+      ),
395
+    );
396
+  }
397
+}
398
+
399
+alertDialogFailedRetrievedData(BuildContext context) {
400
+  Widget okButton = TextButton(
401
+    child: Text("Refresh"),
402
+    onPressed: () {
403
+      Navigator.of(context, rootNavigator: true).pop();
404
+      Navigator.pushReplacement(
405
+          context, MaterialPageRoute(builder: (context) => CanvasingDetail()));
406
+    },
407
+  );
408
+
409
+  Widget noButton = TextButton(
410
+    child: Text("Back"),
411
+    onPressed: () {
412
+      Navigator.of(context, rootNavigator: true).pop();
413
+      Navigator.pop(context);
414
+    },
415
+  );
416
+
417
+  // set up the AlertDialog
418
+  AlertDialog alert = AlertDialog(
419
+    title: Text("Employee Self Service"),
420
+    content: Text("Failed to Retrieve Data"),
421
+    actions: [
422
+      noButton,
423
+      okButton,
424
+    ],
425
+  );
426
+
427
+  // show the dialog
428
+  showDialog(
429
+    context: context,
430
+    barrierDismissible: false,
431
+    builder: (BuildContext context) {
432
+      return alert;
433
+    },
434
+  );
435
+}
436
+
437
+alertDialogFailedResponse(BuildContext context) {
438
+  Widget okButton = TextButton(
439
+    child: Text("Refresh"),
440
+    onPressed: () {
441
+      Navigator.of(context, rootNavigator: true).pop();
442
+      Navigator.pushReplacement(
443
+          context, MaterialPageRoute(builder: (context) => CanvasingDetail()));
444
+    },
445
+  );
446
+
447
+  Widget noButton = TextButton(
448
+    child: Text("Back"),
449
+    onPressed: () {
450
+      Navigator.of(context, rootNavigator: true).pop();
451
+      Navigator.pop(context);
452
+    },
453
+  );
454
+
455
+  // set up the AlertDialog
456
+  AlertDialog alert = AlertDialog(
457
+    title: Text("Employee Self Service"),
458
+    content: Text("Server Response Error"),
459
+    actions: [
460
+      noButton,
461
+      okButton,
462
+    ],
463
+  );
464
+
465
+  // show the dialog
466
+  showDialog(
467
+    context: context,
468
+    barrierDismissible: false,
469
+    builder: (BuildContext context) {
470
+      return alert;
471
+    },
472
+  );
473
+}
474
+
475
+alertDialogFakeGPSDetected(BuildContext context) {
476
+  Widget okButton = TextButton(
477
+    child: Text("Refresh"),
478
+    onPressed: () {
479
+      Navigator.of(context, rootNavigator: true).pop();
480
+      Navigator.pushReplacement(
481
+          context, MaterialPageRoute(builder: (context) => CanvasingDetail()));
482
+    },
483
+  );
484
+
485
+  // set up the AlertDialog
486
+  AlertDialog alert = AlertDialog(
487
+    title: Text("Employee Self Service"),
488
+    content: Text("Fake GPS Detected, Please Use Default GPS!"),
489
+    actions: [
490
+      okButton,
491
+    ],
492
+  );
493
+
494
+  // show the dialog
495
+  showDialog(
496
+    context: context,
497
+    barrierDismissible: false,
498
+    builder: (BuildContext context) {
499
+      return alert;
500
+    },
501
+  );
502
+}
503
+
504
+alertDialogPermissionDenied(BuildContext context) {
505
+  Widget okButton = TextButton(
506
+    child: Text("Refresh"),
507
+    onPressed: () {
508
+      Navigator.of(context, rootNavigator: true).pop();
509
+      Navigator.pushReplacement(
510
+          context, MaterialPageRoute(builder: (context) => CanvasingDetail()));
511
+    },
512
+  );
513
+
514
+  Widget noButton = TextButton(
515
+    child: Text("Back"),
516
+    onPressed: () {
517
+      Navigator.of(context, rootNavigator: true).pop();
518
+      Navigator.pop(context);
519
+    },
520
+  );
521
+
522
+  // set up the AlertDialog
523
+  AlertDialog alert = AlertDialog(
524
+    title: Text("Employee Self Service"),
525
+    content:
526
+    Text("Location permissions are denied, we cannot request permissions"),
527
+    actions: [
528
+      noButton,
529
+      okButton,
530
+    ],
531
+  );
532
+
533
+  // show the dialog
534
+  showDialog(
535
+    context: context,
536
+    barrierDismissible: false,
537
+    builder: (BuildContext context) {
538
+      return alert;
539
+    },
540
+  );
541
+}
542
+
543
+alertDialogPermissionDeniedForever(BuildContext context) {
544
+  Widget noButton = TextButton(
545
+    child: Text("Back"),
546
+    onPressed: () {
547
+      Navigator.of(context, rootNavigator: true).pop();
548
+      Navigator.pop(context);
549
+    },
550
+  );
551
+
552
+  // set up the AlertDialog
553
+  AlertDialog alert = AlertDialog(
554
+    title: Text("Employee Self Service"),
555
+    content: Text(
556
+        "Location permissions are permanently denied, we cannot request permissions. Please configure it in your device settings."),
557
+    actions: [noButton],
558
+  );
559
+
560
+  // show the dialog
561
+  showDialog(
562
+    context: context,
563
+    barrierDismissible: false,
564
+    builder: (BuildContext context) {
565
+      return alert;
566
+    },
567
+  );
568
+}
569
+
570
+alertDialogEnableLocaionServices(BuildContext context) {
571
+  ProgressDialog loading = ProgressDialog(context);
572
+  loading = ProgressDialog(context,
573
+      type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
574
+  loading.style(
575
+      message: 'Please Wait .....',
576
+      borderRadius: 3,
577
+      backgroundColor: Colors.white,
578
+      progressWidget: CircularProgressIndicator(),
579
+      elevation: 10.0,
580
+      padding: EdgeInsets.all(10),
581
+      insetAnimCurve: Curves.easeInOut,
582
+      progress: 0.0,
583
+      maxProgress: 100.0,
584
+      progressTextStyle: TextStyle(
585
+          color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
586
+      messageTextStyle: TextStyle(
587
+          color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
588
+
589
+  Widget okButton = TextButton(
590
+    child: Text("Open Settings"),
591
+    onPressed: () {
592
+      //AppSettings.openLocationSettings();
593
+      Navigator.of(context, rootNavigator: true).pop();
594
+      loading.hide();
595
+    },
596
+  );
597
+
598
+  Widget noButton = TextButton(
599
+    child: Text("No, thanks"),
600
+    onPressed: () {
601
+      Navigator.of(context, rootNavigator: true).pop();
602
+      Navigator.pop(context);
603
+      loading.hide();
604
+    },
605
+  );
606
+
607
+  // set up the AlertDialog
608
+  AlertDialog alert = AlertDialog(
609
+    title: Text("Employee Self Service"),
610
+    content:
611
+    Text("For a better experience, please turn on your device location"),
612
+    actions: [
613
+      noButton,
614
+      okButton,
615
+    ],
616
+  );
617
+
618
+  // show the dialog
619
+  showDialog(
620
+    context: context,
621
+    barrierDismissible: false,
622
+    builder: (BuildContext context) {
623
+      return alert;
624
+    },
625
+  );
626
+}

lib/Screens/Menu/AjukanCuti/history_cuti.dart → lib/Screens/Menu/Canvasing/canvasing_screen.dart Просмотреть файл

@@ -1,60 +1,73 @@
1
+import 'dart:async';
1 2
 import 'dart:convert';
3
+import 'dart:ffi';
2 4
 
5
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/canvasingDetail_screen.dart';
6
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/getAll_post.dart';
3 7
 import 'package:flutter/material.dart';
4 8
 import 'package:fluttertoast/fluttertoast.dart';
5 9
 import 'package:google_fonts/google_fonts.dart';
6
-import 'package:employee_selfservice_mobile/Screens/Menu/AjukanCuti/RequestHttp/historyCuti_post.dart';
7 10
 import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
11
+import 'package:shared_preferences/shared_preferences.dart';
8 12
 import 'dart:developer' as logDev;
9 13
 
10
-import '../AjukanCuti/backgroundHistory.dart';
14
+import '../../background.dart';
11 15
 
12
-class HistoryCuti extends StatefulWidget {
13
-  const HistoryCuti({Key? key}) : super(key: key);
16
+class CanvasingScreen extends StatefulWidget {
17
+  const CanvasingScreen({Key? key}) : super(key: key);
14 18
 
15 19
   @override
16
-  State<HistoryCuti> createState() => _HistoryCutiState();
20
+  State<CanvasingScreen> createState() => _CanvasingScreen();
17 21
 }
18 22
 
19
-class _HistoryCutiState extends State<HistoryCuti> {
23
+class _CanvasingScreen extends State<CanvasingScreen> {
20 24
   late List <String> id_List;
21 25
   late List <String> name_List;
22
-  late List <String> type_cuti_List;
23
-  late List <String> detail_List;
24
-  late List <String> created_on_List;
25
-  late List <String> created_by_List;
26
-  late List <String> start_date_List;
27
-  late List <String> end_date_List;
28
-  late List <String> duration_List;
29
-  late List <String> status_List;
26
+  late List <String> customer_List;
27
+  late List <String> telp_List;
28
+  late List <String> alamat_List;
29
+
30 30
   late List <Color> statusColor;
31 31
   late List <bool> visible;
32 32
 
33
-  int HistoryLength = 0;
33
+  int AllDataLength = 0;
34 34
 
35 35
   @override
36 36
   initState() {
37 37
     super.initState();
38 38
     id_List = [""];
39 39
     name_List = [""];
40
-    type_cuti_List = [""];
41
-    detail_List = [""];
42
-    created_on_List = [""];
43
-    created_by_List = [""];
44
-    start_date_List = [""];
45
-    end_date_List = [""];
46
-    duration_List = [""];
47
-    status_List = [""];
48
-    statusColor = [Colors.black54];
40
+    customer_List = [""];
41
+    telp_List = [""];
42
+    alamat_List = [""];
43
+
49 44
     visible = [false];
50 45
 
51 46
     WidgetsBinding.instance.addPostFrameCallback((_) async {
52
-      getHistoryData();
47
+      getAllData();
48
+      //initTimer();
49
+    });
50
+  }
51
+
52
+  Timer? timer;
53
+  void initTimer() {
54
+    if (timer != null && timer!.isActive) return;
55
+
56
+    timer = Timer.periodic(const Duration(seconds: 60), (timer) {
57
+      //job
58
+      setState(() {
59
+        getAllData();
60
+      });
53 61
     });
54
-    logDev.log(HistoryLength.toString(), name: "Banyak History");
55 62
   }
56 63
 
57
-  getHistoryData() async {
64
+  @override
65
+  void dispose() {
66
+    //timer?.cancel();
67
+    super.dispose();
68
+  }
69
+
70
+  getAllData() async {
58 71
     ProgressDialog loading = ProgressDialog(context);
59 72
     loading = ProgressDialog(context,
60 73
         type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
@@ -73,72 +86,58 @@ class _HistoryCutiState extends State<HistoryCuti> {
73 86
         messageTextStyle: TextStyle(
74 87
             color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
75 88
 
89
+    final SharedPreferences prefs = await SharedPreferences.getInstance();
90
+    int? user_id = prefs.getInt('user_id');
91
+    logDev.log(user_id!.toString(), name: "ID NYA BERAPA???!!!");
92
+
76 93
     await loading.show();
77
-    HistoryCuti_Post.connectToAPI().then((valueResult) async {
94
+    GetAll_Post.connectToAPI(user_id).then((valueResult) async {
78 95
       Map<String, dynamic> object = jsonDecode(valueResult);
79 96
       if (object.containsKey("result").toString() == "true") {
80
-        String result = object['result'].toString();
81
-        if (result.contains("Failed")) {
97
+        String status = object['result']['status'].toString();
98
+        if (status.contains("failed")) {
82 99
           await loading.hide();
83 100
           alertDialogFailedRetrievedData(context);
84
-        } else {
85
-          List <dynamic> historyCuti = object['result'];
86
-         /* logDev.log(historyCuti.toString(), name: "History Cuti");
87
-          logDev.log(historyCuti.length.toString(), name: "Banyaknya History Cuti");*/
101
+        } else if (status.contains("success")){
102
+          logDev.log(status, name: "SUCCeSS?");
103
+          List <dynamic> allData = object['result']['data'];
104
+          await loading.hide();
88 105
           setState(() {
89
-            for (int i = 0; i < historyCuti.length; i++){
90
-              String id = historyCuti[i]['id'].toString();
91
-              String name = historyCuti[i]['name'].toString();
92
-              String type_cuti = historyCuti[i]['type_cuti'].toString();
93
-              String detail = historyCuti[i]['detail'].toString();
94
-              String created_on = historyCuti[i]['created_on'].toString();
95
-              String created_by = historyCuti[i]['created_by'].toString();
96
-              String start_date = historyCuti[i]['start_date'].toString();
97
-              String end_date = historyCuti[i]['end_date'].toString();
98
-              String duration = historyCuti[i]['duration'].toString();
99
-              String status = historyCuti[i]['status'].toString();
106
+            for (int i = 0; i < allData.length; i++){
107
+              String id = allData[i]['id'].toString();
108
+              String name = allData[i]['name'].toString();
109
+              String customer = allData[i]['customer'].toString();
110
+              String telp = allData[i]['telp'].toString();
111
+              String alamat = allData[i]['alamat'].toString();
112
+
113
+              if (customer == "false"){
114
+                customer ="-";
115
+              }
116
+
117
+              if (telp == "false"){
118
+                telp = "-";
119
+              }
100 120
 
101
-              if (detail == "false"){
102
-                detail = "-";
121
+              if (alamat == "false"){
122
+                alamat = "-";
103 123
               }
104 124
 
105 125
               id_List.add(id);
106 126
               name_List.add(name);
107
-              type_cuti_List.add(type_cuti);
108
-              detail_List.add(detail);
109
-              created_on_List.add(created_on);
110
-              created_by_List.add(created_by);
111
-              start_date_List.add(start_date.substring(0,10));
112
-              end_date_List.add(end_date.substring(0,10));
113
-              duration_List.add(duration);
114
-              status_List.add(status);
127
+              customer_List.add(customer);
128
+              telp_List.add(telp);
129
+              alamat_List.add(alamat);
115 130
               visible.add(false);
116
-
117
-              var statColor;
118
-              if (status == "To Approve"){
119
-                statColor = Colors.red;
120
-              } else if (status == "Second Approval"){
121
-                statColor = Colors.green;
122
-              } else if (status == "Approved"){
123
-                statColor = Colors.blueAccent;
124
-              }
125
-              statusColor.add(statColor);
126 131
             }
127 132
 
128 133
             id_List.removeAt(0);
129 134
             name_List.removeAt(0);
130
-            type_cuti_List.removeAt(0);
131
-            detail_List.removeAt(0);
132
-            created_on_List.removeAt(0);
133
-            created_by_List.removeAt(0);
134
-            start_date_List.removeAt(0);
135
-            end_date_List.removeAt(0);
136
-            duration_List.removeAt(0);
137
-            status_List.removeAt(0);
138
-            statusColor.removeAt(0);
135
+            customer_List.removeAt(0);
136
+            telp_List.removeAt(0);
137
+            alamat_List.removeAt(0);
139 138
             visible.removeAt(0);
140 139
 
141
-            HistoryLength = historyCuti.length;
140
+            AllDataLength = allData.length;
142 141
           });
143 142
         }
144 143
       } else {
@@ -150,8 +149,8 @@ class _HistoryCutiState extends State<HistoryCuti> {
150 149
             textColor: Colors.white,
151 150
             fontSize: 16.0);
152 151
       }
153
-      await loading.hide();
154 152
     });
153
+    await loading.hide();
155 154
   }
156 155
 
157 156
   @override
@@ -166,14 +165,15 @@ class _HistoryCutiState extends State<HistoryCuti> {
166 165
                   children: [
167 166
                     WavyHeader(),
168 167
                     Container(
169
-                        margin: EdgeInsets.only(top: (size.height / 6) - 20),
168
+                        margin: EdgeInsets.only(
169
+                            top: (size.height / 6) - 20),
170 170
                         padding: EdgeInsets.fromLTRB(0, 5, 25, 5),
171 171
                         child: Row(
172 172
                           mainAxisAlignment: MainAxisAlignment.end,
173 173
                           crossAxisAlignment: CrossAxisAlignment.end,
174 174
                           children: [
175 175
                             Text(
176
-                              'Leaves History\t\t',
176
+                              'CANVASING\t\t',
177 177
                               maxLines: 1,
178 178
                               style: GoogleFonts.luckiestGuy(
179 179
                                 fontSize: 28,
@@ -182,7 +182,7 @@ class _HistoryCutiState extends State<HistoryCuti> {
182 182
                               ),
183 183
                             ),
184 184
                             Image.asset(
185
-                              'assets/images/ic_history.png',
185
+                              'assets/icons/menu/ic_canvasing_4.png',
186 186
                               width: 40,
187 187
                               height: 40,
188 188
                             ),
@@ -194,11 +194,12 @@ class _HistoryCutiState extends State<HistoryCuti> {
194 194
               ],
195 195
             ),
196 196
             Container(
197
-              margin: EdgeInsets.only(top: (MediaQuery.of(context).size.height / 6) + 40, left: 5, right: 5, bottom: 10),
197
+              margin: EdgeInsets.only(top: (MediaQuery.of(context).size.height / 6) + 40,
198
+                  left: 5, right: 5, bottom: 10),
198 199
               child: ListView.builder(
199 200
                 scrollDirection: Axis.vertical,
200 201
                 shrinkWrap: true,
201
-                itemCount: HistoryLength,
202
+                itemCount: AllDataLength,
202 203
                 itemBuilder: (context, int i) {
203 204
                   return Container(
204 205
                     child: InkWell(
@@ -209,32 +210,33 @@ class _HistoryCutiState extends State<HistoryCuti> {
209 210
                             Row(
210 211
                               children: [
211 212
                                 Expanded(
212
-                                    flex: 8,
213
+                                    flex: 10,
213 214
                                     child: Padding(
214 215
                                       padding: EdgeInsets.fromLTRB(10, 5, 5, 5),
215 216
                                       child: Column(
216 217
                                         mainAxisAlignment: MainAxisAlignment.center,
217 218
                                         crossAxisAlignment: CrossAxisAlignment.start,
218 219
                                         children: [
219
-                                          Text(type_cuti_List[i], style: GoogleFonts.rubikBubbles(fontSize: 16)),
220
-                                          Text(start_date_List[i] + " - " + end_date_List[i] + " (" + duration_List[i] + ") ", style: GoogleFonts.nunito(fontSize: 15)),
221
-                                          Text("\nDescription : " + detail_List[i], style: GoogleFonts.nunito(fontSize: 15)),
222
-                                          Text("\nCreated : " + created_on_List[i], style: GoogleFonts.yeonSung(fontSize: 14, fontStyle: FontStyle.italic)),
220
+                                          //Text(id_List[i], style: GoogleFonts.rubikBubbles(fontSize: 15)),
221
+                                          Text(name_List[i], style: GoogleFonts.rubikBubbles(fontSize: 15)),
222
+                                          Text(customer_List[i], style: GoogleFonts.nunito(fontSize: 15)),
223
+                                          Text(telp_List[i], style: GoogleFonts.nunito(fontSize: 15)),
224
+                                          Text(alamat_List[i], style: GoogleFonts.nunito(fontSize: 15)),
223 225
                                         ],
224 226
                                       ),
225 227
                                     )
226 228
                                 ),
227
-                                Expanded(
229
+                                /*Expanded(
228 230
                                     flex: 2,
229 231
                                     child: Padding(
230 232
                                       padding: EdgeInsets.fromLTRB(5, 5, 5, 5),
231 233
                                       child: Text(status_List[i], textAlign: TextAlign.center, style: GoogleFonts.lilitaOne(color: statusColor[i], fontSize: 17),
232 234
                                       ),
233 235
                                     )
234
-                                ),
236
+                                ),*/
235 237
                               ],
236 238
                             ),
237
-                            Align(
239
+                            /*Align(
238 240
                               alignment: Alignment.centerLeft,
239 241
                               child: Visibility(
240 242
                                   visible: visible[i],
@@ -244,19 +246,22 @@ class _HistoryCutiState extends State<HistoryCuti> {
244 246
                                       mainAxisAlignment: MainAxisAlignment.start,
245 247
                                       crossAxisAlignment: CrossAxisAlignment.start,
246 248
                                       children: [
247
-                                        Text("\nAttachment : ", style: GoogleFonts.josefinSans(fontSize: 15, fontWeight: FontWeight.bold)),
248
-                                        Text("Created : " + created_on_List[i], style: GoogleFonts.nunito(fontSize: 15, fontStyle: FontStyle.italic)),
249
+                                        Text(telp_List[i], style: GoogleFonts.nunito(fontSize: 15)),
250
+                                        Text(alamat_List[i], style: GoogleFonts.nunito(fontSize: 15)),
249 251
                                       ],
250 252
                                     ),
251 253
                                   )
252 254
                               ),
253
-                            )
255
+                            )*/
254 256
                           ],
255 257
                         ),
256 258
                       ),
257 259
                       onTap: (){
258
-                        setState(() {
259
-                          visible[i] = !visible[i];
260
+                        setState(() async {
261
+                          //visible[i] = !visible[i];
262
+                          var prefs = await SharedPreferences.getInstance();
263
+                          await prefs.setString('idDetail', id_List[i]);
264
+                          Navigator.push(context, MaterialPageRoute(builder: (context) => CanvasingDetail()));
260 265
                         });
261 266
                       },
262 267
                     ),
@@ -275,7 +280,7 @@ alertDialogFailedRetrievedData(BuildContext context) {
275 280
     onPressed: () {
276 281
       Navigator.of(context, rootNavigator: true).pop();
277 282
       Navigator.pushReplacement(
278
-          context, MaterialPageRoute(builder: (context) => HistoryCuti()));
283
+          context, MaterialPageRoute(builder: (context) => CanvasingScreen()));
279 284
     },
280 285
   );
281 286
 
@@ -289,7 +294,7 @@ alertDialogFailedRetrievedData(BuildContext context) {
289 294
 
290 295
   // set up the AlertDialog
291 296
   AlertDialog alert = AlertDialog(
292
-    title: Text("Employee Self Service"),
297
+    title: Text("Canvasing"),
293 298
     content: Text("Failed to Retrieve Data"),
294 299
     actions: [
295 300
       noButton,
@@ -300,6 +305,7 @@ alertDialogFailedRetrievedData(BuildContext context) {
300 305
   // show the dialog
301 306
   showDialog(
302 307
     context: context,
308
+    barrierDismissible: false,
303 309
     builder: (BuildContext context) {
304 310
       return alert;
305 311
     },

+ 44
- 0
lib/Screens/Menu/Canvasing/filingData_post.dart Просмотреть файл

@@ -0,0 +1,44 @@
1
+import 'dart:convert';
2
+import 'dart:core';
3
+import 'package:flutter/material.dart';
4
+import 'package:http/http.dart' as http;
5
+import 'package:employee_selfservice_mobile/constants.dart';
6
+import 'dart:developer' as developer;
7
+
8
+import 'package:shared_preferences/shared_preferences.dart';
9
+
10
+class FilingData_Post {
11
+  late String id;
12
+  late String amount;
13
+  late String kk;
14
+  late String ktp;
15
+  late String npwp;
16
+  late int user_id;
17
+
18
+  FilingData_Post({required this.amount, required this.kk, required this.ktp, required this.npwp});
19
+
20
+  static Future<String> connectToAPI(String id, String amount, String kk, String ktp, String npwp, int user_id) async {
21
+    String URL = baseURL + "/api/filing_data";
22
+
23
+    final SharedPreferences prefs = await SharedPreferences.getInstance();
24
+
25
+    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
26
+      "data": [
27
+        {
28
+          "id": id,
29
+          "amount": amount,
30
+          "kk": kk,
31
+          "ktp": ktp,
32
+          "npwp": npwp,
33
+          "user_id": user_id
34
+        }
35
+      ]
36
+    }), headers: {
37
+      "Content-Type": "application/json",
38
+      "Api-key": apiKey
39
+    });
40
+
41
+    //developer.log(sendData.body, name: "GET ALL");
42
+    return sendData.body;
43
+  }
44
+}

+ 628
- 0
lib/Screens/Menu/Canvasing/filing_screen.dart Просмотреть файл

@@ -0,0 +1,628 @@
1
+import 'dart:convert';
2
+import 'dart:io';
3
+import 'package:employee_selfservice_mobile/Screens/Home/home_screen.dart';
4
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/filingData_post.dart';
5
+import 'package:file_picker/file_picker.dart';
6
+import 'package:flutter/cupertino.dart';
7
+import 'package:flutter/material.dart';
8
+import 'package:fluttertoast/fluttertoast.dart';
9
+import 'package:google_fonts/google_fonts.dart';
10
+import 'package:intl/intl.dart';
11
+import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
12
+import 'package:shared_preferences/shared_preferences.dart';
13
+
14
+import 'dart:developer' as logDev;
15
+
16
+import '../../background.dart';
17
+
18
+//List<String> fileAttach = [""];
19
+TextEditingController amountTextController = TextEditingController();
20
+
21
+class FilingScreen extends StatefulWidget {
22
+  const FilingScreen({Key? key}) : super(key: key);
23
+
24
+  @override
25
+  State<FilingScreen> createState() => _FilingScreen();
26
+}
27
+
28
+class _FilingScreen extends State<FilingScreen> {
29
+  String _fileTextKK = "";
30
+  String _fileTextKTP = "";
31
+  String _fileTextNPWP = "";
32
+  String base64KK = "";
33
+  String base64KTP = "";
34
+  String base64NPWP = "";
35
+
36
+  initState(){
37
+    WidgetsBinding.instance.addPostFrameCallback((_) {
38
+      base64KK = "";
39
+      base64KTP = "";
40
+      base64NPWP = "";
41
+    });
42
+    super.initState();
43
+  }
44
+
45
+  @override
46
+  Widget build(BuildContext context) {
47
+    var size = MediaQuery.sizeOf(context);
48
+    return Scaffold(
49
+      body: SingleChildScrollView(
50
+          child: Column(
51
+            children: <Widget>[
52
+              Stack(
53
+                children: [
54
+                  WavyHeader(),
55
+                  Container(
56
+                      margin: EdgeInsets.only(top: MediaQuery.of(context).size.height/6 - 20),
57
+                      padding: EdgeInsets.fromLTRB(20, 5, 25, 5),
58
+                      child: Row(
59
+                        mainAxisAlignment: MainAxisAlignment.end,
60
+                        crossAxisAlignment: CrossAxisAlignment.end,
61
+                        children: [
62
+                          Text(
63
+                            'Filing\t\t',
64
+                            maxLines: 2,
65
+                            style: GoogleFonts.luckiestGuy(
66
+                              fontSize: 28,
67
+                              color: Color(0xFF4858A7),
68
+                              fontStyle: FontStyle.italic,
69
+                            ),
70
+                          ),
71
+                          Image.asset("assets/icons/menu/ic_filing_1.png",
72
+                            width: 40,
73
+                            height: 40,
74
+                          ),
75
+                        ],
76
+                      )),
77
+                  SafeArea(
78
+                    child: Container(
79
+                      width: MediaQuery.of(context).size.width,
80
+                      margin: EdgeInsets.only(
81
+                        top: MediaQuery.of(context).size.height / 5,
82
+                        left: 10,
83
+                        right: 10,
84
+                        bottom : 15,
85
+                      ),
86
+                      child: Column(
87
+                        children: [
88
+                          Container(
89
+                            child: Card(
90
+                              elevation: 10,
91
+                              child: Container(
92
+                                decoration: BoxDecoration(
93
+                                    color: Color(0XFFFAF7EE),
94
+                                    borderRadius: BorderRadius.circular(10)),
95
+                                child: Column(
96
+                                  children: [
97
+                                    Container(
98
+                                      margin: EdgeInsets.only(
99
+                                          left: 10, right: 10, top: 15, bottom: 10),
100
+                                      child: Text('Filing', style:
101
+                                      GoogleFonts.josefinSans(fontSize: 19, fontWeight: FontWeight.bold, decoration: TextDecoration.underline,
102
+                                          decorationStyle: TextDecorationStyle.dashed),),
103
+                                    ),
104
+                                    Container(
105
+                                      margin: EdgeInsets.only(
106
+                                          left: 10, right: 10, top: 10, bottom: 10),
107
+                                      child: Column(
108
+                                        children: [
109
+                                          Align(
110
+                                              alignment: Alignment.centerLeft,
111
+                                              child: Text(
112
+                                                'Amount',
113
+                                                style: GoogleFonts.inconsolata(
114
+                                                    fontSize: 16, fontWeight: FontWeight.bold),
115
+                                              )
116
+                                          ),
117
+                                          Container(
118
+                                              margin: EdgeInsets.only(top: 7),
119
+                                              decoration: BoxDecoration(
120
+                                                  color: Colors.white,
121
+                                                  borderRadius:
122
+                                                  BorderRadius.circular(5)),
123
+                                              child: Padding(
124
+                                                padding: EdgeInsets.only(
125
+                                                    left: 10,
126
+                                                    right: 10,
127
+                                                    top: 5,
128
+                                                    bottom: 5),
129
+                                                child: TextFormField(
130
+                                                    keyboardType:
131
+                                                    TextInputType.number,
132
+                                                    maxLines: 1,
133
+                                                    controller: amountTextController,
134
+                                                    textInputAction:
135
+                                                    TextInputAction.next,
136
+                                                    decoration: InputDecoration(
137
+                                                      border:
138
+                                                      InputBorder.none,
139
+                                                      hintText:
140
+                                                      "ex. 1500500", )),
141
+                                              )
142
+                                          )
143
+                                        ],
144
+                                      ),
145
+                                    ),
146
+                                    Container(
147
+                                      margin: EdgeInsets.only(
148
+                                          left: 10, right: 10, top: 10),
149
+                                      child: Column(
150
+                                        children: [
151
+                                          Align(
152
+                                            alignment: Alignment.centerLeft,
153
+                                            child: Text(
154
+                                              'Kartu Keluarga',
155
+                                              style: GoogleFonts.inconsolata(
156
+                                                  fontSize: 16, fontWeight: FontWeight.bold),
157
+                                            ),
158
+                                          ),
159
+                                          Container(
160
+                                            child: ElevatedButton(
161
+                                              onPressed: () {
162
+                                                _pickFilesKK();
163
+                                              },
164
+                                              /*style: ElevatedButton.styleFrom(
165
+                                              backgroundColor:
166
+                                                  CupertinoColors
167
+                                                      .systemGrey2),*/
168
+                                              child: Container(
169
+                                                width: double.infinity,
170
+                                                child: Text("Choose File",
171
+                                                    style: TextStyle(
172
+                                                        color: Colors.white,
173
+                                                        fontSize: 16,
174
+                                                        fontWeight:
175
+                                                        FontWeight.w400)),
176
+                                              ),
177
+                                            ),
178
+                                          ),
179
+                                          Container(
180
+                                            alignment:
181
+                                            Alignment.centerLeft,
182
+                                            margin: EdgeInsets.only(
183
+                                                left: 15,
184
+                                                right: 15,
185
+                                                bottom: 10),
186
+                                            child: Text(_fileTextKK,
187
+                                              overflow:
188
+                                              TextOverflow.ellipsis,
189
+                                              /*maxLines: 7,*/
190
+                                              style: TextStyle(
191
+                                                  color: Colors.black54),
192
+                                            ),
193
+                                          ),
194
+                                        ],
195
+                                      ),
196
+                                    ),
197
+                                    Container(
198
+                                      margin: EdgeInsets.only(
199
+                                          left: 10, right: 10, top: 10),
200
+                                      child: Column(
201
+                                        children: [
202
+                                          Align(
203
+                                            alignment: Alignment.centerLeft,
204
+                                            child: Text(
205
+                                              'KTP',
206
+                                              style: GoogleFonts.inconsolata(
207
+                                                  fontSize: 16, fontWeight: FontWeight.bold),
208
+                                            ),
209
+                                          ),
210
+                                          Container(
211
+                                            child: ElevatedButton(
212
+                                              onPressed: () {
213
+                                                _pickFilesKTP();
214
+                                              },
215
+                                              /*style: ElevatedButton.styleFrom(
216
+                                              backgroundColor:
217
+                                                  CupertinoColors
218
+                                                      .systemGrey2),*/
219
+                                              child: Container(
220
+                                                width: double.infinity,
221
+                                                child: Text("Choose File",
222
+                                                    style: TextStyle(
223
+                                                        color: Colors.white,
224
+                                                        fontSize: 16,
225
+                                                        fontWeight:
226
+                                                        FontWeight.w400)),
227
+                                              ),
228
+                                            ),
229
+                                          ),
230
+                                          Container(
231
+                                            alignment:
232
+                                            Alignment.centerLeft,
233
+                                            margin: EdgeInsets.only(
234
+                                                left: 15,
235
+                                                right: 15,
236
+                                                bottom: 10),
237
+                                            child: Text(_fileTextKTP,
238
+                                              overflow:
239
+                                              TextOverflow.ellipsis,
240
+                                              /*maxLines: 7,*/
241
+                                              style: TextStyle(
242
+                                                  color: Colors.black54),
243
+                                            ),
244
+                                          ),
245
+                                        ],
246
+                                      ),
247
+                                    ),
248
+                                    Container(
249
+                                      margin: EdgeInsets.only(
250
+                                          left: 10, right: 10, top: 10),
251
+                                      child: Column(
252
+                                        children: [
253
+                                          Align(
254
+                                            alignment: Alignment.centerLeft,
255
+                                            child: Text(
256
+                                              'NPWP',
257
+                                              style: GoogleFonts.inconsolata(
258
+                                                  fontSize: 16, fontWeight: FontWeight.bold),
259
+                                            ),
260
+                                          ),
261
+                                          Container(
262
+                                            child: ElevatedButton(
263
+                                              onPressed: () {
264
+                                                _pickFilesNPWP();
265
+                                              },
266
+                                              /*style: ElevatedButton.styleFrom(
267
+                                              backgroundColor:
268
+                                                  CupertinoColors
269
+                                                      .systemGrey2),*/
270
+                                              child: Container(
271
+                                                width: double.infinity,
272
+                                                child: Text("Choose File",
273
+                                                    style: TextStyle(
274
+                                                        color: Colors.white,
275
+                                                        fontSize: 16,
276
+                                                        fontWeight:
277
+                                                        FontWeight.w400)),
278
+                                              ),
279
+                                            ),
280
+                                          ),
281
+                                          Container(
282
+                                            alignment:
283
+                                            Alignment.centerLeft,
284
+                                            margin: EdgeInsets.only(
285
+                                                left: 15,
286
+                                                right: 15,
287
+                                                bottom: 10),
288
+                                            child: Text(_fileTextNPWP,
289
+                                              overflow:
290
+                                              TextOverflow.ellipsis,
291
+                                              /*maxLines: 7,*/
292
+                                              style: TextStyle(
293
+                                                  color: Colors.black54),
294
+                                            ),
295
+                                          ),
296
+                                        ],
297
+                                      ),
298
+                                    ),
299
+                                    InkWell(
300
+                                      child: Container(
301
+                                        margin: EdgeInsets.only(left: 10, right: 10, bottom: 15),
302
+                                        padding: EdgeInsets.fromLTRB(
303
+                                            10, 10, 10, 10),
304
+                                        width: double.infinity,
305
+                                        decoration: BoxDecoration(
306
+                                            borderRadius:
307
+                                            BorderRadius.circular(5),
308
+                                            gradient: LinearGradient(colors: [
309
+                                              Color(0xFFFF9945),
310
+                                              Color(0xFFFc6076)
311
+                                            ])),
312
+                                        child: Text('Submit',
313
+                                            textAlign: TextAlign.center,
314
+                                            style: TextStyle(
315
+                                                color: Colors.white,
316
+                                                fontSize: 17,
317
+                                                fontWeight: FontWeight.w500)),
318
+                                      ),
319
+                                      onTap: () async {
320
+                                        ProgressDialog loading = ProgressDialog(context);
321
+                                        loading = ProgressDialog(context,
322
+                                            type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
323
+                                        loading.style(
324
+                                            message: 'Please Wait .....',
325
+                                            borderRadius: 3,
326
+                                            backgroundColor: Colors.white,
327
+                                            progressWidget: CircularProgressIndicator(),
328
+                                            elevation: 10.0,
329
+                                            padding: EdgeInsets.all(10),
330
+                                            insetAnimCurve: Curves.easeInOut,
331
+                                            progress: 0.0,
332
+                                            maxProgress: 100.0,
333
+                                            progressTextStyle: TextStyle(
334
+                                                color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
335
+                                            messageTextStyle: TextStyle(
336
+                                                color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
337
+
338
+                                        if (!validateFormFiling(context)){
339
+                                          return;
340
+                                        } else if (validateFormFiling(context)){
341
+                                          await loading.show();
342
+
343
+                                          final SharedPreferences prefs = await SharedPreferences.getInstance();
344
+                                          String? idDetail = prefs.getString('idDetail');
345
+                                          logDev.log(idDetail!, name: "APAKAH ADA ID?");
346
+                                          int? user_id = prefs.getInt('user_id');
347
+
348
+                                          FilingData_Post.connectToAPI(idDetail!, amountTextController.text.toString(), base64KK, base64KTP, base64NPWP, user_id!).then((valueResult) async {
349
+                                            Map<String, dynamic> object = json.decode(valueResult);
350
+                                            if (object.containsKey("result").toString() == "true") {
351
+                                              String result = object['result'].toString();
352
+                                              String status = object['result']['status'].toString();
353
+
354
+                                              if (status == "success") {
355
+                                                await loading.hide();
356
+                                                Widget okButton = TextButton(
357
+                                                  child: Text("OK"),
358
+                                                  onPressed: () {
359
+                                                    amountTextController.clear();
360
+                                                    Navigator.of(context, rootNavigator: true).pop();
361
+                                                    Navigator.pushReplacement(context, MaterialPageRoute(
362
+                                                        builder: (context) => HomeView()));
363
+                                                  },
364
+                                                );
365
+
366
+                                                // set up the AlertDialog
367
+                                                AlertDialog alert = AlertDialog(
368
+                                                  title: Text("Canvasing"),
369
+                                                  content: Text("Data Submitted!"),
370
+                                                  actions: [
371
+                                                    okButton,
372
+                                                  ],
373
+                                                );
374
+
375
+                                                // show the dialog
376
+                                                showDialog(
377
+                                                  context: context,
378
+                                                  barrierDismissible: false,
379
+                                                  builder: (BuildContext context) {
380
+                                                    return alert;
381
+                                                  },
382
+                                                );
383
+                                              }
384
+                                            } else {
385
+                                              await loading.hide();
386
+                                              alertDialogFailedResponse(context);
387
+                                            }
388
+                                          });
389
+                                        }
390
+                                      },
391
+                                    )
392
+                                  ],
393
+                                ),
394
+                              ),
395
+                            ),
396
+                          ),
397
+                        ],
398
+                      ),
399
+                    ),
400
+                  ),
401
+                ],
402
+              ),
403
+            ],
404
+          )),
405
+    );
406
+  }
407
+
408
+  //Pick Files KK
409
+  void _pickFilesKK() async {
410
+    FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: false, type: FileType.custom, allowedExtensions: ["jpg"]);
411
+
412
+    if (_fileTextKK != ""){
413
+      _fileTextKK = "";
414
+    }
415
+
416
+    if (result != null) {
417
+      List<File> files = result.paths.map((path) => File(path!)).toList();
418
+      for (int i = 0; i< files.length; i++){
419
+        String fileName = files[i].path.split('/').last;
420
+        _fileTextKK = _fileTextKK + "\n" + fileName;
421
+
422
+        List<int> fileInBytes = files[i].readAsBytesSync();
423
+        base64KK = base64Encode(fileInBytes);
424
+        //logDev.log(toBase64, name: "Base64 nya kah?");
425
+        //fileAttach.add(toBase64);
426
+      }
427
+      //fileAttach.removeAt(0);
428
+      /*logDev.log(fileAttach.toString(), name: "File Attach Base64");*/
429
+      //logDev.log(fileAttach.length.toString(), name: "Length File Attach");
430
+      logDev.log(files.toString(), name: "Files (KK) Picked");
431
+
432
+      setState(() {
433
+        base64KK;
434
+        _fileTextKK;
435
+        //_totalFile = "Total File : " + files.length.toString();
436
+      });
437
+    } else {
438
+      // User canceled the picker
439
+    }
440
+  }
441
+
442
+  //Pick Files KTP
443
+  void _pickFilesKTP() async {
444
+    FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: false, type: FileType.custom, allowedExtensions: ["jpg"]);
445
+
446
+    if (_fileTextKTP != ""){
447
+      _fileTextKTP = "";
448
+    }
449
+
450
+    if (result != null) {
451
+      List<File> files = result.paths.map((path) => File(path!)).toList();
452
+      for (int i = 0; i< files.length; i++){
453
+        String fileName = files[i].path.split('/').last;
454
+        _fileTextKTP = _fileTextKTP + "\n" + fileName;
455
+
456
+        List<int> fileInBytes = files[i].readAsBytesSync();
457
+        base64KTP = base64Encode(fileInBytes);
458
+        //fileAttach.add(toBase64);
459
+      }
460
+     // fileAttach.removeAt(0);
461
+      /*logDev.log(fileAttach.toString(), name: "File Attach Base64");*/
462
+      //logDev.log(fileAttach.length.toString(), name: "Length File Attach");
463
+      logDev.log(files.toString(), name: "Files Picked");
464
+
465
+      setState(() {
466
+        base64KTP;
467
+        _fileTextKTP;
468
+        //_totalFile = "Total File : " + files.length.toString();
469
+      });
470
+    } else {
471
+      // User canceled the picker
472
+    }
473
+  }
474
+
475
+  //Pick Files NPWP
476
+  void _pickFilesNPWP() async {
477
+    FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: false, type: FileType.custom, allowedExtensions: ["jpg"]);
478
+
479
+    if (_fileTextNPWP != ""){
480
+      _fileTextNPWP = "";
481
+    }
482
+
483
+    if (result != null) {
484
+      List<File> files = result.paths.map((path) => File(path!)).toList();
485
+      for (int i = 0; i< files.length; i++){
486
+        String fileName = files[i].path.split('/').last;
487
+        _fileTextNPWP = _fileTextNPWP + "\n" + fileName;
488
+
489
+        List<int> fileInBytes = files[i].readAsBytesSync();
490
+        base64NPWP = base64Encode(fileInBytes);
491
+        //fileAttach.add(toBase64);
492
+      }
493
+      //fileAttach.removeAt(0);
494
+      /*logDev.log(fileAttach.toString(), name: "File Attach Base64");*/
495
+      //logDev.log(fileAttach.length.toString(), name: "Length File Attach");
496
+      logDev.log(files.toString(), name: "Files Picked");
497
+
498
+      setState(() {
499
+        base64NPWP;
500
+        _fileTextNPWP;
501
+        //_totalFile = "Total File : " + files.length.toString();
502
+      });
503
+    } else {
504
+      // User canceled the picker
505
+    }
506
+  }
507
+
508
+  bool validateFormFiling(BuildContext context) {
509
+    bool result = true;
510
+    if (amountTextController.text.toString().isEmpty) {
511
+      Fluttertoast.showToast(
512
+          msg: "Amount Required!",
513
+          toastLength: Toast.LENGTH_SHORT,
514
+          gravity: ToastGravity.CENTER,
515
+          timeInSecForIosWeb: 1,
516
+          textColor: Colors.white,
517
+          fontSize: 16.0);
518
+      result = false;
519
+    } else if (_fileTextKK.isEmpty) {
520
+      Fluttertoast.showToast(
521
+          msg: "Karti Keluarga Required!",
522
+          toastLength: Toast.LENGTH_SHORT,
523
+          gravity: ToastGravity.CENTER,
524
+          timeInSecForIosWeb: 1,
525
+          textColor: Colors.white,
526
+          fontSize: 16.0);
527
+      result = false;
528
+    } else if (_fileTextKTP.isEmpty) {
529
+        Fluttertoast.showToast(
530
+        msg: "KTP Required!",
531
+        toastLength: Toast.LENGTH_SHORT,
532
+        gravity: ToastGravity.CENTER,
533
+        timeInSecForIosWeb: 1,
534
+        textColor: Colors.white,
535
+        fontSize: 16.0);
536
+        result = false;
537
+    } else if (_fileTextNPWP.isEmpty) {
538
+      Fluttertoast.showToast(
539
+          msg: "NPWP Required!",
540
+          toastLength: Toast.LENGTH_SHORT,
541
+          gravity: ToastGravity.CENTER,
542
+          timeInSecForIosWeb: 1,
543
+          textColor: Colors.white,
544
+          fontSize: 16.0);
545
+      result = false;
546
+    }
547
+
548
+    return result;
549
+  }
550
+}
551
+
552
+alertDialogFailedRetrievedData(BuildContext context){
553
+  Widget okButton = TextButton(
554
+    child: Text("Refresh"),
555
+    onPressed: () {
556
+      Navigator.of(context, rootNavigator: true).pop();
557
+      Navigator.pushReplacement(context, MaterialPageRoute(
558
+          builder: (context) => FilingScreen()));
559
+    },
560
+  );
561
+
562
+  Widget noButton = TextButton(
563
+    child: Text("Back"),
564
+    onPressed: () {
565
+      Navigator.of(context, rootNavigator: true).pop();
566
+      Navigator.pop(context);
567
+
568
+    },
569
+  );
570
+
571
+  // set up the AlertDialog
572
+  AlertDialog alert = AlertDialog(
573
+    title: Text("Canvasing"),
574
+    content: Text("Failed to Retrieve Data"),
575
+    actions: [
576
+      noButton,
577
+      okButton,
578
+    ],
579
+  );
580
+
581
+  // show the dialog
582
+  showDialog(
583
+    context: context,
584
+    barrierDismissible: false,
585
+    builder: (BuildContext context) {
586
+      return alert;
587
+    },
588
+  );
589
+}
590
+
591
+alertDialogFailedResponse(BuildContext context){
592
+  Widget okButton = TextButton(
593
+    child: Text("Refresh"),
594
+    onPressed: () {
595
+      Navigator.of(context, rootNavigator: true).pop();
596
+      Navigator.pushReplacement(context, MaterialPageRoute(
597
+          builder: (context) => FilingScreen()));
598
+    },
599
+  );
600
+
601
+  Widget noButton = TextButton(
602
+    child: Text("Back"),
603
+    onPressed: () {
604
+      Navigator.of(context, rootNavigator: true).pop();
605
+      Navigator.pop(context);
606
+
607
+    },
608
+  );
609
+
610
+  // set up the AlertDialog
611
+  AlertDialog alert = AlertDialog(
612
+    title: Text("Canvasing"),
613
+    content: Text("Server Response Error"),
614
+    actions: [
615
+      noButton,
616
+      okButton,
617
+    ],
618
+  );
619
+
620
+  // show the dialog
621
+  showDialog(
622
+    context: context,
623
+    barrierDismissible: false,
624
+    builder: (BuildContext context) {
625
+      return alert;
626
+    },
627
+  );
628
+}

lib/Screens/Menu/Absensi/RequestHttp/checkStatus_post.dart → lib/Screens/Menu/Canvasing/getAll_post.dart Просмотреть файл

@@ -1,18 +1,19 @@
1 1
 import 'dart:convert';
2 2
 import 'dart:core';
3
+import 'package:flutter/material.dart';
3 4
 import 'package:http/http.dart' as http;
4 5
 import 'package:employee_selfservice_mobile/constants.dart';
5 6
 import 'dart:developer' as developer;
6 7
 
7 8
 import 'package:shared_preferences/shared_preferences.dart';
8 9
 
9
-class CheckStatus_Post {
10
-  late String session;
10
+class GetAll_Post {
11
+  late int user_id;
11 12
 
12
-  CheckStatus_Post({required this.session});
13
+  GetAll_Post({required this.user_id});
13 14
 
14
-  static Future<String> connectToAPI() async {
15
-    String URL = baseURL + "/api/v1/check_status";
15
+  static Future<String> connectToAPI(int user_id) async {
16
+    String URL = baseURL + "/api/get_all";
16 17
 
17 18
     final SharedPreferences prefs = await SharedPreferences.getInstance();
18 19
     final session = prefs.getString('session');
@@ -20,7 +21,7 @@ class CheckStatus_Post {
20 21
     var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
21 22
       "data": [
22 23
         {
23
-          "session": session
24
+          "user_id": user_id
24 25
         }
25 26
       ]
26 27
     }), headers: {
@@ -28,7 +29,7 @@ class CheckStatus_Post {
28 29
       "Api-key": apiKey
29 30
     });
30 31
 
31
-    //developer.log(sendData.body, name: "Get Status Absensi Result");
32
+    //developer.log(sendData.body, name: "GET ALL");
32 33
     return sendData.body;
33 34
   }
34 35
 }

lib/Screens/Menu/SlipGaji/RequestHttp/historySlipGaji_post.dart → lib/Screens/Menu/Canvasing/navigate_post.dart Просмотреть файл

@@ -1,26 +1,26 @@
1 1
 import 'dart:convert';
2 2
 import 'dart:core';
3
+import 'package:flutter/material.dart';
3 4
 import 'package:http/http.dart' as http;
4 5
 import 'package:employee_selfservice_mobile/constants.dart';
5 6
 import 'dart:developer' as developer;
6 7
 
7 8
 import 'package:shared_preferences/shared_preferences.dart';
8 9
 
9
-class HistorySlipGaji_Post {
10
-  late String session;
10
+class Navigate_Post {
11
+  late String id;
12
+  late int user_id;
11 13
 
12
-  HistorySlipGaji_Post({required this.session});
14
+  Navigate_Post({required this.id});
13 15
 
14
-  static Future<String> connectToAPI() async {
15
-    String URL = baseURL + "/api/v1/history_slip_gaji";
16
-
17
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
18
-    final session = prefs.getString('session');
16
+  static Future<String> connectToAPI(String id, int user_id) async {
17
+    String URL = baseURL + "/api/navigate";
19 18
 
20 19
     var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
21 20
       "data": [
22 21
         {
23
-          "session": session
22
+          "id": id,
23
+          "user_id":user_id
24 24
         }
25 25
       ]
26 26
     }), headers: {
@@ -28,7 +28,7 @@ class HistorySlipGaji_Post {
28 28
       "Api-key": apiKey
29 29
     });
30 30
 
31
-    developer.log(sendData.body, name: "History Slip Gaji Result");
31
+    //developer.log(sendData.body, name: "GET ALL");
32 32
     return sendData.body;
33 33
   }
34 34
 }

lib/Screens/Menu/Absensi/RequestHttp/historyAbsensi_post.dart → lib/Screens/Menu/Canvasing/startFiling_post.dart Просмотреть файл

@@ -1,26 +1,28 @@
1 1
 import 'dart:convert';
2 2
 import 'dart:core';
3
+import 'package:flutter/material.dart';
3 4
 import 'package:http/http.dart' as http;
4 5
 import 'package:employee_selfservice_mobile/constants.dart';
5 6
 import 'dart:developer' as developer;
6 7
 
7 8
 import 'package:shared_preferences/shared_preferences.dart';
8 9
 
9
-class HistoryAbsensi_Post {
10
-  late String session;
10
+class StartFiling_Post {
11
+  late String id;
12
+  late int user_id;
11 13
 
12
-  HistoryAbsensi_Post({required this.session});
14
+  StartFiling_Post({required this.id});
13 15
 
14
-  static Future<String> connectToAPI() async {
15
-    String URL = baseURL + "/api/v1/history_absensi";
16
+  static Future<String> connectToAPI(String id, int user_id) async {
17
+    String URL = baseURL + "/api/start_filing";
16 18
 
17 19
     final SharedPreferences prefs = await SharedPreferences.getInstance();
18
-    final session = prefs.getString('session');
19 20
 
20 21
     var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
21 22
       "data": [
22 23
         {
23
-          "session": session
24
+          "id": id,
25
+          "user_id": user_id
24 26
         }
25 27
       ]
26 28
     }), headers: {
@@ -28,7 +30,6 @@ class HistoryAbsensi_Post {
28 30
       "Api-key": apiKey
29 31
     });
30 32
 
31
-    //developer.log(sendData.body, name: "Get History Absensi Result");
32 33
     return sendData.body;
33 34
   }
34 35
 }

+ 34
- 0
lib/Screens/Menu/Canvasing/updateGPS_post.dart Просмотреть файл

@@ -0,0 +1,34 @@
1
+import 'dart:convert';
2
+import 'dart:core';
3
+import 'package:flutter/material.dart';
4
+import 'package:http/http.dart' as http;
5
+import 'package:employee_selfservice_mobile/constants.dart';
6
+import 'dart:developer' as developer;
7
+
8
+class UpdateGPS_Post {
9
+  late String id;
10
+  late String map;
11
+  late int user_id;
12
+
13
+  UpdateGPS_Post({required this.id});
14
+
15
+  static Future<String> connectToAPI(String id, String map, int user_id) async {
16
+    String URL = baseURL + "/api/update_gps";
17
+
18
+    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
19
+      "data": [
20
+        {
21
+          "id": id,
22
+          "map": map,
23
+          "user_id": user_id
24
+        }
25
+      ]
26
+    }), headers: {
27
+      "Content-Type": "application/json",
28
+      "Api-key": apiKey
29
+    });
30
+
31
+    //developer.log(sendData.body, name: "GET ALL");
32
+    return sendData.body;
33
+  }
34
+}

+ 155
- 0
lib/Screens/Menu/Dashboard/dashboard_screen.dart Просмотреть файл

@@ -0,0 +1,155 @@
1
+import 'dart:convert';
2
+import 'dart:ffi';
3
+
4
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/canvasingDetail_screen.dart';
5
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/getAll_post.dart';
6
+import 'package:employee_selfservice_mobile/Screens/Menu/History/getHistory_post.dart';
7
+import 'package:employee_selfservice_mobile/constants.dart';
8
+import 'package:flutter/material.dart';
9
+import 'package:fluttertoast/fluttertoast.dart';
10
+import 'package:google_fonts/google_fonts.dart';
11
+import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
12
+import 'package:shared_preferences/shared_preferences.dart';
13
+import 'package:webview_flutter/webview_flutter.dart';
14
+import 'dart:developer' as logDev;
15
+
16
+import '../../background.dart';
17
+
18
+class DashboardScreen extends StatefulWidget {
19
+  const DashboardScreen({Key? key}) : super(key: key);
20
+
21
+  @override
22
+  State<DashboardScreen> createState() => _DashboardScreen();
23
+}
24
+
25
+class _DashboardScreen extends State<DashboardScreen> {
26
+  WebViewController controller = WebViewController();
27
+
28
+  int user_id = 0;
29
+
30
+  @override
31
+  initState() {
32
+    super.initState();
33
+    getUserID();
34
+    //logDev.log(user_id.toString(), name: "user id setelah balikan??");
35
+    controller = WebViewController()
36
+      ..setJavaScriptMode(JavaScriptMode.unrestricted)
37
+      ..setBackgroundColor(const Color(0x00000000))
38
+      ..setNavigationDelegate(
39
+        NavigationDelegate(
40
+          onProgress: (int progress) {
41
+            // Update loading bar.
42
+          },
43
+          onPageStarted: (String url) {},
44
+          onPageFinished: (String url) {},
45
+          onWebResourceError: (WebResourceError error) {},
46
+          onNavigationRequest: (NavigationRequest request) {
47
+            if (request.url.startsWith('https://www.youtube.com/')) {
48
+              return NavigationDecision.prevent;
49
+            }
50
+            return NavigationDecision.navigate;
51
+          },
52
+        ),
53
+      )
54
+      ..loadRequest(Uri.parse(baseURL + "/dashboard/"));
55
+   /* WidgetsBinding.instance.addPostFrameCallback((_) async {
56
+
57
+    });*/
58
+  }
59
+
60
+  getUserID() async {
61
+    final SharedPreferences prefs = await SharedPreferences.getInstance();
62
+    user_id = prefs.getInt('user_id')!;
63
+    logDev.log(user_id.toString(), name: "user id??");
64
+
65
+    return user_id;
66
+  }
67
+
68
+  @override
69
+  Widget build(BuildContext context) {
70
+    var size = MediaQuery.of(context).size;
71
+    return Scaffold(
72
+      body: Stack(
73
+          children: [
74
+            Column(
75
+              children: <Widget>[
76
+                Stack(
77
+                  children: [
78
+                    WavyHeader(),
79
+                    Container(
80
+                        margin: EdgeInsets.only(
81
+                            top: (size.height / 6) - 20),
82
+                        padding: EdgeInsets.fromLTRB(0, 5, 25, 5),
83
+                        child: Row(
84
+                          mainAxisAlignment: MainAxisAlignment.end,
85
+                          crossAxisAlignment: CrossAxisAlignment.end,
86
+                          children: [
87
+                            Text(
88
+                              'DASHBOARD CANVASING\t\t',
89
+                              maxLines: 1,
90
+                              style: GoogleFonts.luckiestGuy(
91
+                                fontSize: 28,
92
+                                color: Color(0xFF4858A7),
93
+                                fontStyle: FontStyle.italic,
94
+                              ),
95
+                            ),
96
+                            Image.asset(
97
+                              'assets/icons/menu/ic_history.png',
98
+                              width: 40,
99
+                              height: 40,
100
+                            ),
101
+                          ],
102
+                        )
103
+                    ),
104
+                  ],
105
+                ),
106
+
107
+              ],
108
+            ),
109
+            Container(
110
+              margin: EdgeInsets.only(top: (MediaQuery.of(context).size.height / 6) + 40,
111
+                  left: 5, right: 5, bottom: 10),
112
+              child: WebViewWidget(controller: controller),
113
+            )
114
+          ]),
115
+    );
116
+  }
117
+}
118
+
119
+alertDialogFailedRetrievedData(BuildContext context) {
120
+  Widget okButton = TextButton(
121
+    child: Text("Refresh"),
122
+    onPressed: () {
123
+      Navigator.of(context, rootNavigator: true).pop();
124
+      Navigator.pushReplacement(
125
+          context, MaterialPageRoute(builder: (context) => DashboardScreen()));
126
+    },
127
+  );
128
+
129
+  Widget noButton = TextButton(
130
+    child: Text("Back"),
131
+    onPressed: () {
132
+      Navigator.of(context, rootNavigator: true).pop();
133
+      Navigator.pop(context);
134
+    },
135
+  );
136
+
137
+  // set up the AlertDialog
138
+  AlertDialog alert = AlertDialog(
139
+    title: Text("Canvasing"),
140
+    content: Text("Failed to Retrieve Data"),
141
+    actions: [
142
+      noButton,
143
+      okButton,
144
+    ],
145
+  );
146
+
147
+  // show the dialog
148
+  showDialog(
149
+    context: context,
150
+    barrierDismissible: false,
151
+    builder: (BuildContext context) {
152
+      return alert;
153
+    },
154
+  );
155
+}

lib/Screens/ForgotPassword/resetPassword_post.dart → lib/Screens/Menu/History/getHistory_post.dart Просмотреть файл

@@ -1,21 +1,24 @@
1 1
 import 'dart:convert';
2 2
 import 'dart:core';
3
+import 'package:flutter/material.dart';
3 4
 import 'package:http/http.dart' as http;
4 5
 import 'package:employee_selfservice_mobile/constants.dart';
5 6
 import 'dart:developer' as developer;
6 7
 
7
-class ResetPassword_Post {
8
-  late String email;
8
+import 'package:shared_preferences/shared_preferences.dart';
9 9
 
10
-  ResetPassword_Post({required this.email});
10
+class GetHistory_Post {
11
+  late int user_id;
11 12
 
12
-  static Future<String> connectToAPI(String email) async {
13
-    String URL = baseURL + "/api/v1/ask_reset_password";
13
+  GetHistory_Post({required this.user_id});
14
+
15
+  static Future<String> connectToAPI(int user_id) async {
16
+    String URL = baseURL + "/api/history";
14 17
 
15 18
     var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
16 19
       "data": [
17 20
         {
18
-          "email": email
21
+          "user_id": user_id
19 22
         }
20 23
       ]
21 24
     }), headers: {
@@ -23,7 +26,7 @@ class ResetPassword_Post {
23 26
       "Api-key": apiKey
24 27
     });
25 28
 
26
-    developer.log(sendData.body, name: "sendatabody");
29
+    //developer.log(sendData.body, name: "GET ALL");
27 30
     return sendData.body;
28 31
   }
29 32
 }

lib/Screens/Menu/Reimburse/history_reimburse.dart → lib/Screens/Menu/History/history_screen.dart Просмотреть файл

@@ -1,47 +1,48 @@
1 1
 import 'dart:convert';
2
+import 'dart:ffi';
2 3
 
4
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/canvasingDetail_screen.dart';
5
+import 'package:employee_selfservice_mobile/Screens/Menu/Canvasing/getAll_post.dart';
6
+import 'package:employee_selfservice_mobile/Screens/Menu/History/getHistory_post.dart';
3 7
 import 'package:flutter/material.dart';
4 8
 import 'package:fluttertoast/fluttertoast.dart';
5 9
 import 'package:google_fonts/google_fonts.dart';
6 10
 import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
11
+import 'package:shared_preferences/shared_preferences.dart';
7 12
 import 'dart:developer' as logDev;
8 13
 
9
-import '../AjukanCuti/backgroundHistory.dart';
10
-import 'RequestHttp/historyReimburse_post.dart';
14
+import '../../background.dart';
11 15
 
12
-class HistoryReimburse extends StatefulWidget {
13
-  const HistoryReimburse({Key? key}) : super(key: key);
16
+class HistoryScreen extends StatefulWidget {
17
+  const HistoryScreen({Key? key}) : super(key: key);
14 18
 
15 19
   @override
16
-  State<HistoryReimburse> createState() => _HistoryReimburse();
20
+  State<HistoryScreen> createState() => _HistoryScreen();
17 21
 }
18 22
 
19
-class _HistoryReimburse extends State<HistoryReimburse> {
20
-  late List <String> date_List;
23
+class _HistoryScreen extends State<HistoryScreen> {
24
+  late List <String> id_List;
21 25
   late List <String> name_List;
22
-  late List <String> employee_List;
23
-  late List <String> payment_List;
24
-  late List <String> activity_List;
25
-  late List <String> total_List;
26
-  late List <String> status_List;
26
+  late List <String> customer_List;
27
+  late List <String> telp_List;
28
+  late List <String> alamat_List;
29
+  late List <String> stage_List;
27 30
 
28 31
   late List <Color> statusColor;
29 32
   late List <bool> visible;
30 33
 
31
-  int HistoryLength = 0;
34
+  int AllDataLength = 0;
32 35
 
33 36
   @override
34 37
   initState() {
35 38
     super.initState();
36
-    date_List = [""];
39
+    id_List = [""];
37 40
     name_List = [""];
38
-    employee_List = [""];
39
-    payment_List = [""];
40
-    activity_List = [""];
41
-    total_List = [""];
42
-    status_List = [""];
41
+    customer_List = [""];
42
+    telp_List = [""];
43
+    alamat_List = [""];
44
+    stage_List = [""];
43 45
 
44
-    statusColor = [Colors.black54];
45 46
     visible = [false];
46 47
 
47 48
     WidgetsBinding.instance.addPostFrameCallback((_) async {
@@ -68,62 +69,61 @@ class _HistoryReimburse extends State<HistoryReimburse> {
68 69
         messageTextStyle: TextStyle(
69 70
             color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
70 71
 
72
+    final SharedPreferences prefs = await SharedPreferences.getInstance();
73
+    int? user_id = prefs.getInt('user_id');
74
+    logDev.log(user_id!.toString(), name: "ID NYA BERAPA???!!!");
75
+
71 76
     await loading.show();
72
-    HistoryReimburse_Post.connectToAPI().then((valueResult) async {
77
+    GetHistory_Post.connectToAPI(user_id).then((valueResult) async {
73 78
       Map<String, dynamic> object = jsonDecode(valueResult);
74 79
       if (object.containsKey("result").toString() == "true") {
75
-        String result = object['result'].toString();
76
-        if (result.contains("failed")) {
80
+        String status = object['result']['status'].toString();
81
+        if (status.contains("failed")) {
77 82
           await loading.hide();
78 83
           alertDialogFailedRetrievedData(context);
79
-        } else {
80
-          List <dynamic> historyReimburse = object['result'];
84
+        } else if (status.contains("success")){
85
+          logDev.log(status, name: "SUCCeSS?");
86
+          List <dynamic> allData = object['result']['data'];
81 87
           await loading.hide();
82 88
           setState(() {
83
-            for (int i = 0; i < historyReimburse.length; i++){
84
-              String date = historyReimburse[i]['date'].toString();
85
-              String name = historyReimburse[i]['name'].toString();
86
-              String employee = historyReimburse[i]['employee'].toString();
87
-              String payment = historyReimburse[i]['payment'].toString();
88
-              String activity = historyReimburse[i]['activity'].toString();
89
-              String total = historyReimburse[i]['total'].toString();
90
-              String status = historyReimburse[i]['status'].toString();
89
+            for (int i = 0; i < allData.length; i++){
90
+              String id = allData[i]['id'].toString();
91
+              String name = allData[i]['name'].toString();
92
+              String customer = allData[i]['customer'].toString();
93
+              String telp = allData[i]['telp'].toString();
94
+              String alamat = allData[i]['alamat'].toString();
95
+              String stage = allData[i]['stage'].toString();
91 96
 
92
-              /*if (detail == "false"){
93
-                detail = "-";
94
-              }*/
97
+              if (customer == "false"){
98
+                customer ="-";
99
+              }
95 100
 
96
-              date_List.add(date);
97
-              name_List.add(name);
98
-              employee_List.add(employee);
99
-              payment_List.add(payment);
100
-              activity_List.add(activity);
101
-              total_List.add(total);
102
-              status_List.add(status);
103
-              visible.add(false);
101
+              if (telp == "false"){
102
+                telp = "-";
103
+              }
104 104
 
105
-              var statColor;
106
-              if (status == "draft"){
107
-                statColor = Colors.red;
108
-              } else if (status == "approved"){
109
-                statColor = Colors.green;
110
-              } else if (status == "done"){
111
-                statColor = Colors.blueAccent;
105
+              if (alamat == "false"){
106
+                alamat = "-";
112 107
               }
113
-              statusColor.add(statColor);
108
+
109
+              id_List.add(id);
110
+              name_List.add(name);
111
+              customer_List.add(customer);
112
+              telp_List.add(telp);
113
+              alamat_List.add(alamat);
114
+              stage_List.add(stage);
115
+              visible.add(false);
114 116
             }
115 117
 
116
-            date_List.removeAt(0);
118
+            id_List.removeAt(0);
117 119
             name_List.removeAt(0);
118
-            employee_List.removeAt(0);
119
-            payment_List.removeAt(0);
120
-            activity_List.removeAt(0);
121
-            total_List.removeAt(0);
122
-            status_List.removeAt(0);
123
-            statusColor.removeAt(0);
120
+            customer_List.removeAt(0);
121
+            telp_List.removeAt(0);
122
+            alamat_List.removeAt(0);
123
+            stage_List.removeAt(0);
124 124
             visible.removeAt(0);
125 125
 
126
-            HistoryLength = historyReimburse.length;
126
+            AllDataLength = allData.length;
127 127
           });
128 128
         }
129 129
       } else {
@@ -159,7 +159,7 @@ class _HistoryReimburse extends State<HistoryReimburse> {
159 159
                           crossAxisAlignment: CrossAxisAlignment.end,
160 160
                           children: [
161 161
                             Text(
162
-                              'Reimburse History\t\t',
162
+                              'CANVASING HISTORY\t\t',
163 163
                               maxLines: 1,
164 164
                               style: GoogleFonts.luckiestGuy(
165 165
                                 fontSize: 28,
@@ -168,7 +168,7 @@ class _HistoryReimburse extends State<HistoryReimburse> {
168 168
                               ),
169 169
                             ),
170 170
                             Image.asset(
171
-                              'assets/images/ic_history.png',
171
+                              'assets/icons/menu/ic_history.png',
172 172
                               width: 40,
173 173
                               height: 40,
174 174
                             ),
@@ -185,7 +185,7 @@ class _HistoryReimburse extends State<HistoryReimburse> {
185 185
               child: ListView.builder(
186 186
                 scrollDirection: Axis.vertical,
187 187
                 shrinkWrap: true,
188
-                itemCount: HistoryLength,
188
+                itemCount: AllDataLength,
189 189
                 itemBuilder: (context, int i) {
190 190
                   return Container(
191 191
                     child: InkWell(
@@ -196,33 +196,35 @@ class _HistoryReimburse extends State<HistoryReimburse> {
196 196
                             Row(
197 197
                               children: [
198 198
                                 Expanded(
199
-                                    flex: 8,
199
+                                    flex: 10,
200 200
                                     child: Padding(
201 201
                                       padding: EdgeInsets.fromLTRB(10, 5, 5, 5),
202 202
                                       child: Column(
203 203
                                         mainAxisAlignment: MainAxisAlignment.center,
204 204
                                         crossAxisAlignment: CrossAxisAlignment.start,
205 205
                                         children: [
206
+                                          //Text(id_List[i], style: GoogleFonts.rubikBubbles(fontSize: 15)),
206 207
                                           Text(name_List[i], style: GoogleFonts.rubikBubbles(fontSize: 16)),
207
-                                          Text(activity_List[i], style: GoogleFonts.nunito(fontSize: 15)),
208
-                                          Text(date_List[i], style: GoogleFonts.nunito(fontSize: 15)),
209
-                                          Text("\Total : " + total_List[i], style: GoogleFonts.nunito(fontSize: 15)),
210
-                                          Text("Payment : " + payment_List[i], style: GoogleFonts.yeonSung(fontSize: 14, fontStyle: FontStyle.italic)),
208
+                                          Text(customer_List[i], style: GoogleFonts.nunito(fontSize: 15)),
209
+                                          Text(telp_List[i], style: GoogleFonts.nunito(fontSize: 15)),
210
+                                          Text(alamat_List[i], style: GoogleFonts.nunito(fontSize: 15)),
211
+                                          Text("", style: GoogleFonts.nunito(fontSize: 14)),
212
+                                          Text(stage_List[i], style: GoogleFonts.nunito(fontSize: 17, fontWeight: FontWeight.bold, color: Colors.blueAccent)),
211 213
                                         ],
212 214
                                       ),
213 215
                                     )
214 216
                                 ),
215
-                                Expanded(
217
+                                /*Expanded(
216 218
                                     flex: 2,
217 219
                                     child: Padding(
218 220
                                       padding: EdgeInsets.fromLTRB(5, 5, 5, 5),
219 221
                                       child: Text(status_List[i], textAlign: TextAlign.center, style: GoogleFonts.lilitaOne(color: statusColor[i], fontSize: 17),
220 222
                                       ),
221 223
                                     )
222
-                                ),
224
+                                ),*/
223 225
                               ],
224 226
                             ),
225
-                            Align(
227
+                            /*Align(
226 228
                               alignment: Alignment.centerLeft,
227 229
                               child: Visibility(
228 230
                                   visible: visible[i],
@@ -232,20 +234,22 @@ class _HistoryReimburse extends State<HistoryReimburse> {
232 234
                                       mainAxisAlignment: MainAxisAlignment.start,
233 235
                                       crossAxisAlignment: CrossAxisAlignment.start,
234 236
                                       children: [
235
-                                        Text("\nAttachment : ", style: GoogleFonts.josefinSans(fontSize: 15, fontWeight: FontWeight.bold)),
236
-                                        Text("\Total : " + total_List[i], style: GoogleFonts.nunito(fontSize: 15)),
237
-                                        Text("Payment : " + payment_List[i], style: GoogleFonts.yeonSung(fontSize: 14, fontStyle: FontStyle.italic)),
237
+                                        Text(telp_List[i], style: GoogleFonts.nunito(fontSize: 15)),
238
+                                        Text(alamat_List[i], style: GoogleFonts.nunito(fontSize: 15)),
238 239
                                       ],
239 240
                                     ),
240 241
                                   )
241 242
                               ),
242
-                            )
243
+                            )*/
243 244
                           ],
244 245
                         ),
245 246
                       ),
246 247
                       onTap: (){
247
-                        setState(() {
248
-                          visible[i] = !visible[i];
248
+                        setState(() async {
249
+                          //visible[i] = !visible[i];
250
+                         /* var prefs = await SharedPreferences.getInstance();
251
+                          await prefs.setString('idDetail', id_List[i]);
252
+                          Navigator.push(context, MaterialPageRoute(builder: (context) => CanvasingDetail()));*/
249 253
                         });
250 254
                       },
251 255
                     ),
@@ -264,7 +268,7 @@ alertDialogFailedRetrievedData(BuildContext context) {
264 268
     onPressed: () {
265 269
       Navigator.of(context, rootNavigator: true).pop();
266 270
       Navigator.pushReplacement(
267
-          context, MaterialPageRoute(builder: (context) => HistoryReimburse()));
271
+          context, MaterialPageRoute(builder: (context) => HistoryScreen()));
268 272
     },
269 273
   );
270 274
 
@@ -278,7 +282,7 @@ alertDialogFailedRetrievedData(BuildContext context) {
278 282
 
279 283
   // set up the AlertDialog
280 284
   AlertDialog alert = AlertDialog(
281
-    title: Text("Employee Self Service"),
285
+    title: Text("Canvasing"),
282 286
     content: Text("Failed to Retrieve Data"),
283 287
     actions: [
284 288
       noButton,

+ 0
- 39
lib/Screens/Menu/Reimburse/RequestHttp/categoryReimburse_post.dart Просмотреть файл

@@ -1,39 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:http/http.dart' as http;
4
-import 'package:employee_selfservice_mobile/constants.dart';
5
-import 'dart:developer' as developer;
6
-
7
-import 'package:shared_preferences/shared_preferences.dart';
8
-
9
-class CategoryReimburse_Post {
10
-  late String session;
11
-
12
-  CategoryReimburse_Post({required this.session});
13
-
14
-  static Future<String> connectToAPI() async {
15
-    String URL = baseURL + "/api/v1/kategori_reimburse";
16
-
17
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
18
-    final session = prefs.getString('session');
19
-
20
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
21
-      "data": [
22
-        {
23
-          "session": session
24
-        }
25
-      ]
26
-    }), headers: {
27
-      "Content-Type": "application/json",
28
-      "Api-key": apiKey
29
-    });
30
-
31
-    //developer.log(sendData.body, name: "Get Jenis Cuti Result");
32
-    return sendData.body;
33
-
34
-    /*var jsonObject = json.decode(sendData.body);
35
-    developer.log(jsonObject.toString(), name: 'Log');*/
36
-    // return jsonObject;
37
-    // return LoginPostResult.createPostResult(jsonObject);
38
-  }
39
-}

+ 0
- 34
lib/Screens/Menu/Reimburse/RequestHttp/historyReimburse_post.dart Просмотреть файл

@@ -1,34 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:http/http.dart' as http;
4
-import 'package:employee_selfservice_mobile/constants.dart';
5
-import 'dart:developer' as developer;
6
-
7
-import 'package:shared_preferences/shared_preferences.dart';
8
-
9
-class HistoryReimburse_Post {
10
-  late String session;
11
-
12
-  HistoryReimburse_Post({required this.session});
13
-
14
-  static Future<String> connectToAPI() async {
15
-    String URL = baseURL + "/api/v1/history_reimburse";
16
-
17
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
18
-    final session = prefs.getString('session');
19
-
20
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
21
-      "data": [
22
-        {
23
-          "session": session
24
-        }
25
-      ]
26
-    }), headers: {
27
-      "Content-Type": "application/json",
28
-      "Api-key": apiKey
29
-    });
30
-
31
-    developer.log(sendData.body, name: "Get History Reimburse Result");
32
-    return sendData.body;
33
-  }
34
-}

+ 0
- 49
lib/Screens/Menu/Reimburse/RequestHttp/pengajuanReimburse_post.dart Просмотреть файл

@@ -1,49 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:flutter/material.dart';
4
-import 'package:http/http.dart' as http;
5
-import 'package:employee_selfservice_mobile/constants.dart';
6
-import 'dart:developer' as developer;
7
-
8
-import 'package:shared_preferences/shared_preferences.dart';
9
-
10
-class PengajuanReimburse_Post {
11
-  late String name;
12
-  late String product;
13
-  late String date;
14
-  late String total;
15
-  late String payment_mode;
16
-  late String description;
17
-  late List<String> file;
18
-  late String session;
19
-
20
-  PengajuanReimburse_Post({required this.session});
21
-
22
-  static Future<String> connectToAPI(String name, String product, String date, String total, String payment_mode, String description, List<String> file) async {
23
-    String URL = baseURL + "/api/v1/pengajuan_reimburse";
24
-
25
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
26
-    final session = prefs.getString('session');
27
-
28
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
29
-      "data": [
30
-        {
31
-          "name" : name,
32
-          "product" : product,
33
-          "date" : date,
34
-          "total" : total,
35
-          "payment_mode" : payment_mode,
36
-          "description" : description,
37
-          "session": session,
38
-          "file" : file
39
-        }
40
-      ]
41
-    }), headers: {
42
-      "Content-Type": "application/json",
43
-      "Api-key": apiKey
44
-    });
45
-
46
-    developer.log(sendData.body, name: "Pengajuan REIMBURSE");
47
-    return sendData.body;
48
-  }
49
-}

+ 0
- 866
lib/Screens/Menu/Reimburse/reimburse_screen.dart Просмотреть файл

@@ -1,866 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:io';
3
-import 'package:file_picker/file_picker.dart';
4
-import 'package:flutter/cupertino.dart';
5
-import 'package:flutter/material.dart';
6
-import 'package:fluttertoast/fluttertoast.dart';
7
-import 'package:google_fonts/google_fonts.dart';
8
-import 'package:employee_selfservice_mobile/Screens/Menu/Reimburse/RequestHttp/categoryReimburse_post.dart';
9
-import 'package:intl/intl.dart';
10
-import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
11
-
12
-import 'dart:developer' as logDev;
13
-import '../SlipGaji/background.dart';
14
-import 'RequestHttp/pengajuanReimburse_post.dart';
15
-import 'history_reimburse.dart';
16
-
17
-List<String> fileAttach = [""];
18
-TextEditingController namaProdukTeksController = TextEditingController();
19
-TextEditingController deskripsiTeksController = TextEditingController();
20
-TextEditingController totalHargaTeksController = TextEditingController();
21
-
22
-class ReimburseScreen extends StatefulWidget {
23
-  const ReimburseScreen({Key? key}) : super(key: key);
24
-
25
-  @override
26
-  State<ReimburseScreen> createState() => _ReimburseScreen();
27
-}
28
-
29
-class _ReimburseScreen extends State<ReimburseScreen> {
30
-  String _fileText = "";
31
-  String _totalFile= "";
32
-
33
-  bool visibleDateFrom = false;
34
-
35
-  late List <String> idReimburseCategory;
36
-  late List <String> reimburseCategory;
37
-
38
-  DateTime dateFrom = DateTime.now();
39
-
40
-  late String formattedDateFrom = "";
41
-  late String idReimburse;
42
-
43
-  var selectedCategory;
44
-  String valuePayment = "";
45
-
46
-  initState(){
47
-    namaProdukTeksController.clear();
48
-    deskripsiTeksController.clear();
49
-    totalHargaTeksController.clear();
50
-    reimburseCategory = [""];
51
-    idReimburseCategory = [""];
52
-    WidgetsBinding.instance.addPostFrameCallback((_) {
53
-      reimburseCategory = getKategoriReimburse();
54
-    });
55
-    super.initState();
56
-  }
57
-
58
-  getKategoriReimburse () async {
59
-    ProgressDialog loading = ProgressDialog(context);
60
-    loading = ProgressDialog(context,
61
-        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
62
-    loading.style(
63
-        message: 'Please Wait .....',
64
-        borderRadius: 3,
65
-        backgroundColor: Colors.white,
66
-        progressWidget: CircularProgressIndicator(),
67
-        elevation: 10.0,
68
-        padding: EdgeInsets.all(10),
69
-        insetAnimCurve: Curves.easeInOut,
70
-        progress: 0.0,
71
-        maxProgress: 100.0,
72
-        progressTextStyle: TextStyle(
73
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
74
-        messageTextStyle: TextStyle(
75
-            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
76
-
77
-    await loading.show();
78
-    CategoryReimburse_Post.connectToAPI().then((valueResult) async {
79
-      Map<String, dynamic> object = json.decode(valueResult);
80
-      if (object.containsKey("result").toString() == "true"){
81
-        String result = object['result'].toString();
82
-        logDev.log(result, name: "Jenis Cuti Result");
83
-        if (result.contains("failed")) {
84
-          await loading.hide();
85
-          setState(() {
86
-            alertDialogFailedRetrievedData(context);
87
-          });
88
-        } else {
89
-          List <dynamic> kategori = object['result'];
90
-          setState(() {
91
-            idReimburseCategory.removeAt(0);
92
-            reimburseCategory.removeAt(0);
93
-            for (int i = 0; i < kategori.length; i++){
94
-              int id = kategori[i]['id'];
95
-              String name = kategori[i]['name'].toString();
96
-              idReimburseCategory.add(id.toString());
97
-              reimburseCategory.add(name);
98
-            }
99
-            logDev.log(idReimburseCategory.toString(), name: "ID Reimburse");
100
-          });
101
-          await loading.hide();
102
-        }
103
-      } else {
104
-        setState(() async {
105
-          await loading.hide();
106
-          alertDialogFailedResponse(context);
107
-        });
108
-        await loading.hide();
109
-      }
110
-    });
111
-    return reimburseCategory;
112
-  }
113
-
114
-  @override
115
-  Widget build(BuildContext context) {
116
-    var size = MediaQuery.sizeOf(context);
117
-    return Scaffold(
118
-      body: SingleChildScrollView(
119
-          child: Column(
120
-            children: <Widget>[
121
-              Stack(
122
-                children: [
123
-                  WavyHeader(),
124
-                  Container(
125
-                      margin: EdgeInsets.only(top: MediaQuery.of(context).size.height/6 - 20),
126
-                      padding: EdgeInsets.fromLTRB(20, 5, 25, 5),
127
-                      child: Row(
128
-                        mainAxisAlignment: MainAxisAlignment.end,
129
-                        crossAxisAlignment: CrossAxisAlignment.end,
130
-                        children: [
131
-                          Text(
132
-                            'Reimburse\t\t',
133
-                            maxLines: 2,
134
-                            style: GoogleFonts.luckiestGuy(
135
-                              fontSize: 28,
136
-                              color: Color(0xFF4858A7),
137
-                              fontStyle: FontStyle.italic,
138
-                            ),
139
-                          ),
140
-                          Image.asset("assets/icons/menu/ic_reimburse.png",
141
-                            width: 40,
142
-                            height: 40,
143
-                          ),
144
-                        ],
145
-                      )),
146
-                  SafeArea(
147
-                    child: Container(
148
-                      width: MediaQuery.of(context).size.width,
149
-                      margin: EdgeInsets.only(
150
-                        top: MediaQuery.of(context).size.height / 5,
151
-                        left: 10,
152
-                        right: 10,
153
-                        bottom : 15,
154
-                      ),
155
-                      child: Column(
156
-                        children: [
157
-                          InkWell(
158
-                            child: Container(
159
-                                margin: EdgeInsets.only(top: 5, bottom: 15),
160
-                                padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
161
-                                width: double.infinity,
162
-                                decoration: BoxDecoration(
163
-                                    borderRadius: BorderRadius.circular(5),
164
-                                    gradient: LinearGradient(colors: [
165
-                                      Color(0xFF2D4059),
166
-                                      Color(0xFF2D4059),
167
-                                      /*Color(0xFFEAFFD0),
168
-                                  Color(0xFF95E1D3),*/
169
-                                    ])),
170
-                                child: Row(
171
-                                  mainAxisAlignment: MainAxisAlignment.center,
172
-                                  children: [
173
-                                    Text('See Reimburse History\t\t',
174
-                                        textAlign: TextAlign.center,
175
-                                        style: TextStyle(
176
-                                            color: Colors.white,
177
-                                            fontSize: 17,
178
-                                            fontWeight: FontWeight.w500)),
179
-                                    Image.asset(
180
-                                      'assets/images/ic_arrow_white.png',
181
-                                      width: 30,
182
-                                      height: 30,
183
-                                    )
184
-                                  ],
185
-                                )),
186
-                            onTap: () {
187
-                              Navigator.push(context, MaterialPageRoute(
188
-                                  builder: (context) => HistoryReimburse()));
189
-                            },
190
-                          ),
191
-                          Container(
192
-                            child: Card(
193
-                              elevation: 10,
194
-                              child: Container(
195
-                                decoration: BoxDecoration(
196
-                                    color: Color(0XFFFAF7EE),
197
-                                    borderRadius: BorderRadius.circular(10)),
198
-                                child: Column(
199
-                                  children: [
200
-                                    Container(
201
-                                      margin: EdgeInsets.only(
202
-                                          left: 10, right: 10, top: 15, bottom: 10),
203
-                                      child: Text('Reimburse Submission', style:
204
-                                      GoogleFonts.josefinSans(fontSize: 19, fontWeight: FontWeight.bold, decoration: TextDecoration.underline,
205
-                                          decorationStyle: TextDecorationStyle.dashed),),
206
-                                    ),
207
-                                    Container(
208
-                                      margin: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 10),
209
-                                      child: Column(
210
-                                        children: [
211
-                                          Align(
212
-                                            alignment: Alignment.centerLeft,
213
-                                            child:  Text(
214
-                                              'Category',
215
-                                              style: GoogleFonts.inconsolata(
216
-                                                  fontSize: 16, fontWeight: FontWeight.bold),
217
-                                            ),
218
-                                          ),
219
-                                          Container(
220
-                                            margin: EdgeInsets.only(top: 7),
221
-                                            decoration: BoxDecoration(
222
-                                                    color:
223
-                                                    CupertinoColors.systemGrey2,
224
-                                                    borderRadius:
225
-                                                    BorderRadius.circular(5)),
226
-                                                child: DropdownButton(
227
-                                                  menuMaxHeight: size.height * 0.31,
228
-                                                  dropdownColor: Colors.grey.shade300,
229
-                                                  value: this.selectedCategory,
230
-                                                  isExpanded: true,
231
-                                                  underline: SizedBox(),
232
-                                                  hint: Text(
233
-                                                    '\t\t\Choose Category',
234
-                                                    style: TextStyle(
235
-                                                        color: Colors.black54),
236
-                                                  ),
237
-                                                  onChanged: (value) {
238
-                                                    print(value);
239
-                                                    setState(() {
240
-                                                      selectedCategory = value!;
241
-                                                      for (int i = 0; i < reimburseCategory.length; i++){
242
-                                                        if (selectedCategory == reimburseCategory.elementAt(i)){
243
-                                                          idReimburse = idReimburseCategory.elementAt(i);
244
-                                                        }
245
-                                                      }
246
-                                                      logDev.log(idReimburse, name: "ID REIMBURSENYA APA");
247
-                                                    });
248
-                                                  },
249
-                                                  items: reimburseCategory
250
-                                                      .map(
251
-                                                        (e) => DropdownMenuItem(
252
-                                                        value: e,
253
-                                                        child:
254
-                                                        Text("\t\t\t" + e)),
255
-                                                  )
256
-                                                      .toList(),
257
-                                                ),
258
-                                              ),
259
-                                        ],
260
-                                      ),
261
-                                    ),
262
-                                    Container(
263
-                                      margin: EdgeInsets.only(
264
-                                          left: 10, right: 10, top: 10, bottom: 10),
265
-                                      child: Column(
266
-                                        children: [
267
-                                          Align(
268
-                                            alignment: Alignment.centerLeft,
269
-                                            child: Text(
270
-                                              'Item Name',
271
-                                              style: GoogleFonts.inconsolata(
272
-                                                  fontSize: 16, fontWeight: FontWeight.bold),
273
-                                            ),
274
-                                          ),
275
-                                          Container(
276
-                                              margin: EdgeInsets.only(top: 7),
277
-                                              decoration: BoxDecoration(
278
-                                                  color: Colors.white,
279
-                                                  borderRadius:
280
-                                                  BorderRadius.circular(5)),
281
-                                              child: Padding(
282
-                                                padding: EdgeInsets.only(
283
-                                                    left: 10,
284
-                                                    right: 10,
285
-                                                    top: 5,
286
-                                                    bottom: 5),
287
-                                                child: TextFormField(
288
-                                                    keyboardType: TextInputType.multiline,
289
-                                                    controller: namaProdukTeksController,
290
-                                                    maxLines: null,
291
-                                                    textInputAction:
292
-                                                    TextInputAction.done,
293
-                                                    decoration: InputDecoration(
294
-                                                        border:
295
-                                                        InputBorder.none,
296
-                                                        hintText: "ex. Airplane Ticket")),
297
-                                              )),
298
-                                        ],
299
-                                      ),
300
-                                    ),
301
-                                    Container(
302
-                                      margin: EdgeInsets.only(
303
-                                          left: 10, right: 10, top: 10, bottom: 10),
304
-                                      child: Column(
305
-                                        children: [
306
-                                          Column(
307
-                                            children: [
308
-                                              Align(
309
-                                                alignment: Alignment.centerLeft,
310
-                                                child: Text(
311
-                                                  'Date', style: GoogleFonts.inconsolata(fontSize: 16, fontWeight: FontWeight.bold),
312
-                                                ),
313
-                                              ),
314
-                                              ElevatedButton(
315
-                                                    onPressed: () async {
316
-                                                      DateTime? newDate = await showDatePicker(
317
-                                                          context: context,
318
-                                                          initialDate: dateFrom,
319
-                                                          firstDate:
320
-                                                          DateTime(1900),
321
-                                                          lastDate:
322
-                                                          DateTime(2100));
323
-                                                      final DateFormat formatter = DateFormat('yyyy-MM-dd');
324
-                                                      if (newDate == null) {
325
-                                                          return;
326
-                                                      } else {
327
-                                                          setState(() {
328
-                                                            if (visibleDateFrom == false){
329
-                                                              visibleDateFrom = !visibleDateFrom;
330
-                                                            }
331
-                                                            formattedDateFrom = formatter.format(newDate);
332
-                                                            //dateFrom = formattedFrom as DateTime;
333
-                                                          });
334
-                                                        }
335
-                                                      },
336
-                                                      child: Container(
337
-                                                        width: double.infinity,
338
-                                                        child: Text(
339
-                                                          "Choose Date",
340
-                                                          style: TextStyle(
341
-                                                              color: Colors.white,
342
-                                                              fontSize: 16,
343
-                                                              fontWeight:
344
-                                                              FontWeight.w400),
345
-                                                        ),
346
-                                                      ),
347
-                                                    ),
348
-                                            ]
349
-                                          ),
350
-                                          Visibility(
351
-                                            visible: visibleDateFrom,
352
-                                            child: Container(
353
-                                              alignment: Alignment.centerLeft,
354
-                                              margin: EdgeInsets.only(
355
-                                                  left: 15,
356
-                                                  right: 15,
357
-                                                  bottom: 5),
358
-                                              child: Text(formattedDateFrom,
359
-                                                overflow:
360
-                                                TextOverflow.ellipsis,
361
-                                                maxLines: 1,
362
-                                                style: TextStyle(
363
-                                                    color: Colors.black54),
364
-                                              ),
365
-                                            ),
366
-                                          )
367
-                                        ],
368
-                                      ),
369
-                                    ),
370
-                                    Container(
371
-                                      margin: EdgeInsets.only(
372
-                                          left: 10, right: 10, top: 10, bottom: 10),
373
-                                      child: Column(
374
-                                        children: [
375
-                                          Align(
376
-                                              alignment: Alignment.centerLeft,
377
-                                              child: Text(
378
-                                                'Total Amount',
379
-                                                style: GoogleFonts.inconsolata(
380
-                                                    fontSize: 16, fontWeight: FontWeight.bold),
381
-                                              )
382
-                                          ),
383
-                                          Container(
384
-                                              margin: EdgeInsets.only(top: 7),
385
-                                              decoration: BoxDecoration(
386
-                                                  color: Colors.white,
387
-                                                  borderRadius:
388
-                                                  BorderRadius.circular(5)),
389
-                                              child: Padding(
390
-                                                padding: EdgeInsets.only(
391
-                                                    left: 10,
392
-                                                    right: 10,
393
-                                                    top: 5,
394
-                                                    bottom: 5),
395
-                                                child: TextFormField(
396
-                                                    keyboardType:
397
-                                                    TextInputType.number,
398
-                                                    maxLines: 1,
399
-                                                    controller: totalHargaTeksController,
400
-                                                    textInputAction:
401
-                                                    TextInputAction.next,
402
-                                                    decoration: InputDecoration(
403
-                                                        border:
404
-                                                        InputBorder.none,
405
-                                                        hintText:
406
-                                                        "ex. 1500500", )),
407
-                                              )
408
-                                          )
409
-                                        ],
410
-                                      ),
411
-                                    ),
412
-                                    Container(
413
-                                      margin: EdgeInsets.only(
414
-                                          left: 10, right: 10, top: 10, bottom: 10),
415
-                                      child: Column(
416
-                                        children: [
417
-                                          Align(
418
-                                              alignment: Alignment.centerLeft,
419
-                                              child: Text(
420
-                                                'Description',
421
-                                                style: GoogleFonts.inconsolata(
422
-                                                    fontSize: 16, fontWeight: FontWeight.bold),
423
-                                              )),
424
-                                          Container(
425
-                                              margin: EdgeInsets.only(top: 7),
426
-                                              decoration: BoxDecoration(
427
-                                                  color: Colors.white,
428
-                                                  borderRadius:
429
-                                                  BorderRadius.circular(5)),
430
-                                              child: Padding(
431
-                                                padding: EdgeInsets.only(
432
-                                                    left: 10,
433
-                                                    right: 10,
434
-                                                    top: 5,
435
-                                                    bottom: 5),
436
-                                                child: TextFormField(
437
-                                                    keyboardType:
438
-                                                    TextInputType.multiline,
439
-                                                    controller: deskripsiTeksController,
440
-                                                    maxLines: null,
441
-                                                    textInputAction:
442
-                                                    TextInputAction.done,
443
-                                                    decoration: InputDecoration(
444
-                                                        border:
445
-                                                        InputBorder.none,
446
-                                                        hintText: "description")),
447
-                                              )
448
-                                          )
449
-                                        ],
450
-                                      ),
451
-                                    ),
452
-                                    Container(
453
-                                      margin: EdgeInsets.only(
454
-                                          left: 10, right: 10, top: 10, bottom: 10),
455
-                                      child: Column(
456
-                                        children: [
457
-                                          Align(
458
-                                              alignment: Alignment.centerLeft,
459
-                                              child: Text('Payment', style: GoogleFonts.inconsolata(
460
-                                                  fontSize: 16, fontWeight: FontWeight.bold),
461
-                                              )
462
-                                          ),
463
-                                          Container(
464
-                                            child: Column(
465
-                                              children: [
466
-                                                Row(
467
-                                                  children: [
468
-                                                    Radio(
469
-                                                      value: "own_account",
470
-                                                      groupValue: valuePayment,
471
-                                                      onChanged: (value) {
472
-                                                        setState(() {
473
-                                                          valuePayment = value!;
474
-                                                        });
475
-                                                      },
476
-                                                    ),
477
-                                                    Flexible(
478
-                                                      child: Text(
479
-                                                          "Own (Need Reimburse)", style: TextStyle(color: Colors.black54,
480
-                                                      )
481
-                                                      )
482
-                                                    ),
483
-                                                  ],
484
-                                                ),
485
-                                                Row(
486
-                                                  children: [
487
-                                                    Radio(
488
-                                                      value: "company_account",
489
-                                                      groupValue: valuePayment,
490
-                                                      onChanged: (value) {
491
-                                                        setState(() {
492
-                                                          valuePayment = value!;
493
-                                                          //logDev.log(valuePayment, name: "VALUE PAYMENT");
494
-                                                        });
495
-                                                      },
496
-                                                    ),
497
-                                                    Flexible(
498
-                                                        child: Text(
499
-                                                            "Company",
500
-                                                            style: TextStyle(
501
-                                                                color: Colors
502
-                                                                    .black54)))
503
-                                                  ],
504
-                                                ),
505
-                                              ],
506
-                                            ),
507
-                                          ),
508
-                                        ],
509
-                                      ),
510
-                                    ),
511
-                                    Container(
512
-                                      margin: EdgeInsets.only(
513
-                                          left: 10, right: 10, top: 10),
514
-                                      child: Column(
515
-                                        children: [
516
-                                          Align(
517
-                                                alignment: Alignment.centerLeft,
518
-                                                child: Text(
519
-                                                  'Attachment',
520
-                                                  style: GoogleFonts.inconsolata(
521
-                                                      fontSize: 16, fontWeight: FontWeight.bold),
522
-                                                ),
523
-                                              ),
524
-                                          Container(
525
-                                            child: ElevatedButton(
526
-                                              onPressed: () {
527
-                                                _pickMultipleFiles();
528
-                                              },
529
-                                              /*style: ElevatedButton.styleFrom(
530
-                                              backgroundColor:
531
-                                                  CupertinoColors
532
-                                                      .systemGrey2),*/
533
-                                              child: Container(
534
-                                                width: double.infinity,
535
-                                                child: Text("Choose File",
536
-                                                    style: TextStyle(
537
-                                                        color: Colors.white,
538
-                                                        fontSize: 16,
539
-                                                        fontWeight:
540
-                                                        FontWeight.w400)),
541
-                                              ),
542
-                                            ),
543
-                                          ),
544
-                                          Container(
545
-                                            alignment:
546
-                                            Alignment.centerLeft,
547
-                                            margin: EdgeInsets.only(
548
-                                                left: 15,
549
-                                                right: 15,
550
-                                                bottom: 10),
551
-                                            child: Text(_totalFile + _fileText,
552
-                                              overflow:
553
-                                              TextOverflow.ellipsis,
554
-                                              /*maxLines: 7,*/
555
-                                              style: TextStyle(
556
-                                                  color: Colors.black54),
557
-                                            ),
558
-                                          ),
559
-                                        ],
560
-                                      ),
561
-                                    ),
562
-                                    InkWell(
563
-                                      child: Container(
564
-                                        margin: EdgeInsets.only(left: 10, right: 10, bottom: 15),
565
-                                        padding: EdgeInsets.fromLTRB(
566
-                                            10, 10, 10, 10),
567
-                                        width: double.infinity,
568
-                                        decoration: BoxDecoration(
569
-                                            borderRadius:
570
-                                            BorderRadius.circular(5),
571
-                                            gradient: LinearGradient(colors: [
572
-                                              Color(0xFFFF9945),
573
-                                              Color(0xFFFc6076)
574
-                                            ])),
575
-                                        child: Text('Submit',
576
-                                            textAlign: TextAlign.center,
577
-                                            style: TextStyle(
578
-                                                color: Colors.white,
579
-                                                fontSize: 17,
580
-                                                fontWeight: FontWeight.w500)),
581
-                                      ),
582
-                                      onTap: () async {
583
-                                        ProgressDialog loading = ProgressDialog(context);
584
-                                        loading = ProgressDialog(context,
585
-                                            type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
586
-                                        loading.style(
587
-                                            message: 'Please Wait .....',
588
-                                            borderRadius: 3,
589
-                                            backgroundColor: Colors.white,
590
-                                            progressWidget: CircularProgressIndicator(),
591
-                                            elevation: 10.0,
592
-                                            padding: EdgeInsets.all(10),
593
-                                            insetAnimCurve: Curves.easeInOut,
594
-                                            progress: 0.0,
595
-                                            maxProgress: 100.0,
596
-                                            progressTextStyle: TextStyle(
597
-                                                color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
598
-                                            messageTextStyle: TextStyle(
599
-                                                color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
600
-
601
-                                        if (!validateFormReimburse(context)){
602
-                                          return;
603
-                                        } else if (validateFormReimburse(context)){
604
-                                          await loading.show();
605
-                                          PengajuanReimburse_Post.connectToAPI(namaProdukTeksController.text.toString(), idReimburse,
606
-                                              formattedDateFrom, totalHargaTeksController.text.toString(), valuePayment,
607
-                                              deskripsiTeksController.text.toString(), fileAttach).then((valueResult) async {
608
-                                                logDev.log(fileAttach.toString(), name: "FILE ATTACH APA AJA");
609
-                                            Map<String, dynamic> object = json.decode(valueResult);
610
-                                            if (object.containsKey("result").toString() == "true") {
611
-                                              String result = object['result'].toString();
612
-                                              if (result.contains("status")) {
613
-                                                await loading.hide();
614
-                                                Widget okButton = TextButton(
615
-                                                  child: Text("OK"),
616
-                                                  onPressed: () {
617
-                                                    Navigator.of(context, rootNavigator: true).pop();
618
-                                                  },
619
-                                                );
620
-
621
-                                                // set up the AlertDialog
622
-                                                AlertDialog alert = AlertDialog(
623
-                                                  title: Text("Employee Self Service"),
624
-                                                  content: Text("Error Submit, Please Try Again Later!"),
625
-                                                  actions: [
626
-                                                    okButton,
627
-                                                  ],
628
-                                                );
629
-
630
-                                                // show the dialog
631
-                                                showDialog(
632
-                                                  context: context,
633
-                                                  barrierDismissible: false,
634
-                                                  builder: (BuildContext context) {
635
-                                                    return alert;
636
-                                                  },
637
-                                                );
638
-                                              } else {
639
-                                                await loading.hide();
640
-                                                formattedDateFrom = "";
641
-                                                visibleDateFrom = false;
642
-                                                visibleDateFrom = false;
643
-                                                deskripsiTeksController.clear();
644
-                                                Widget okButton = TextButton(
645
-                                                  child: Text("OK"),
646
-                                                  onPressed: () {
647
-                                                    Navigator.of(context, rootNavigator: true).pop();
648
-                                                    Navigator.pushReplacement(context, MaterialPageRoute(
649
-                                                        builder: (context) => ReimburseScreen()));
650
-                                                  },
651
-                                                );
652
-
653
-                                                // set up the AlertDialog
654
-                                                AlertDialog alert = AlertDialog(
655
-                                                  title: Text("Employee Self Service"),
656
-                                                  content: Text("Success Submit Reimburse"),
657
-                                                  actions: [
658
-                                                    okButton,
659
-                                                  ],
660
-                                                );
661
-
662
-                                                // show the dialog
663
-                                                showDialog(
664
-                                                  context: context,
665
-                                                  barrierDismissible: false,
666
-                                                  builder: (BuildContext context) {
667
-                                                    return alert;
668
-                                                  },
669
-                                                );
670
-                                              }
671
-                                            } else {
672
-                                              await loading.hide();
673
-                                              alertDialogFailedResponse(context);
674
-                                            }
675
-                                          });
676
-                                        }
677
-                                      },
678
-                                    )
679
-                                  ],
680
-                                ),
681
-                              ),
682
-                            ),
683
-                          ),
684
-                        ],
685
-                      ),
686
-                    ),
687
-                  ),
688
-                ],
689
-              ),
690
-            ],
691
-          )),
692
-    );
693
-  }
694
-
695
-  //Pick Files
696
-  void _pickMultipleFiles() async {
697
-    FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true);
698
-
699
-    if (_fileText != ""){
700
-      _fileText = "";
701
-    }
702
-
703
-    if (result != null) {
704
-      List<File> files = result.paths.map((path) => File(path!)).toList();
705
-      for (int i = 0; i< files.length; i++){
706
-        String fileName = files[i].path.split('/').last;
707
-        _fileText = _fileText + "\n" + fileName;
708
-
709
-        List<int> fileInBytes = files[i].readAsBytesSync();
710
-        String toBase64 = base64Encode(fileInBytes);
711
-        fileAttach.add(toBase64);
712
-      }
713
-      fileAttach.removeAt(0);
714
-      /*logDev.log(fileAttach.toString(), name: "File Attach Base64");*/
715
-      logDev.log(fileAttach.length.toString(), name: "Length File Attach");
716
-      logDev.log(files.toString(), name: "Files Picked");
717
-
718
-      setState(() {
719
-        _fileText;
720
-        _totalFile = "Total File : " + files.length.toString();
721
-      });
722
-    } else {
723
-      // User canceled the picker
724
-    }
725
-  }
726
-
727
-  //Validasi Form Reimburse
728
-  bool validateFormReimburse(BuildContext context) {
729
-    bool result = true;
730
-    if (selectedCategory == null) {
731
-      Fluttertoast.showToast(
732
-          msg: "Category Not Selected",
733
-          toastLength: Toast.LENGTH_SHORT,
734
-          gravity: ToastGravity.CENTER,
735
-          timeInSecForIosWeb: 1,
736
-          textColor: Colors.white,
737
-          fontSize: 16.0);
738
-      result = false;
739
-    } else if (namaProdukTeksController.text.toString().isEmpty) {
740
-      Fluttertoast.showToast(
741
-          msg: "Item Name Required!",
742
-          toastLength: Toast.LENGTH_SHORT,
743
-          gravity: ToastGravity.CENTER,
744
-          timeInSecForIosWeb: 1,
745
-          textColor: Colors.white,
746
-          fontSize: 16.0);
747
-      result = false;
748
-    } else if  (formattedDateFrom == "") {
749
-      Fluttertoast.showToast(
750
-          msg: "Date Not Selected",
751
-          toastLength: Toast.LENGTH_SHORT,
752
-          gravity: ToastGravity.CENTER,
753
-          timeInSecForIosWeb: 1,
754
-          textColor: Colors.white,
755
-          fontSize: 16.0);
756
-      result = false;
757
-    } else if (totalHargaTeksController.text.toString().isEmpty) {
758
-      Fluttertoast.showToast(
759
-          msg: "Total Amount Required!",
760
-          toastLength: Toast.LENGTH_SHORT,
761
-          gravity: ToastGravity.CENTER,
762
-          timeInSecForIosWeb: 1,
763
-          textColor: Colors.white,
764
-          fontSize: 16.0);
765
-      result = false;
766
-    } else if (deskripsiTeksController.text.toString().isEmpty) {
767
-      Fluttertoast.showToast(
768
-          msg: "Description Required!",
769
-          toastLength: Toast.LENGTH_SHORT,
770
-          gravity: ToastGravity.CENTER,
771
-          timeInSecForIosWeb: 1,
772
-          textColor: Colors.white,
773
-          fontSize: 16.0);
774
-      result = false;
775
-    } else if (valuePayment == ""){
776
-      Fluttertoast.showToast(
777
-          msg: "Payment Option Not Selected",
778
-          toastLength: Toast.LENGTH_SHORT,
779
-          gravity: ToastGravity.CENTER,
780
-          timeInSecForIosWeb: 1,
781
-          textColor: Colors.white,
782
-          fontSize: 16.0);
783
-      result = false;
784
-    }
785
-
786
-    return result;
787
-  }
788
-}
789
-
790
-alertDialogFailedRetrievedData(BuildContext context){
791
-  Widget okButton = TextButton(
792
-    child: Text("Refresh"),
793
-    onPressed: () {
794
-      Navigator.of(context, rootNavigator: true).pop();
795
-      Navigator.pushReplacement(context, MaterialPageRoute(
796
-          builder: (context) => ReimburseScreen()));
797
-    },
798
-  );
799
-
800
-  Widget noButton = TextButton(
801
-    child: Text("Back"),
802
-    onPressed: () {
803
-      Navigator.of(context, rootNavigator: true).pop();
804
-      Navigator.pop(context);
805
-
806
-    },
807
-  );
808
-
809
-  // set up the AlertDialog
810
-  AlertDialog alert = AlertDialog(
811
-    title: Text("Employee Self Service"),
812
-    content: Text("Failed to Retrieve Data"),
813
-    actions: [
814
-      noButton,
815
-      okButton,
816
-    ],
817
-  );
818
-
819
-  // show the dialog
820
-  showDialog(
821
-    context: context,
822
-    barrierDismissible: false,
823
-    builder: (BuildContext context) {
824
-      return alert;
825
-    },
826
-  );
827
-}
828
-
829
-alertDialogFailedResponse(BuildContext context){
830
-  Widget okButton = TextButton(
831
-    child: Text("Refresh"),
832
-    onPressed: () {
833
-       Navigator.of(context, rootNavigator: true).pop();
834
-      Navigator.pushReplacement(context, MaterialPageRoute(
835
-          builder: (context) => ReimburseScreen()));
836
-    },
837
-  );
838
-
839
-  Widget noButton = TextButton(
840
-    child: Text("Back"),
841
-    onPressed: () {
842
-      Navigator.of(context, rootNavigator: true).pop();
843
-      Navigator.pop(context);
844
-
845
-    },
846
-  );
847
-
848
-  // set up the AlertDialog
849
-  AlertDialog alert = AlertDialog(
850
-    title: Text("Employee Self Service"),
851
-    content: Text("Server Response Error"),
852
-    actions: [
853
-      noButton,
854
-      okButton,
855
-    ],
856
-  );
857
-
858
-  // show the dialog
859
-  showDialog(
860
-    context: context,
861
-    barrierDismissible: false,
862
-    builder: (BuildContext context) {
863
-      return alert;
864
-    },
865
-  );
866
-}

+ 0
- 36
lib/Screens/Menu/SlipGaji/RequestHttp/detailSlipGaji_post.dart Просмотреть файл

@@ -1,36 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:http/http.dart' as http;
4
-import 'package:employee_selfservice_mobile/constants.dart';
5
-import 'dart:developer' as developer;
6
-
7
-import 'package:shared_preferences/shared_preferences.dart';
8
-
9
-class DetailSlipGaji_Post {
10
-  late String batch_id;
11
-  late String session;
12
-
13
-  DetailSlipGaji_Post({required this.session});
14
-
15
-  static Future<String> connectToAPI(String batch_id) async {
16
-    String URL = baseURL + "/api/v1/detail_slip_gaji";
17
-
18
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
19
-    final session = prefs.getString('session');
20
-
21
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
22
-      "data": [
23
-        {
24
-          "batch_id" : batch_id,
25
-          "session": session
26
-        }
27
-      ]
28
-    }), headers: {
29
-      "Content-Type": "application/json",
30
-      "Api-key": apiKey
31
-    });
32
-
33
-    developer.log(sendData.body, name: "Detail Slip Gaji Result");
34
-    return sendData.body;
35
-  }
36
-}

+ 0
- 36
lib/Screens/Menu/SlipGaji/RequestHttp/downloadSlipGaji_post.dart Просмотреть файл

@@ -1,36 +0,0 @@
1
-import 'dart:convert';
2
-import 'dart:core';
3
-import 'package:http/http.dart' as http;
4
-import 'package:employee_selfservice_mobile/constants.dart';
5
-import 'dart:developer' as developer;
6
-
7
-import 'package:shared_preferences/shared_preferences.dart';
8
-
9
-class DownloadSlipGaji_Post {
10
-  late String batch_id;
11
-  late String session;
12
-
13
-  DownloadSlipGaji_Post({required this.session});
14
-
15
-  static Future<String> connectToAPI(String batch_id) async {
16
-    String URL = baseURL + "/api/v1/download_slip";
17
-
18
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
19
-    final session = prefs.getString('session');
20
-
21
-    var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
22
-      "data": [
23
-        {
24
-          "batch_id" : batch_id,
25
-          "session" : session
26
-        }
27
-      ]
28
-    }), headers: {
29
-      "Content-Type": "application/json",
30
-      "Api-key": apiKey
31
-    });
32
-
33
-    developer.log(sendData.body, name: "Download Slip Gaji Result");
34
-    return sendData.body;
35
-  }
36
-}

+ 0
- 575
lib/Screens/Menu/SlipGaji/slipgaji_screen.dart Просмотреть файл

@@ -1,575 +0,0 @@
1
-import 'dart:convert';
2
-
3
-import 'package:flutter/cupertino.dart';
4
-import 'package:flutter/material.dart';
5
-import 'package:google_fonts/google_fonts.dart';
6
-import 'package:employee_selfservice_mobile/Screens/Menu/SlipGaji/RequestHttp/detailSlipGaji_post.dart';
7
-import 'package:employee_selfservice_mobile/Screens/Menu/SlipGaji/RequestHttp/downloadSlipGaji_post.dart';
8
-import 'package:employee_selfservice_mobile/Screens/Menu/SlipGaji/RequestHttp/historySlipGaji_post.dart';
9
-import 'package:employee_selfservice_mobile/Screens/Menu/SlipGaji/background.dart';
10
-import 'package:employee_selfservice_mobile/constants.dart';
11
-import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
12
-import 'dart:developer' as logDev;
13
-
14
-import 'package:shared_preferences/shared_preferences.dart';
15
-import 'package:url_launcher/url_launcher.dart';
16
-
17
-class SlipGajiScreen extends StatefulWidget {
18
-  const SlipGajiScreen({Key? key}) : super(key: key);
19
-
20
-  @override
21
-  State<SlipGajiScreen> createState() => _SlipGajiScreenState();
22
-}
23
-
24
-class _SlipGajiScreenState extends State<SlipGajiScreen> {
25
-  //History Slip Gaji
26
-  late List <String> dateTo_List;
27
-  late List <String> batchID_List;
28
-
29
-  //Detail Slip Gaji
30
-  late List <String> number_List;
31
-  late List <String> period_List;
32
-  late List <String> namaPegawai_List;
33
-  late List <String> status_List;
34
-  late List <String> structure_List;
35
-  late String position;
36
-
37
-  //Komponen Gaji
38
-  late List <String> name_List;
39
-  late List <String> category_List;
40
-  late List <String> total_List;
41
-
42
-  int HistoryLength = 0;
43
-  late int indexBatchID = 0;
44
-
45
-  var selectedDate;
46
-  bool visible = false;
47
-
48
-  @override
49
-  void initState() {
50
-    super.initState();
51
-    dateTo_List = [""];
52
-    batchID_List = [""];
53
-
54
-    number_List = [""];
55
-    period_List = [""];
56
-    namaPegawai_List = [""];
57
-    status_List = [""];
58
-    structure_List = [""];
59
-    position = "";
60
-
61
-    name_List = [""];
62
-    category_List = [""];
63
-    total_List = [""];
64
-
65
-    WidgetsBinding.instance.addPostFrameCallback((_) {
66
-      getHistoryData();
67
-    });
68
-  }
69
-
70
-  getHistoryData() async {
71
-    ProgressDialog loading = ProgressDialog(context);
72
-    loading = ProgressDialog(context,
73
-        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
74
-    loading.style(
75
-        message: 'Please Wait .....',
76
-        borderRadius: 3,
77
-        backgroundColor: Colors.white,
78
-        progressWidget: CircularProgressIndicator(),
79
-        elevation: 10.0,
80
-        padding: EdgeInsets.all(10),
81
-        insetAnimCurve: Curves.easeInOut,
82
-        progress: 0.0,
83
-        maxProgress: 100.0,
84
-        progressTextStyle: TextStyle(
85
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
86
-        messageTextStyle: TextStyle(
87
-            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
88
-    await loading.show();
89
-    HistorySlipGaji_Post.connectToAPI().then((valueResult) async {
90
-      Map<String, dynamic> object = json.decode(valueResult);
91
-      if (object.containsKey("result").toString() == "true"){
92
-        String result = object['result'].toString();
93
-        if (result.contains("failed")) {
94
-          await loading.hide();
95
-          setState(() {
96
-            alertDialogFailedRetrievedData(context);
97
-          });
98
-        } else {
99
-          List <dynamic> historySlipGaji = object['result'];
100
-          setState(() {
101
-            for (int i = 0; i < historySlipGaji.length; i++){
102
-              String dateTo = historySlipGaji[i]['date_to'].toString();
103
-              String bulan = dateTo.substring(5,7);
104
-              String tahun = dateTo.substring(0,4);
105
-              String batchID = historySlipGaji[i]['batch_id'].toString();
106
-
107
-              String bulanStr = "";
108
-              if (bulan == "01"){
109
-                bulanStr = "January";
110
-              } else if (bulan == "02"){
111
-                bulanStr = "February";
112
-              } else if (bulan == "03"){
113
-                bulanStr = "March";
114
-              } else if (bulan == "04"){
115
-                bulanStr = "April";
116
-              } else if (bulan == "05"){
117
-                bulanStr = "May";
118
-              } else if (bulan == "06"){
119
-                bulanStr = "June";
120
-              } else if (bulan == "07"){
121
-                bulanStr = "July";
122
-              } else if (bulan == "08"){
123
-                bulanStr = "August";
124
-              } else if (bulan == "09"){
125
-                bulanStr = "September";
126
-              } else if (bulan == "10"){
127
-                bulanStr = "October";
128
-              } else if (bulan == "11"){
129
-                bulanStr = "November";
130
-              } else if (bulan == "12"){
131
-                bulanStr = "December";
132
-              }
133
-
134
-              String bulanTahun = bulanStr + " " + tahun;
135
-              dateTo_List.add(bulanTahun);
136
-              batchID_List.add(batchID);
137
-            }
138
-            dateTo_List.removeAt(0);
139
-            batchID_List.removeAt(0);
140
-            logDev.log(dateTo_List.toString(), name: "LIST DATE");
141
-            HistoryLength = historySlipGaji.length;
142
-
143
-          });
144
-          await loading.hide();
145
-        }
146
-      } else {
147
-        setState((){
148
-          alertDialogFailedResponse(context);
149
-        });
150
-        await loading.hide();
151
-      }
152
-      await loading.hide();
153
-    });
154
-    return HistoryLength;
155
-  }
156
-
157
-  getDetailData () async {
158
-    ProgressDialog loading = ProgressDialog(context);
159
-    loading = ProgressDialog(context,
160
-        type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
161
-    loading.style(
162
-        message: 'Please Wait .....',
163
-        borderRadius: 3,
164
-        backgroundColor: Colors.white,
165
-        progressWidget: CircularProgressIndicator(),
166
-        elevation: 10.0,
167
-        padding: EdgeInsets.all(10),
168
-        insetAnimCurve: Curves.easeInOut,
169
-        progress: 0.0,
170
-        maxProgress: 100.0,
171
-        progressTextStyle: TextStyle(
172
-            color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
173
-        messageTextStyle: TextStyle(
174
-            color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
175
-    await loading.show();
176
-
177
-    final SharedPreferences prefs = await SharedPreferences.getInstance();
178
-      DetailSlipGaji_Post.connectToAPI(batchID_List[indexBatchID]).then((valueResult) async {
179
-        Map<String, dynamic> object = json.decode(valueResult);
180
-        if (object.containsKey("result").toString() == "true"){
181
-          String result = object['result'].toString();
182
-          if (result.contains("failed")) {
183
-            await loading.hide();
184
-            logDev.log("ERROR", name: "FAILED RESULT");
185
-            setState(() {
186
-              alertDialogFailedRetrievedData(context);
187
-            });
188
-          } else {
189
-            List <dynamic> detailSlipGaji = object['result'];
190
-            setState(() {
191
-              position = prefs.getString('position')!;
192
-              logDev.log(position, name: "POSITION");
193
-              for (int i = 0; i < detailSlipGaji.length; i++){
194
-                String nomor = detailSlipGaji[i]['number'].toString();
195
-                logDev.log(nomor, name: "NOMOR/NUMBER");
196
-                String tanggalAwal = detailSlipGaji[i]['date_from'];
197
-                String tanggalAkhir = detailSlipGaji[i]['date_to'];
198
-                String namaPegawai = detailSlipGaji[i]['employee'];
199
-                String status = detailSlipGaji[i]['status'];
200
-                String structure =detailSlipGaji[i]['structure'];
201
-                //number_List.add(nomor);
202
-                structure_List.add(structure);
203
-                period_List.add(tanggalAwal + " to " + tanggalAkhir);
204
-                namaPegawai_List.add(namaPegawai);
205
-                status_List.add(status);
206
-
207
-                List <dynamic> component =detailSlipGaji[i]['component'];
208
-                logDev.log(component.length.toString(), name: "BANYAK COMPONENT");
209
-                for (int j = 0; j < component.length; j++){
210
-                  String name = component[j]['name'].toString();
211
-                  String category = component[j]['category'].toString();
212
-                  double total = component[j]['total'];
213
-
214
-                  name_List.add(name);
215
-                  category_List.add(category);
216
-                  total_List.add(total.toString());
217
-                }
218
-              }
219
-
220
-
221
-              number_List.remove(0);
222
-              structure_List.removeAt(0);
223
-              period_List.removeAt(0);
224
-              namaPegawai_List.removeAt(0);
225
-              status_List.removeAt(0);
226
-
227
-              name_List.removeAt(0);
228
-              category_List.removeAt(0);
229
-              total_List.removeAt(0);
230
-            });
231
-            await loading.hide();
232
-          }
233
-        } else {
234
-          setState((){
235
-            alertDialogFailedResponse(context);
236
-            logDev.log("ERROR", name: "RESPONSE FAILED RESULT");
237
-           /* Fluttertoast.showToast(
238
-                msg: "Server Response Error",
239
-                toastLength: Toast.LENGTH_SHORT,
240
-                gravity: ToastGravity.CENTER,
241
-                timeInSecForIosWeb: 1,
242
-                textColor: Colors.white,
243
-                fontSize: 16.0);*/
244
-          });
245
-          await loading.hide();
246
-        }
247
-        await loading.hide();
248
-      });
249
-
250
-  }
251
-
252
-  @override
253
-  Widget build(BuildContext context) {
254
-    var size = MediaQuery.sizeOf(context);
255
-    return Scaffold(
256
-      body: SingleChildScrollView(
257
-          child: Column(
258
-        children: <Widget>[
259
-          Stack(
260
-            children: [
261
-              WavyHeader(),
262
-              Container(
263
-                margin: EdgeInsets.only(top: MediaQuery.of(context).size.height/6 - 20),
264
-                padding: EdgeInsets.fromLTRB(20, 5, 25, 5),
265
-                child: Row(
266
-                  mainAxisAlignment: MainAxisAlignment.end,
267
-                  crossAxisAlignment: CrossAxisAlignment.end,
268
-                  children: [
269
-                    Text(
270
-                      'Pay Slip\t\t',
271
-                      maxLines: 1,
272
-                      style: GoogleFonts.luckiestGuy(
273
-                        fontSize: 28,
274
-                        color: Color(0xFF4858A7),
275
-                        fontStyle: FontStyle.italic,
276
-                      ),
277
-                    ),
278
-                    Image.asset('assets/icons/ic_salary.png', width: 40, height: 40,),
279
-                  ],
280
-                )
281
-              ),
282
-              SafeArea(
283
-                  child: Container(
284
-                width: MediaQuery.of(context).size.width,
285
-                margin: EdgeInsets.only(
286
-                  top: MediaQuery.of(context).size.height / 5,
287
-                  left: 15,
288
-                  right: 15,
289
-                ),
290
-                child: Column(
291
-                  children: [
292
-                    Container(
293
-                      margin: EdgeInsets.only(bottom: 20),
294
-                      child: Row(
295
-                        children: [
296
-                          Expanded(
297
-                              flex: 2,
298
-                              child: Text(
299
-                                'Date\t:\t',
300
-                                style: GoogleFonts.inconsolata(fontSize: 20),
301
-                              )),
302
-                          Expanded(
303
-                              flex: 8,
304
-                              child: Container(
305
-                                decoration: BoxDecoration(
306
-                                    color: CupertinoColors.systemGrey2,
307
-                                    borderRadius: BorderRadius.circular(5)),
308
-                                child: DropdownButton(
309
-                                  menuMaxHeight: size.height * 0.31,
310
-                                  value: this.selectedDate,
311
-                                  isExpanded: true,
312
-                                  underline: SizedBox(),
313
-                                  hint: Text(
314
-                                    '\t\t\tChoose Date',
315
-                                    style: TextStyle(color: Colors.black54),
316
-                                  ),
317
-                                  onChanged: (value) {
318
-                                    print(value);
319
-                                    setState(() {
320
-                                      selectedDate = value!;
321
-                                      if (selectedDate == value){
322
-                                        visible = true;
323
-                                        for (int i = 0; i < dateTo_List.length; i ++){
324
-                                          if (selectedDate == dateTo_List[i]){
325
-                                            indexBatchID = i;
326
-                                            break;
327
-                                          }
328
-                                        }
329
-                                        //logDev.log(indexBatchID.toString(), name: "INDEX BATCH ID");
330
-                                        getDetailData();
331
-                                      } else {
332
-                                        visible = false;
333
-                                      }
334
-                                    });
335
-                                  },
336
-                                  items: dateTo_List
337
-                                      .map(
338
-                                        (e) => DropdownMenuItem(
339
-                                            value: e,
340
-                                            child: Text("\t\t\t" + e)),
341
-                                      )
342
-                                      .toList(),
343
-                                ),
344
-                              )),
345
-                        ],
346
-                      ),
347
-                    ),
348
-                    Visibility(
349
-                      visible: visible,
350
-                      child: Text(
351
-                        'Pay Slip ' + selectedDate.toString() + "\nPT. Global Service Indonesia",
352
-                        textAlign: TextAlign.center,
353
-                        style: GoogleFonts.viga(
354
-                          fontSize: 15,
355
-                          fontWeight: FontWeight.bold,
356
-                        ),
357
-                      ),
358
-                    ),
359
-                    Visibility(
360
-                        visible: visible,
361
-                        child: ListView.builder(
362
-                          shrinkWrap: true,
363
-                          itemCount: 1,
364
-                          itemBuilder: (context, int indexBatchID){
365
-                            return Container(
366
-                              //height: 200,
367
-                              margin: EdgeInsets.fromLTRB(0, 15, 0, 10),
368
-                              decoration: BoxDecoration(
369
-                                color: Color(0XFFFFFEFC),
370
-                                borderRadius: BorderRadius.circular(10),
371
-                              ),
372
-                              child: Card(
373
-                                elevation: 5,
374
-                                child: Column(
375
-                                  children: [
376
-                                    Text(number_List[indexBatchID], style: GoogleFonts.rubikBubbles(fontSize: 16)),
377
-                                    Text(structure_List[indexBatchID], style: GoogleFonts.nunito(fontSize: 15)),
378
-                                    Text(period_List[indexBatchID], style: GoogleFonts.nunito(fontSize: 15)),
379
-                                    Text(name_List[indexBatchID], style: GoogleFonts.nunito(fontSize: 15)),
380
-                                    Text(position, style: GoogleFonts.nunito(fontSize: 15)),
381
-                                    Text("Payment : " /*+ payment_List[i]*/, style: GoogleFonts.yeonSung(fontSize: 14, fontStyle: FontStyle.italic)),
382
-                                    Text(number_List[indexBatchID], style: GoogleFonts.rubikBubbles(fontSize: 16)),
383
-                                  ],
384
-                                ),
385
-                              ),
386
-                            );
387
-                          },
388
-                        ),
389
-                    ),
390
-                    Visibility(
391
-                      visible: visible,
392
-                      child: Container(
393
-                        alignment: Alignment.centerRight,
394
-                        child: ElevatedButton(
395
-                          onPressed: () async {
396
-                            ProgressDialog loading = ProgressDialog(context);
397
-                            loading = ProgressDialog(context,
398
-                                type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
399
-                            loading.style(
400
-                                message: 'Please Wait .....',
401
-                                borderRadius: 3,
402
-                                backgroundColor: Colors.white,
403
-                                progressWidget: CircularProgressIndicator(),
404
-                                elevation: 10.0,
405
-                                padding: EdgeInsets.all(10),
406
-                                insetAnimCurve: Curves.easeInOut,
407
-                                progress: 0.0,
408
-                                maxProgress: 100.0,
409
-                                progressTextStyle: TextStyle(
410
-                                    color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
411
-                                messageTextStyle: TextStyle(
412
-                                    color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
413
-                            await loading.show();
414
-
415
-                            DownloadSlipGaji_Post.connectToAPI(batchID_List[indexBatchID]).then((valueResult) async {
416
-                              Map<String, dynamic> object = json.decode(valueResult);
417
-                              if (object.containsKey("result").toString() == "true"){
418
-                                String result = object['result'].toString();
419
-                                if (result.contains("failed")) {
420
-                                  await loading.hide();
421
-                                  setState(() {
422
-                                    alertDialogFailedDownloadPayslip(context);
423
-                                  });
424
-                                } else if (result.contains("url")){
425
-                                  await loading.hide();
426
-                                  setState(() {
427
-                                    //_launchURL(Uri.parse(baseURL + object['result']['url'].toString()));
428
-                                    Uri url = Uri.parse(Uri.encodeFull(baseURL + object['result']['url'.toString()]));
429
-                                    launchUrl(url, mode: LaunchMode.externalApplication);
430
-                                  });
431
-                                }
432
-                              } else {
433
-                                await loading.hide();
434
-                                setState((){
435
-                                  alertDialogFailedResponse(context);
436
-                                });
437
-                              }
438
-                              await loading.hide();
439
-                            });
440
-                          },
441
-                          style: ElevatedButton.styleFrom(),
442
-                          child: Text('Download Slip Gaji'),
443
-                        ),
444
-                      ),
445
-                    ),
446
-                  ],
447
-                ),
448
-              )),
449
-            ],
450
-          ),
451
-        ],
452
-      )),
453
-    );
454
-  }
455
-}
456
-
457
-const List<Color> Gradients1 = [
458
-  Color(0xFF0EDED2),
459
-  Color(0xFF03A0FE),
460
-];
461
-
462
-launchURL(Uri url) async {
463
-  if (await canLaunchUrl(url)) {
464
-    await launchUrl(url);
465
-  } else {
466
-    throw 'Could not launch $url';
467
-  }
468
-}
469
-
470
-alertDialogFailedRetrievedData(BuildContext context){
471
-  Widget okButton = TextButton(
472
-    child: Text("Refresh"),
473
-    onPressed: () {
474
-      Navigator.of(context, rootNavigator: true).pop();
475
-      Navigator.pushReplacement(context, MaterialPageRoute(
476
-          builder: (context) => SlipGajiScreen()));
477
-    },
478
-  );
479
-
480
-  Widget noButton = TextButton(
481
-    child: Text("Back"),
482
-    onPressed: () {
483
-      Navigator.of(context, rootNavigator: true).pop();
484
-      Navigator.pop(context);
485
-
486
-    },
487
-  );
488
-
489
-  // set up the AlertDialog
490
-  AlertDialog alert = AlertDialog(
491
-    title: Text(appName),
492
-    content: Text("Failed to Retrieve Data"),
493
-    actions: [
494
-      noButton,
495
-      okButton,
496
-    ],
497
-  );
498
-
499
-  // show the dialog
500
-  showDialog(
501
-    context: context,
502
-    barrierDismissible: false,
503
-    builder: (BuildContext context) {
504
-      return alert;
505
-    },
506
-  );
507
-}
508
-
509
-alertDialogFailedResponse(BuildContext context){
510
-  Widget okButton = TextButton(
511
-    child: Text("Refresh"),
512
-    onPressed: () {
513
-      Navigator.of(context, rootNavigator: true).pop();
514
-      Navigator.pushReplacement(context, MaterialPageRoute(
515
-          builder: (context) => SlipGajiScreen()));
516
-    },
517
-  );
518
-
519
-  Widget noButton = TextButton(
520
-    child: Text("Back"),
521
-    onPressed: () {
522
-      Navigator.of(context, rootNavigator: true).pop();
523
-      Navigator.pop(context);
524
-
525
-    },
526
-  );
527
-
528
-  // set up the AlertDialog
529
-  AlertDialog alert = AlertDialog(
530
-    title: Text(appName),
531
-    content: Text("Server Response Error"),
532
-    actions: [
533
-      noButton,
534
-      okButton,
535
-    ],
536
-  );
537
-
538
-  // show the dialog
539
-  showDialog(
540
-    context: context,
541
-    barrierDismissible: false,
542
-    builder: (BuildContext context) {
543
-      return alert;
544
-    },
545
-  );
546
-}
547
-
548
-alertDialogFailedDownloadPayslip(BuildContext context){
549
-  Widget okButton = TextButton(
550
-    child: Text("Try Again"),
551
-    onPressed: () {
552
-      Navigator.of(context, rootNavigator: true).pop();
553
-      Navigator.pop(context);
554
-
555
-    },
556
-  );
557
-
558
-  // set up the AlertDialog
559
-  AlertDialog alert = AlertDialog(
560
-    title: Text(appName),
561
-    content: Text("Failed to Download Payslip"),
562
-    actions: [
563
-      okButton,
564
-    ],
565
-  );
566
-
567
-  // show the dialog
568
-  showDialog(
569
-    context: context,
570
-    barrierDismissible: false,
571
-    builder: (BuildContext context) {
572
-      return alert;
573
-    },
574
-  );
575
-}

+ 1
- 1
lib/Screens/Splash/splash_screen.dart Просмотреть файл

@@ -134,7 +134,7 @@ class SplashScreen extends StatelessWidget {
134 134
                   child: SizedBox(
135 135
                       width: size.width * 0.55,
136 136
                       //height: 250,
137
-                      child: Image.asset('assets/animation/iconapp2.gif')
137
+                      child: Image.asset('assets/icons/menu/ic_canvasing_1.png')
138 138
                     /*LottieBuilder.asset('assets/animation/animation_4.json',
139 139
                     repeat: true, ),*/
140 140
                   ),

lib/Screens/Menu/SlipGaji/background.dart → lib/Screens/background.dart Просмотреть файл


+ 32
- 0
pubspec.lock Просмотреть файл

@@ -1277,6 +1277,38 @@ packages:
1277 1277
       url: "https://pub.dev"
1278 1278
     source: hosted
1279 1279
     version: "0.1.4-beta"
1280
+  webview_flutter:
1281
+    dependency: "direct main"
1282
+    description:
1283
+      name: webview_flutter
1284
+      sha256: c1ab9b81090705c6069197d9fdc1625e587b52b8d70cdde2339d177ad0dbb98e
1285
+      url: "https://pub.dev"
1286
+    source: hosted
1287
+    version: "4.4.1"
1288
+  webview_flutter_android:
1289
+    dependency: transitive
1290
+    description:
1291
+      name: webview_flutter_android
1292
+      sha256: b0cd33dd7d3dd8e5f664e11a19e17ba12c352647269921a3b568406b001f1dff
1293
+      url: "https://pub.dev"
1294
+    source: hosted
1295
+    version: "3.12.0"
1296
+  webview_flutter_platform_interface:
1297
+    dependency: transitive
1298
+    description:
1299
+      name: webview_flutter_platform_interface
1300
+      sha256: "6d9213c65f1060116757a7c473247c60f3f7f332cac33dc417c9e362a9a13e4f"
1301
+      url: "https://pub.dev"
1302
+    source: hosted
1303
+    version: "2.6.0"
1304
+  webview_flutter_wkwebview:
1305
+    dependency: transitive
1306
+    description:
1307
+      name: webview_flutter_wkwebview
1308
+      sha256: b4b42295b3aa91ed22ba6d3dd7de56efbb8f3ab3d6e41d8b1615d13537c7801d
1309
+      url: "https://pub.dev"
1310
+    source: hosted
1311
+    version: "3.9.2"
1280 1312
   win32:
1281 1313
     dependency: transitive
1282 1314
     description:

+ 1
- 1
pubspec.yaml Просмотреть файл

@@ -67,7 +67,6 @@ dependencies:
67 67
   flutter_map: ^5.0.0
68 68
   geolocator: ^10.0.1
69 69
   geocoding: ^2.1.0
70
-  #geocoder: ^0.2.1
71 70
   tuple: ^2.0.1
72 71
   #positioned_tap_detector: ^1.0.3
73 72
   transparent_image: ^2.0.0
@@ -95,6 +94,7 @@ dependencies:
95 94
   app_settings: ^5.1.1
96 95
   flutter_gif: ^0.0.4
97 96
   syncfusion_flutter_calendar: ^23.1.41
97
+  webview_flutter: ^4.4.1
98 98
 
99 99
 dev_dependencies:
100 100
   flutter_test:

Загрузка…
Отмена
Сохранить