step 11 : proses clock in, clock out
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../app/constant.dart';
|
||||
import '../../app/route.dart';
|
||||
import '../../model/auth_model.dart';
|
||||
import '../../provider/current_menu_provider.dart';
|
||||
import '../../provider/current_user_provider.dart';
|
||||
import '../../provider/google_login_provider.dart';
|
||||
|
||||
@@ -92,6 +93,7 @@ class LoginScreen extends HookConsumerWidget {
|
||||
.read(currentUserGoogleProvider.notifier)
|
||||
.update((state) => account);
|
||||
ref.read(currentUserProvider.notifier).state = authModel;
|
||||
ref.read(currentPageProvider.state).update((state) => 0);
|
||||
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||
homeRoute,
|
||||
(route) => false,
|
||||
@@ -121,7 +123,7 @@ class LoginScreen extends HookConsumerWidget {
|
||||
} else if (next is LoginStateDone) {
|
||||
isLoading.value = false;
|
||||
isSuccess.value = true;
|
||||
// ref.read(currentPageProvider.state).update((state) => 0);
|
||||
ref.read(currentPageProvider.state).update((state) => 0);
|
||||
Navigator.of(context)
|
||||
.pushNamedAndRemoveUntil(homeRoute, (route) => false);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:absensi_sas_flutter/provider/current_user_provider.dart';
|
||||
import 'package:absensi_sas_flutter/repository/presensi_repository.dart';
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
@@ -7,6 +8,7 @@ import '../../provider/current_check_distance_provider.dart';
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../provider/graphql_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
import 'check_presensi_jam_provider.dart';
|
||||
|
||||
abstract class CheckDistanceState extends Equatable {
|
||||
final DateTime date;
|
||||
@@ -63,6 +65,21 @@ class CheckDistanceNotifier extends StateNotifier<CheckDistanceState> {
|
||||
);
|
||||
// set ke global state provider
|
||||
ref.read(currentCheckDistanceProvider.notifier).update((state) => resp);
|
||||
|
||||
// panggil provider cek jam masuk dan pulang (checkPresensiJamProvider)
|
||||
final user = ref.read(currentUserProvider);
|
||||
Map<String, dynamic> inpVariablesCheckPresensiJam = {
|
||||
"M_StaffID": M_StaffID,
|
||||
"M_CompanyID": M_CompanyID,
|
||||
"token": user?.token ?? "",
|
||||
};
|
||||
ref.read(checkPresensiJamProvider.notifier).checkPresensiJam(
|
||||
M_StaffID,
|
||||
M_CompanyID,
|
||||
user?.token ?? "",
|
||||
inpVariablesCheckPresensiJam,
|
||||
);
|
||||
|
||||
state = CheckDistanceStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
|
||||
81
lib/screen/presensi/check_presensi_jam_provider.dart
Normal file
81
lib/screen/presensi/check_presensi_jam_provider.dart
Normal file
@@ -0,0 +1,81 @@
|
||||
import 'package:absensi_sas_flutter/model/check_presensi_jam_model.dart';
|
||||
import 'package:absensi_sas_flutter/repository/presensi_repository.dart';
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../provider/current_check_jam_presensi_provider.dart';
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../provider/graphql_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
|
||||
abstract class CheckPresensiJamState extends Equatable {
|
||||
final DateTime date;
|
||||
const CheckPresensiJamState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class CheckPresensiJamStateInit extends CheckPresensiJamState {
|
||||
CheckPresensiJamStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class CheckPresensiJamStateLoading extends CheckPresensiJamState {
|
||||
CheckPresensiJamStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class CheckPresensiJamStateError extends CheckPresensiJamState {
|
||||
final String message;
|
||||
CheckPresensiJamStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class CheckPresensiJamStateDone extends CheckPresensiJamState {
|
||||
final CheckPresensiJamModel model;
|
||||
CheckPresensiJamStateDone({
|
||||
required this.model,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class CheckPresensiJamNotifier extends StateNotifier<CheckPresensiJamState> {
|
||||
final Ref ref;
|
||||
CheckPresensiJamNotifier({
|
||||
required this.ref,
|
||||
}) : super(CheckPresensiJamStateInit());
|
||||
|
||||
void checkPresensiJam(
|
||||
String M_StaffID,
|
||||
String M_CompanyID,
|
||||
String token,
|
||||
Map<String, dynamic> paramInpVariables,
|
||||
) async {
|
||||
try {
|
||||
state = CheckPresensiJamStateLoading();
|
||||
final graphql = ref.read(graphqlProvider(''));
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp = await PresensiRepository(graphql: graphql, dio: dio)
|
||||
.checkPresensiJam(
|
||||
M_StaffID,
|
||||
M_CompanyID,
|
||||
token,
|
||||
paramInpVariables,
|
||||
);
|
||||
// set ke global state provider currentCheckJamPresensiProvider
|
||||
ref.read(currentCheckJamPresensiProvider.notifier).update((state) => resp);
|
||||
state = CheckPresensiJamStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = CheckPresensiJamStateError(message: e.message ?? "");
|
||||
} else {
|
||||
state = CheckPresensiJamStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// provider
|
||||
final checkPresensiJamProvider =
|
||||
StateNotifierProvider<CheckPresensiJamNotifier, CheckPresensiJamState>(
|
||||
(ref) => CheckPresensiJamNotifier(ref: ref),
|
||||
);
|
||||
102
lib/screen/presensi/presensi_clock_in_provider.dart
Normal file
102
lib/screen/presensi/presensi_clock_in_provider.dart
Normal file
@@ -0,0 +1,102 @@
|
||||
import 'package:absensi_sas_flutter/repository/presensi_repository.dart';
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../provider/graphql_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
import 'check_presensi_jam_provider.dart';
|
||||
|
||||
abstract class PresensiClockInState extends Equatable {
|
||||
final DateTime date;
|
||||
const PresensiClockInState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class PresensiClockInStateInit extends PresensiClockInState {
|
||||
PresensiClockInStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class PresensiClockInStateLoading extends PresensiClockInState {
|
||||
PresensiClockInStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class PresensiClockInStateError extends PresensiClockInState {
|
||||
final String message;
|
||||
PresensiClockInStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class PresensiClockInStateDone extends PresensiClockInState {
|
||||
final String model;
|
||||
PresensiClockInStateDone({
|
||||
required this.model,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class PresensiClockInNotifier extends StateNotifier<PresensiClockInState> {
|
||||
final Ref ref;
|
||||
PresensiClockInNotifier({
|
||||
required this.ref,
|
||||
}) : super(PresensiClockInStateInit());
|
||||
|
||||
void presensiClockIn(
|
||||
String T_TransactionM_StaffID,
|
||||
String T_TransactionM_CompanyID,
|
||||
String T_TransactionCurrentLatitude,
|
||||
String T_TransactionCurrentLongitude,
|
||||
String T_TransactionCurrentDistance,
|
||||
String T_TransactionSelfiePhoto,
|
||||
String token,
|
||||
String isSelfie,
|
||||
Map<String, dynamic> paramInpVariables,
|
||||
) async {
|
||||
try {
|
||||
state = PresensiClockInStateLoading();
|
||||
final graphql = ref.read(graphqlProvider(''));
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp = await PresensiRepository(graphql: graphql, dio: dio)
|
||||
.presensiNormalClockIn(
|
||||
T_TransactionM_StaffID,
|
||||
T_TransactionM_CompanyID,
|
||||
T_TransactionCurrentLatitude,
|
||||
T_TransactionCurrentLongitude,
|
||||
T_TransactionCurrentDistance,
|
||||
T_TransactionSelfiePhoto,
|
||||
token,
|
||||
isSelfie,
|
||||
paramInpVariables,
|
||||
);
|
||||
|
||||
// panggil provider cek jam masuk dan pulang (checkPresensiJamProvider)
|
||||
Map<String, dynamic> inpVariablesCheckPresensiJam = {
|
||||
"M_StaffID": T_TransactionM_StaffID,
|
||||
"M_CompanyID": T_TransactionM_CompanyID,
|
||||
"token": token,
|
||||
};
|
||||
ref.read(checkPresensiJamProvider.notifier).checkPresensiJam(
|
||||
T_TransactionM_StaffID,
|
||||
T_TransactionM_CompanyID,
|
||||
token,
|
||||
inpVariablesCheckPresensiJam,
|
||||
);
|
||||
print('call check presensi');
|
||||
state = PresensiClockInStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = PresensiClockInStateError(message: e.message ?? "");
|
||||
} else {
|
||||
state = PresensiClockInStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// provider
|
||||
final presensiClockInProvider =
|
||||
StateNotifierProvider<PresensiClockInNotifier, PresensiClockInState>(
|
||||
(ref) => PresensiClockInNotifier(ref: ref),
|
||||
);
|
||||
102
lib/screen/presensi/presensi_clock_out_provider.dart
Normal file
102
lib/screen/presensi/presensi_clock_out_provider.dart
Normal file
@@ -0,0 +1,102 @@
|
||||
import 'package:absensi_sas_flutter/repository/presensi_repository.dart';
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../provider/graphql_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
import 'check_presensi_jam_provider.dart';
|
||||
|
||||
abstract class PresensiClockOutState extends Equatable {
|
||||
final DateTime date;
|
||||
const PresensiClockOutState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class PresensiClockOutStateInit extends PresensiClockOutState {
|
||||
PresensiClockOutStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class PresensiClockOutStateLoading extends PresensiClockOutState {
|
||||
PresensiClockOutStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class PresensiClockOutStateError extends PresensiClockOutState {
|
||||
final String message;
|
||||
PresensiClockOutStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class PresensiClockOutStateDone extends PresensiClockOutState {
|
||||
final String model;
|
||||
PresensiClockOutStateDone({
|
||||
required this.model,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class PresensiClockOutNotifier extends StateNotifier<PresensiClockOutState> {
|
||||
final Ref ref;
|
||||
PresensiClockOutNotifier({
|
||||
required this.ref,
|
||||
}) : super(PresensiClockOutStateInit());
|
||||
|
||||
void presensiClockOut(
|
||||
String T_TransactionM_StaffID,
|
||||
String T_TransactionM_CompanyID,
|
||||
String T_TransactionCurrentLatitude,
|
||||
String T_TransactionCurrentLongitude,
|
||||
String T_TransactionCurrentDistance,
|
||||
String T_TransactionSelfiePhoto,
|
||||
String token,
|
||||
String isSelfie,
|
||||
Map<String, dynamic> paramInpVariables,
|
||||
) async {
|
||||
try {
|
||||
state = PresensiClockOutStateLoading();
|
||||
final graphql = ref.read(graphqlProvider(''));
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp = await PresensiRepository(graphql: graphql, dio: dio)
|
||||
.presensiNormalClockOut(
|
||||
T_TransactionM_StaffID,
|
||||
T_TransactionM_CompanyID,
|
||||
T_TransactionCurrentLatitude,
|
||||
T_TransactionCurrentLongitude,
|
||||
T_TransactionCurrentDistance,
|
||||
T_TransactionSelfiePhoto,
|
||||
token,
|
||||
isSelfie,
|
||||
paramInpVariables,
|
||||
);
|
||||
|
||||
// panggil provider cek jam masuk dan pulang (checkPresensiJamProvider)
|
||||
Map<String, dynamic> inpVariablesCheckPresensiJam = {
|
||||
"M_StaffID": T_TransactionM_StaffID,
|
||||
"M_CompanyID": T_TransactionM_CompanyID,
|
||||
"token": token,
|
||||
};
|
||||
ref.read(checkPresensiJamProvider.notifier).checkPresensiJam(
|
||||
T_TransactionM_StaffID,
|
||||
T_TransactionM_CompanyID,
|
||||
token,
|
||||
inpVariablesCheckPresensiJam,
|
||||
);
|
||||
print('call check presensi clockout');
|
||||
state = PresensiClockOutStateDone(model: resp);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = PresensiClockOutStateError(message: e.message ?? "");
|
||||
} else {
|
||||
state = PresensiClockOutStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// provider
|
||||
final presensiClockOutProvider =
|
||||
StateNotifierProvider<PresensiClockOutNotifier, PresensiClockOutState>(
|
||||
(ref) => PresensiClockOutNotifier(ref: ref),
|
||||
);
|
||||
@@ -1,4 +1,9 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:absensi_sas_flutter/provider/current_check_jam_presensi_provider.dart';
|
||||
import 'package:absensi_sas_flutter/screen/presensi/check_distance_provider.dart';
|
||||
import 'package:absensi_sas_flutter/screen/presensi/check_presensi_jam_provider.dart';
|
||||
import 'package:absensi_sas_flutter/screen/presensi/presensi_clock_in_provider.dart';
|
||||
import 'package:absensi_sas_flutter/widget/real_date.dart';
|
||||
import 'package:absensi_sas_flutter/widget/sankbar_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -12,7 +17,9 @@ import '../../app/constant.dart';
|
||||
import '../../app/route.dart';
|
||||
import '../../provider/current_check_distance_provider.dart';
|
||||
import '../../provider/current_user_provider.dart';
|
||||
import '../../widget/custom_drawer.dart';
|
||||
import '../../widget/real_time.dart';
|
||||
import 'presensi_clock_out_provider.dart';
|
||||
|
||||
class PresensiScreen extends HookConsumerWidget {
|
||||
const PresensiScreen({super.key});
|
||||
@@ -23,7 +30,9 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
final isLoadingAddressUserLocation = useState<bool>(false);
|
||||
final isLoadingProsesCheckDistance = useState<bool>(false);
|
||||
final varCurrentDistanceProvider = ref.watch(currentCheckDistanceProvider);
|
||||
final selectedUser = ref.read(currentUserProvider);
|
||||
final varCurrentCheckJamProvider =
|
||||
ref.watch(currentCheckJamPresensiProvider);
|
||||
final selectedUser = ref.watch(currentUserProvider);
|
||||
|
||||
final positionLatitude = useState<String>("");
|
||||
final positionLongitude = useState<String>("");
|
||||
@@ -78,6 +87,7 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
if (positionLatitude.value.isNotEmpty &&
|
||||
positionLongitude.value.isNotEmpty) {
|
||||
print('check distance provider');
|
||||
|
||||
// panggil check distance provider
|
||||
ref.read(checkDistanceProvider.notifier).checkDistance(
|
||||
selectedUser?.model.staffId ?? "",
|
||||
@@ -130,6 +140,64 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
}
|
||||
});
|
||||
|
||||
// check jam presensi
|
||||
ref.listen(checkPresensiJamProvider, (prev, next) {
|
||||
if (next is CheckPresensiJamStateLoading) {
|
||||
isLoadingProsesCheckDistance.value = true;
|
||||
} else if (next is CheckPresensiJamStateError) {
|
||||
isLoadingProsesCheckDistance.value = false;
|
||||
SanckbarWidget(
|
||||
context, "Error : " + next.toString(), snackbarType.warning);
|
||||
} else if (next is CheckPresensiJamStateDone) {
|
||||
isLoadingProsesCheckDistance.value = false;
|
||||
}
|
||||
});
|
||||
|
||||
// proses presensi clock in
|
||||
ref.listen(presensiClockInProvider, (prev, next) {
|
||||
if (next is PresensiClockInStateLoading) {
|
||||
isLoadingProsesCheckDistance.value = true;
|
||||
} else if (next is PresensiClockInStateError) {
|
||||
isLoadingProsesCheckDistance.value = false;
|
||||
SanckbarWidget(
|
||||
context, "Error : " + next.toString(), snackbarType.warning);
|
||||
} else if (next is PresensiClockInStateDone) {
|
||||
isLoadingProsesCheckDistance.value = false;
|
||||
if (next.model == "OK") {
|
||||
SanckbarWidget(context, "Berhasil Absen Masuk", snackbarType.success);
|
||||
requestLocationPermission();
|
||||
}
|
||||
// else{
|
||||
// if(next.model == "WARNING"){
|
||||
// SanckbarWidget(context, "Berhasil Absen Masuk", snackbarType.success);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
// proses presensi clock in
|
||||
ref.listen(presensiClockOutProvider, (prev, next) {
|
||||
if (next is PresensiClockOutStateLoading) {
|
||||
isLoadingProsesCheckDistance.value = true;
|
||||
} else if (next is PresensiClockOutStateError) {
|
||||
isLoadingProsesCheckDistance.value = false;
|
||||
SanckbarWidget(
|
||||
context, "Error : " + next.toString(), snackbarType.warning);
|
||||
} else if (next is PresensiClockOutStateDone) {
|
||||
isLoadingProsesCheckDistance.value = false;
|
||||
if (next.model == "OK") {
|
||||
SanckbarWidget(
|
||||
context, "Berhasil Absen Pulang", snackbarType.success);
|
||||
requestLocationPermission();
|
||||
}
|
||||
// else{
|
||||
// if(next.model == "WARNING"){
|
||||
// SanckbarWidget(context, "Berhasil Absen Masuk", snackbarType.success);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
final staffID = ref.read(currentUserProvider)?.model.staffId ?? "0";
|
||||
@@ -150,18 +218,6 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
requestLocationPermission();
|
||||
|
||||
// // jika sudah dapat latitude dan logitude baru panggil check distance provider
|
||||
// if (positionLatitude.value.isNotEmpty &&
|
||||
// positionLongitude.value.isNotEmpty) {
|
||||
// // panggil check distance provider
|
||||
// ref.read(checkDistanceProvider.notifier).checkDistance(
|
||||
// selectedUser?.model.staffId ?? "",
|
||||
// selectedUser?.model.companyId ?? "",
|
||||
// positionLatitude.value,
|
||||
// positionLongitude.value,
|
||||
// );
|
||||
// }
|
||||
});
|
||||
return () {};
|
||||
}, []);
|
||||
@@ -176,13 +232,14 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
String T_TransactionCurrentDistance,
|
||||
String T_TransactionSelfiePhoto,
|
||||
String token,
|
||||
String tipeAbsen,
|
||||
) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('Konfirmasi'),
|
||||
content: Text('Apakah anda yakin untuk melakukan Clock In?'),
|
||||
content: Text('Apakah anda yakin untuk melakukan $tipeAbsen?'),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
@@ -191,7 +248,7 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
onPressed: () {
|
||||
T_TransactionSelfiePhoto = "";
|
||||
|
||||
var param = {
|
||||
Map<String, dynamic> param = {
|
||||
"T_TransactionM_StaffID": T_TransactionM_StaffID,
|
||||
"T_TransactionM_CompanyID": T_TransactionM_CompanyID,
|
||||
"T_TransactionCurrentLatitude":
|
||||
@@ -201,10 +258,42 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
"T_TransactionCurrentDistance":
|
||||
T_TransactionCurrentDistance,
|
||||
"T_TransactionSelfiePhoto": T_TransactionSelfiePhoto,
|
||||
"token":token,
|
||||
"token": token,
|
||||
"isSelfie": "FALSE"
|
||||
};
|
||||
print(param);
|
||||
Navigator.of(context).pop();
|
||||
// print(param);
|
||||
|
||||
if (tipeAbsen == "Clock In") {
|
||||
ref.read(presensiClockInProvider.notifier).presensiClockIn(
|
||||
T_TransactionM_StaffID,
|
||||
T_TransactionM_CompanyID,
|
||||
T_TransactionCurrentLatitude,
|
||||
T_TransactionCurrentLongitude,
|
||||
T_TransactionCurrentDistance,
|
||||
T_TransactionSelfiePhoto,
|
||||
token,
|
||||
"FALSE",
|
||||
param,
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
if (tipeAbsen == "Clock Out") {
|
||||
ref
|
||||
.read(presensiClockOutProvider.notifier)
|
||||
.presensiClockOut(
|
||||
T_TransactionM_StaffID,
|
||||
T_TransactionM_CompanyID,
|
||||
T_TransactionCurrentLatitude,
|
||||
T_TransactionCurrentLongitude,
|
||||
T_TransactionCurrentDistance,
|
||||
T_TransactionSelfiePhoto,
|
||||
token,
|
||||
"FALSE",
|
||||
param,
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
'Yakin',
|
||||
@@ -280,6 +369,7 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
// elevation: 1.0,
|
||||
elevation: 0.5,
|
||||
),
|
||||
drawer: CustomDrawer(),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
@@ -415,74 +505,137 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
height: Constant.getActualYPhone(context: context, y: 50),
|
||||
),
|
||||
|
||||
// gambar icon presensi
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 130),
|
||||
height: Constant.getActualYPhone(context: context, y: 130),
|
||||
child: FittedBox(
|
||||
child: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
final T_TransactionM_StaffID =
|
||||
selectedUser?.model.staffId ?? "";
|
||||
final T_TransactionM_CompanyID =
|
||||
selectedUser?.model.companyId ?? "";
|
||||
final T_TransactionCurrentLatitude =
|
||||
positionLatitude.value;
|
||||
final T_TransactionCurrentLongitude =
|
||||
positionLongitude.value;
|
||||
final T_TransactionCurrentDistance =
|
||||
varCurrentDistanceProvider?.currentDistance ?? "";
|
||||
final T_TransactionSelfiePhoto = "";
|
||||
final token = selectedUser?.token ?? "";
|
||||
// tombol aksi absen masuk & pulang
|
||||
if (varCurrentCheckJamProvider?.isAbsenClockIn == "TRUE" &&
|
||||
varCurrentCheckJamProvider?.isAbsenClockIn == "TRUE") ...[
|
||||
SizedBox.shrink()
|
||||
] else ...[
|
||||
if (varCurrentCheckJamProvider?.isAbsenClockIn == "FALSE" &&
|
||||
varCurrentCheckJamProvider?.jamClockIn == "") ...[
|
||||
// gambar icon presensi clock in
|
||||
(isLoadingAddressUserLocation.value)
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: Container(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 130),
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 130),
|
||||
child: FittedBox(
|
||||
child: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
final T_TransactionM_StaffID =
|
||||
selectedUser?.model.staffId ?? "";
|
||||
final T_TransactionM_CompanyID =
|
||||
selectedUser?.model.companyId ?? "";
|
||||
final T_TransactionCurrentLatitude =
|
||||
positionLatitude.value;
|
||||
final T_TransactionCurrentLongitude =
|
||||
positionLongitude.value;
|
||||
final T_TransactionCurrentDistance =
|
||||
varCurrentDistanceProvider
|
||||
?.currentDistance ??
|
||||
"";
|
||||
final T_TransactionSelfiePhoto = "";
|
||||
final token = selectedUser?.token ?? "";
|
||||
|
||||
showConfirmationDialog(
|
||||
context,
|
||||
T_TransactionM_StaffID,
|
||||
T_TransactionM_CompanyID,
|
||||
T_TransactionCurrentLatitude,
|
||||
T_TransactionCurrentLongitude,
|
||||
T_TransactionCurrentDistance,
|
||||
T_TransactionSelfiePhoto,
|
||||
token,
|
||||
);
|
||||
},
|
||||
backgroundColor: Color(0xFFFFFFFF),
|
||||
shape: CircleBorder(),
|
||||
child: Container(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 130),
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 130),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
// fit: BoxFit.cover,
|
||||
image: AssetImage(
|
||||
'images/presensi_finger2.png'), // Ganti dengan path gambar Anda
|
||||
showConfirmationDialog(
|
||||
context,
|
||||
T_TransactionM_StaffID,
|
||||
T_TransactionM_CompanyID,
|
||||
T_TransactionCurrentLatitude,
|
||||
T_TransactionCurrentLongitude,
|
||||
T_TransactionCurrentDistance,
|
||||
T_TransactionSelfiePhoto,
|
||||
token,
|
||||
"Clock In");
|
||||
},
|
||||
backgroundColor: Color(0xFFFFFFFF),
|
||||
shape: CircleBorder(),
|
||||
child: Container(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 130),
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 130),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
// fit: BoxFit.cover,
|
||||
image: AssetImage(
|
||||
'images/presensi_finger2.png'), // Ganti dengan path gambar Anda
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
] else ...[
|
||||
// gambar icon presensi clock out
|
||||
if (varCurrentCheckJamProvider?.isAbsenClockIn ==
|
||||
"TRUE" &&
|
||||
varCurrentCheckJamProvider?.jamClockIn != "") ...[
|
||||
(isLoadingAddressUserLocation.value)
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: Container(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 130),
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 130),
|
||||
child: FittedBox(
|
||||
child: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
final T_TransactionM_StaffID =
|
||||
selectedUser?.model.staffId ?? "";
|
||||
final T_TransactionM_CompanyID =
|
||||
selectedUser?.model.companyId ?? "";
|
||||
final T_TransactionCurrentLatitude =
|
||||
positionLatitude.value;
|
||||
final T_TransactionCurrentLongitude =
|
||||
positionLongitude.value;
|
||||
final T_TransactionCurrentDistance =
|
||||
varCurrentDistanceProvider
|
||||
?.currentDistance ??
|
||||
"";
|
||||
final T_TransactionSelfiePhoto = "";
|
||||
final token = selectedUser?.token ?? "";
|
||||
|
||||
// Container(
|
||||
// width: Constant.getActualXPhone(context: context, x: 100),
|
||||
// height: Constant.getActualYPhone(context: context, y: 200),
|
||||
// decoration: BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// fit: BoxFit.cover,
|
||||
// image: AssetImage(
|
||||
// 'images/presensi_finger1.png'), // Ganti dengan path gambar Anda
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
showConfirmationDialog(
|
||||
context,
|
||||
T_TransactionM_StaffID,
|
||||
T_TransactionM_CompanyID,
|
||||
T_TransactionCurrentLatitude,
|
||||
T_TransactionCurrentLongitude,
|
||||
T_TransactionCurrentDistance,
|
||||
T_TransactionSelfiePhoto,
|
||||
token,
|
||||
"Clock Out");
|
||||
},
|
||||
backgroundColor: Color(0xFFFFFFFF),
|
||||
shape: CircleBorder(),
|
||||
child: Container(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 130),
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 130),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
// fit: BoxFit.cover,
|
||||
image: AssetImage(
|
||||
'images/presensi_finger_clok_out.png'), // Ganti dengan path gambar Anda
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
],
|
||||
|
||||
Spacer(),
|
||||
|
||||
// Expanded(
|
||||
// child: SizedBox(),
|
||||
// ),
|
||||
|
||||
// clock in & clock out
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
@@ -510,19 +663,44 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 8),
|
||||
),
|
||||
Text(
|
||||
'--:--',
|
||||
style: Constant.titlePresensiH2_700(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant.textTrueBlack,
|
||||
),
|
||||
(isLoadingAddressUserLocation.value)
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: (varCurrentCheckJamProvider
|
||||
?.isAbsenClockIn ==
|
||||
"TRUE" &&
|
||||
varCurrentCheckJamProvider
|
||||
?.jamClockIn !=
|
||||
"")
|
||||
? Text(
|
||||
// '--:--',
|
||||
varCurrentCheckJamProvider
|
||||
?.jamClockIn ??
|
||||
"NULL",
|
||||
style: Constant.titlePresensiH2_700(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant.textTrueBlack,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'--:--',
|
||||
style: Constant.titlePresensiH2_700(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant.textTrueBlack,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 4),
|
||||
),
|
||||
Text(
|
||||
'Clock In',
|
||||
style: Constant.titleH2_700(context: context)
|
||||
.copyWith(
|
||||
color: Constant.textTrueBlack,
|
||||
color: Constant.textLightGrey,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -541,19 +719,44 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 8),
|
||||
),
|
||||
Text(
|
||||
'--:--',
|
||||
style: Constant.titlePresensiH2_700(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant.textTrueBlack,
|
||||
),
|
||||
(isLoadingAddressUserLocation.value)
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: (varCurrentCheckJamProvider
|
||||
?.isAbsenClockOut ==
|
||||
"TRUE" &&
|
||||
varCurrentCheckJamProvider
|
||||
?.jamClockOut !=
|
||||
"")
|
||||
? Text(
|
||||
// '--:--',
|
||||
varCurrentCheckJamProvider
|
||||
?.jamClockOut ??
|
||||
"NULL",
|
||||
style: Constant.titlePresensiH2_700(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant.textTrueBlack,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'--:--',
|
||||
style: Constant.titlePresensiH2_700(
|
||||
context: context)
|
||||
.copyWith(
|
||||
color: Constant.textTrueBlack,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 4),
|
||||
),
|
||||
Text(
|
||||
'Clock Out',
|
||||
style: Constant.titleH2_700(context: context)
|
||||
.copyWith(
|
||||
color: Constant.textTrueBlack,
|
||||
color: Constant.textLightGrey,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -567,81 +770,6 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
// bottomNavigationBar: Container(
|
||||
// width: Constant.getActualXPhone(context: context, x: 390),
|
||||
// height: Constant.getActualYPhone(context: context, y: 84),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Color(0xFFFFFFFF),
|
||||
// boxShadow: [
|
||||
// BoxShadow(
|
||||
// offset: Offset(0, -1),
|
||||
// blurRadius: 8,
|
||||
// spreadRadius: -8,
|
||||
// color: Color.fromRGBO(0, 0, 0, 0.10),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// child: Row(
|
||||
// children: <Widget>[
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Image.asset(
|
||||
// 'images/clockin_presensi.png', // Path gambar untuk "Clock In"
|
||||
// width: Constant.getActualXPhone(context: context, x: 22),
|
||||
// height: Constant.getActualYPhone(context: context, y: 22),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: Constant.getActualYPhone(context: context, y: 8),
|
||||
// ),
|
||||
// Text(
|
||||
// '--:--',
|
||||
// style: Constant.titlePresensiH2_700(context: context)
|
||||
// .copyWith(
|
||||
// color: Constant.textTrueBlack,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// 'Clock In',
|
||||
// style: Constant.titleH2_700(context: context).copyWith(
|
||||
// color: Constant.textTrueBlack,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// )),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Image.asset(
|
||||
// 'images/clockout_presensi.png', // Path gambar untuk "Check In"
|
||||
// width: Constant.getActualXPhone(context: context, x: 22),
|
||||
// height: Constant.getActualYPhone(context: context, y: 22),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: Constant.getActualYPhone(context: context, y: 8),
|
||||
// ),
|
||||
// Text(
|
||||
// '--:--',
|
||||
// style: Constant.titlePresensiH2_700(context: context)
|
||||
// .copyWith(
|
||||
// color: Constant.textTrueBlack,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// 'Clock Out',
|
||||
// style: Constant.titleH2_700(context: context).copyWith(
|
||||
// color: Constant.textTrueBlack,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// )),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user