Merge pull request #41 from FRE-Informatica/fix/fd-806
Fix/fd 806 - Refinamentos de Estilização e Layout
This commit is contained in:
commit
6446b60dd9
|
@ -1,650 +0,0 @@
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
// import 'package:hub/components/organisms/bottom_arrow_linked_locals/bottom_arrow_linked_locals_component_widget.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
|
||||||
import 'package:hub/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart';
|
|
||||||
import 'package:hub/custom_code/actions/get_dev_u_u_i_d.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
|
||||||
import 'package:hub/flutter_flow/random_data_util.dart';
|
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
|
||||||
import 'package:share_plus/share_plus.dart';
|
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
|
||||||
|
|
||||||
import '../shared/utils/log_util.dart';
|
|
||||||
|
|
||||||
Future<void> openTermsOfUse(BuildContext context) async {
|
|
||||||
final Uri url = Uri.parse('https://freaccess.com.br/pp/');
|
|
||||||
if (!await launchUrl(url)) {
|
|
||||||
throw Exception('Could not launch $url');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future repeatVisitScheduleAction(
|
|
||||||
BuildContext context, {
|
|
||||||
List<dynamic>? visitorJsonList,
|
|
||||||
String? visitorStrList,
|
|
||||||
String? visitStartDateStr,
|
|
||||||
String? visitEndDateStr,
|
|
||||||
String? visitReasonStr,
|
|
||||||
String? visitLevelStr,
|
|
||||||
bool? visitTempBol,
|
|
||||||
String? visitObsStr,
|
|
||||||
}) async {
|
|
||||||
context.go(
|
|
||||||
'/scheduleCompleteVisitPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
'visitStartDateStr': visitStartDateStr,
|
|
||||||
'visitEndDateStr': visitEndDateStr,
|
|
||||||
'visitReasonStr': visitReasonStr,
|
|
||||||
'visitLevelStr': visitLevelStr,
|
|
||||||
'visitTempBol': visitTempBol,
|
|
||||||
'visitObsStr': visitObsStr,
|
|
||||||
'visitorStrList': visitorStrList,
|
|
||||||
'visitorJsonList': visitorJsonList,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Color> manageStatusColorAction(
|
|
||||||
BuildContext context, {
|
|
||||||
required String? visitStatusStr,
|
|
||||||
}) async {
|
|
||||||
if (visitStatusStr == 'A') {
|
|
||||||
return FlutterFlowTheme.of(context).success;
|
|
||||||
} else if ((visitStatusStr == 'C') ||
|
|
||||||
(visitStatusStr == 'F') ||
|
|
||||||
(visitStatusStr == 'B') ||
|
|
||||||
(visitStatusStr == 'I')) {
|
|
||||||
return FlutterFlowTheme.of(context).error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FlutterFlowTheme.of(context).warning;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future signInLoginAction(
|
|
||||||
BuildContext context,
|
|
||||||
FlutterFlowModel model, {
|
|
||||||
String? emailAdress,
|
|
||||||
String? password,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
final ApiCallResponse? response;
|
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final LoginCall callback = PhpGroup.loginCall;
|
|
||||||
AppState().deviceDescription = randomString(
|
|
||||||
10,
|
|
||||||
10,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
|
|
||||||
final String? devUUID;
|
|
||||||
final String userUUID;
|
|
||||||
final String status;
|
|
||||||
final String userDevUUID;
|
|
||||||
final String userName;
|
|
||||||
final String email;
|
|
||||||
final String passwd;
|
|
||||||
final bool isLogged;
|
|
||||||
|
|
||||||
email = emailAdress!;
|
|
||||||
passwd = password!;
|
|
||||||
|
|
||||||
devUUID = await getDevUUID();
|
|
||||||
|
|
||||||
if ((email != '') && (passwd != '')) {
|
|
||||||
AppState().email = email;
|
|
||||||
AppState().passwd = passwd;
|
|
||||||
response = await callback.call();
|
|
||||||
|
|
||||||
if (response.jsonBody['error'] == false) {
|
|
||||||
userUUID = response.jsonBody['uid'];
|
|
||||||
|
|
||||||
status = response.jsonBody['user']['status'];
|
|
||||||
userDevUUID = response.jsonBody['user']['dev_id'];
|
|
||||||
userName = response.jsonBody['user']['name'];
|
|
||||||
|
|
||||||
db.update('devUUID', devUUID, 'user');
|
|
||||||
db.update('userUUID', userUUID, 'user');
|
|
||||||
db.update('userDevUUID', userDevUUID, 'user');
|
|
||||||
db.update('status', status, 'user');
|
|
||||||
db.update('userName', userName, 'user');
|
|
||||||
|
|
||||||
isLogged = true;
|
|
||||||
await checkLocals(context: context, model: model).then((value) {
|
|
||||||
AppState().haveLocal = value;
|
|
||||||
AppState().isLogged = isLogged;
|
|
||||||
AppState().update(() {});
|
|
||||||
toggleApp(context);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (response.jsonBody['error'] == null) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
} else {
|
|
||||||
DialogUtil.error(context, response.jsonBody['error_msg'].toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
} catch (e, s) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
LogUtil.requestAPIFailed(
|
|
||||||
'login.php', emailAdress.toString(), "Login", e, s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> signUpRegisterAction(
|
|
||||||
BuildContext context, {
|
|
||||||
required String? name,
|
|
||||||
String? passwd,
|
|
||||||
required String? email,
|
|
||||||
String? device,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
ApiCallResponse? response;
|
|
||||||
|
|
||||||
if ((email != null && email != '') &&
|
|
||||||
(passwd != null && passwd != '' && passwd.length > 7) &&
|
|
||||||
(name != null && name != '')) {
|
|
||||||
response = await PhpGroup.registerCall.call(
|
|
||||||
name: name,
|
|
||||||
password: passwd,
|
|
||||||
email: email,
|
|
||||||
token: randomString(
|
|
||||||
36,
|
|
||||||
36,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
),
|
|
||||||
uuid: randomString(
|
|
||||||
36,
|
|
||||||
36,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
),
|
|
||||||
tipo: device,
|
|
||||||
descricao: randomString(
|
|
||||||
36,
|
|
||||||
36,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.jsonBody['error'] == false) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
DialogUtil.error(context, response.jsonBody['error_msg']);
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (e, s) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
LogUtil.requestAPIFailed(
|
|
||||||
'registro.php', email.toString(), "Register", e, s);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future forgotPasswdAction(
|
|
||||||
BuildContext context, {
|
|
||||||
required String? email,
|
|
||||||
}) async {
|
|
||||||
ApiCallResponse? response;
|
|
||||||
ForgotPasswordCall callback = PhpGroup.forgotPasswordCall;
|
|
||||||
|
|
||||||
response = await PhpGroup.forgotPasswordCall.call(
|
|
||||||
email: email,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.jsonBody['error'] != false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future toggleSignInPage(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/signInPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.fade,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future toggleSignUpPage(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/signUpPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.fade,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future toggleApp(BuildContext context) async {
|
|
||||||
final haveLocal = AppState().haveLocal;
|
|
||||||
if (haveLocal == true) {
|
|
||||||
context.go('/homePage');
|
|
||||||
} else if (haveLocal == false) {
|
|
||||||
context.go(
|
|
||||||
'/receptionPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.fade,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> visitCancelAction(BuildContext context,
|
|
||||||
{required int? idDestino,
|
|
||||||
required int? idVisita,
|
|
||||||
required String? accessKey,
|
|
||||||
required String? email}) async {
|
|
||||||
final ApiCallResponse? response;
|
|
||||||
final CancelaVisita callback = PhpGroup.cancelaVisita;
|
|
||||||
|
|
||||||
response = await callback.call(
|
|
||||||
idDestino: idDestino,
|
|
||||||
idVisita: idVisita,
|
|
||||||
AccessKey: accessKey,
|
|
||||||
UsuEmail: email,
|
|
||||||
DevDesc: '',
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
return !response.jsonBody['error'];
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> snackbar(BuildContext context, {required bool opt}) async {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
elevation: 10,
|
|
||||||
margin: const EdgeInsets.all(50),
|
|
||||||
content: Center(
|
|
||||||
child: Text(
|
|
||||||
opt
|
|
||||||
? FFLocalizations.of(context).getText('asjd2q3k2j4l21')
|
|
||||||
: FFLocalizations.of(context).getText('asda2e42fafa'),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
fontWeight: FontWeight.normal,
|
|
||||||
color: FlutterFlowTheme.of(context).info,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: opt
|
|
||||||
? FlutterFlowTheme.of(context).success.withOpacity(0.5)
|
|
||||||
: FlutterFlowTheme.of(context).error.withOpacity(0.5),
|
|
||||||
duration: const Duration(seconds: 3),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> checkLocals({
|
|
||||||
String? cliUUID,
|
|
||||||
required BuildContext context,
|
|
||||||
required FlutterFlowModel model,
|
|
||||||
}) async {
|
|
||||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
|
||||||
|
|
||||||
final response = await callback.call();
|
|
||||||
|
|
||||||
if (response.jsonBody['error']) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
|
||||||
|
|
||||||
if (locals.isEmpty) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> showShare(payload) async {
|
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final cliName = await db
|
|
||||||
.get(key: 'cliName', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
for (var i = 0; i < payload['convites'].length; i++) {
|
|
||||||
await Share.share('''
|
|
||||||
Olá, \*${payload['convites'][i]['VTE_NOME']}\*! Você foi convidado para \*$cliName\*.
|
|
||||||
|
|
||||||
\*Validade do Convite\*:
|
|
||||||
- Início: ${payload['convites'][i]['VAW_DTINICIO']}
|
|
||||||
- Fim: ${payload['convites'][i]['VAW_DTFIM']}
|
|
||||||
|
|
||||||
URL do Convite: https://visita.freaccess.com.br/${payload['convites'][i]['VAW_ID']}/$cliUUID/${payload['convites'][i]['VAW_CHAVE']}
|
|
||||||
''');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future answersRequest(
|
|
||||||
{required BuildContext context,
|
|
||||||
required String? ref,
|
|
||||||
required String? task,
|
|
||||||
required String? response,
|
|
||||||
required String? id}) async {
|
|
||||||
final ApiCallResponse? respondeSolicitacaoCall;
|
|
||||||
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall;
|
|
||||||
|
|
||||||
respondeSolicitacaoCall = await callback.call(
|
|
||||||
referencia: ref,
|
|
||||||
tarefa: task,
|
|
||||||
resposta: response,
|
|
||||||
idVisitante: id,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (respondeSolicitacaoCall.statusCode == 200) {
|
|
||||||
return !respondeSolicitacaoCall.jsonBody['error'];
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future changeStatusAction(
|
|
||||||
BuildContext context,
|
|
||||||
int idDestino,
|
|
||||||
int idVisita,
|
|
||||||
String accessKey,
|
|
||||||
String email,
|
|
||||||
) async {
|
|
||||||
// Navigator.pop(context, true);
|
|
||||||
context.pop(true);
|
|
||||||
|
|
||||||
bool? blockVisitRequest;
|
|
||||||
blockVisitRequest = await visitCancelAction(
|
|
||||||
context,
|
|
||||||
accessKey: accessKey,
|
|
||||||
idDestino: idDestino,
|
|
||||||
idVisita: idVisita,
|
|
||||||
email: email,
|
|
||||||
);
|
|
||||||
if (!context.mounted) return;
|
|
||||||
if (blockVisitRequest == true) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// QR Code
|
|
||||||
|
|
||||||
Uint8List assembleQRPacket(int direction, String identifier, String password) {
|
|
||||||
List<int> packet = [direction];
|
|
||||||
|
|
||||||
String paddedBadge = identifier.padLeft(30, '0');
|
|
||||||
|
|
||||||
for (var i = 0; i < paddedBadge.length; i += 2) {
|
|
||||||
packet.add(int.parse(paddedBadge.substring(i, i + 2), radix: 16));
|
|
||||||
}
|
|
||||||
|
|
||||||
DateTime now = DateTime.now();
|
|
||||||
int year = now.year % 100;
|
|
||||||
int month = now.month;
|
|
||||||
int day = now.day;
|
|
||||||
int hour = now.hour;
|
|
||||||
int minute = now.minute;
|
|
||||||
|
|
||||||
int sum = year + month + day + hour + minute;
|
|
||||||
|
|
||||||
if (sum == int.parse('0D', radix: 16) || sum == int.parse('0A', radix: 16)) {
|
|
||||||
packet.add(int.parse('FF', radix: 16));
|
|
||||||
} else {
|
|
||||||
packet.add(sum);
|
|
||||||
}
|
|
||||||
|
|
||||||
String paddedPassword = password.length != 4 ? 'FFFF' : password;
|
|
||||||
|
|
||||||
for (var i = 0; i < paddedPassword.length; i += 2) {
|
|
||||||
packet.add(int.parse(paddedPassword.substring(i, i + 2), radix: 16));
|
|
||||||
}
|
|
||||||
|
|
||||||
int check = 0x00;
|
|
||||||
|
|
||||||
for (var b in packet) {
|
|
||||||
check ^= b;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check == int.parse('0D', radix: 16) ||
|
|
||||||
check == int.parse('0A', radix: 16)) {
|
|
||||||
packet.add(int.parse('FF', radix: 16));
|
|
||||||
} else {
|
|
||||||
packet.add(check);
|
|
||||||
}
|
|
||||||
|
|
||||||
var bytes =
|
|
||||||
packet.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join((' '));
|
|
||||||
|
|
||||||
return Uint8List.fromList(packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
Uint8List hexStringToByteArray(String s) {
|
|
||||||
int len = s.length;
|
|
||||||
Uint8List data = Uint8List(len ~/ 2);
|
|
||||||
for (int i = 0; i < len; i += 2) {
|
|
||||||
data[i ~/ 2] =
|
|
||||||
((int.parse(s[i], radix: 16) << 4) + int.parse(s[i + 1], radix: 16));
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
String byteToHexa(Uint8List pDados) {
|
|
||||||
return pDados
|
|
||||||
.map((byte) => byte.toRadixString(16).padLeft(2, '0').toUpperCase())
|
|
||||||
.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> byteToString(Uint8List bytes) async {
|
|
||||||
return String.fromCharCodes(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildQrCode(
|
|
||||||
{
|
|
||||||
// required String data,
|
|
||||||
// required String type,
|
|
||||||
// required int version,
|
|
||||||
// required int maskPattern,
|
|
||||||
required int errorCorrectLevel,
|
|
||||||
required double dimension,
|
|
||||||
required String identifier,
|
|
||||||
required String pass,
|
|
||||||
required int direction}) {
|
|
||||||
try {
|
|
||||||
const Color backgroundColor = Colors.white;
|
|
||||||
const Color foregroundColor = Colors.black;
|
|
||||||
return QrImageView.withQr(
|
|
||||||
qr: QrCode.fromUint8List(
|
|
||||||
data: assembleQRPacket(direction, identifier, pass),
|
|
||||||
errorCorrectLevel: errorCorrectLevel),
|
|
||||||
size: dimension,
|
|
||||||
padding: const EdgeInsets.all(10),
|
|
||||||
backgroundColor: backgroundColor,
|
|
||||||
foregroundColor: foregroundColor);
|
|
||||||
} catch (e) {
|
|
||||||
return Text("Erro ao gerar QR Code: ${e.toString()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future scheduleVisitOptAction(BuildContext context) async {
|
|
||||||
await showAdaptiveDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return Padding(
|
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
|
||||||
child: OptionSelectionModalWidget(
|
|
||||||
routesListStr: <String>[
|
|
||||||
'scheduleCompleteVisitPage',
|
|
||||||
'scheduleProvisionalVisitPage',
|
|
||||||
'fastPassPage',
|
|
||||||
],
|
|
||||||
iconsListIcon: <IconData>[
|
|
||||||
Icons.date_range_rounded,
|
|
||||||
Icons.date_range_rounded,
|
|
||||||
Icons.date_range_rounded,
|
|
||||||
],
|
|
||||||
nameListStr: <String>[
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Visita\nCompleta',
|
|
||||||
enText: 'Complete\nSchedule',
|
|
||||||
),
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Visita\nProvisória',
|
|
||||||
enText: 'Provisional\nSchedule',
|
|
||||||
),
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Visita\nRápida',
|
|
||||||
enText: 'Fast\nSchedule',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future registerVisitorOptAction(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/registerVisitorPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future peopleOnThePropertyAction(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/peopleOnThePropertyPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.fade,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future preferencesSettings(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/preferencesSettings',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future liberationHistoryOptAction(BuildContext context) async {
|
|
||||||
await showAdaptiveDialog(
|
|
||||||
// isScrollControlled: true,
|
|
||||||
// backgroundColor: Colors.transparent,
|
|
||||||
// enableDrag: false,
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return Padding(
|
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
|
||||||
child: OptionSelectionModalWidget(
|
|
||||||
routesListStr: <String>[
|
|
||||||
'liberationHistory',
|
|
||||||
'acessHistoryPage',
|
|
||||||
'scheduleCompleteVisitPage',
|
|
||||||
// 'messageHistoryPage',
|
|
||||||
],
|
|
||||||
iconsListIcon: <IconData>[
|
|
||||||
Icons.history_rounded,
|
|
||||||
Icons.history_rounded,
|
|
||||||
Icons.history_rounded,
|
|
||||||
// Icons.history_rounded,
|
|
||||||
],
|
|
||||||
nameListStr: <String>[
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Histórico\nde Liberação',
|
|
||||||
enText: 'Liberation\nHistory',
|
|
||||||
),
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Histórico\nde Acesso',
|
|
||||||
enText: 'Access\nHistory',
|
|
||||||
),
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Histórico\nde Visita',
|
|
||||||
enText: 'Visit\nHistory',
|
|
||||||
),
|
|
||||||
// FFLocalizations.of(context).getVariableText(
|
|
||||||
// ptText: 'Histórico\nde Mensagens',
|
|
||||||
// enText: 'Message\nHistory',
|
|
||||||
// ),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future accessQRCodeOptAction(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/qrCodePage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum status { active, unknown, canceled, finished, blocked, inactive }
|
|
||||||
|
|
||||||
status? getStatus(dynamic data) {
|
|
||||||
switch (data) {
|
|
||||||
case 'A':
|
|
||||||
return status.active;
|
|
||||||
case 'F':
|
|
||||||
return status.finished;
|
|
||||||
case 'B':
|
|
||||||
return status.blocked;
|
|
||||||
case 'C':
|
|
||||||
return status.canceled;
|
|
||||||
case 'I':
|
|
||||||
return status.inactive;
|
|
||||||
default:
|
|
||||||
return status.unknown;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -15,22 +15,9 @@ import 'package:mime_type/mime_type.dart';
|
||||||
import '/flutter_flow/uploaded_file.dart';
|
import '/flutter_flow/uploaded_file.dart';
|
||||||
import 'get_streamed_response.dart';
|
import 'get_streamed_response.dart';
|
||||||
|
|
||||||
enum ApiCallType {
|
enum ApiCallType { GET, POST, DELETE, PUT, PATCH }
|
||||||
GET,
|
|
||||||
POST,
|
|
||||||
DELETE,
|
|
||||||
PUT,
|
|
||||||
PATCH,
|
|
||||||
}
|
|
||||||
|
|
||||||
enum BodyType {
|
enum BodyType { NONE, JSON, TEXT, X_WWW_FORM_URL_ENCODED, MULTIPART, BLOB }
|
||||||
NONE,
|
|
||||||
JSON,
|
|
||||||
TEXT,
|
|
||||||
X_WWW_FORM_URL_ENCODED,
|
|
||||||
MULTIPART,
|
|
||||||
BLOB,
|
|
||||||
}
|
|
||||||
|
|
||||||
class ApiCallOptions extends Equatable {
|
class ApiCallOptions extends Equatable {
|
||||||
const ApiCallOptions({
|
const ApiCallOptions({
|
||||||
|
|
|
@ -3,7 +3,8 @@ import 'dart:developer';
|
||||||
import 'package:awesome_notifications/awesome_notifications.dart';
|
import 'package:awesome_notifications/awesome_notifications.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
import 'package:hub/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart';
|
import 'package:hub/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart';
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||||
import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart';
|
import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart';
|
||||||
|
@ -23,6 +24,28 @@ Future<void> onMessageReceived(
|
||||||
final cliUUID = await db
|
final cliUUID = await db
|
||||||
.get(key: 'cliUUID', field: 'value')
|
.get(key: 'cliUUID', field: 'value')
|
||||||
.then((value) => value.toString());
|
.then((value) => value.toString());
|
||||||
|
answersRequest(
|
||||||
|
{required BuildContext context,
|
||||||
|
required String? ref,
|
||||||
|
required String? task,
|
||||||
|
required String? response,
|
||||||
|
required String? id}) async {
|
||||||
|
final ApiCallResponse? respondeSolicitacaoCall;
|
||||||
|
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall;
|
||||||
|
|
||||||
|
respondeSolicitacaoCall = await callback.call(
|
||||||
|
referencia: ref,
|
||||||
|
tarefa: task,
|
||||||
|
resposta: response,
|
||||||
|
idVisitante: id,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (respondeSolicitacaoCall.statusCode == 200) {
|
||||||
|
return !respondeSolicitacaoCall.jsonBody['error'];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (handleClick) {
|
switch (handleClick) {
|
||||||
case 'visit_request':
|
case 'visit_request':
|
||||||
|
|
|
@ -58,6 +58,7 @@ class _CustomInputUtilState extends State<CustomInputUtil> {
|
||||||
controller: widget.controller,
|
controller: widget.controller,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
validator: widget.validator,
|
validator: widget.validator,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
autofocus: widget.autoFocus,
|
autofocus: widget.autoFocus,
|
||||||
focusNode: widget.focusNode,
|
focusNode: widget.focusNode,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
|
|
|
@ -98,7 +98,7 @@ class _CardItemTemplateComponentWidgetState
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _generateImage() {
|
Widget _generateImage() {
|
||||||
// CachedNetworkImage.evictFromCache(widget.imagePath ?? '');
|
CachedNetworkImage.evictFromCache(widget.imagePath ?? '');
|
||||||
return ClipRRect(
|
return ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
|
|
|
@ -1,415 +0,0 @@
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:http/http.dart';
|
|
||||||
import 'package:hub/actions/actions.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
|
||||||
import 'package:hub/custom_code/actions/convert_to_upload_file.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
|
||||||
import 'package:hub/flutter_flow/form_field_controller.dart';
|
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
|
||||||
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
|
||||||
import 'package:share_plus/share_plus.dart';
|
|
||||||
|
|
||||||
Widget buildVisitDetails({
|
|
||||||
required dynamic item,
|
|
||||||
required BuildContext context,
|
|
||||||
required Future<dynamic> Function(BuildContext, int, int, String, String)
|
|
||||||
changeStatusAction,
|
|
||||||
required String devUUID,
|
|
||||||
required String userUUID,
|
|
||||||
required String cliUUID,
|
|
||||||
required String cliName,
|
|
||||||
}) {
|
|
||||||
return DetailsComponentWidget(
|
|
||||||
buttons: [
|
|
||||||
if (getStatus(item['VAW_STATUS']) == status.active) // REJECT ACTION
|
|
||||||
FFButtonWidget(
|
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Cancelar',
|
|
||||||
enText: 'Cancel',
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.close),
|
|
||||||
onPressed: () async {
|
|
||||||
showAlertDialog(
|
|
||||||
context,
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Cancelar Visita',
|
|
||||||
enText: 'Cancel Visit',
|
|
||||||
),
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Você tem certeza que deseja bloquear essa visita?',
|
|
||||||
enText: 'Are you sure you want to block this visit?',
|
|
||||||
), () async {
|
|
||||||
await changeStatusAction
|
|
||||||
?.call(
|
|
||||||
context,
|
|
||||||
int.parse(item['VAW_DESTINO']),
|
|
||||||
int.parse(item['VAW_ID']),
|
|
||||||
item['VAW_CHAVE'] ?? '',
|
|
||||||
item['VTE_DOCUMENTO'] ?? '',
|
|
||||||
)
|
|
||||||
.then((value) {
|
|
||||||
// Navigator.pop(context, value);
|
|
||||||
context.pop(value);
|
|
||||||
|
|
||||||
if (value == false) {
|
|
||||||
showSnackbar(
|
|
||||||
context,
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'Error blocking visit',
|
|
||||||
ptText: 'Erro ao bloquear visita',
|
|
||||||
),
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
} else if (value == true) {
|
|
||||||
showSnackbar(
|
|
||||||
context,
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'Success canceling visit',
|
|
||||||
ptText: 'Succeso ao cancelar visita',
|
|
||||||
),
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}).catchError((err, stack) {
|
|
||||||
context.pop();
|
|
||||||
showSnackbar(
|
|
||||||
context,
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'Error blocking visit',
|
|
||||||
ptText: 'Erro ao bloquear visita',
|
|
||||||
),
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 130,
|
|
||||||
height: 40,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
elevation: 0,
|
|
||||||
textStyle: TextStyle(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
// borderRadius: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (getStatus(item['VAW_STATUS']) != status.active) // RECALL ACTION
|
|
||||||
FFButtonWidget(
|
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Reagendar',
|
|
||||||
enText: 'Reschedule',
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.refresh),
|
|
||||||
onPressed: () async {
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
|
|
||||||
context.pushNamed('scheduleCompleteVisitPage', extra: {
|
|
||||||
'dropdownValue1': item['MOT_DESCRICAO'],
|
|
||||||
'dropdownValue2': item['NAC_DESCRICAO'],
|
|
||||||
'visitorJsonList': [item],
|
|
||||||
'visitorStrList': item['VTE_DOCUMENTO'],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 130,
|
|
||||||
height: 40,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
elevation: 0,
|
|
||||||
textStyle: TextStyle(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
// borderRadius: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (getStatus(item['VAW_STATUS']) == status.active) // SHARE ACTION
|
|
||||||
FFButtonWidget(
|
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Compartilhar',
|
|
||||||
enText: 'Share',
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.share),
|
|
||||||
onPressed: () async {
|
|
||||||
Share.share('''
|
|
||||||
Olá, \*${item['VTE_NOME']}\*! Você foi convidado para \*${cliName}\*.
|
|
||||||
|
|
||||||
\*Validade do Convite\*:
|
|
||||||
- Início: ${item['VAW_DTINICIO']}
|
|
||||||
- Fim: ${item['VAW_DTFIM']}
|
|
||||||
|
|
||||||
URL do Convite: https://visita.freaccess.com.br/${item['VAW_ID']}/${cliUUID}/${item['VAW_CHAVE']}
|
|
||||||
''');
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 130,
|
|
||||||
height: 40,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
elevation: 0,
|
|
||||||
textStyle: TextStyle(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
// borderRadius: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
labelsHashMap: Map<String, String>.from({
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:':
|
|
||||||
item['VTE_NOME'] ?? '',
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Inicio", enText: "Start")}:':
|
|
||||||
item['VAW_DTINICIO'] != '' && item['VAW_DTINICIO'] != null
|
|
||||||
? ValidatorUtil.toLocalDateTime(
|
|
||||||
'yyyy-MM-dd HH:mm:ss', item['VAW_DTINICIO'])
|
|
||||||
: '',
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Fim", enText: "End")}:':
|
|
||||||
item['VAW_DTFIM'] != '' && item['VAW_DTFIM'] != null
|
|
||||||
? ValidatorUtil.toLocalDateTime(
|
|
||||||
'yyyy-MM-dd HH:mm:ss', item['VAW_DTFIM'])
|
|
||||||
: '',
|
|
||||||
}),
|
|
||||||
imagePath:
|
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?cliID=${cliUUID}&atividade=getFoto&Documento=${item['VTE_DOCUMENTO'] ?? ''}&tipo=E',
|
|
||||||
statusHashMap: [
|
|
||||||
if (getStatus(item['VAW_STATUS']) == status.active)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Ativo',
|
|
||||||
enText: 'Active',
|
|
||||||
): FlutterFlowTheme.of(context).warning,
|
|
||||||
}),
|
|
||||||
if (getStatus(item['VAW_STATUS']) == status.unknown)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Pendente',
|
|
||||||
enText: 'Pending',
|
|
||||||
): FlutterFlowTheme.of(context).alternate,
|
|
||||||
}),
|
|
||||||
if (getStatus(item['VAW_STATUS']) == status.canceled)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Cancelado',
|
|
||||||
enText: 'Canceled',
|
|
||||||
): FlutterFlowTheme.of(context).error,
|
|
||||||
}),
|
|
||||||
if (getStatus(item['VAW_STATUS']) == status.finished)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Finalizado',
|
|
||||||
enText: 'Finished',
|
|
||||||
): FlutterFlowTheme.of(context).success,
|
|
||||||
}),
|
|
||||||
if (getStatus(item['VAW_STATUS']) == status.blocked)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Bloqueado',
|
|
||||||
enText: 'Blocked',
|
|
||||||
): FlutterFlowTheme.of(context).error,
|
|
||||||
}),
|
|
||||||
if (getStatus(item['VAW_STATUS']) == status.inactive)
|
|
||||||
Map<String, Color>.from({
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Inativo',
|
|
||||||
enText: 'Inactive',
|
|
||||||
): FlutterFlowTheme.of(context).warning,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildPetDetails({
|
|
||||||
required dynamic item,
|
|
||||||
required BuildContext context,
|
|
||||||
required Future<dynamic> Function(BuildContext, int, int, String, String)
|
|
||||||
changeStatusAction,
|
|
||||||
required String devUUID,
|
|
||||||
required String userUUID,
|
|
||||||
required String cliUUID,
|
|
||||||
required String cliName,
|
|
||||||
required PetsPageModel model,
|
|
||||||
}) {
|
|
||||||
return DetailsComponentWidget(
|
|
||||||
buttons: [
|
|
||||||
// EDIT ACTION
|
|
||||||
FFButtonWidget(
|
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Editar',
|
|
||||||
enText: 'Edit',
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.edit),
|
|
||||||
onPressed: () async {
|
|
||||||
context.pop();
|
|
||||||
|
|
||||||
model.isEditing = true;
|
|
||||||
model.item = item;
|
|
||||||
model.switchTab(0);
|
|
||||||
model.setEditForm();
|
|
||||||
// model.safeSetState!();
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 130,
|
|
||||||
height: 40,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
elevation: 0,
|
|
||||||
textStyle: TextStyle(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
// borderRadius: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// DELETE ACTION
|
|
||||||
FFButtonWidget(
|
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Excluir',
|
|
||||||
enText: 'Delete',
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.close),
|
|
||||||
onPressed: () async {
|
|
||||||
showAlertDialog(
|
|
||||||
context,
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Excluir Pet',
|
|
||||||
enText: 'Delete Pet',
|
|
||||||
),
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Você tem certeza que deseja excluir esse pet?',
|
|
||||||
enText: 'Are you sure you want to delete this pet?',
|
|
||||||
), () async {
|
|
||||||
int id = item['id'];
|
|
||||||
await PhpGroup.deletePet
|
|
||||||
.call(
|
|
||||||
petID: id,
|
|
||||||
)
|
|
||||||
.then((value) {
|
|
||||||
// Navigator.pop(context, value);
|
|
||||||
context.pop(value);
|
|
||||||
context.pop(value);
|
|
||||||
|
|
||||||
if (value == false) {
|
|
||||||
showSnackbar(
|
|
||||||
context,
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Erro ao excluir pet',
|
|
||||||
enText: 'Error deleting pet',
|
|
||||||
),
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
} else if (value == true) {
|
|
||||||
showSnackbar(
|
|
||||||
context,
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'Success deleting pet',
|
|
||||||
ptText: 'Succeso ao excluir pet',
|
|
||||||
),
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}).catchError((err, stack) {
|
|
||||||
context.pop();
|
|
||||||
showSnackbar(
|
|
||||||
context,
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'Error deleting pet',
|
|
||||||
ptText: 'Erro ao excluir pet',
|
|
||||||
),
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
options: FFButtonOptions(
|
|
||||||
width: 130,
|
|
||||||
height: 40,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
elevation: 0,
|
|
||||||
textStyle: TextStyle(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
// borderRadius: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
// 'MIN', 'PEQ', 'MED', 'GRA', 'GIG'
|
|
||||||
labelsHashMap: Map<String, String>.from({
|
|
||||||
if (item['species'] != null && item['species'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Espécie", enText: "Species")}:':
|
|
||||||
item['species'].toString().toUpperCase(),
|
|
||||||
if (item['breed'] != null && item['breed'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Raça", enText: "Breed")}:':
|
|
||||||
item['breed'].toString().toUpperCase(),
|
|
||||||
if (item['color'] != null && item['color'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Cor", enText: "Color")}:':
|
|
||||||
item['color'].toString().toUpperCase(),
|
|
||||||
if (item['birthdayDate'] != null && item['birthdayDate'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Data de Nascimento", enText: "Date of Birth")}:':
|
|
||||||
ValidatorUtil.formatDateTimePicker(item['birthdayDate']),
|
|
||||||
if (item['gender'] != null && item['gender'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Gênero", enText: "Gender")}:':
|
|
||||||
item['gender'] == 'MAC'
|
|
||||||
? FFLocalizations.of(context)
|
|
||||||
.getVariableText(ptText: 'MACHO', enText: 'MALE')
|
|
||||||
: FFLocalizations.of(context)
|
|
||||||
.getVariableText(enText: 'FEMALE', ptText: 'FÊMEA'),
|
|
||||||
if (item['size'] != null && item['size'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Porte", enText: "Size")}:':
|
|
||||||
item['size'] == 'MIN'
|
|
||||||
? FFLocalizations.of(context)
|
|
||||||
.getVariableText(ptText: 'MINI', enText: 'MINI')
|
|
||||||
: item['size'] == 'PEQ'
|
|
||||||
? FFLocalizations.of(context)
|
|
||||||
.getVariableText(ptText: 'PEQUENO', enText: 'SMALL')
|
|
||||||
: item['size'] == 'MED'
|
|
||||||
? FFLocalizations.of(context)
|
|
||||||
.getVariableText(ptText: 'MÉDIO', enText: 'MEDIUM')
|
|
||||||
: item['size'] == 'GRD'
|
|
||||||
? FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'GRANDE', enText: 'LARGE')
|
|
||||||
: item['size'] == 'GIG'
|
|
||||||
? FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'GIGANTE', enText: 'GIANT')
|
|
||||||
: '',
|
|
||||||
if (item['notes'] != null && item['notes'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Observação", enText: "Notes")}:':
|
|
||||||
item['notes'] ?? '',
|
|
||||||
}),
|
|
||||||
imagePath:
|
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${devUUID}&userUUID=${userUUID}&cliID=${cliUUID}&atividade=consultaFotoPet&petId=${item['id'] ?? ''}',
|
|
||||||
statusHashMap: [
|
|
||||||
if (item['gender'] == "MAC")
|
|
||||||
Map<String, Color>.from({
|
|
||||||
item['name']: Color(0xFF094CB0),
|
|
||||||
}),
|
|
||||||
if (item['gender'] == "FEM")
|
|
||||||
Map<String, Color>.from({
|
|
||||||
item['name']: Color(0xFFE463E7),
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -250,6 +250,9 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
model.personNameTextController,
|
model.personNameTextController,
|
||||||
focusNode:
|
focusNode:
|
||||||
model.personNameFocusNode,
|
model.personNameFocusNode,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.primary,
|
||||||
onChanged: (_) =>
|
onChanged: (_) =>
|
||||||
EasyDebounce.debounce(
|
EasyDebounce.debounce(
|
||||||
'model.personNameTextController',
|
'model.personNameTextController',
|
||||||
|
@ -261,7 +264,7 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
TextInputAction.next,
|
TextInputAction.next,
|
||||||
obscureText: false,
|
obscureText: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: false,
|
isDense: true,
|
||||||
labelText:
|
labelText:
|
||||||
FFLocalizations.of(context)
|
FFLocalizations.of(context)
|
||||||
.getText(
|
.getText(
|
||||||
|
@ -402,6 +405,9 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
model.dateTimeTextController,
|
model.dateTimeTextController,
|
||||||
focusNode:
|
focusNode:
|
||||||
model.dateTimeFocusNode,
|
model.dateTimeFocusNode,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.primary,
|
||||||
onChanged: (_) =>
|
onChanged: (_) =>
|
||||||
EasyDebounce.debounce(
|
EasyDebounce.debounce(
|
||||||
'model.dateTimeTextController',
|
'model.dateTimeTextController',
|
||||||
|
@ -413,7 +419,7 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
obscureText: false,
|
obscureText: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: false,
|
isDense: true,
|
||||||
labelText:
|
labelText:
|
||||||
FFLocalizations.of(context)
|
FFLocalizations.of(context)
|
||||||
.getText(
|
.getText(
|
||||||
|
@ -738,11 +744,16 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
focusNode:
|
focusNode:
|
||||||
model.notesFocusNode,
|
model.notesFocusNode,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
|
showCursor: true,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(
|
||||||
|
context)
|
||||||
|
.primary,
|
||||||
textInputAction:
|
textInputAction:
|
||||||
TextInputAction.next,
|
TextInputAction.next,
|
||||||
obscureText: false,
|
obscureText: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: false,
|
isDense: true,
|
||||||
labelText:
|
labelText:
|
||||||
FFLocalizations.of(
|
FFLocalizations.of(
|
||||||
context)
|
context)
|
||||||
|
|
|
@ -170,6 +170,7 @@ class _QrCodePassKeyTemplateComponentWidgetState
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.keyTextFieldTextController,
|
controller: _model.keyTextFieldTextController,
|
||||||
focusNode: _model.keyTextFieldFocusNode,
|
focusNode: _model.keyTextFieldFocusNode,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
onChanged: (_) => EasyDebounce.debounce(
|
onChanged: (_) => EasyDebounce.debounce(
|
||||||
'_model.keyTextFieldTextController',
|
'_model.keyTextFieldTextController',
|
||||||
const Duration(milliseconds: 2000),
|
const Duration(milliseconds: 2000),
|
||||||
|
@ -271,7 +272,6 @@ class _QrCodePassKeyTemplateComponentWidgetState
|
||||||
maxLength}) =>
|
maxLength}) =>
|
||||||
null,
|
null,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
cursorColor: FlutterFlowTheme.of(context).primary,
|
|
||||||
validator: _model.keyTextFieldTextControllerValidator
|
validator: _model.keyTextFieldTextControllerValidator
|
||||||
.asValidator(context),
|
.asValidator(context),
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
|
|
|
@ -3,12 +3,12 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/image_util.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
|
|
||||||
import '/backend/api_requests/api_calls.dart';
|
import '/backend/api_requests/api_calls.dart';
|
||||||
import '/custom_code/actions/index.dart' as actions;
|
|
||||||
import '/flutter_flow/flutter_flow_drop_down.dart';
|
import '/flutter_flow/flutter_flow_drop_down.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
@ -171,6 +171,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _model.textController2,
|
controller: _model.textController2,
|
||||||
focusNode: _model.textFieldFocusNode2,
|
focusNode: _model.textFieldFocusNode2,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
textCapitalization: TextCapitalization.none,
|
textCapitalization: TextCapitalization.none,
|
||||||
|
@ -307,6 +308,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController1,
|
controller: _model.textController1,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
focusNode: _model.textFieldFocusNode1,
|
focusNode: _model.textFieldFocusNode1,
|
||||||
onChanged: (_) => EasyDebounce.debounce(
|
onChanged: (_) => EasyDebounce.debounce(
|
||||||
'_model.textFieldFocusNode1',
|
'_model.textFieldFocusNode1',
|
||||||
|
@ -661,6 +663,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController3,
|
controller: _model.textController3,
|
||||||
focusNode: _model.textFieldFocusNode3,
|
focusNode: _model.textFieldFocusNode3,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
|
@ -749,6 +752,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
24.0, 0.0, 24.0, 0.0),
|
24.0, 0.0, 24.0, 0.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController4,
|
controller: _model.textController4,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
focusNode: _model.textFieldFocusNode4,
|
focusNode: _model.textFieldFocusNode4,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
@ -839,7 +843,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
onPressed: _isFormValid(context)
|
onPressed: _isFormValid(context)
|
||||||
? () async {
|
? () async {
|
||||||
_model.imgBase64 =
|
_model.imgBase64 =
|
||||||
await actions.convertImageFileToBase64(
|
await ImageUtils.convertImageFileToBase64(
|
||||||
_model.uploadedLocalFile,
|
_model.uploadedLocalFile,
|
||||||
);
|
);
|
||||||
_model.scheduleVisitor =
|
_model.scheduleVisitor =
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
|
import 'package:hub/flutter_flow/random_data_util.dart';
|
||||||
import 'package:hub/pages/home_page/home_page_model.dart';
|
import 'package:hub/pages/home_page/home_page_model.dart';
|
||||||
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/device_util.dart';
|
||||||
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
|
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'sign_in_template_component_widget.dart'
|
import 'sign_in_template_component_widget.dart'
|
||||||
|
@ -48,6 +56,120 @@ class SignInTemplateComponentModel
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> checkLocals({
|
||||||
|
String? cliUUID,
|
||||||
|
required BuildContext context,
|
||||||
|
required FlutterFlowModel model,
|
||||||
|
}) async {
|
||||||
|
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||||
|
|
||||||
|
final response = await callback.call();
|
||||||
|
|
||||||
|
if (response.jsonBody['error']) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||||
|
|
||||||
|
if (locals.isEmpty) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future signInLoginAction(
|
||||||
|
BuildContext context,
|
||||||
|
FlutterFlowModel model, {
|
||||||
|
String? emailAdress,
|
||||||
|
String? password,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final ApiCallResponse? response;
|
||||||
|
final DatabaseHelper db = DatabaseHelper();
|
||||||
|
final LoginCall callback = PhpGroup.loginCall;
|
||||||
|
AppState().deviceDescription = randomString(
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
|
final String? devUUID;
|
||||||
|
final String userUUID;
|
||||||
|
final String status;
|
||||||
|
final String userDevUUID;
|
||||||
|
final String userName;
|
||||||
|
final String email;
|
||||||
|
final String passwd;
|
||||||
|
final bool isLogged;
|
||||||
|
|
||||||
|
email = emailAdress!;
|
||||||
|
passwd = password!;
|
||||||
|
|
||||||
|
devUUID = await DeviceUtil.getDevUUID();
|
||||||
|
|
||||||
|
if ((email != '') && (passwd != '')) {
|
||||||
|
AppState().email = email;
|
||||||
|
AppState().passwd = passwd;
|
||||||
|
response = await callback.call();
|
||||||
|
|
||||||
|
if (response.jsonBody['error'] == false) {
|
||||||
|
userUUID = response.jsonBody['uid'];
|
||||||
|
|
||||||
|
status = response.jsonBody['user']['status'];
|
||||||
|
userDevUUID = response.jsonBody['user']['dev_id'];
|
||||||
|
userName = response.jsonBody['user']['name'];
|
||||||
|
|
||||||
|
db.update('devUUID', devUUID, 'user');
|
||||||
|
db.update('userUUID', userUUID, 'user');
|
||||||
|
db.update('userDevUUID', userDevUUID, 'user');
|
||||||
|
db.update('status', status, 'user');
|
||||||
|
db.update('userName', userName, 'user');
|
||||||
|
|
||||||
|
isLogged = true;
|
||||||
|
await checkLocals(context: context, model: model).then((value) {
|
||||||
|
AppState().haveLocal = value;
|
||||||
|
AppState().isLogged = isLogged;
|
||||||
|
AppState().update(() {});
|
||||||
|
toggleApp(context);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (response.jsonBody['error'] == null) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
} else {
|
||||||
|
DialogUtil.error(
|
||||||
|
context, response.jsonBody['error_msg'].toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
} catch (e, s) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
LogUtil.requestAPIFailed(
|
||||||
|
'login.php', emailAdress.toString(), "Login", e, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future toggleApp(BuildContext context) async {
|
||||||
|
final haveLocal = AppState().haveLocal;
|
||||||
|
if (haveLocal == true) {
|
||||||
|
context.go('/homePage');
|
||||||
|
} else if (haveLocal == false) {
|
||||||
|
context.go(
|
||||||
|
'/receptionPage',
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
|
hasTransition: true,
|
||||||
|
transitionType: PageTransitionType.fade,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState(BuildContext context) {
|
void initState(BuildContext context) {
|
||||||
emailAddressTextControllerValidator = _emailAddressTextControllerValidator;
|
emailAddressTextControllerValidator = _emailAddressTextControllerValidator;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
|
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import '/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart';
|
import '/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart';
|
||||||
import '/flutter_flow/flutter_flow_animations.dart';
|
import '/flutter_flow/flutter_flow_animations.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
@ -241,6 +240,10 @@ class _SignInTemplateComponentWidgetState
|
||||||
.emailAddressTextController,
|
.emailAddressTextController,
|
||||||
focusNode: _model
|
focusNode: _model
|
||||||
.emailAddressFocusNode,
|
.emailAddressFocusNode,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(
|
||||||
|
context)
|
||||||
|
.primary,
|
||||||
onChanged: (_) =>
|
onChanged: (_) =>
|
||||||
EasyDebounce.debounce(
|
EasyDebounce.debounce(
|
||||||
'_model.emailAddressTextController',
|
'_model.emailAddressTextController',
|
||||||
|
@ -382,6 +385,10 @@ class _SignInTemplateComponentWidgetState
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model
|
controller: _model
|
||||||
.passwordTextController,
|
.passwordTextController,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(
|
||||||
|
context)
|
||||||
|
.primary,
|
||||||
focusNode:
|
focusNode:
|
||||||
_model.passwordFocusNode,
|
_model.passwordFocusNode,
|
||||||
onChanged: (_) =>
|
onChanged: (_) =>
|
||||||
|
@ -549,7 +556,7 @@ class _SignInTemplateComponentWidgetState
|
||||||
onPressed: _isFormInvalid()
|
onPressed: _isFormInvalid()
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
await action_blocks
|
await _model
|
||||||
.signInLoginAction(
|
.signInLoginAction(
|
||||||
context,
|
context,
|
||||||
_model,
|
_model,
|
||||||
|
@ -709,7 +716,7 @@ class _SignInTemplateComponentWidgetState
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
try {
|
try {
|
||||||
await action_blocks
|
await _model
|
||||||
.signInLoginAction(
|
.signInLoginAction(
|
||||||
context,
|
context,
|
||||||
_model,
|
_model,
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
|
import 'package:hub/flutter_flow/random_data_util.dart';
|
||||||
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
|
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'sign_up_template_component_widget.dart'
|
import 'sign_up_template_component_widget.dart'
|
||||||
show SignUpTemplateComponentWidget;
|
show SignUpTemplateComponentWidget;
|
||||||
|
@ -93,4 +99,62 @@ class SignUpTemplateComponentModel
|
||||||
passwordRegisterFormFocusNode?.dispose();
|
passwordRegisterFormFocusNode?.dispose();
|
||||||
passwordRegisterFormTextController?.dispose();
|
passwordRegisterFormTextController?.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> signUpRegisterAction(
|
||||||
|
BuildContext context, {
|
||||||
|
required String? name,
|
||||||
|
String? passwd,
|
||||||
|
required String? email,
|
||||||
|
String? device,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
ApiCallResponse? response;
|
||||||
|
|
||||||
|
if ((email != null && email != '') &&
|
||||||
|
(passwd != null && passwd != '' && passwd.length > 7) &&
|
||||||
|
(name != null && name != '')) {
|
||||||
|
response = await PhpGroup.registerCall.call(
|
||||||
|
name: name,
|
||||||
|
password: passwd,
|
||||||
|
email: email,
|
||||||
|
token: randomString(
|
||||||
|
36,
|
||||||
|
36,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
uuid: randomString(
|
||||||
|
36,
|
||||||
|
36,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
tipo: device,
|
||||||
|
descricao: randomString(
|
||||||
|
36,
|
||||||
|
36,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.jsonBody['error'] == false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
DialogUtil.error(context, response.jsonBody['error_msg']);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (e, s) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
LogUtil.requestAPIFailed(
|
||||||
|
'registro.php', email.toString(), "Register", e, s);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import 'package:hub/shared/components/atoms/atom_terms_of_use.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import '/flutter_flow/flutter_flow_animations.dart';
|
import '/flutter_flow/flutter_flow_animations.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
@ -690,9 +689,8 @@ class _SignUpTemplateComponentWidgetState
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
var shouldSetState = false;
|
var shouldSetState = false;
|
||||||
_model.signUp =
|
_model.signUp = await _model
|
||||||
await action_blocks
|
.signUpRegisterAction(
|
||||||
.signUpRegisterAction(
|
|
||||||
context,
|
context,
|
||||||
name: _model
|
name: _model
|
||||||
.nameRegisterFormTextController
|
.nameRegisterFormTextController
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
// Automatic FlutterFlow imports
|
|
||||||
|
|
||||||
import 'index.dart'; // Imports other custom actions
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:typed_data';
|
|
||||||
import '../../flutter_flow/uploaded_file.dart';
|
|
||||||
|
|
||||||
Future<String?> convertImageFileToBase64(FFUploadedFile imageFile) async {
|
|
||||||
List<int>? imageBytes = imageFile.bytes;
|
|
||||||
if (imageBytes != null) {
|
|
||||||
String base64Image = base64Encode(imageBytes);
|
|
||||||
return base64Image;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
// Automatic FlutterFlow imports
|
|
||||||
import '/backend/schema/structs/index.dart';
|
|
||||||
import '/backend/schema/enums/enums.dart';
|
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
|
||||||
import 'index.dart'; // Imports other custom actions
|
|
||||||
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
// Begin custom action code
|
|
||||||
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
|
|
||||||
|
|
||||||
import 'dart:convert'; // Import for base64 decoding
|
|
||||||
import 'dart:io'; // Import for file operations
|
|
||||||
import 'package:path_provider/path_provider.dart'; // Import for temporary directory
|
|
||||||
|
|
||||||
|
|
||||||
Future<FFUploadedFile> convertToUploadFile(String img) async {
|
|
||||||
// Decode the base64 string into bytes
|
|
||||||
Uint8List bytes = base64.decode(img);
|
|
||||||
|
|
||||||
// Create a temporary file to store the image
|
|
||||||
final tempDir = await getTemporaryDirectory();
|
|
||||||
final tempPath = tempDir.path;
|
|
||||||
final tempFile = await File('$tempPath/image.jpg').create();
|
|
||||||
await tempFile.writeAsBytes(bytes);
|
|
||||||
|
|
||||||
// Create an FFUploadedFile object using the temporary file
|
|
||||||
return FFUploadedFile(
|
|
||||||
bytes: bytes,
|
|
||||||
name: 'image.jpg',
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
import '/backend/schema/structs/index.dart';
|
|
||||||
import 'dart:developer';
|
|
||||||
import '/backend/schema/enums/enums.dart';
|
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
|
||||||
import 'index.dart'; // Imports other custom actions
|
|
||||||
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'dart:io';
|
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
|
||||||
|
|
||||||
Future<String?> getDevUUID() async {
|
|
||||||
var deviceInfo = DeviceInfoPlugin();
|
|
||||||
if (Platform.isIOS) {
|
|
||||||
// import 'dart:io'
|
|
||||||
var iosDeviceInfo = await deviceInfo.iosInfo;
|
|
||||||
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
|
|
||||||
} else if (Platform.isAndroid) {
|
|
||||||
var androidDeviceInfo = await deviceInfo.androidInfo;
|
|
||||||
return androidDeviceInfo.id; // unique ID on Android
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String?> getSerialNumber() async {
|
|
||||||
var deviceInfo = DeviceInfoPlugin();
|
|
||||||
if (Platform.isIOS) {
|
|
||||||
// import 'dart:io'
|
|
||||||
var iosDeviceInfo = await deviceInfo.iosInfo;
|
|
||||||
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
|
|
||||||
} else if (Platform.isAndroid) {
|
|
||||||
var androidDeviceInfo = await deviceInfo.androidInfo;
|
|
||||||
return androidDeviceInfo.serialNumber; // unique ID on Android
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
export 'convert_image_file_to_base64.dart' show convertImageFileToBase64;
|
|
||||||
export 'convert_to_upload_file.dart' show convertToUploadFile;
|
|
||||||
export 'get_dev_u_u_i_d.dart' show getDevUUID;
|
|
|
@ -1 +0,0 @@
|
||||||
export 'image_cropper.dart' show ImageCropper;
|
|
|
@ -1,61 +0,0 @@
|
||||||
|
|
||||||
import 'dart:collection';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
LinkedHashMap<String, dynamic> menu = LinkedHashMap.from({
|
|
||||||
"Schedule":
|
|
||||||
[{
|
|
||||||
"title": "Schedule\nVisit",
|
|
||||||
"icon": Icons.settings,
|
|
||||||
"route": "/Schedule",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Complete\Schedule",
|
|
||||||
"icon": Icons.calendar_today,
|
|
||||||
"route": "/Complete",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Provisional\Schedule",
|
|
||||||
"icon": Icons.calendar_today,
|
|
||||||
"route": "/Provisional",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Fast\Schedule",
|
|
||||||
"icon": Icons.calendar_today,
|
|
||||||
"route": "/Fast",
|
|
||||||
}],
|
|
||||||
"Consult":
|
|
||||||
[{
|
|
||||||
"title": "Consult",
|
|
||||||
"icon": Icons.search,
|
|
||||||
"route": "/consult",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Liberation\nConsult",
|
|
||||||
"icon": Icons.search,
|
|
||||||
"route": "/Liberation",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Access\nConsult",
|
|
||||||
"icon": Icons.search,
|
|
||||||
"route": "/Access",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Poeple\nConsult",
|
|
||||||
"icon": Icons.search,
|
|
||||||
"route": "/Poeple",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "QR Code\nConsult",
|
|
||||||
"icon": Icons.search,
|
|
||||||
"route": "/qrcode",
|
|
||||||
}],
|
|
||||||
"Preferences":
|
|
||||||
[{
|
|
||||||
"title": "Preferences",
|
|
||||||
"icon": Icons.settings,
|
|
||||||
"route": "/preferences",
|
|
||||||
}],
|
|
||||||
|
|
||||||
});
|
|
|
@ -9,48 +9,23 @@ import 'lat_lng.dart';
|
||||||
import 'place.dart';
|
import 'place.dart';
|
||||||
import 'uploaded_file.dart';
|
import 'uploaded_file.dart';
|
||||||
|
|
||||||
|
|
||||||
String? isOneAcliID(String jsonString) {
|
|
||||||
// Converte o JSON em um Map
|
|
||||||
final Map<String, dynamic> data = jsonDecode(jsonString);
|
|
||||||
|
|
||||||
// Extrai a lista de locais
|
|
||||||
final List<dynamic> locais = data['locais'];
|
|
||||||
|
|
||||||
// Filtra os locais onde CLU_STATUS é igual a "A"
|
|
||||||
final List<dynamic> locaisAtivos =
|
|
||||||
locais.where((local) => local['CLU_STATUS'] == 'A').toList();
|
|
||||||
|
|
||||||
// Verifica se existe somente um local ativo
|
|
||||||
if (locaisAtivos.length == 1) {
|
|
||||||
return locaisAtivos.first['CLI_ID'];
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String? convertToUppercase(String input) {
|
String? convertToUppercase(String input) {
|
||||||
// recebe uuma string qualquer e retorna ela em uppercase
|
|
||||||
return input.toUpperCase();
|
return input.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
String? uploadFileToBase64(String? uploadFile) {
|
String? uploadFileToBase64(String? uploadFile) {
|
||||||
// takes an UploadFile of an image as an argument and returns a base64 string of that image
|
|
||||||
if (uploadFile == null) {
|
if (uploadFile == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converte a string em uma lista de inteiros
|
|
||||||
final List<int> bytes = uploadFile.codeUnits;
|
final List<int> bytes = uploadFile.codeUnits;
|
||||||
|
|
||||||
// Converte os bytes em uma string base64
|
|
||||||
final String base64String = base64.encode(bytes);
|
final String base64String = base64.encode(bytes);
|
||||||
|
|
||||||
return base64String;
|
return base64String;
|
||||||
}
|
}
|
||||||
|
|
||||||
String jsonListToStr(List<dynamic> visitorList) {
|
String jsonListToStr(List<dynamic> visitorList) {
|
||||||
// rece um json list e retorna uma string de $.visitante.VTE_DOCUMENTO separado por virgula
|
|
||||||
String result = '';
|
String result = '';
|
||||||
for (var visitor in visitorList) {
|
for (var visitor in visitorList) {
|
||||||
result += '${visitor['VTE_DOCUMENTO']},';
|
result += '${visitor['VTE_DOCUMENTO']},';
|
||||||
|
@ -62,7 +37,6 @@ List<dynamic> listStrJsonToJsonList(
|
||||||
dynamic jsonList,
|
dynamic jsonList,
|
||||||
List<String> strList,
|
List<String> strList,
|
||||||
) {
|
) {
|
||||||
// Recebe um jsonList e uma stringList como argumento e retorna uma nova jsonList associando cada item
|
|
||||||
List<dynamic> result = [];
|
List<dynamic> result = [];
|
||||||
|
|
||||||
for (int i = 0; i < jsonList.length; i++) {
|
for (int i = 0; i < jsonList.length; i++) {
|
||||||
|
@ -79,13 +53,10 @@ List<dynamic> listStrJsonToJsonList(
|
||||||
}
|
}
|
||||||
|
|
||||||
String strListToStr(List<String> strList) {
|
String strListToStr(List<String> strList) {
|
||||||
// recebe uma stringList como argumento e retorna uma str com cada item da strList separado por virgula
|
|
||||||
|
|
||||||
return strList.join(',');
|
return strList.join(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
int extractIdToStr(String str) {
|
int extractIdToStr(String str) {
|
||||||
// recebe um uma string e retorna um inteiro com o valor entre '_ID:' e a próxima vírgula ','
|
|
||||||
final idStart = str.indexOf('_ID:') + 4;
|
final idStart = str.indexOf('_ID:') + 4;
|
||||||
final idEnd = str.indexOf(',', idStart);
|
final idEnd = str.indexOf(',', idStart);
|
||||||
final idStr = str.substring(idStart, idEnd);
|
final idStr = str.substring(idStart, idEnd);
|
||||||
|
@ -93,14 +64,12 @@ int extractIdToStr(String str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
String extractDescToStr(String str) {
|
String extractDescToStr(String str) {
|
||||||
// recebe um uma string e retorna uma string com o valor entre '_DESCRICAO' e a próxima vírgula ','
|
|
||||||
final startIndex = str.indexOf('_DESCRICAO:') + '_DESCRICAO:'.length;
|
final startIndex = str.indexOf('_DESCRICAO:') + '_DESCRICAO:'.length;
|
||||||
final endIndex = str.indexOf(',', startIndex);
|
final endIndex = str.indexOf(',', startIndex);
|
||||||
return str.substring(startIndex, endIndex);
|
return str.substring(startIndex, endIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
String jsonToStr(dynamic json) {
|
String jsonToStr(dynamic json) {
|
||||||
// recebe um json como parametro, converte-o em string e retorna essa string
|
|
||||||
String jsonString = jsonEncode(json);
|
String jsonString = jsonEncode(json);
|
||||||
return jsonString;
|
return jsonString;
|
||||||
}
|
}
|
||||||
|
@ -115,4 +84,4 @@ Stream<double> getProgressValue() {
|
||||||
final progress = math.max(0.0, 1.0 - (elapsedTime / (endTime - startTime)));
|
final progress = math.max(0.0, 1.0 - (elapsedTime / (endTime - startTime)));
|
||||||
return progress;
|
return progress;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'form_field_controller.dart';
|
import 'form_field_controller.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class FlutterFlowDropDown<T> extends StatefulWidget {
|
class FlutterFlowDropDown<T> extends StatefulWidget {
|
||||||
const FlutterFlowDropDown({
|
const FlutterFlowDropDown({
|
||||||
super.key,
|
super.key,
|
||||||
|
|
|
@ -104,29 +104,7 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
|
||||||
name: 'scheduleCompleteVisitPage',
|
name: 'scheduleCompleteVisitPage',
|
||||||
path: '/scheduleCompleteVisitPage',
|
path: '/scheduleCompleteVisitPage',
|
||||||
builder: (context, params) {
|
builder: (context, params) {
|
||||||
final dropdownValue1 = params.getParam(
|
return const ScheduleCompleteVisitPageWidget();
|
||||||
'dropdownValue1',
|
|
||||||
ParamType.String,
|
|
||||||
);
|
|
||||||
final dropdownValue2 = params.getParam(
|
|
||||||
'dropdownValue2',
|
|
||||||
ParamType.String,
|
|
||||||
);
|
|
||||||
final visitorStrList = params.getParam(
|
|
||||||
'visitorStrList',
|
|
||||||
ParamType.String,
|
|
||||||
);
|
|
||||||
final visitorJsonList = params.getParam<dynamic>(
|
|
||||||
'visitorJsonList',
|
|
||||||
ParamType.JSON,
|
|
||||||
isList: true,
|
|
||||||
);
|
|
||||||
return ScheduleCompleteVisitPageWidget(
|
|
||||||
dropdownValue1: dropdownValue1 ?? '',
|
|
||||||
dropdownValue2: dropdownValue2 ?? '',
|
|
||||||
visitorStrList: visitorStrList ?? '',
|
|
||||||
visitorJsonList: visitorJsonList ?? [],
|
|
||||||
);
|
|
||||||
}),
|
}),
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'deliverySchedule',
|
name: 'deliverySchedule',
|
||||||
|
@ -155,7 +133,7 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'acessHistoryPage',
|
name: 'acessHistoryPage',
|
||||||
path: '/acessHistoryPage',
|
path: '/acessHistoryPage',
|
||||||
builder: (context, params) => AcessHistoryPageWidget(opt: const {
|
builder: (context, params) => AccessHistoryScreen(opt: const {
|
||||||
'personType': '.*',
|
'personType': '.*',
|
||||||
'accessType': '.*',
|
'accessType': '.*',
|
||||||
'search': '.*',
|
'search': '.*',
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
export '/pages/acess_history_page/acess_history_page_widget.dart'
|
export 'pages/acess_history_page/acess_history_page_widget.dart'
|
||||||
show AcessHistoryPageWidget;
|
show AccessHistoryScreen;
|
||||||
export '/pages/home_page/home_page_widget.dart' show HomePageWidget;
|
export 'pages/home_page/home_page_widget.dart' show HomePageWidget;
|
||||||
export '/pages/liberation_history/liberation_history_widget.dart'
|
export 'pages/liberation_history/liberation_history_widget.dart'
|
||||||
show LiberationHistoryWidget;
|
show LiberationHistoryWidget;
|
||||||
export '/pages/people_on_the_property_page/people_on_the_property_page_widget.dart'
|
export 'pages/people_on_the_property_page/people_on_the_property_page_widget.dart'
|
||||||
show PeopleOnThePropertyPageWidget;
|
show PeopleOnThePropertyPageWidget;
|
||||||
export '/pages/preferences_settings_page/preferences_settings_widget.dart'
|
export 'pages/preferences_settings_page/preferences_settings_widget.dart'
|
||||||
show PreferencesPageWidget;
|
show PreferencesPageWidget;
|
||||||
export '/pages/qr_code_page/qr_code_page_widget.dart' show QrCodePageWidget;
|
export 'pages/qr_code_page/qr_code_page_widget.dart' show QrCodePageWidget;
|
||||||
export '/pages/register_visitor_page/register_visitor_page_widget.dart'
|
export 'pages/register_visitor_page/register_visitor_page_widget.dart'
|
||||||
show RegisterVisitorPageWidget;
|
show RegisterVisitorPageWidget;
|
||||||
export '/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart'
|
export 'pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart'
|
||||||
show ScheduleCompleteVisitPageWidget;
|
show ScheduleCompleteVisitPageWidget;
|
||||||
export '/pages/sign_in_page/sign_in_page_widget.dart' show SignInPageWidget;
|
export 'pages/sign_in_page/sign_in_page_widget.dart' show SignInPageWidget;
|
||||||
export '/pages/sign_up_page/sign_up_page_widget.dart' show SignUpPageWidget;
|
export 'pages/sign_up_page/sign_up_page_widget.dart' show SignUpPageWidget;
|
||||||
export '/pages/welcome_page/welcome_page_widget.dart' show WelcomePageWidget;
|
export 'pages/welcome_page/welcome_page_widget.dart' show WelcomePageWidget;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import 'package:hub/flutter_flow/request_manager.dart';
|
||||||
import 'package:hub/pages/acess_history_page/acess_history_page_widget.dart';
|
import 'package:hub/pages/acess_history_page/acess_history_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
|
|
||||||
class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
class AcessHistoryPageModel extends FlutterFlowModel<AccessHistoryScreen> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final DatabaseHelper db = DatabaseHelper();
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
|
|
|
@ -15,19 +15,18 @@ import 'package:hub/shared/utils/log_util.dart';
|
||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
class AcessHistoryPageWidget extends StatefulWidget {
|
class AccessHistoryScreen extends StatefulWidget {
|
||||||
late Map<String, String> opt = {
|
late Map<String, String> opt = {
|
||||||
'personType': '.*',
|
'personType': '.*',
|
||||||
'accessType': '.*',
|
'accessType': '.*',
|
||||||
'search': '.*',
|
'search': '.*',
|
||||||
};
|
};
|
||||||
AcessHistoryPageWidget({super.key, required this.opt});
|
AccessHistoryScreen({super.key, required this.opt});
|
||||||
@override
|
@override
|
||||||
State<AcessHistoryPageWidget> createState() =>
|
State<AccessHistoryScreen> createState() => _AccessHistoryState(opt);
|
||||||
_AcessHistoryPageWidgetState(opt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
class _AccessHistoryState extends State<AccessHistoryScreen> {
|
||||||
late AcessHistoryPageModel _model;
|
late AcessHistoryPageModel _model;
|
||||||
final BehaviorSubject<Map<String, String>> selectedTypeSubject;
|
final BehaviorSubject<Map<String, String>> selectedTypeSubject;
|
||||||
bool _isSubjectClosed = false;
|
bool _isSubjectClosed = false;
|
||||||
|
@ -44,7 +43,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
||||||
late Future<void> _accessFuture;
|
late Future<void> _accessFuture;
|
||||||
List<dynamic> _accessWrap = [];
|
List<dynamic> _accessWrap = [];
|
||||||
|
|
||||||
_AcessHistoryPageWidgetState(Map<String, String> opt)
|
_AccessHistoryState(Map<String, String> opt)
|
||||||
: selectedTypeSubject = BehaviorSubject.seeded(opt) {
|
: selectedTypeSubject = BehaviorSubject.seeded(opt) {
|
||||||
selectedTypeSubject.listen((value) {});
|
selectedTypeSubject.listen((value) {});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
import 'package:hub/flutter_flow/request_manager.dart';
|
import 'package:hub/flutter_flow/request_manager.dart';
|
||||||
|
@ -49,6 +50,29 @@ class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
||||||
.then((value) => value.toString());
|
.then((value) => value.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future answersRequest(
|
||||||
|
{required BuildContext context,
|
||||||
|
required String? ref,
|
||||||
|
required String? task,
|
||||||
|
required String? response,
|
||||||
|
required String? id}) async {
|
||||||
|
final ApiCallResponse? respondeSolicitacaoCall;
|
||||||
|
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall;
|
||||||
|
|
||||||
|
respondeSolicitacaoCall = await callback.call(
|
||||||
|
referencia: ref,
|
||||||
|
tarefa: task,
|
||||||
|
resposta: response,
|
||||||
|
idVisitante: id,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (respondeSolicitacaoCall.statusCode == 200) {
|
||||||
|
return !respondeSolicitacaoCall.jsonBody['error'];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
unfocusNode.dispose();
|
unfocusNode.dispose();
|
||||||
|
|
|
@ -2,7 +2,6 @@ import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||||
|
@ -234,7 +233,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||||
),
|
),
|
||||||
icon: const Icon(Icons.done),
|
icon: const Icon(Icons.done),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
answersRequest
|
_model.answersRequest
|
||||||
.call(
|
.call(
|
||||||
context: context,
|
context: context,
|
||||||
ref: liberationHistoryItem['NOT_ID'].toString(),
|
ref: liberationHistoryItem['NOT_ID'].toString(),
|
||||||
|
@ -286,7 +285,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||||
),
|
),
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
return answersRequest
|
return _model.answersRequest
|
||||||
.call(
|
.call(
|
||||||
context: context,
|
context: context,
|
||||||
ref: liberationHistoryItem['NOT_ID'].toString(),
|
ref: liberationHistoryItem['NOT_ID'].toString(),
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
import 'package:hub/pages/people_on_the_property_page/people_on_the_property_page_widget.dart';
|
import 'package:hub/pages/people_on_the_property_page/people_on_the_property_page_widget.dart';
|
||||||
|
@ -16,4 +15,4 @@ class PeopleOnThePropertyPageModel
|
||||||
void dispose() {
|
void dispose() {
|
||||||
unfocusNode.dispose();
|
unfocusNode.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_action.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/pages/liberation_history/liberation_history_model.dart';
|
import 'package:hub/pages/liberation_history/liberation_history_model.dart';
|
||||||
|
@ -264,10 +262,9 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return Dialog(
|
return Dialog(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: buildPetDetails(
|
child: widget.model.buildPetDetails(
|
||||||
item: uItem,
|
item: uItem,
|
||||||
context: context,
|
context: context,
|
||||||
changeStatusAction: changeStatusAction,
|
|
||||||
devUUID: devUUID,
|
devUUID: devUUID,
|
||||||
userUUID: userUUID,
|
userUUID: userUUID,
|
||||||
cliUUID: cliUUID,
|
cliUUID: cliUUID,
|
||||||
|
|
|
@ -5,15 +5,18 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
import 'package:hub/custom_code/actions/convert_to_upload_file.dart';
|
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||||
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
|
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/form_field_controller.dart';
|
import 'package:hub/flutter_flow/form_field_controller.dart';
|
||||||
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/pets_page/pets_page_widget.dart';
|
import 'package:hub/pages/pets_page/pets_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/image_util.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
import '/custom_code/actions/index.dart' as actions;
|
|
||||||
|
|
||||||
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final DatabaseHelper db = DatabaseHelper();
|
||||||
|
@ -164,7 +167,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
Response response = await get(Uri.parse(
|
Response response = await get(Uri.parse(
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId'));
|
'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId'));
|
||||||
String base64 = base64Encode(response.bodyBytes);
|
String base64 = base64Encode(response.bodyBytes);
|
||||||
uploadedTempFile = await convertToUploadFile(base64);
|
uploadedTempFile = await ImageUtils.convertToUploadFile(base64);
|
||||||
updateImage?.call();
|
updateImage?.call();
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -269,7 +272,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updatePet() async {
|
Future<void> updatePet() async {
|
||||||
var img = await actions.convertImageFileToBase64(uploadedLocalFile!);
|
var img = await ImageUtils.convertImageFileToBase64(uploadedLocalFile!);
|
||||||
img = "base64;jpeg,$img";
|
img = "base64;jpeg,$img";
|
||||||
final url =
|
final url =
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${devUUID}&userUUID=${userUUID}&cliID=${cliUUID}&atividade=consultaFotoPet&petId=$petId';
|
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${devUUID}&userUUID=${userUUID}&cliID=${cliUUID}&atividade=consultaFotoPet&petId=$petId';
|
||||||
|
@ -314,7 +317,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> registerPet() async {
|
Future<void> registerPet() async {
|
||||||
var img = await actions.convertImageFileToBase64(uploadedLocalFile!);
|
var img = await ImageUtils.convertImageFileToBase64(uploadedLocalFile!);
|
||||||
img = "base64;jpeg,$img";
|
img = "base64;jpeg,$img";
|
||||||
final response = await PhpGroup.registerPet.call(
|
final response = await PhpGroup.registerPet.call(
|
||||||
image: img,
|
image: img,
|
||||||
|
@ -389,4 +392,181 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
dropDownValueController1 = FormFieldController<String>(null);
|
dropDownValueController1 = FormFieldController<String>(null);
|
||||||
dropDownValueController2 = FormFieldController<String>(null);
|
dropDownValueController2 = FormFieldController<String>(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget buildPetDetails({
|
||||||
|
required dynamic item,
|
||||||
|
required BuildContext context,
|
||||||
|
required String devUUID,
|
||||||
|
required String userUUID,
|
||||||
|
required String cliUUID,
|
||||||
|
required String cliName,
|
||||||
|
required PetsPageModel model,
|
||||||
|
}) {
|
||||||
|
return DetailsComponentWidget(
|
||||||
|
buttons: [
|
||||||
|
// EDIT ACTION
|
||||||
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Editar',
|
||||||
|
enText: 'Edit',
|
||||||
|
),
|
||||||
|
icon: const Icon(Icons.edit),
|
||||||
|
onPressed: () async {
|
||||||
|
context.pop();
|
||||||
|
|
||||||
|
model.isEditing = true;
|
||||||
|
model.item = item;
|
||||||
|
model.switchTab(0);
|
||||||
|
model.setEditForm();
|
||||||
|
// model.safeSetState!();
|
||||||
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// DELETE ACTION
|
||||||
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Excluir',
|
||||||
|
enText: 'Delete',
|
||||||
|
),
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
onPressed: () async {
|
||||||
|
showAlertDialog(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Excluir Pet',
|
||||||
|
enText: 'Delete Pet',
|
||||||
|
),
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Você tem certeza que deseja excluir esse pet?',
|
||||||
|
enText: 'Are you sure you want to delete this pet?',
|
||||||
|
), () async {
|
||||||
|
int id = item['id'];
|
||||||
|
await PhpGroup.deletePet
|
||||||
|
.call(
|
||||||
|
petID: id,
|
||||||
|
)
|
||||||
|
.then((value) {
|
||||||
|
// Navigator.pop(context, value);
|
||||||
|
context.pop(value);
|
||||||
|
context.pop(value);
|
||||||
|
|
||||||
|
if (value == false) {
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Erro ao excluir pet',
|
||||||
|
enText: 'Error deleting pet',
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
} else if (value == true) {
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Success deleting pet',
|
||||||
|
ptText: 'Succeso ao excluir pet',
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}).catchError((err, stack) {
|
||||||
|
context.pop();
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Error deleting pet',
|
||||||
|
ptText: 'Erro ao excluir pet',
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
// 'MIN', 'PEQ', 'MED', 'GRA', 'GIG'
|
||||||
|
labelsHashMap: Map<String, String>.from({
|
||||||
|
if (item['species'] != null && item['species'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Espécie", enText: "Species")}:':
|
||||||
|
item['species'].toString().toUpperCase(),
|
||||||
|
if (item['breed'] != null && item['breed'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Raça", enText: "Breed")}:':
|
||||||
|
item['breed'].toString().toUpperCase(),
|
||||||
|
if (item['color'] != null && item['color'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Cor", enText: "Color")}:':
|
||||||
|
item['color'].toString().toUpperCase(),
|
||||||
|
if (item['birthdayDate'] != null && item['birthdayDate'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Data de Nascimento", enText: "Date of Birth")}:':
|
||||||
|
ValidatorUtil.formatDateTimePicker(item['birthdayDate']),
|
||||||
|
if (item['gender'] != null && item['gender'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Gênero", enText: "Gender")}:':
|
||||||
|
item['gender'] == 'MAC'
|
||||||
|
? FFLocalizations.of(context)
|
||||||
|
.getVariableText(ptText: 'MACHO', enText: 'MALE')
|
||||||
|
: FFLocalizations.of(context)
|
||||||
|
.getVariableText(enText: 'FEMALE', ptText: 'FÊMEA'),
|
||||||
|
if (item['size'] != null && item['size'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Porte", enText: "Size")}:':
|
||||||
|
item['size'] == 'MIN'
|
||||||
|
? FFLocalizations.of(context)
|
||||||
|
.getVariableText(ptText: 'MINI', enText: 'MINI')
|
||||||
|
: item['size'] == 'PEQ'
|
||||||
|
? FFLocalizations.of(context)
|
||||||
|
.getVariableText(ptText: 'PEQUENO', enText: 'SMALL')
|
||||||
|
: item['size'] == 'MED'
|
||||||
|
? FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'MÉDIO', enText: 'MEDIUM')
|
||||||
|
: item['size'] == 'GRD'
|
||||||
|
? FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'GRANDE', enText: 'LARGE')
|
||||||
|
: item['size'] == 'GIG'
|
||||||
|
? FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'GIGANTE', enText: 'GIANT')
|
||||||
|
: '',
|
||||||
|
if (item['notes'] != null && item['notes'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Observação", enText: "Notes")}:':
|
||||||
|
item['notes'] ?? '',
|
||||||
|
}),
|
||||||
|
imagePath:
|
||||||
|
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${devUUID}&userUUID=${userUUID}&cliID=${cliUUID}&atividade=consultaFotoPet&petId=${item['id'] ?? ''}',
|
||||||
|
statusHashMap: [
|
||||||
|
if (item['gender'] == "MAC")
|
||||||
|
Map<String, Color>.from({
|
||||||
|
item['name']: Color(0xFF094CB0),
|
||||||
|
}),
|
||||||
|
if (item['gender'] == "FEM")
|
||||||
|
Map<String, Color>.from({
|
||||||
|
item['name']: Color(0xFFE463E7),
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import 'package:hub/components/atomic_components/shared_components_atoms/custom_
|
||||||
import 'package:hub/components/atomic_components/shared_components_atoms/media_upload_button.dart';
|
import 'package:hub/components/atomic_components/shared_components_atoms/media_upload_button.dart';
|
||||||
import 'package:hub/components/atomic_components/shared_components_atoms/submit_button.dart';
|
import 'package:hub/components/atomic_components/shared_components_atoms/submit_button.dart';
|
||||||
import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart';
|
import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart';
|
||||||
import 'package:hub/custom_code/actions/convert_to_upload_file.dart';
|
|
||||||
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
|
@ -28,13 +27,13 @@ import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/flutter_flow/upload_data.dart';
|
import 'package:hub/flutter_flow/upload_data.dart';
|
||||||
import 'package:hub/pages/pets_page/pets_history_screen.dart';
|
import 'package:hub/pages/pets_page/pets_history_screen.dart';
|
||||||
|
|
||||||
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
||||||
|
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/image_util.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
import 'package:sqflite/sqflite.dart';
|
||||||
import '/custom_code/actions/index.dart' as actions;
|
|
||||||
|
|
||||||
class PetsPageWidget extends StatefulWidget {
|
class PetsPageWidget extends StatefulWidget {
|
||||||
dynamic pet;
|
dynamic pet;
|
||||||
|
@ -83,7 +82,8 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
|
||||||
Response response = await get(Uri.parse(
|
Response response = await get(Uri.parse(
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${_model.devUUID}&userUUID=${_model.userUUID}&cliID=${_model.cliUUID}&atividade=consultaFotoPet&petId=$petId'));
|
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${_model.devUUID}&userUUID=${_model.userUUID}&cliID=${_model.cliUUID}&atividade=consultaFotoPet&petId=$petId'));
|
||||||
String base64 = base64Encode(response.bodyBytes);
|
String base64 = base64Encode(response.bodyBytes);
|
||||||
FFUploadedFile uploadedFile = await convertToUploadFile(base64);
|
FFUploadedFile uploadedFile =
|
||||||
|
await ImageUtils.convertToUploadFile(base64);
|
||||||
setState(() {
|
setState(() {
|
||||||
_model.handleUploadComplete(uploadedFile);
|
_model.handleUploadComplete(uploadedFile);
|
||||||
});
|
});
|
||||||
|
@ -309,6 +309,8 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textControllerData,
|
controller: _model.textControllerData,
|
||||||
focusNode: _model.textFieldFocusData,
|
focusNode: _model.textFieldFocusData,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(context).primary,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
autovalidateMode:
|
autovalidateMode:
|
||||||
AutovalidateMode.onUserInteraction,
|
AutovalidateMode.onUserInteraction,
|
||||||
|
@ -772,6 +774,8 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textControllerData,
|
controller: _model.textControllerData,
|
||||||
focusNode: _model.textFieldFocusData,
|
focusNode: _model.textFieldFocusData,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(context).primary,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
autovalidateMode:
|
autovalidateMode:
|
||||||
AutovalidateMode.onUserInteraction,
|
AutovalidateMode.onUserInteraction,
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:typed_data';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
import 'package:hub/pages/qr_code_page/qr_code_page_widget.dart';
|
import 'package:hub/pages/qr_code_page/qr_code_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
|
||||||
class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
|
class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
|
||||||
/// Local state fields for this page.
|
/// Local state fields for this page.
|
||||||
|
@ -39,6 +41,100 @@ class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
|
||||||
unfocusNode.dispose();
|
unfocusNode.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint8List assembleQRPacket(
|
||||||
|
int direction, String identifier, String password) {
|
||||||
|
List<int> packet = [direction];
|
||||||
|
|
||||||
|
String paddedBadge = identifier.padLeft(30, '0');
|
||||||
|
|
||||||
|
for (var i = 0; i < paddedBadge.length; i += 2) {
|
||||||
|
packet.add(int.parse(paddedBadge.substring(i, i + 2), radix: 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
int year = now.year % 100;
|
||||||
|
int month = now.month;
|
||||||
|
int day = now.day;
|
||||||
|
int hour = now.hour;
|
||||||
|
int minute = now.minute;
|
||||||
|
|
||||||
|
int sum = year + month + day + hour + minute;
|
||||||
|
|
||||||
|
if (sum == int.parse('0D', radix: 16) ||
|
||||||
|
sum == int.parse('0A', radix: 16)) {
|
||||||
|
packet.add(int.parse('FF', radix: 16));
|
||||||
|
} else {
|
||||||
|
packet.add(sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
String paddedPassword = password.length != 4 ? 'FFFF' : password;
|
||||||
|
|
||||||
|
for (var i = 0; i < paddedPassword.length; i += 2) {
|
||||||
|
packet.add(int.parse(paddedPassword.substring(i, i + 2), radix: 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
int check = 0x00;
|
||||||
|
|
||||||
|
for (var b in packet) {
|
||||||
|
check ^= b;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check == int.parse('0D', radix: 16) ||
|
||||||
|
check == int.parse('0A', radix: 16)) {
|
||||||
|
packet.add(int.parse('FF', radix: 16));
|
||||||
|
} else {
|
||||||
|
packet.add(check);
|
||||||
|
}
|
||||||
|
|
||||||
|
var bytes = packet
|
||||||
|
.map((byte) => byte.toRadixString(16).padLeft(2, '0'))
|
||||||
|
.join((' '));
|
||||||
|
|
||||||
|
return Uint8List.fromList(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint8List hexStringToByteArray(String s) {
|
||||||
|
int len = s.length;
|
||||||
|
Uint8List data = Uint8List(len ~/ 2);
|
||||||
|
for (int i = 0; i < len; i += 2) {
|
||||||
|
data[i ~/ 2] =
|
||||||
|
((int.parse(s[i], radix: 16) << 4) + int.parse(s[i + 1], radix: 16));
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
String byteToHexa(Uint8List pDados) {
|
||||||
|
return pDados
|
||||||
|
.map((byte) => byte.toRadixString(16).padLeft(2, '0').toUpperCase())
|
||||||
|
.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> byteToString(Uint8List bytes) async {
|
||||||
|
return String.fromCharCodes(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildQrCode(
|
||||||
|
{required int errorCorrectLevel,
|
||||||
|
required double dimension,
|
||||||
|
required String identifier,
|
||||||
|
required String pass,
|
||||||
|
required int direction}) {
|
||||||
|
try {
|
||||||
|
const Color backgroundColor = Colors.white;
|
||||||
|
const Color foregroundColor = Colors.black;
|
||||||
|
return QrImageView.withQr(
|
||||||
|
qr: QrCode.fromUint8List(
|
||||||
|
data: assembleQRPacket(direction, identifier, pass),
|
||||||
|
errorCorrectLevel: errorCorrectLevel),
|
||||||
|
size: dimension,
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
foregroundColor: foregroundColor);
|
||||||
|
} catch (e) {
|
||||||
|
return Text("Erro ao gerar QR Code: ${e.toString()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Action blocks.
|
/// Action blocks.
|
||||||
Future qrCodeEncoder(
|
Future qrCodeEncoder(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:flutter_animate/flutter_animate.dart';
|
import 'package:flutter_animate/flutter_animate.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
|
||||||
import 'package:hub/components/templates_components/qr_code_pass_key_template_component/qr_code_pass_key_template_component_widget.dart';
|
import 'package:hub/components/templates_components/qr_code_pass_key_template_component/qr_code_pass_key_template_component_widget.dart';
|
||||||
import 'package:hub/flutter_flow/custom_functions.dart';
|
import 'package:hub/flutter_flow/custom_functions.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_animations.dart';
|
import 'package:hub/flutter_flow/flutter_flow_animations.dart';
|
||||||
|
@ -146,7 +145,7 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
|
||||||
? await _showBiometricsAuth(context)
|
? await _showBiometricsAuth(context)
|
||||||
: await _showQrCodeBottomSheet(context);
|
: await _showQrCodeBottomSheet(context);
|
||||||
},
|
},
|
||||||
child: buildQrCode(
|
child: _model.buildQrCode(
|
||||||
dimension: dimension,
|
dimension: dimension,
|
||||||
errorCorrectLevel: QrErrorCorrectLevel.M,
|
errorCorrectLevel: QrErrorCorrectLevel.M,
|
||||||
identifier: _model.userDevUUID,
|
identifier: _model.userDevUUID,
|
||||||
|
|
|
@ -1,25 +1,43 @@
|
||||||
|
import 'dart:ffi';
|
||||||
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
|
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||||
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
|
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/form_field_controller.dart';
|
import 'package:hub/flutter_flow/form_field_controller.dart';
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/flutter_flow/request_manager.dart';
|
import 'package:hub/flutter_flow/request_manager.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart';
|
||||||
|
import 'package:hub/pages/schedule_complete_visit_page/visit_history_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
|
import 'package:hub/shared/mixins/status_mixin.dart';
|
||||||
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
class ScheduleCompleteVisitPageModel
|
class ScheduleCompleteVisitPageModel
|
||||||
extends FlutterFlowModel<ScheduleCompleteVisitPageWidget> {
|
extends FlutterFlowModel<ScheduleComplete> {
|
||||||
|
late VoidCallback safeSetState;
|
||||||
|
late Function(Function) updateState;
|
||||||
final _visitHistoryManager = FutureRequestManager<ApiCallResponse>();
|
final _visitHistoryManager = FutureRequestManager<ApiCallResponse>();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final DatabaseHelper db = DatabaseHelper();
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
|
|
||||||
|
late final String? dropdownValue1;
|
||||||
|
late final String? dropdownValue2;
|
||||||
|
bool? dropDownValidator1;
|
||||||
|
bool? dropDownValidator2;
|
||||||
|
List<dynamic> visitorJsonList = [];
|
||||||
|
String visitorStrList = '0';
|
||||||
|
|
||||||
Future<ApiCallResponse> visitHistory({
|
Future<ApiCallResponse> visitHistory({
|
||||||
String? uniqueQueryKey,
|
String? uniqueQueryKey,
|
||||||
bool? overrideCache,
|
bool? overrideCache,
|
||||||
|
@ -34,34 +52,25 @@ class ScheduleCompleteVisitPageModel
|
||||||
void clearVisitHistoryCacheKey(String? uniqueKey) =>
|
void clearVisitHistoryCacheKey(String? uniqueKey) =>
|
||||||
_visitHistoryManager.clearRequest(uniqueKey);
|
_visitHistoryManager.clearRequest(uniqueKey);
|
||||||
|
|
||||||
/// Local state fields for this page.
|
|
||||||
|
|
||||||
String convertDateFormat(String dateStr) {
|
String convertDateFormat(String dateStr) {
|
||||||
try {
|
try {
|
||||||
// Formato original
|
|
||||||
DateFormat originalFormat = DateFormat('dd/MM/yyyy HH:mm:ss');
|
DateFormat originalFormat = DateFormat('dd/MM/yyyy HH:mm:ss');
|
||||||
// Novo formato
|
|
||||||
DateFormat newFormat = DateFormat('y-M-d H:mm:ss');
|
DateFormat newFormat = DateFormat('y-M-d H:mm:ss');
|
||||||
|
|
||||||
// Validate the input string format
|
|
||||||
if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$')
|
if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$')
|
||||||
.hasMatch(dateStr)) {
|
.hasMatch(dateStr)) {
|
||||||
return 'Invalid date format';
|
return 'Invalid date format';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converte a string para DateTime
|
|
||||||
DateTime dateTime = originalFormat.parse(dateStr);
|
DateTime dateTime = originalFormat.parse(dateStr);
|
||||||
|
|
||||||
// Converte DateTime para a nova string formatada
|
|
||||||
String formattedDate = newFormat.format(dateTime);
|
String formattedDate = newFormat.format(dateTime);
|
||||||
return formattedDate;
|
return formattedDate;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Handle the exception by returning an error message or a default value
|
|
||||||
return 'Invalid date format';
|
return 'Invalid date format';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<dynamic> visitorJsonList = [];
|
|
||||||
void addToVisitorJsonList(dynamic item) => visitorJsonList.add(item);
|
void addToVisitorJsonList(dynamic item) => visitorJsonList.add(item);
|
||||||
void removeFromVisitorJsonList(dynamic item) => visitorJsonList.remove(item);
|
void removeFromVisitorJsonList(dynamic item) => visitorJsonList.remove(item);
|
||||||
void removeAtIndexFromVisitorJsonList(int index) =>
|
void removeAtIndexFromVisitorJsonList(int index) =>
|
||||||
|
@ -71,10 +80,6 @@ class ScheduleCompleteVisitPageModel
|
||||||
void updateVisitorJsonListAtIndex(int index, Function(dynamic) updateFn) =>
|
void updateVisitorJsonListAtIndex(int index, Function(dynamic) updateFn) =>
|
||||||
visitorJsonList[index] = updateFn(visitorJsonList[index]);
|
visitorJsonList[index] = updateFn(visitorJsonList[index]);
|
||||||
|
|
||||||
String visitorStrList = '0';
|
|
||||||
bool? dropDownValidator1;
|
|
||||||
bool? dropDownValidator2;
|
|
||||||
|
|
||||||
bool isValid() {
|
bool isValid() {
|
||||||
if ((textController1!.text != '') &&
|
if ((textController1!.text != '') &&
|
||||||
(textController2!.text != '') &&
|
(textController2!.text != '') &&
|
||||||
|
@ -85,15 +90,11 @@ class ScheduleCompleteVisitPageModel
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// State fields for stateful widgets in this page.
|
|
||||||
|
|
||||||
final unfocusNode = FocusNode();
|
final unfocusNode = FocusNode();
|
||||||
// State field(s) for TabBar widget.
|
|
||||||
TabController? tabBarController;
|
TabController? tabBarController;
|
||||||
int get tabBarCurrentIndex =>
|
int get tabBarCurrentIndex =>
|
||||||
tabBarController != null ? tabBarController!.index : 0;
|
tabBarController != null ? tabBarController!.index : 0;
|
||||||
|
|
||||||
// State field(s) for TextField widget.
|
|
||||||
FocusNode? textFieldFocusNode1;
|
FocusNode? textFieldFocusNode1;
|
||||||
TextEditingController? textController1;
|
TextEditingController? textController1;
|
||||||
String? Function(BuildContext, String?)? textController1Validator;
|
String? Function(BuildContext, String?)? textController1Validator;
|
||||||
|
@ -131,7 +132,6 @@ class ScheduleCompleteVisitPageModel
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime? datePicked1;
|
DateTime? datePicked1;
|
||||||
// State field(s) for TextField widget.
|
|
||||||
FocusNode? textFieldFocusNode2;
|
FocusNode? textFieldFocusNode2;
|
||||||
TextEditingController? textController2;
|
TextEditingController? textController2;
|
||||||
String? Function(BuildContext, String?)? textController2Validator;
|
String? Function(BuildContext, String?)? textController2Validator;
|
||||||
|
@ -170,26 +170,16 @@ class ScheduleCompleteVisitPageModel
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime? datePicked2;
|
DateTime? datePicked2;
|
||||||
// State field(s) for DropDown widget.
|
|
||||||
String? dropDownValue1;
|
String? dropDownValue1;
|
||||||
FormFieldController<String>? dropDownValueController1;
|
FormFieldController<String>? dropDownValueController1;
|
||||||
|
|
||||||
// State field(s) for DropDown widget.
|
|
||||||
String? dropDownValue2;
|
String? dropDownValue2;
|
||||||
FormFieldController<String>? dropDownValueController2;
|
FormFieldController<String>? dropDownValueController2;
|
||||||
// State field(s) for Switch widget.
|
|
||||||
bool? switchValue;
|
bool? switchValue;
|
||||||
// State field(s) for TextField widget.
|
|
||||||
FocusNode? textFieldFocusNode3;
|
FocusNode? textFieldFocusNode3;
|
||||||
TextEditingController? textController3;
|
TextEditingController? textController3;
|
||||||
String? Function(BuildContext, String?)? textController3Validator;
|
String? Function(BuildContext, String?)? textController3Validator;
|
||||||
String? _textController3Validator(BuildContext context, String? val) {
|
String? _textController3Validator(BuildContext context, String? val) {
|
||||||
// if (val == null || val.isEmpty) {
|
|
||||||
// return FFLocalizations.of(context).getVariableText(
|
|
||||||
// enText: 'This field is required.',
|
|
||||||
// ptText: 'Este campo é obrigatório.',
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +207,7 @@ class ScheduleCompleteVisitPageModel
|
||||||
textController1 = TextEditingController(
|
textController1 = TextEditingController(
|
||||||
text: dateTimeFormat(
|
text: dateTimeFormat(
|
||||||
'dd/MM/yyyy HH:mm:ss',
|
'dd/MM/yyyy HH:mm:ss',
|
||||||
DateTime.now().add(const Duration(minutes: 10)),
|
DateTime.now().add(const Duration(minutes: 0)),
|
||||||
// locale: FFLocalizations.of(context).languageCode,
|
|
||||||
));
|
));
|
||||||
textController1Validator = _textController1Validator;
|
textController1Validator = _textController1Validator;
|
||||||
|
|
||||||
|
@ -227,13 +216,59 @@ class ScheduleCompleteVisitPageModel
|
||||||
text: dateTimeFormat(
|
text: dateTimeFormat(
|
||||||
'dd/MM/yyyy HH:mm:ss',
|
'dd/MM/yyyy HH:mm:ss',
|
||||||
DateTime.now().add(const Duration(days: 1)),
|
DateTime.now().add(const Duration(days: 1)),
|
||||||
// locale: FFLocalizations.of(context).languageCode,
|
|
||||||
));
|
));
|
||||||
textController2Validator = _textController2Validator;
|
textController2Validator = _textController2Validator;
|
||||||
|
|
||||||
textFieldFocusNode3 = FocusNode();
|
textFieldFocusNode3 = FocusNode();
|
||||||
textController3 = TextEditingController();
|
textController3 = TextEditingController();
|
||||||
textController3Validator = _textController3Validator;
|
textController3Validator = _textController3Validator;
|
||||||
|
|
||||||
|
dropDownValueController1 ??=
|
||||||
|
FormFieldController<String>(dropDownValue1 ??= '');
|
||||||
|
dropDownValueController2 ??=
|
||||||
|
FormFieldController<String>(dropDownValue2 ??= '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Updated variables for dropdowns
|
||||||
|
late final List<String> reasonsDropDown1 = [];
|
||||||
|
late final List<String> labelsDropDown1 = [];
|
||||||
|
late final List<String> optionsDropdown1 = [];
|
||||||
|
|
||||||
|
late final List<String> lavelsDropDown2 = [];
|
||||||
|
late final List<String> labelsDropDown2 = [];
|
||||||
|
late final List<String> optionsDropdown2 = [];
|
||||||
|
|
||||||
|
// Methods to process dropdown values
|
||||||
|
void processDropDown1(List<dynamic> reasonsJsonList) {
|
||||||
|
if (dropDownValue1 != null && dropDownValue1!.isNotEmpty) {
|
||||||
|
String value = dropDownValue1!;
|
||||||
|
if (!(value.contains('{') &&
|
||||||
|
value.contains('}') &&
|
||||||
|
value.contains(':'))) {
|
||||||
|
var item = reasonsJsonList.where((reason) =>
|
||||||
|
reason['MOT_DESCRICAO'].toString().contains(dropDownValue1!));
|
||||||
|
dropDownValue1 = item.firstOrNull?.toString() ?? '';
|
||||||
|
dropDownValueController1?.value = dropDownValue1!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reasonsDropDown1.clear();
|
||||||
|
reasonsDropDown1.addAll(reasonsJsonList.map((e) => e.toString()).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
void processDropDown2(List<dynamic> lavelList) {
|
||||||
|
if (dropDownValue2 != null && dropDownValue2!.isNotEmpty) {
|
||||||
|
String value = dropDownValue2!;
|
||||||
|
if (!(value.contains('{') &&
|
||||||
|
value.contains('}') &&
|
||||||
|
value.contains(':'))) {
|
||||||
|
var item = lavelList.where((level) =>
|
||||||
|
level['NAC_DESCRICAO'].toString().contains(dropDownValue2!));
|
||||||
|
dropDownValue2 = item.firstOrNull?.toString() ?? '';
|
||||||
|
dropDownValueController2?.value = dropDownValue2!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lavelsDropDown2.clear();
|
||||||
|
lavelsDropDown2.addAll(lavelList.map((e) => e.toString()).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -252,7 +287,55 @@ class ScheduleCompleteVisitPageModel
|
||||||
clearVisitHistoryCache();
|
clearVisitHistoryCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Action blocks.
|
Future changeStatusAction(
|
||||||
|
BuildContext context,
|
||||||
|
int idDestino,
|
||||||
|
int idVisita,
|
||||||
|
String accessKey,
|
||||||
|
String email,
|
||||||
|
) async {
|
||||||
|
// Navigator.pop(context, true);
|
||||||
|
context.pop(true);
|
||||||
|
|
||||||
|
bool? blockVisitRequest;
|
||||||
|
blockVisitRequest = await visitCancelAction(
|
||||||
|
context,
|
||||||
|
accessKey: accessKey,
|
||||||
|
idDestino: idDestino,
|
||||||
|
idVisita: idVisita,
|
||||||
|
email: email,
|
||||||
|
);
|
||||||
|
if (!context.mounted) return;
|
||||||
|
if (blockVisitRequest == true) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> visitCancelAction(BuildContext context,
|
||||||
|
{required int? idDestino,
|
||||||
|
required int? idVisita,
|
||||||
|
required String? accessKey,
|
||||||
|
required String? email}) async {
|
||||||
|
final ApiCallResponse? response;
|
||||||
|
final CancelaVisita callback = PhpGroup.cancelaVisita;
|
||||||
|
|
||||||
|
response = await callback.call(
|
||||||
|
idDestino: idDestino,
|
||||||
|
idVisita: idVisita,
|
||||||
|
AccessKey: accessKey,
|
||||||
|
UsuEmail: email,
|
||||||
|
DevDesc: '',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return !response.jsonBody['error'];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future getVisitorsActionPage(
|
Future getVisitorsActionPage(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
List<dynamic>? visitorsJsonList,
|
List<dynamic>? visitorsJsonList,
|
||||||
|
@ -270,4 +353,258 @@ class ScheduleCompleteVisitPageModel
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void switchTab(int index) {
|
||||||
|
tabBarController?.animateTo(index);
|
||||||
|
|
||||||
|
safeSetState.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFormField() {
|
||||||
|
// if ((visitorStrList != null && visitorStrList != '') &&
|
||||||
|
// ((visitorJsonList != null && (visitorJsonList)!.isNotEmpty) != null)) {
|
||||||
|
// visitorJsonList = visitorJsonList!
|
||||||
|
// .where((e) =>
|
||||||
|
// visitorStrList ==
|
||||||
|
// getJsonField(
|
||||||
|
// e,
|
||||||
|
// r'''$.VTE_DOCUMENTO''',
|
||||||
|
// ).toString().toString())
|
||||||
|
// .toList()
|
||||||
|
// .toList()
|
||||||
|
// .cast<dynamic>();
|
||||||
|
// visitorStrList = visitorStrList!;
|
||||||
|
|
||||||
|
// safeSetState.call();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ((dropdownValue1 != null && dropdownValue1 != '') &&
|
||||||
|
// (dropdownValue2 != null && dropdownValue2 != '')) {
|
||||||
|
// dropDownValue1 = dropdownValue1!;
|
||||||
|
// dropDownValue2 = dropdownValue2!;
|
||||||
|
// safeSetState.call();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildVisitDetails({
|
||||||
|
required dynamic item,
|
||||||
|
required BuildContext context,
|
||||||
|
required Future<dynamic> Function(BuildContext, int, int, String, String)
|
||||||
|
changeStatusAction,
|
||||||
|
required String devUUID,
|
||||||
|
required String userUUID,
|
||||||
|
required String cliUUID,
|
||||||
|
required String cliName,
|
||||||
|
}) {
|
||||||
|
return DetailsComponentWidget(
|
||||||
|
buttons: [
|
||||||
|
if (Status.getStatus(item['VAW_STATUS']) ==
|
||||||
|
StatusEnum.active) // REJECT ACTION
|
||||||
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Cancelar',
|
||||||
|
enText: 'Cancel',
|
||||||
|
),
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
onPressed: () async {
|
||||||
|
showAlertDialog(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Cancelar Visita',
|
||||||
|
enText: 'Cancel Visit',
|
||||||
|
),
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Você tem certeza que deseja bloquear essa visita?',
|
||||||
|
enText: 'Are you sure you want to block this visit?',
|
||||||
|
), () async {
|
||||||
|
await changeStatusAction
|
||||||
|
?.call(
|
||||||
|
context,
|
||||||
|
int.parse(item['VAW_DESTINO']),
|
||||||
|
int.parse(item['VAW_ID']),
|
||||||
|
item['VAW_CHAVE'] ?? '',
|
||||||
|
item['VTE_DOCUMENTO'] ?? '',
|
||||||
|
)
|
||||||
|
.then((value) {
|
||||||
|
// Navigator.pop(context, value);
|
||||||
|
context.pop(value);
|
||||||
|
|
||||||
|
if (value == false) {
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Error blocking visit',
|
||||||
|
ptText: 'Erro ao bloquear visita',
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
} else if (value == true) {
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Success canceling visit',
|
||||||
|
ptText: 'Succeso ao cancelar visita',
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}).catchError((err, stack) {
|
||||||
|
context.pop();
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Error blocking visit',
|
||||||
|
ptText: 'Erro ao bloquear visita',
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (Status.getStatus(item['VAW_STATUS']) !=
|
||||||
|
StatusEnum.active) // RECALL ACTION
|
||||||
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Reagendar',
|
||||||
|
enText: 'Reschedule',
|
||||||
|
),
|
||||||
|
icon: const Icon(Icons.refresh),
|
||||||
|
onPressed: () async {
|
||||||
|
context.pop();
|
||||||
|
|
||||||
|
dropDownValue1 = item['MOT_DESCRICAO'];
|
||||||
|
dropDownValue2 = item['NAC_DESCRICAO'];
|
||||||
|
|
||||||
|
visitorJsonList = [item];
|
||||||
|
visitorStrList = item['VTE_DOCUMENTO'];
|
||||||
|
|
||||||
|
switchTab(0);
|
||||||
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (Status.getStatus(item['VAW_STATUS']) ==
|
||||||
|
StatusEnum.active) // SHARE ACTION
|
||||||
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Compartilhar',
|
||||||
|
enText: 'Share',
|
||||||
|
),
|
||||||
|
icon: const Icon(Icons.share),
|
||||||
|
onPressed: () async {
|
||||||
|
Share.share('''
|
||||||
|
Olá, \*${item['VTE_NOME']}\*! Você foi convidado para \*${cliName}\*.
|
||||||
|
|
||||||
|
\*Validade do Convite\*:
|
||||||
|
- Início: ${item['VAW_DTINICIO']}
|
||||||
|
- Fim: ${item['VAW_DTFIM']}
|
||||||
|
|
||||||
|
URL do Convite: https://visita.freaccess.com.br/${item['VAW_ID']}/${cliUUID}/${item['VAW_CHAVE']}
|
||||||
|
''');
|
||||||
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
labelsHashMap: Map<String, String>.from({
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:':
|
||||||
|
item['VTE_NOME'] ?? '',
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Inicio", enText: "Start")}:':
|
||||||
|
item['VAW_DTINICIO'] != '' && item['VAW_DTINICIO'] != null
|
||||||
|
? ValidatorUtil.toLocalDateTime(
|
||||||
|
'yyyy-MM-dd HH:mm:ss', item['VAW_DTINICIO'])
|
||||||
|
: '',
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Fim", enText: "End")}:':
|
||||||
|
item['VAW_DTFIM'] != '' && item['VAW_DTFIM'] != null
|
||||||
|
? ValidatorUtil.toLocalDateTime(
|
||||||
|
'yyyy-MM-dd HH:mm:ss', item['VAW_DTFIM'])
|
||||||
|
: '',
|
||||||
|
}),
|
||||||
|
imagePath:
|
||||||
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${cliUUID}&atividade=getFoto&Documento=${item['VTE_DOCUMENTO'] ?? ''}&tipo=E',
|
||||||
|
statusHashMap: [
|
||||||
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.active)
|
||||||
|
Map<String, Color>.from({
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Ativo',
|
||||||
|
enText: 'Active',
|
||||||
|
): FlutterFlowTheme.of(context).warning,
|
||||||
|
}),
|
||||||
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.unknown)
|
||||||
|
Map<String, Color>.from({
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Pendente',
|
||||||
|
enText: 'Pending',
|
||||||
|
): FlutterFlowTheme.of(context).alternate,
|
||||||
|
}),
|
||||||
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.canceled)
|
||||||
|
Map<String, Color>.from({
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Cancelado',
|
||||||
|
enText: 'Canceled',
|
||||||
|
): FlutterFlowTheme.of(context).error,
|
||||||
|
}),
|
||||||
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.finished)
|
||||||
|
Map<String, Color>.from({
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Finalizado',
|
||||||
|
enText: 'Finished',
|
||||||
|
): FlutterFlowTheme.of(context).success,
|
||||||
|
}),
|
||||||
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.blocked)
|
||||||
|
Map<String, Color>.from({
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Bloqueado',
|
||||||
|
enText: 'Blocked',
|
||||||
|
): FlutterFlowTheme.of(context).error,
|
||||||
|
}),
|
||||||
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.inactive)
|
||||||
|
Map<String, Color>.from({
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Inativo',
|
||||||
|
enText: 'Inactive',
|
||||||
|
): FlutterFlowTheme.of(context).warning,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -5,7 +7,6 @@ import 'package:flutter/scheduler.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/components/atomic_components/shared_components_atoms/toast.dart';
|
import 'package:hub/components/atomic_components/shared_components_atoms/toast.dart';
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||||
|
@ -19,23 +20,22 @@ import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/form_field_controller.dart';
|
import 'package:hub/flutter_flow/form_field_controller.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
||||||
import 'package:hub/pages/visit_history_page/visit_history_page_widget.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/visit_history_page_widget.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/share_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ScheduleCompleteVisitPageWidget extends StatefulWidget {
|
class ScheduleComplete extends StatefulWidget {
|
||||||
const ScheduleCompleteVisitPageWidget({
|
const ScheduleComplete({Key? key}) : super(key: key);
|
||||||
super.key,
|
|
||||||
this.dropdownValue1,
|
|
||||||
this.dropdownValue2,
|
|
||||||
this.visitorStrList,
|
|
||||||
this.visitorJsonList,
|
|
||||||
});
|
|
||||||
|
|
||||||
final String? dropdownValue1;
|
@override
|
||||||
final String? dropdownValue2;
|
State<StatefulWidget> createState() {
|
||||||
final String? visitorStrList;
|
throw UnimplementedError();
|
||||||
final List<dynamic>? visitorJsonList;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ScheduleCompleteVisitPageWidget extends ScheduleComplete {
|
||||||
|
const ScheduleCompleteVisitPageWidget();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ScheduleCompleteVisitPageWidget> createState() =>
|
State<ScheduleCompleteVisitPageWidget> createState() =>
|
||||||
|
@ -57,39 +57,9 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_model = createModel(context, () => ScheduleCompleteVisitPageModel());
|
_model = createModel(context, () => ScheduleCompleteVisitPageModel());
|
||||||
|
_model.safeSetState = () => safeSetState(() {});
|
||||||
|
_model.updateState = (Function fn) => safeSetState(fn());
|
||||||
|
|
||||||
// On page load action.
|
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
|
||||||
if ((widget.visitorStrList != null && widget.visitorStrList != '') &&
|
|
||||||
((widget.visitorJsonList != null &&
|
|
||||||
(widget.visitorJsonList)!.isNotEmpty) !=
|
|
||||||
null)) {
|
|
||||||
_model.visitorJsonList = widget.visitorJsonList!
|
|
||||||
.where((e) =>
|
|
||||||
widget.visitorStrList ==
|
|
||||||
getJsonField(
|
|
||||||
e,
|
|
||||||
r'''$.VTE_DOCUMENTO''',
|
|
||||||
).toString().toString())
|
|
||||||
.toList()
|
|
||||||
.toList()
|
|
||||||
.cast<dynamic>();
|
|
||||||
_model.visitorStrList = widget.visitorStrList!;
|
|
||||||
|
|
||||||
safeSetState(() {});
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((widget.dropdownValue1 != null && widget.dropdownValue1 != '') &&
|
|
||||||
(widget.dropdownValue2 != null && widget.dropdownValue2 != '')) {
|
|
||||||
_model.dropDownValue1 = widget.dropdownValue1!;
|
|
||||||
_model.dropDownValue2 = widget.dropdownValue2!;
|
|
||||||
safeSetState(() {});
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
_model.tabBarController = TabController(
|
_model.tabBarController = TabController(
|
||||||
vsync: this,
|
vsync: this,
|
||||||
length: 2,
|
length: 2,
|
||||||
|
@ -107,21 +77,15 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadMoreVisitHistory() async {
|
void _loadMoreVisitHistory() async {
|
||||||
// Simulate fetching data from an API or database
|
|
||||||
Future<List<String>> fetchVisitHistory(int start, int limit) async {
|
Future<List<String>> fetchVisitHistory(int start, int limit) async {
|
||||||
// Simulate network delay
|
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
// Generate a list of visit history items
|
|
||||||
return List.generate(limit, (index) => "Item ${start + index}");
|
return List.generate(limit, (index) => "Item ${start + index}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the start index for the next batch of items to load
|
|
||||||
final int start = _visitHistoryLoadingIdx * _visitHistoryLoadingCount;
|
final int start = _visitHistoryLoadingIdx * _visitHistoryLoadingCount;
|
||||||
// Fetch the next batch of items
|
|
||||||
final List<String> newItems =
|
final List<String> newItems =
|
||||||
await fetchVisitHistory(start, _visitHistoryLoadingCount);
|
await fetchVisitHistory(start, _visitHistoryLoadingCount);
|
||||||
|
|
||||||
// If new items were fetched, add them to the list and update the index
|
|
||||||
if (newItems.isNotEmpty) {
|
if (newItems.isNotEmpty) {
|
||||||
_visitHistoryList.addAll(newItems);
|
_visitHistoryList.addAll(newItems);
|
||||||
_visitHistoryLoadingIdx++;
|
_visitHistoryLoadingIdx++;
|
||||||
|
@ -183,7 +147,7 @@ PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'61lcxdgm' /* Agendar Visita */,
|
'61lcxdgm',
|
||||||
),
|
),
|
||||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
||||||
fontFamily: 'Nunito',
|
fontFamily: 'Nunito',
|
||||||
|
@ -223,12 +187,12 @@ Widget bodyScheduleCompleteVisit(BuildContext context,
|
||||||
tabs: [
|
tabs: [
|
||||||
Tab(
|
Tab(
|
||||||
text: FFLocalizations.of(context).getText(
|
text: FFLocalizations.of(context).getText(
|
||||||
'ueth1f4g' /* Cadastrar Visita */,
|
'ueth1f4g',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Tab(
|
Tab(
|
||||||
text: FFLocalizations.of(context).getText(
|
text: FFLocalizations.of(context).getText(
|
||||||
'k4uraqam' /* Histórico de Visitas */,
|
'k4uraqam',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -278,7 +242,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
20.0, 30.0, 0.0, 24.0),
|
20.0, 30.0, 0.0, 24.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'98evnbbe' /* Qual o período de validade da ... */,
|
'98evnbbe',
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
@ -298,7 +262,6 @@ Widget scheduleVisit(BuildContext context,
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height: 60.0,
|
height: 60.0,
|
||||||
// decoration: const BoxDecoration(),
|
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -328,7 +291,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
.labelMediumFamily),
|
.labelMediumFamily),
|
||||||
),
|
),
|
||||||
hintText: FFLocalizations.of(context).getText(
|
hintText: FFLocalizations.of(context).getText(
|
||||||
'53cbwqh9' /* Quando você inicia a visita? */,
|
'53cbwqh9',
|
||||||
),
|
),
|
||||||
hintStyle: FlutterFlowTheme.of(context)
|
hintStyle: FlutterFlowTheme.of(context)
|
||||||
.labelMedium
|
.labelMedium
|
||||||
|
@ -549,7 +512,6 @@ Widget scheduleVisit(BuildContext context,
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height: 60.0,
|
height: 60.0,
|
||||||
// decoration: const BoxDecoration(),
|
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -579,7 +541,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
.labelMediumFamily),
|
.labelMediumFamily),
|
||||||
),
|
),
|
||||||
hintText: FFLocalizations.of(context).getText(
|
hintText: FFLocalizations.of(context).getText(
|
||||||
'xpgc5e8d' /* Quando a visita terminá? */,
|
'xpgc5e8d',
|
||||||
),
|
),
|
||||||
hintStyle: FlutterFlowTheme.of(context)
|
hintStyle: FlutterFlowTheme.of(context)
|
||||||
.labelMedium
|
.labelMedium
|
||||||
|
@ -793,9 +755,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]
|
]),
|
||||||
// .divide(const SizedBox(height: 0.0)),
|
|
||||||
),
|
|
||||||
Column(
|
Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
|
@ -806,7 +766,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
20.0, 24.0, 0.0, 30.0),
|
20.0, 24.0, 0.0, 30.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'u0jocx7e' /* Quais visitantes você deseja c... */,
|
'u0jocx7e',
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
@ -1018,7 +978,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
alignment: const AlignmentDirectional(0.0, 0.0),
|
alignment: const AlignmentDirectional(0.0, 0.0),
|
||||||
child: AutoSizeText(
|
child: AutoSizeText(
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'r8soavtz' /* Clique para adicionar um visit... */,
|
'r8soavtz',
|
||||||
),
|
),
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context)
|
||||||
.bodyMedium
|
.bodyMedium
|
||||||
|
@ -1052,7 +1012,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
20.0, 24.0, 0.0, 24.0),
|
20.0, 24.0, 0.0, 24.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'0meymh6u' /* Quais são os motivos da visita... */,
|
'0meymh6u',
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
@ -1097,54 +1057,23 @@ Widget scheduleVisit(BuildContext context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final dropDownGetDadosResponse =
|
|
||||||
snapshot.data!;
|
|
||||||
final reasonsJsonList =
|
final reasonsJsonList =
|
||||||
PhpGroup.getDadosCall.reasonsJsonList(
|
PhpGroup.getDadosCall.reasonsJsonList(
|
||||||
dropDownGetDadosResponse.jsonBody);
|
snapshot.data!.jsonBody);
|
||||||
|
final reasonsOptionLabels = PhpGroup
|
||||||
|
.getDadosCall
|
||||||
|
.reasonsMotDescStrList(
|
||||||
|
snapshot.data!.jsonBody);
|
||||||
|
|
||||||
if (_model.dropDownValue1 != '' &&
|
_model.processDropDown1(reasonsJsonList!);
|
||||||
_model.dropDownValue1 != null) {
|
|
||||||
String value =
|
|
||||||
_model.dropDownValue1.toString() ??
|
|
||||||
'';
|
|
||||||
|
|
||||||
if (value.contains('{') &&
|
|
||||||
value.contains('}') &&
|
|
||||||
value.contains(':')) {
|
|
||||||
} else {
|
|
||||||
if (reasonsJsonList != null &&
|
|
||||||
reasonsJsonList.isNotEmpty) {
|
|
||||||
var item = reasonsJsonList.where(
|
|
||||||
(reason) =>
|
|
||||||
reason['MOT_DESCRICAO']
|
|
||||||
.toString()
|
|
||||||
.contains(_model
|
|
||||||
.dropDownValue1 ??
|
|
||||||
''));
|
|
||||||
_model.dropDownValue1 =
|
|
||||||
item.firstOrNull.toString() ?? '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return FlutterFlowDropDown<String>(
|
return FlutterFlowDropDown<String>(
|
||||||
fillColor: FlutterFlowTheme.of(context)
|
fillColor: FlutterFlowTheme.of(context)
|
||||||
.primaryBackground,
|
.primaryBackground,
|
||||||
controller:
|
controller:
|
||||||
_model.dropDownValueController1 ??=
|
_model.dropDownValueController1,
|
||||||
FormFieldController<String>(
|
options: _model.reasonsDropDown1,
|
||||||
_model.dropDownValue1 ??= ''),
|
optionLabels: reasonsOptionLabels,
|
||||||
options: reasonsJsonList != null &&
|
|
||||||
reasonsJsonList != []
|
|
||||||
? reasonsJsonList
|
|
||||||
.map((e) => e.toString())
|
|
||||||
.toList()
|
|
||||||
: [],
|
|
||||||
optionLabels: PhpGroup.getDadosCall
|
|
||||||
.reasonsMotDescStrList(
|
|
||||||
dropDownGetDadosResponse
|
|
||||||
.jsonBody),
|
|
||||||
onChanged: (val) => safeSetState(
|
onChanged: (val) => safeSetState(
|
||||||
() => _model.dropDownValue1 = val),
|
() => _model.dropDownValue1 = val),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
|
@ -1163,7 +1092,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
hintText:
|
hintText:
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'6p3e0bzr' /* Escolha um motivo aqui */,
|
'6p3e0bzr',
|
||||||
),
|
),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.keyboard_arrow_down_rounded,
|
Icons.keyboard_arrow_down_rounded,
|
||||||
|
@ -1229,7 +1158,6 @@ Widget scheduleVisit(BuildContext context,
|
||||||
child: FutureBuilder<ApiCallResponse>(
|
child: FutureBuilder<ApiCallResponse>(
|
||||||
future: PhpGroup.getDadosCall.call(),
|
future: PhpGroup.getDadosCall.call(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
// Customize what your widget looks like when it's loading.
|
|
||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
return Center(
|
return Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
@ -1244,53 +1172,19 @@ Widget scheduleVisit(BuildContext context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final dropDownGetDadosResponse =
|
final lavelsJsonList = PhpGroup.getDadosCall
|
||||||
snapshot.data!;
|
.levelJsonList(snapshot.data!.jsonBody);
|
||||||
final lavelList = PhpGroup.getDadosCall
|
final lavelsOptionLabels = PhpGroup
|
||||||
.levelJsonList(
|
.getDadosCall
|
||||||
dropDownGetDadosResponse.jsonBody);
|
.levelNACDescricaoStrList(
|
||||||
|
snapshot.data!.jsonBody);
|
||||||
if (_model.dropDownValue2 != '' &&
|
_model.processDropDown2(lavelsJsonList!);
|
||||||
_model.dropDownValue2 != null) {
|
|
||||||
String value =
|
|
||||||
_model.dropDownValue2.toString() ??
|
|
||||||
'';
|
|
||||||
|
|
||||||
if (value.contains('{') &&
|
|
||||||
value.contains('}') &&
|
|
||||||
value.contains(':')) {
|
|
||||||
// log("Valor e um Objeto | Usuário Escolheu o Nivel ${_model.dropDownValue2}");
|
|
||||||
} else {
|
|
||||||
// log("Valor e uma String | Usuário Escolheu o Nivel ${_model.dropDownValue2}");
|
|
||||||
if (lavelList != null &&
|
|
||||||
lavelList.isNotEmpty) {
|
|
||||||
var item = lavelList.where((level) =>
|
|
||||||
level['NAC_DESCRICAO']
|
|
||||||
.toString()
|
|
||||||
.contains(
|
|
||||||
_model.dropDownValue2 ??
|
|
||||||
''));
|
|
||||||
_model.dropDownValue2 =
|
|
||||||
item.firstOrNull.toString() ?? '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return FlutterFlowDropDown<String>(
|
return FlutterFlowDropDown<String>(
|
||||||
controller:
|
controller:
|
||||||
_model.dropDownValueController2 ??=
|
_model.dropDownValueController2,
|
||||||
FormFieldController<String>(
|
options: _model.lavelsDropDown2,
|
||||||
_model.dropDownValue2 ??= ''),
|
optionLabels: lavelsOptionLabels,
|
||||||
options:
|
|
||||||
lavelList != null && lavelList != []
|
|
||||||
? lavelList
|
|
||||||
.map((e) => e.toString())
|
|
||||||
.toList()
|
|
||||||
: [],
|
|
||||||
optionLabels: PhpGroup.getDadosCall
|
|
||||||
.levelNACDescricaoStrList(
|
|
||||||
dropDownGetDadosResponse
|
|
||||||
.jsonBody),
|
|
||||||
onChanged: (val) => safeSetState(
|
onChanged: (val) => safeSetState(
|
||||||
() => _model.dropDownValue2 = val),
|
() => _model.dropDownValue2 = val),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
|
@ -1309,7 +1203,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
hintText:
|
hintText:
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'2wun8p6c' /* Escolha um nível de acesso aqu... */,
|
'2wun8p6c',
|
||||||
),
|
),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.keyboard_arrow_down_rounded,
|
Icons.keyboard_arrow_down_rounded,
|
||||||
|
@ -1373,7 +1267,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
20.0, 24.0, 0.0, 24.0),
|
20.0, 24.0, 0.0, 24.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'8rk26eg1' /* Visita se encerra após o prime... */,
|
'8rk26eg1',
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
@ -1402,7 +1296,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
0.0, 0.0, 130.0, 0.0),
|
0.0, 0.0, 130.0, 0.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'lgv0q5ht' /* Visita única */,
|
'lgv0q5ht',
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context)
|
||||||
|
@ -1476,7 +1370,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
20.0, 0.0, 0.0, 24.0),
|
20.0, 0.0, 0.0, 24.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context).getText(
|
FFLocalizations.of(context).getText(
|
||||||
'eftcs67c' /* Você tem alguma observação sob... */,
|
'eftcs67c',
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
@ -1500,12 +1394,13 @@ Widget scheduleVisit(BuildContext context,
|
||||||
controller: _model.textController3,
|
controller: _model.textController3,
|
||||||
focusNode: _model.textFieldFocusNode3,
|
focusNode: _model.textFieldFocusNode3,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
obscureText: false,
|
obscureText: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: false,
|
isDense: false,
|
||||||
labelText: FFLocalizations.of(context).getText(
|
labelText: FFLocalizations.of(context).getText(
|
||||||
't0q2vuup' /* Observações da Visita */,
|
't0q2vuup',
|
||||||
),
|
),
|
||||||
labelStyle: FlutterFlowTheme.of(context)
|
labelStyle: FlutterFlowTheme.of(context)
|
||||||
.labelMedium
|
.labelMedium
|
||||||
|
@ -1519,7 +1414,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
.labelMediumFamily),
|
.labelMediumFamily),
|
||||||
),
|
),
|
||||||
hintText: FFLocalizations.of(context).getText(
|
hintText: FFLocalizations.of(context).getText(
|
||||||
'w18iztdm' /* Escreva as suas observações aq... */,
|
'w18iztdm',
|
||||||
),
|
),
|
||||||
hintStyle: FlutterFlowTheme.of(context)
|
hintStyle: FlutterFlowTheme.of(context)
|
||||||
.labelMedium
|
.labelMedium
|
||||||
|
@ -1622,7 +1517,6 @@ Widget scheduleVisit(BuildContext context,
|
||||||
false) {
|
false) {
|
||||||
context.pop();
|
context.pop();
|
||||||
|
|
||||||
//MILESTONE
|
|
||||||
_model.dropDownValue1 = null;
|
_model.dropDownValue1 = null;
|
||||||
_model.dropDownValue2 = null;
|
_model.dropDownValue2 = null;
|
||||||
_model.dropDownValueController1 =
|
_model.dropDownValueController1 =
|
||||||
|
@ -1640,7 +1534,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
gravity: ToastGravity.TOP,
|
gravity: ToastGravity.TOP,
|
||||||
backgroundColor: Colors.green);
|
backgroundColor: Colors.green);
|
||||||
|
|
||||||
await showShare(value.jsonBody);
|
await ShareUtil.showShare(value.jsonBody);
|
||||||
} else {
|
} else {
|
||||||
await DialogUtil.errorDefault(context);
|
await DialogUtil.errorDefault(context);
|
||||||
context.pop();
|
context.pop();
|
||||||
|
@ -1700,7 +1594,6 @@ Widget scheduleVisit(BuildContext context,
|
||||||
.primaryBackground,
|
.primaryBackground,
|
||||||
width: 1,
|
width: 1,
|
||||||
),
|
),
|
||||||
// borderRadius: 12,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_action.dart';
|
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
||||||
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
|
import 'package:hub/shared/mixins/status_mixin.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
|
|
||||||
class VisitHistoryWidget extends StatefulWidget {
|
class VisitHistoryWidget extends ScheduleComplete {
|
||||||
VisitHistoryWidget({Key? key}) : super(key: key);
|
const VisitHistoryWidget();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_VisitHistoryWidgetState createState() => _VisitHistoryWidgetState();
|
_VisitHistoryWidgetState createState() => _VisitHistoryWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
with TickerProviderStateMixin {
|
with TickerProviderStateMixin, Status {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final DatabaseHelper db = DatabaseHelper();
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
|
@ -29,6 +29,7 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
final int _pageSize = 10;
|
final int _pageSize = 10;
|
||||||
bool _hasData = false;
|
bool _hasData = false;
|
||||||
bool _loading = false;
|
bool _loading = false;
|
||||||
|
late ScheduleCompleteVisitPageModel _model;
|
||||||
|
|
||||||
late Future<void> _visitFuture;
|
late Future<void> _visitFuture;
|
||||||
List<dynamic> _visitWrap = [];
|
List<dynamic> _visitWrap = [];
|
||||||
|
@ -48,6 +49,8 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
_model = createModel(context, () => ScheduleCompleteVisitPageModel());
|
||||||
_initVariables();
|
_initVariables();
|
||||||
_visitFuture = _fetchVisits();
|
_visitFuture = _fetchVisits();
|
||||||
|
|
||||||
|
@ -200,42 +203,47 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
: '',
|
: '',
|
||||||
},
|
},
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == StatusEnum.active)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Ativo',
|
ptText: 'Ativo',
|
||||||
enText: 'Active',
|
enText: 'Active',
|
||||||
): FlutterFlowTheme.of(context).warning,
|
): FlutterFlowTheme.of(context).warning,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.finished)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
StatusEnum.finished)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Finalizado',
|
ptText: 'Finalizado',
|
||||||
enText: 'Finished',
|
enText: 'Finished',
|
||||||
): FlutterFlowTheme.of(context).success,
|
): FlutterFlowTheme.of(context).success,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.unknown)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
StatusEnum.unknown)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Desconhecido',
|
ptText: 'Desconhecido',
|
||||||
enText: 'Unknown',
|
enText: 'Unknown',
|
||||||
): FlutterFlowTheme.of(context).alternate,
|
): FlutterFlowTheme.of(context).alternate,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.canceled)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
StatusEnum.canceled)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Cancelado',
|
ptText: 'Cancelado',
|
||||||
enText: 'Canceled',
|
enText: 'Canceled',
|
||||||
): FlutterFlowTheme.of(context).error,
|
): FlutterFlowTheme.of(context).error,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.blocked)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
StatusEnum.blocked)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Bloqueado',
|
ptText: 'Bloqueado',
|
||||||
enText: 'Blocked',
|
enText: 'Blocked',
|
||||||
): FlutterFlowTheme.of(context).error,
|
): FlutterFlowTheme.of(context).error,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.inactive)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
StatusEnum.inactive)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Inativo',
|
ptText: 'Inativo',
|
||||||
|
@ -263,10 +271,10 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return Dialog(
|
return Dialog(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: buildVisitDetails(
|
child: _model.buildVisitDetails(
|
||||||
item: visitaWrapItem,
|
item: visitaWrapItem,
|
||||||
context: context,
|
context: context,
|
||||||
changeStatusAction: changeStatusAction,
|
changeStatusAction: _model.changeStatusAction,
|
||||||
devUUID: devUUID,
|
devUUID: devUUID,
|
||||||
userUUID: userUUID,
|
userUUID: userUUID,
|
||||||
cliUUID: cliUUID,
|
cliUUID: cliUUID,
|
|
@ -1,12 +1,13 @@
|
||||||
|
import 'package:hub/shared/mixins/switcher_mixin.dart';
|
||||||
|
|
||||||
import '/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart';
|
import '/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'sign_in_page_model.dart';
|
import 'sign_in_page_model.dart';
|
||||||
export 'sign_in_page_model.dart';
|
export 'sign_in_page_model.dart';
|
||||||
|
|
||||||
class SignInPageWidget extends StatefulWidget {
|
class SignInPageWidget extends StatefulWidget with Switcher {
|
||||||
const SignInPageWidget({super.key});
|
const SignInPageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -48,7 +49,7 @@ class _SignInPageWidgetState extends State<SignInPageWidget> {
|
||||||
updateOnChange: true,
|
updateOnChange: true,
|
||||||
child: SignInTemplateComponentWidget(
|
child: SignInTemplateComponentWidget(
|
||||||
toggleSignUpPage: () async {
|
toggleSignUpPage: () async {
|
||||||
await action_blocks.toggleSignUpPage(context);
|
await Switcher.toggleSignUpPage(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -56,4 +57,4 @@ class _SignInPageWidgetState extends State<SignInPageWidget> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
|
import 'package:hub/shared/mixins/switcher_mixin.dart';
|
||||||
|
|
||||||
import '/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart';
|
import '/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'sign_up_page_model.dart';
|
import 'sign_up_page_model.dart';
|
||||||
export 'sign_up_page_model.dart';
|
export 'sign_up_page_model.dart';
|
||||||
|
|
||||||
class SignUpPageWidget extends StatefulWidget {
|
class SignUpPageWidget extends StatefulWidget with Switcher {
|
||||||
const SignUpPageWidget({super.key});
|
const SignUpPageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -48,7 +49,7 @@ class _SignUpPageWidgetState extends State<SignUpPageWidget> {
|
||||||
updateOnChange: true,
|
updateOnChange: true,
|
||||||
child: SignUpTemplateComponentWidget(
|
child: SignUpTemplateComponentWidget(
|
||||||
toggleSignInPage: () async {
|
toggleSignInPage: () async {
|
||||||
await action_blocks.toggleSignInPage(context);
|
await Switcher.toggleSignInPage(context);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -57,4 +58,4 @@ class _SignUpPageWidgetState extends State<SignUpPageWidget> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
|
import 'package:hub/shared/mixins/switcher_mixin.dart';
|
||||||
|
|
||||||
import '/components/templates_components/welcome_template_component/welcome_template_component_widget.dart';
|
import '/components/templates_components/welcome_template_component/welcome_template_component_widget.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'welcome_page_model.dart';
|
import 'welcome_page_model.dart';
|
||||||
export 'welcome_page_model.dart';
|
export 'welcome_page_model.dart';
|
||||||
|
|
||||||
class WelcomePageWidget extends StatefulWidget {
|
class WelcomePageWidget extends StatefulWidget with Switcher {
|
||||||
const WelcomePageWidget({super.key});
|
const WelcomePageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -66,10 +67,10 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
|
||||||
updateOnChange: true,
|
updateOnChange: true,
|
||||||
child: WelcomeTemplateComponentWidget(
|
child: WelcomeTemplateComponentWidget(
|
||||||
toggleSignUpPage: () async {
|
toggleSignUpPage: () async {
|
||||||
await action_blocks.toggleSignUpPage(context);
|
await Switcher.toggleSignUpPage(context);
|
||||||
},
|
},
|
||||||
toggleSignInPage: () async {
|
toggleSignInPage: () async {
|
||||||
await action_blocks.toggleSignInPage(context);
|
await Switcher.toggleSignInPage(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
enum StatusEnum { active, unknown, canceled, finished, blocked, inactive }
|
||||||
|
|
||||||
|
mixin Status {
|
||||||
|
static StatusEnum? getStatus(dynamic data) {
|
||||||
|
switch (data) {
|
||||||
|
case 'A':
|
||||||
|
return StatusEnum.active;
|
||||||
|
case 'F':
|
||||||
|
return StatusEnum.finished;
|
||||||
|
case 'B':
|
||||||
|
return StatusEnum.blocked;
|
||||||
|
case 'C':
|
||||||
|
return StatusEnum.canceled;
|
||||||
|
case 'I':
|
||||||
|
return StatusEnum.inactive;
|
||||||
|
default:
|
||||||
|
return StatusEnum.unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
|
|
||||||
|
mixin Switcher {
|
||||||
|
static Future toggleSignInPage(BuildContext context) async {
|
||||||
|
context.go(
|
||||||
|
'/signInPage',
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
|
hasTransition: true,
|
||||||
|
transitionType: PageTransitionType.fade,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future toggleSignUpPage(BuildContext context) async {
|
||||||
|
context.go(
|
||||||
|
'/signUpPage',
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
|
hasTransition: true,
|
||||||
|
transitionType: PageTransitionType.fade,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
import '/backend/schema/structs/index.dart';
|
||||||
|
import 'dart:developer';
|
||||||
|
import '/backend/schema/enums/enums.dart';
|
||||||
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'dart:io';
|
||||||
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
|
|
||||||
|
class DeviceUtil {
|
||||||
|
static Future<String?> getDevUUID() async {
|
||||||
|
var deviceInfo = DeviceInfoPlugin();
|
||||||
|
if (Platform.isIOS) {
|
||||||
|
// import 'dart:io'
|
||||||
|
var iosDeviceInfo = await deviceInfo.iosInfo;
|
||||||
|
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
|
||||||
|
} else if (Platform.isAndroid) {
|
||||||
|
var androidDeviceInfo = await deviceInfo.androidInfo;
|
||||||
|
return androidDeviceInfo.id; // unique ID on Android
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<String?> getSerialNumber() async {
|
||||||
|
var deviceInfo = DeviceInfoPlugin();
|
||||||
|
if (Platform.isIOS) {
|
||||||
|
// import 'dart:io'
|
||||||
|
var iosDeviceInfo = await deviceInfo.iosInfo;
|
||||||
|
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
|
||||||
|
} else if (Platform.isAndroid) {
|
||||||
|
var androidDeviceInfo = await deviceInfo.androidInfo;
|
||||||
|
return androidDeviceInfo.serialNumber; // unique ID on Android
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
// Automatic FlutterFlow imports
|
||||||
|
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
import '../../flutter_flow/uploaded_file.dart';
|
||||||
|
|
||||||
|
class ImageUtils {
|
||||||
|
static Future<String?> convertImageFileToBase64(
|
||||||
|
FFUploadedFile imageFile) async {
|
||||||
|
List<int>? imageBytes = imageFile.bytes;
|
||||||
|
if (imageBytes != null) {
|
||||||
|
String base64Image = base64Encode(imageBytes);
|
||||||
|
return base64Image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<FFUploadedFile> convertToUploadFile(String img) async {
|
||||||
|
// Decode the base64 string into bytes
|
||||||
|
Uint8List bytes = base64.decode(img);
|
||||||
|
|
||||||
|
// Create a temporary file to store the image
|
||||||
|
final tempDir = await getTemporaryDirectory();
|
||||||
|
final tempPath = tempDir.path;
|
||||||
|
final tempFile = await File('$tempPath/image.jpg').create();
|
||||||
|
await tempFile.writeAsBytes(bytes);
|
||||||
|
|
||||||
|
// Create an FFUploadedFile object using the temporary file
|
||||||
|
return FFUploadedFile(
|
||||||
|
bytes: bytes,
|
||||||
|
name: 'image.jpg',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
|
class ShareUtil {
|
||||||
|
static Future<void> showShare(payload) async {
|
||||||
|
final DatabaseHelper db = DatabaseHelper();
|
||||||
|
final cliName = await db
|
||||||
|
.get(key: 'cliName', field: 'value')
|
||||||
|
.then((value) => value.toString());
|
||||||
|
final cliUUID = await db
|
||||||
|
.get(key: 'cliUUID', field: 'value')
|
||||||
|
.then((value) => value.toString());
|
||||||
|
|
||||||
|
for (var i = 0; i < payload['convites'].length; i++) {
|
||||||
|
await Share.share('''
|
||||||
|
Olá, \*${payload['convites'][i]['VTE_NOME']}\*! Você foi convidado para \*$cliName\*.
|
||||||
|
|
||||||
|
\*Validade do Convite\*:
|
||||||
|
- Início: ${payload['convites'][i]['VAW_DTINICIO']}
|
||||||
|
- Fim: ${payload['convites'][i]['VAW_DTFIM']}
|
||||||
|
|
||||||
|
URL do Convite: https://visita.freaccess.com.br/${payload['convites'][i]['VAW_ID']}/$cliUUID/${payload['convites'][i]['VAW_CHAVE']}
|
||||||
|
''');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
// // Automatic FlutterFlow imports
|
// // Automatic FlutterFlow imports
|
||||||
// import '/backend/schema/structs/index.dart';
|
// import '/backend/schema/structs/index.dart';
|
||||||
// import '/backend/schema/enums/enums.dart';
|
// import '/backend/schema/enums/enums.dart';
|
||||||
// import '/actions/actions.dart' as action_blocks;
|
|
||||||
// import '/flutter_flow/flutter_flow_theme.dart';
|
// import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
// import '/flutter_flow/flutter_flow_util.dart';
|
// import '/flutter_flow/flutter_flow_util.dart';
|
||||||
// import 'index.dart'; // Imports other custom widgets
|
// import 'index.dart'; // Imports other custom widgets
|
|
@ -0,0 +1,58 @@
|
||||||
|
|
||||||
|
|
||||||
|
// // LinkedHashMap<String, dynamic> menu = LinkedHashMap.from({
|
||||||
|
// "Schedule":
|
||||||
|
// [{
|
||||||
|
// "title": "Schedule\nVisit",
|
||||||
|
// "icon": Icons.settings,
|
||||||
|
// "route": "/Schedule",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "title": "Complete\Schedule",
|
||||||
|
// "icon": Icons.calendar_today,
|
||||||
|
// "route": "/Complete",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "title": "Provisional\Schedule",
|
||||||
|
// "icon": Icons.calendar_today,
|
||||||
|
// "route": "/Provisional",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "title": "Fast\Schedule",
|
||||||
|
// "icon": Icons.calendar_today,
|
||||||
|
// "route": "/Fast",
|
||||||
|
// }],
|
||||||
|
// "Consult":
|
||||||
|
// [{
|
||||||
|
// "title": "Consult",
|
||||||
|
// "icon": Icons.search,
|
||||||
|
// "route": "/consult",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "title": "Liberation\nConsult",
|
||||||
|
// "icon": Icons.search,
|
||||||
|
// "route": "/Liberation",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "title": "Access\nConsult",
|
||||||
|
// "icon": Icons.search,
|
||||||
|
// "route": "/Access",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "title": "Poeple\nConsult",
|
||||||
|
// "icon": Icons.search,
|
||||||
|
// "route": "/Poeple",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "title": "QR Code\nConsult",
|
||||||
|
// "icon": Icons.search,
|
||||||
|
// "route": "/qrcode",
|
||||||
|
// }],
|
||||||
|
// "Preferences":
|
||||||
|
// [{
|
||||||
|
// "title": "Preferences",
|
||||||
|
// "icon": Icons.settings,
|
||||||
|
// "route": "/preferences",
|
||||||
|
// }],
|
||||||
|
|
||||||
|
// });
|
Loading…
Reference in New Issue