Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
Crm Attendance
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dio Maulana
Crm Attendance
Commits
77a3594d
Commit
77a3594d
authored
Jun 07, 2023
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jagain absen masuk keluar di frontend
parent
6ae1e7c8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1128 additions
and
488 deletions
+1128
-488
api.dart
lib/api/api.dart
+3
-0
modal_dialog.dart
lib/helper/modal_dialog.dart
+96
-0
profile.dart
lib/models/profile.dart
+25
-0
absent_camera.dart
lib/page/absent_camera/absent_camera.dart
+770
-322
home.dart
lib/page/home/home.dart
+60
-2
onboarding.dart
lib/page/onboarding/onboarding.dart
+164
-161
strings.dart
lib/resource/strings.dart
+5
-0
pubspec.lock
pubspec.lock
+2
-2
pubspec.yaml
pubspec.yaml
+2
-0
index.html
web/index.html
+1
-1
No files found.
lib/api/api.dart
View file @
77a3594d
...
...
@@ -5,6 +5,7 @@ import 'package:excelso_attendance/helper/pref.dart';
import
'package:excelso_attendance/main.dart'
;
import
'package:excelso_attendance/models/absent.dart'
;
import
'package:excelso_attendance/models/branch.dart'
;
import
'package:excelso_attendance/models/profile.dart'
;
import
'package:excelso_attendance/models/shift.dart'
;
import
'package:excelso_attendance/resource/strings.dart'
;
import
'package:http/http.dart'
as
http
;
...
...
@@ -113,9 +114,11 @@ class Api {
return
ApiResponse
(
error:
true
,
msg:
Strings
.
cantConnectToServer
);
}
else
{
if
(
jsonObject
[
'status'
]
==
"ok"
)
{
Map
<
String
,
dynamic
>
user
=
jsonObject
[
'data'
][
'user'
];
return
ApiResponse
(
error:
false
,
msg:
Strings
.
succesGetData
,
data:
ProfileModel
.
json
(
user
),
);
}
else
{
return
ApiResponse
(
...
...
lib/helper/modal_dialog.dart
0 → 100644
View file @
77a3594d
import
'package:excelso_attendance/helper/component/button.dart'
;
import
'package:excelso_attendance/resource/font.dart'
;
import
'package:excelso_attendance/resource/style.dart'
;
import
'package:flutter/material.dart'
;
Future
<
dynamic
>
modalDialogGlobal
({
required
BuildContext
context
,
required
Size
size
,
required
String
title
,
required
String
contentBody
,
required
String
buttonText
,
required
void
Function
()
tapButton
,
bool
isActiveCancelButton
=
false
,
bool
isCustomSecondButton
=
false
,
String
customSecondButtonText
=
''
,
Widget
?
navigateToCustomButton
,
})
async
{
return
showDialog
(
context:
context
,
barrierDismissible:
false
,
builder:
(
BuildContext
ctxDialog
)
=>
AlertDialog
(
shape:
const
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
15
))),
content:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
title
,
style:
getBoldStyle
(
color:
Colors
.
black
,
fontFamily:
FontConstants
.
montserrat
,
fontSize:
FontSize
.
s24
,
),
),
const
SizedBox
(
height:
16
,
),
Text
(
contentBody
,
style:
getMediumStyle
(
color:
Colors
.
black
,
fontFamily:
FontConstants
.
openSans
,
fontSize:
FontSize
.
s16
,
),
),
const
SizedBox
(
height:
42
,
),
InkWell
(
onTap:
()
{
tapButton
();
},
child:
CustomButton
(
text:
buttonText
,
),
),
(
isActiveCancelButton
)
?
InkWell
(
onTap:
()
{
Navigator
.
pop
(
context
);
},
child:
const
CustomButton
(
text:
"Cancel"
,
colorButton:
Colors
.
transparent
,
colorText:
Colors
.
black
,
),
)
:
const
SizedBox
(),
(
isCustomSecondButton
)
?
Column
(
children:
[
const
SizedBox
(
height:
10
,
),
InkWell
(
onTap:
()
{
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
navigateToCustomButton
!),
);
},
child:
CustomButton
(
text:
customSecondButtonText
,
),
),
],
)
:
const
SizedBox
()
],
),
),
);
}
lib/models/profile.dart
0 → 100644
View file @
77a3594d
class
ProfileModel
{
String
id
;
String
brand
;
String
name
;
bool
attendanceIn
;
bool
attendanceOut
;
ProfileModel
({
required
this
.
id
,
required
this
.
brand
,
required
this
.
name
,
required
this
.
attendanceIn
,
required
this
.
attendanceOut
,
});
factory
ProfileModel
.
json
(
Map
<
String
,
dynamic
>
json
)
{
return
ProfileModel
(
id:
json
[
'id'
],
brand:
json
[
'brand'
],
name:
json
[
'name'
],
attendanceIn:
json
[
'today_attendance_in'
],
attendanceOut:
json
[
'today_attendance_out'
],
);
}
}
lib/page/absent_camera/absent_camera.dart
View file @
77a3594d
This diff is collapsed.
Click to expand it.
lib/page/home/home.dart
View file @
77a3594d
...
...
@@ -6,9 +6,11 @@ import 'package:excelso_attendance/helper/arguments/route_args.dart';
import
'package:excelso_attendance/helper/component/button.dart'
;
// import 'package:excelso_attendance/helper/component/text_field.dart';
import
'package:excelso_attendance/helper/global_function/date_time.dart'
;
import
'package:excelso_attendance/helper/modal_dialog.dart'
;
import
'package:excelso_attendance/helper/pref.dart'
;
import
'package:excelso_attendance/helper/widget_responsive.dart'
;
import
'package:excelso_attendance/models/branch.dart'
;
import
'package:excelso_attendance/models/profile.dart'
;
import
'package:excelso_attendance/models/shift.dart'
;
import
'package:excelso_attendance/resource/assets.dart'
;
import
'package:excelso_attendance/resource/colors.dart'
;
...
...
@@ -349,8 +351,42 @@ class _BodyWidgetState extends State<BodyWidget> {
).
then
((
apiResponse
)
{
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
EasyLoading
.
showToast
(
apiResponse
.
msg
);
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"Ok"
,
tapButton:
()
{
Navigator
.
pop
(
context
);
});
}
else
{
ProfileModel
profileUser
=
apiResponse
.
data
as
ProfileModel
;
if
(
profileUser
.
attendanceOut
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
Strings
.
alreadyOut
,
buttonText:
"Ok"
,
tapButton:
()
{
Navigator
.
pop
(
context
);
});
return
;
}
if
(
profileUser
.
attendanceIn
==
false
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
Strings
.
outButNotIn
,
buttonText:
"Ok"
,
tapButton:
()
{
Navigator
.
pop
(
context
);
});
return
;
}
Navigator
.
pushNamed
(
context
,
Routes
.
absentCamera
,
...
...
@@ -966,8 +1002,30 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> {
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
Navigator
.
pop
(
context
);
EasyLoading
.
showToast
(
apiResponse
.
msg
);
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"Ok"
,
tapButton:
()
{
Navigator
.
pop
(
context
);
});
}
else
{
ProfileModel
profileUser
=
apiResponse
.
data
as
ProfileModel
;
if
(
profileUser
.
attendanceIn
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
Strings
.
alreadyIn
,
buttonText:
"Ok"
,
tapButton:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
});
return
;
}
Navigator
.
popAndPushNamed
(
context
,
Routes
.
absentCamera
,
...
...
lib/page/onboarding/onboarding.dart
View file @
77a3594d
...
...
@@ -157,8 +157,8 @@ class BodyWidget extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
SingleChildScrollView
(
child:
Column
(
Size
size
=
MediaQuery
.
of
(
context
).
size
;
return
Column
(
children:
[
Container
(
width:
double
.
infinity
,
...
...
@@ -195,7 +195,7 @@ class BodyWidget extends StatelessWidget {
top:
AppMargin
.
m16
,
),
width:
double
.
infinity
,
height:
332
,
height:
size
.
height
*
0.37
,
child:
Image
(
fit:
BoxFit
.
fill
,
image:
AssetImage
(
...
...
@@ -250,8 +250,8 @@ dengan sekali klik''',
}
},
child:
Container
(
margin:
const
EdgeInsets
.
only
(
top:
60
,
margin:
EdgeInsets
.
only
(
top:
size
.
height
*
0.05
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
AppPadding
.
p20
,
...
...
@@ -322,6 +322,7 @@ dengan sekali klik''',
),
),
),
const
Spacer
(),
Container
(
margin:
const
EdgeInsets
.
only
(
top:
30
,
...
...
@@ -332,9 +333,11 @@ dengan sekali klik''',
color:
Colors
.
black
,
),
),
),
SizedBox
(
height:
AppMargin
.
m10
,
)
],
),
);
}
}
lib/resource/strings.dart
View file @
77a3594d
...
...
@@ -13,4 +13,9 @@ class Strings {
static
String
serverError
=
"Something wrong with our server, refresh page"
;
static
String
succesGetData
=
"Success get data"
;
static
String
pleaseWait
=
"Please wait..."
;
static
String
cameraNotMounted
=
"Kamera tidak berhasil di load"
;
static
String
alreadyIn
=
"Anda sudah melakukan absen masuk hari ini"
;
static
String
alreadyOut
=
"Anda sudah melakukan absen keluar hari ini"
;
static
String
outButNotIn
=
"Anda belum melaukan absen masuk"
;
}
pubspec.lock
View file @
77a3594d
...
...
@@ -74,7 +74,7 @@ packages:
source: hosted
version: "2.5.1"
camera_web:
dependency:
transitive
dependency:
"direct main"
description:
name: camera_web
sha256: bcbd775fb3a9d51cc3ece899d54ad66f6306410556bac5759f78e13f9228841f
...
...
@@ -425,7 +425,7 @@ packages:
source: hosted
version: "4.2.4"
quiver:
dependency:
transitive
dependency:
"direct main"
description:
name: quiver
sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47
...
...
pubspec.yaml
View file @
77a3594d
...
...
@@ -31,6 +31,7 @@ environment:
dependencies
:
autocomplete_textfield
:
^2.0.1
camera
:
^0.10.5+2
camera_web
:
^0.3.1+4
cupertino_icons
:
^1.0.2
dropdown_button2
:
^2.1.3
flutter
:
...
...
@@ -39,6 +40,7 @@ dependencies:
flutter_native_splash
:
^2.3.0
geolocator
:
^9.0.2
http
:
^0.13.5
quiver
:
^3.2.1
shared_preferences
:
^2.1.1
url_strategy
:
^0.2.0
...
...
web/index.html
View file @
77a3594d
...
...
@@ -14,7 +14,7 @@
This is a placeholder for base href that will be replaced by the value of
the `--base-href` argument provided to `flutter build`.
-->
<base
href=
"
$FLUTTER_BASE_HREF
"
/>
<base
href=
"
/attendance/
"
/>
<meta
charset=
"UTF-8"
/>
<meta
content=
"IE=Edge"
http-equiv=
"X-UA-Compatible"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment