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
Expand all
Hide 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';
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/constanta_string.dart'
;
import
'package:excelso_attendance/resource/strings.dart'
;
import
'package:geolocator/geolocator.dart'
;
import
'package:http/http.dart'
as
http
;
...
...
@@ -39,6 +40,8 @@ class Api {
),
);
}
ConstantString
.
outletDistance
=
jsonObject
[
'data'
][
'max_distance'
].
toString
();
return
ApiResponse
(
error:
false
,
msg:
Strings
.
succesGetData
,
...
...
@@ -160,6 +163,11 @@ class Api {
if
(
indexList
==
-
1
)
{
listAbsentUser
.
add
(
nik
);
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
(
error:
false
,
...
...
@@ -254,12 +262,20 @@ Future<dynamic> httpRequest(int typeRequest, String apiUrl, String namaFungsi,
}
else
{
if
(
debug
)
{
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
;
}
}
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
{
bool
error
;
String
msg
;
...
...
lib/page/absent_camera/absent_camera.dart
View file @
a5178681
...
...
@@ -93,15 +93,21 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
// ignore: avoid_print
print
(
"JUMLAH CAMERA TEDETEKSI:
${cameras!.length}
"
);
}
if
(
cameras
!.
length
>
1
)
{
_cameraDescription
=
cameras
![
0
];
}
else
{
if
(
cameras
!.
isNotEmpty
)
{
_cameraDescription
=
cameras
![
0
];
}
else
{
_cameraDescription
=
null
;
for
(
int
i
=
0
;
i
<
cameras
!.
length
;
i
++)
{
// detect only fornt camera
if
(
cameras
![
i
].
lensDirection
==
CameraLensDirection
.
front
)
{
_cameraDescription
=
cameras
![
i
];
}
}
// if (cameras!.length > 1) {
// _cameraDescription = cameras![0];
// } else {
// if (cameras!.isNotEmpty) {
// _cameraDescription = cameras![0];
// } else {
// _cameraDescription = null;
// }
// }
// _cameraDescription = cameras![1];
if
(
_cameraDescription
!=
null
)
{
...
...
@@ -114,6 +120,17 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
enableAudio:
false
,
);
initCamera
(
_controller
!);
}
else
{
isCameraLoading
=
false
;
Navigator
.
pushNamedAndRemoveUntil
(
context
,
Routes
.
errorWidget
,
(
route
)
=>
false
,
arguments:
ErrorWidgetArguments
(
errorMessage:
Strings
.
cameraFrontNotFound
(
cameras
!.
length
.
toString
()),
),
);
}
}).
catchError
((
e
)
{
if
(
e
is
CameraException
)
{
...
...
@@ -158,10 +175,39 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
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
{
c
.
initialize
().
then
((
_
)
{
if
(!
mounted
)
{
...
...
@@ -416,6 +462,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
buttonText:
"OK"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
recallCamera
();
},
);
return
;
...
...
@@ -453,6 +500,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
buttonText:
"OK"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
recallCamera
();
},
);
return
;
...
...
@@ -482,22 +530,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
text:
"Foto Ulang"
,
colorButton:
Colors
.
red
,
onTap:
()
{
_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
!);
});
});
recallCamera
();
},
)
// Container(
...
...
lib/page/absent_success/absent_success.dart
View file @
a5178681
This diff is collapsed.
Click to expand it.
lib/page/home/home.dart
View file @
a5178681
This diff is collapsed.
Click to expand it.
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 {
static
String
alreadyOut
=
"Anda sudah melakukan absen keluar hari ini, yakin ingin absen ulang ?"
;
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