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
a5178681
Commit
a5178681
authored
Jun 14, 2023
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all fixed
parent
31fdd25c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
529 additions
and
397 deletions
+529
-397
api.dart
lib/api/api.dart
+17
-1
absent_camera.dart
lib/page/absent_camera/absent_camera.dart
+56
-23
absent_success.dart
lib/page/absent_success/absent_success.dart
+278
-253
home.dart
lib/page/home/home.dart
+168
-119
constanta_string.dart
lib/resource/constanta_string.dart
+3
-1
strings.dart
lib/resource/strings.dart
+7
-0
No files found.
lib/api/api.dart
View file @
a5178681
...
@@ -7,6 +7,7 @@ import 'package:excelso_attendance/models/absent.dart';
...
@@ -7,6 +7,7 @@ import 'package:excelso_attendance/models/absent.dart';
import
'package:excelso_attendance/models/branch.dart'
;
import
'package:excelso_attendance/models/branch.dart'
;
import
'package:excelso_attendance/models/profile.dart'
;
import
'package:excelso_attendance/models/profile.dart'
;
import
'package:excelso_attendance/models/shift.dart'
;
import
'package:excelso_attendance/models/shift.dart'
;
import
'package:excelso_attendance/resource/constanta_string.dart'
;
import
'package:excelso_attendance/resource/strings.dart'
;
import
'package:excelso_attendance/resource/strings.dart'
;
import
'package:geolocator/geolocator.dart'
;
import
'package:geolocator/geolocator.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:http/http.dart'
as
http
;
...
@@ -39,6 +40,8 @@ class Api {
...
@@ -39,6 +40,8 @@ class Api {
),
),
);
);
}
}
ConstantString
.
outletDistance
=
jsonObject
[
'data'
][
'max_distance'
].
toString
();
return
ApiResponse
(
return
ApiResponse
(
error:
false
,
error:
false
,
msg:
Strings
.
succesGetData
,
msg:
Strings
.
succesGetData
,
...
@@ -160,6 +163,11 @@ class Api {
...
@@ -160,6 +163,11 @@ class Api {
if
(
indexList
==
-
1
)
{
if
(
indexList
==
-
1
)
{
listAbsentUser
.
add
(
nik
);
listAbsentUser
.
add
(
nik
);
setListAbsentUser
(
listAbsentUser
);
setListAbsentUser
(
listAbsentUser
);
}
else
{
// agar yang terakhir di input selalu yang terbaru pada suggest input NIK
listAbsentUser
.
removeAt
(
indexList
);
listAbsentUser
.
add
(
nik
);
setListAbsentUser
(
listAbsentUser
);
}
}
return
ApiResponse
(
return
ApiResponse
(
error:
false
,
error:
false
,
...
@@ -254,12 +262,20 @@ Future<dynamic> httpRequest(int typeRequest, String apiUrl, String namaFungsi,
...
@@ -254,12 +262,20 @@ Future<dynamic> httpRequest(int typeRequest, String apiUrl, String namaFungsi,
}
else
{
}
else
{
if
(
debug
)
{
if
(
debug
)
{
logd
(
'API CLASS ON API.DART, FUNGSI:
$namaFungsi
, URL :
$apiUrl
'
,
logd
(
'API CLASS ON API.DART, FUNGSI:
$namaFungsi
, URL :
$apiUrl
'
,
'ERROR CONNECT TO SERVER, RESPONSE CODE :
${apiResult.statusCode}
'
);
'ERROR CONNECT TO SERVER, RESPONSE CODE :
${apiResult.statusCode}
, result:
${apiResult.body}
'
);
}
}
return
false
;
return
false
;
}
}
}
}
Future
<
void
>
sendTotelegram
(
String
teks
)
async
{
String
token
=
'6297616267:AAFSFXSouDJzFQ2zUcxQcU7YKP18W9z6xFU'
;
String
chatId
=
'577933762'
;
String
apiUrl
=
'https://api.telegram.org/bot
$token
/sendmessage?chat_id=
$chatId
&text=
$teks
&parse_mode=HTML&disable_web_page_preview=true'
;
httpRequest
(
typeGet
,
apiUrl
,
"sendTotelegram"
);
}
class
ApiResponse
{
class
ApiResponse
{
bool
error
;
bool
error
;
String
msg
;
String
msg
;
...
...
lib/page/absent_camera/absent_camera.dart
View file @
a5178681
...
@@ -93,15 +93,21 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
...
@@ -93,15 +93,21 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
// ignore: avoid_print
// ignore: avoid_print
print
(
"JUMLAH CAMERA TEDETEKSI:
${cameras!.length}
"
);
print
(
"JUMLAH CAMERA TEDETEKSI:
${cameras!.length}
"
);
}
}
if
(
cameras
!.
length
>
1
)
{
for
(
int
i
=
0
;
i
<
cameras
!.
length
;
i
++)
{
_cameraDescription
=
cameras
![
0
];
// detect only fornt camera
}
else
{
if
(
cameras
![
i
].
lensDirection
==
CameraLensDirection
.
front
)
{
if
(
cameras
!.
isNotEmpty
)
{
_cameraDescription
=
cameras
![
i
];
_cameraDescription
=
cameras
![
0
];
}
else
{
_cameraDescription
=
null
;
}
}
}
}
// if (cameras!.length > 1) {
// _cameraDescription = cameras![0];
// } else {
// if (cameras!.isNotEmpty) {
// _cameraDescription = cameras![0];
// } else {
// _cameraDescription = null;
// }
// }
// _cameraDescription = cameras![1];
// _cameraDescription = cameras![1];
if
(
_cameraDescription
!=
null
)
{
if
(
_cameraDescription
!=
null
)
{
...
@@ -114,6 +120,17 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
...
@@ -114,6 +120,17 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
enableAudio:
false
,
enableAudio:
false
,
);
);
initCamera
(
_controller
!);
initCamera
(
_controller
!);
}
else
{
isCameraLoading
=
false
;
Navigator
.
pushNamedAndRemoveUntil
(
context
,
Routes
.
errorWidget
,
(
route
)
=>
false
,
arguments:
ErrorWidgetArguments
(
errorMessage:
Strings
.
cameraFrontNotFound
(
cameras
!.
length
.
toString
()),
),
);
}
}
}).
catchError
((
e
)
{
}).
catchError
((
e
)
{
if
(
e
is
CameraException
)
{
if
(
e
is
CameraException
)
{
...
@@ -158,10 +175,39 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
...
@@ -158,10 +175,39 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
print
(
"CAMERA PERMISSION PROB ERROR:
$e
"
);
print
(
"CAMERA PERMISSION PROB ERROR:
$e
"
);
}
}
}
}
}
else
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Error"
,
contentBody:
"
$e
"
,
buttonText:
"OK"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
},
);
}
}
});
});
}
}
void
recallCamera
()
{
_controller
?.
dispose
().
then
((
_
)
{
setState
(()
{});
setState
(()
{
pictureIsTaken
=
false
;
_controller
=
CameraController
(
// Get a specific camera from the list of available cameras.
_cameraDescription
!,
// Define the resolution to use.
ResolutionPreset
.
medium
,
imageFormatGroup:
ImageFormatGroup
.
jpeg
,
enableAudio:
false
,
);
initCamera
(
_controller
!);
});
});
}
Future
<
void
>
initCamera
(
CameraController
c
)
async
{
Future
<
void
>
initCamera
(
CameraController
c
)
async
{
c
.
initialize
().
then
((
_
)
{
c
.
initialize
().
then
((
_
)
{
if
(!
mounted
)
{
if
(!
mounted
)
{
...
@@ -416,6 +462,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
...
@@ -416,6 +462,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
buttonText:
"OK"
,
buttonText:
"OK"
,
tapButtonOk:
()
{
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
recallCamera
();
},
},
);
);
return
;
return
;
...
@@ -453,6 +500,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
...
@@ -453,6 +500,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
buttonText:
"OK"
,
buttonText:
"OK"
,
tapButtonOk:
()
{
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
recallCamera
();
},
},
);
);
return
;
return
;
...
@@ -482,22 +530,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
...
@@ -482,22 +530,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
text:
"Foto Ulang"
,
text:
"Foto Ulang"
,
colorButton:
Colors
.
red
,
colorButton:
Colors
.
red
,
onTap:
()
{
onTap:
()
{
_controller
?.
dispose
().
then
((
_
)
{
recallCamera
();
setState
(()
{});
setState
(()
{
pictureIsTaken
=
false
;
_controller
=
CameraController
(
// Get a specific camera from the list of available cameras.
_cameraDescription
!,
// Define the resolution to use.
ResolutionPreset
.
medium
,
imageFormatGroup:
ImageFormatGroup
.
jpeg
,
enableAudio:
false
,
);
initCamera
(
_controller
!);
});
});
},
},
)
)
// Container(
// Container(
...
...
lib/page/absent_success/absent_success.dart
View file @
a5178681
import
'package:excelso_attendance/helper/component/button.dart'
;
import
'package:excelso_attendance/helper/component/button.dart'
;
import
'package:excelso_attendance/helper/global_function/date_time.dart'
;
import
'package:excelso_attendance/helper/global_function/date_time.dart'
;
import
'package:excelso_attendance/helper/widget_responsive.dart'
;
import
'package:excelso_attendance/models/absent.dart'
;
import
'package:excelso_attendance/models/absent.dart'
;
import
'package:excelso_attendance/models/profile.dart'
;
import
'package:excelso_attendance/models/profile.dart'
;
import
'package:excelso_attendance/resource/assets.dart'
;
import
'package:excelso_attendance/resource/assets.dart'
;
...
@@ -27,7 +28,32 @@ class AbsentSuccessView extends StatelessWidget {
...
@@ -27,7 +28,32 @@ class AbsentSuccessView extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
backgroundColor:
ColorManager
.
backgroundColor
,
backgroundColor:
ColorManager
.
backgroundColor
,
body:
SingleChildScrollView
(
body:
ScreenResponsive
(
widget:
BodyWidget
(
isIn:
isIn
,
profil:
profil
,
nik:
nik
,
absentSuccess:
absentSuccess
),
widthScreen:
MediaQuery
.
of
(
context
).
size
.
width
,
),
);
}
}
class
BodyWidget
extends
StatelessWidget
{
const
BodyWidget
({
super
.
key
,
required
this
.
isIn
,
required
this
.
profil
,
required
this
.
nik
,
required
this
.
absentSuccess
,
});
final
bool
isIn
;
final
ProfileModel
profil
;
final
String
nik
;
final
AbsentSuccessModel
absentSuccess
;
@override
Widget
build
(
BuildContext
context
)
{
return
SingleChildScrollView
(
child:
Column
(
child:
Column
(
children:
[
children:
[
Container
(
Container
(
...
@@ -309,7 +335,6 @@ Sukses''',
...
@@ -309,7 +335,6 @@ Sukses''',
)
)
],
],
),
),
),
);
);
}
}
}
}
lib/page/home/home.dart
View file @
a5178681
...
@@ -14,6 +14,7 @@ import 'package:excelso_attendance/models/profile.dart';
...
@@ -14,6 +14,7 @@ import 'package:excelso_attendance/models/profile.dart';
import
'package:excelso_attendance/models/shift.dart'
;
import
'package:excelso_attendance/models/shift.dart'
;
import
'package:excelso_attendance/resource/assets.dart'
;
import
'package:excelso_attendance/resource/assets.dart'
;
import
'package:excelso_attendance/resource/colors.dart'
;
import
'package:excelso_attendance/resource/colors.dart'
;
import
'package:excelso_attendance/resource/constanta_string.dart'
;
import
'package:excelso_attendance/resource/font.dart'
;
import
'package:excelso_attendance/resource/font.dart'
;
import
'package:excelso_attendance/resource/routes.dart'
;
import
'package:excelso_attendance/resource/routes.dart'
;
import
'package:excelso_attendance/resource/size.dart'
;
import
'package:excelso_attendance/resource/size.dart'
;
...
@@ -62,7 +63,9 @@ class _BodyWidgetState extends State<BodyWidget> {
...
@@ -62,7 +63,9 @@ class _BodyWidgetState extends State<BodyWidget> {
// final TextEditingController nikController = TextEditingController();
// final TextEditingController nikController = TextEditingController();
int
selectedOutlet
=
0
;
int
selectedOutlet
=
0
;
String
nikUser
=
""
;
String
nikUser
=
(
getListAbsentUser
().
isEmpty
)
?
""
:
getListAbsentUser
().
last
;
TextEditingController
?
textEditingController
;
List
<
String
>
dataUserAbsent
=
getListAbsentUser
();
List
<
String
>
dataUserAbsent
=
getListAbsentUser
();
...
@@ -172,15 +175,29 @@ class _BodyWidgetState extends State<BodyWidget> {
...
@@ -172,15 +175,29 @@ class _BodyWidgetState extends State<BodyWidget> {
// borderSideActive: true,
// borderSideActive: true,
// hintText: "NIK",
// hintText: "NIK",
// ),
// ),
child:
Autocomplete
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
margin:
EdgeInsets
.
only
(
bottom:
AppMargin
.
m12
,
),
child:
Text
(
"NIK"
,
style:
getSemiBoldStyle
(
color:
Colors
.
black
,
fontSize:
16
,
),
),
),
Autocomplete
(
optionsBuilder:
(
TextEditingValue
textEditingValue
)
{
optionsBuilder:
(
TextEditingValue
textEditingValue
)
{
if
(
textEditingValue
.
text
.
isEmpty
)
{
if
(
textEditingValue
.
text
.
isEmpty
)
{
return
const
Iterable
<
String
>.
empty
();
return
const
Iterable
<
String
>.
empty
();
}
else
{
}
else
{
return
dataUserAbsent
.
where
(
return
dataUserAbsent
.
where
(
(
data
)
=>
data
(
data
)
=>
data
.
toLowerCase
().
contains
(
.
toLowerCase
()
textEditingValue
.
text
.
toLowerCase
()),
.
contains
(
textEditingValue
.
text
.
toLowerCase
()),
);
);
}
}
},
},
...
@@ -189,6 +206,10 @@ class _BodyWidgetState extends State<BodyWidget> {
...
@@ -189,6 +206,10 @@ class _BodyWidgetState extends State<BodyWidget> {
nikUser
=
selected
;
nikUser
=
selected
;
});
});
}),
}),
initialValue:
TextEditingValue
(
text:
(
getListAbsentUser
().
isEmpty
)
?
""
:
getListAbsentUser
().
last
),
optionsViewBuilder:
(
c
,
onSelected
,
options
)
{
optionsViewBuilder:
(
c
,
onSelected
,
options
)
{
List
<
String
>
listNik
=
options
.
toList
();
List
<
String
>
listNik
=
options
.
toList
();
...
@@ -254,13 +275,14 @@ class _BodyWidgetState extends State<BodyWidget> {
...
@@ -254,13 +275,14 @@ class _BodyWidgetState extends State<BodyWidget> {
},
},
fieldViewBuilder:
fieldViewBuilder:
(
c
,
controller
,
focusNode
,
onEditingComplete
)
{
(
c
,
controller
,
focusNode
,
onEditingComplete
)
{
textEditingController
=
controller
;
return
TextField
(
return
TextField
(
onChanged:
(
teks
)
{
onChanged:
(
teks
)
{
setState
(()
{
setState
(()
{
nikUser
=
teks
;
nikUser
=
teks
;
});
});
},
},
controller:
c
ontroller
,
controller:
textEditingC
ontroller
,
focusNode:
focusNode
,
focusNode:
focusNode
,
onEditingComplete:
()
{
onEditingComplete:
()
{
setState
(()
{
setState
(()
{
...
@@ -291,10 +313,26 @@ class _BodyWidgetState extends State<BodyWidget> {
...
@@ -291,10 +313,26 @@ class _BodyWidgetState extends State<BodyWidget> {
width:
0.4
,
color:
ColorManager
.
grey
),
width:
0.4
,
color:
ColorManager
.
grey
),
borderRadius:
BorderRadius
.
circular
(
5
),
borderRadius:
BorderRadius
.
circular
(
5
),
),
),
suffixIcon:
(
textEditingController
!.
text
.
isNotEmpty
)
?
IconButton
(
onPressed:
()
{
setState
(()
{
textEditingController
!.
clear
();
});
},
icon:
const
Icon
(
Icons
.
dangerous
,
color:
Colors
.
grey
,
),
)
:
null
,
),
),
);
);
},
},
),
),
],
),
),
),
),
),
Container
(
Container
(
...
@@ -380,7 +418,7 @@ class _BodyWidgetState extends State<BodyWidget> {
...
@@ -380,7 +418,7 @@ class _BodyWidgetState extends State<BodyWidget> {
modalDialogGlobal
(
modalDialogGlobal
(
context:
context
,
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"
Gagal
"
,
title:
"
Peringatan
"
,
contentBody:
Strings
.
alreadyOut
,
contentBody:
Strings
.
alreadyOut
,
buttonText:
"Ok"
,
buttonText:
"Ok"
,
tapButtonOk:
()
{
tapButtonOk:
()
{
...
@@ -403,6 +441,17 @@ class _BodyWidgetState extends State<BodyWidget> {
...
@@ -403,6 +441,17 @@ class _BodyWidgetState extends State<BodyWidget> {
);
);
return
;
return
;
}
}
Navigator
.
pushNamed
(
context
,
Routes
.
absentCamera
,
arguments:
AbsentCameraArguments
(
isIn:
false
,
branchModel:
widget
.
nearestBranch
[
selectedOutlet
],
profile:
profileUser
,
nik:
nikUser
,
),
);
}
}
});
});
}
}
...
@@ -709,7 +758,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
...
@@ -709,7 +758,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
margin:
EdgeInsets
.
only
(
top:
AppMargin
.
m18
),
margin:
EdgeInsets
.
only
(
top:
AppMargin
.
m18
),
child:
Center
(
child:
Center
(
child:
Text
(
child:
Text
(
"Outlet dalam radius
10
Km"
,
"Outlet dalam radius
${ConstantString.outletDistance}
Km"
,
style:
getMediumStyle
(
style:
getMediumStyle
(
color:
Colors
.
black
,
color:
Colors
.
black
,
fontSize:
16
,
fontSize:
16
,
...
@@ -813,7 +862,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
...
@@ -813,7 +862,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
),
),
margin:
EdgeInsets
.
symmetric
(
vertical:
AppMargin
.
m16
),
margin:
EdgeInsets
.
symmetric
(
vertical:
AppMargin
.
m16
),
child:
const
CustomButton
(
child:
const
CustomButton
(
text:
"Pilih O
U
tlet"
,
text:
"Pilih O
u
tlet"
,
),
),
),
),
)
)
...
@@ -1030,7 +1079,7 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> {
...
@@ -1030,7 +1079,7 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> {
modalDialogGlobal
(
modalDialogGlobal
(
context:
context
,
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"
Gagal
"
,
title:
"
Peringatan
"
,
contentBody:
Strings
.
alreadyIn
,
contentBody:
Strings
.
alreadyIn
,
buttonText:
"Ok"
,
buttonText:
"Ok"
,
tapButtonOk:
()
{
tapButtonOk:
()
{
...
...
lib/resource/constanta_string.dart
View file @
a5178681
class
ConstantString
{}
class
ConstantString
{
static
String
outletDistance
=
''
;
}
lib/resource/strings.dart
View file @
a5178681
...
@@ -20,4 +20,11 @@ class Strings {
...
@@ -20,4 +20,11 @@ class Strings {
static
String
alreadyOut
=
static
String
alreadyOut
=
"Anda sudah melakukan absen keluar hari ini, yakin ingin absen ulang ?"
;
"Anda sudah melakukan absen keluar hari ini, yakin ingin absen ulang ?"
;
static
String
outButNotIn
=
"Anda belum melakukan absen masuk"
;
static
String
outButNotIn
=
"Anda belum melakukan absen masuk"
;
static
String
cameraDescriptionNull
(
String
camerCount
)
{
return
"Eror loading kamera, {camera description null, camera count:
$camerCount
}"
;
}
static
String
cameraFrontNotFound
(
String
cameraLength
)
{
return
"Kamera depan tidak ditemukan, camera count:
$cameraLength
"
;
}
}
}
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