Merge branch 'develop' into feature/fd-466
This commit is contained in:
commit
8bff1adcf7
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -39,6 +39,7 @@ class PhpGroup {
|
||||||
static GetLiberationsCall getLiberationsCall = GetLiberationsCall();
|
static GetLiberationsCall getLiberationsCall = GetLiberationsCall();
|
||||||
static GetMessagesCall getMessagesCall = GetMessagesCall();
|
static GetMessagesCall getMessagesCall = GetMessagesCall();
|
||||||
static ChangeNotifica changeNotifica = ChangeNotifica();
|
static ChangeNotifica changeNotifica = ChangeNotifica();
|
||||||
|
static UpdateIDE updateIDE = UpdateIDE();
|
||||||
static RespondeVinculo resopndeVinculo = RespondeVinculo();
|
static RespondeVinculo resopndeVinculo = RespondeVinculo();
|
||||||
static ChangePass changePass = ChangePass();
|
static ChangePass changePass = ChangePass();
|
||||||
static ChangePanic changePanic = ChangePanic();
|
static ChangePanic changePanic = ChangePanic();
|
||||||
|
@ -640,6 +641,41 @@ class ChangeNotifica {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class UpdateIDE {
|
||||||
|
Future<ApiCallResponse> call() async {
|
||||||
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
|
final String devUUID = StorageUtil().devUUID;
|
||||||
|
final String userUUID = StorageUtil().userUUID;
|
||||||
|
final String cliID = StorageUtil().cliUUID;
|
||||||
|
final String newIde = StorageUtil().userDevUUID;
|
||||||
|
const String atividade = 'updVisitado';
|
||||||
|
|
||||||
|
return ApiManager.instance.makeApiCall(
|
||||||
|
callName: 'changeNotifica',
|
||||||
|
apiUrl: '$baseUrl/processRequest.php',
|
||||||
|
callType: ApiCallType.POST,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
'devUUID': devUUID,
|
||||||
|
'userUUID': userUUID,
|
||||||
|
'cliID': cliID,
|
||||||
|
'atividade': atividade,
|
||||||
|
'newIde': newIde,
|
||||||
|
},
|
||||||
|
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||||
|
returnBody: true,
|
||||||
|
encodeBodyUtf8: false,
|
||||||
|
decodeUtf8: false,
|
||||||
|
cache: false,
|
||||||
|
isStreamingApi: false,
|
||||||
|
alwaysAllowBody: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class UpdToken {
|
class UpdToken {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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/provisional_schedule_template/provisional_shcedule_template_widget.dart';
|
import 'package:hub/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart';
|
||||||
|
@ -34,15 +36,11 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
String? Function(BuildContext, String?)? personNameTextControllerValidator;
|
String? Function(BuildContext, String?)? personNameTextControllerValidator;
|
||||||
String? _personNameTextControllerValidator(BuildContext context, String? val) {
|
String? _personNameTextControllerValidator(BuildContext context, String? val) {
|
||||||
if (val == null || val.isEmpty) {
|
if (val == null || val.isEmpty) {
|
||||||
return FFLocalizations.of(context).getText(
|
return FFLocalizations.of(context).getText('3hqg8buh');
|
||||||
'3hqg8buh',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val.length > 80) {
|
if (val.length > 80) {
|
||||||
return FFLocalizations.of(context).getText(
|
return FFLocalizations.of(context).getText('l0b0zr50');
|
||||||
'l0b0zr50',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -53,31 +51,26 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
String? Function(BuildContext, String?)? dateTimeTextControllerValidator;
|
String? Function(BuildContext, String?)? dateTimeTextControllerValidator;
|
||||||
String? _dateTimeTextControllerValidator(BuildContext context, String? val) {
|
String? _dateTimeTextControllerValidator(BuildContext context, String? val) {
|
||||||
if (val == null || val.isEmpty) {
|
if (val == null || val.isEmpty) {
|
||||||
return FFLocalizations.of(context).getText(
|
return FFLocalizations.of(context).getText('uzefkuf9');
|
||||||
'uzefkuf9',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime selectedDateTime;
|
DateTime selectedDateTime;
|
||||||
DateTime currentDateTime = DateTime.now();
|
DateTime currentDateTime = DateTime.now().add(const Duration(minutes: 59));
|
||||||
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(val);
|
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(val);
|
log('dateTimeTextController.text: ${dateTimeTextController.text}');
|
||||||
|
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return FFLocalizations.of(context).getVariableText(
|
return FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Formato de data/hora inválido',
|
ptText: 'Formato de data inválido',
|
||||||
enText: 'Invalid date/time format',
|
enText: 'Invalid date format',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedDateTime.isBefore(currentDateTime)) {
|
if (selectedDateTime.isBefore(currentDateTime)) {
|
||||||
return FFLocalizations.of(context).getVariableText(
|
return FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'A data/hora selecionada é inválida',
|
ptText: 'A data devem ser, no mínimo, uma (1) hora à frente.',
|
||||||
enText: 'The selected date/time is invalid',
|
enText: 'The date must be at least one (1) hour ahead.',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +88,8 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
personNameTextController ??= TextEditingController();
|
personNameTextController ??= TextEditingController();
|
||||||
personNameFocusNode ??= FocusNode();
|
personNameFocusNode ??= FocusNode();
|
||||||
|
|
||||||
dateTimeTextController ??= TextEditingController();
|
dateTimeTextController ??= TextEditingController(
|
||||||
|
text: DateFormat('dd/MM/yyyy HH:mm:ss').format(DateTime.now().add(const Duration(days: 1))));
|
||||||
dateTimeFocusNode ??= FocusNode();
|
dateTimeFocusNode ??= FocusNode();
|
||||||
|
|
||||||
notesTextController ??= TextEditingController();
|
notesTextController ??= TextEditingController();
|
||||||
|
@ -104,6 +98,18 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
personNameFocusNode?.dispose();
|
||||||
|
personNameTextController?.dispose();
|
||||||
|
|
||||||
|
dateTimeFocusNode?.dispose();
|
||||||
|
dateTimeTextController?.dispose();
|
||||||
|
|
||||||
|
notesFocusNode?.dispose();
|
||||||
|
notesTextController?.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
bool isFormValid() {
|
bool isFormValid() {
|
||||||
if (personNameTextController.text == '' || personNameTextController.text.length > 80) {
|
if (personNameTextController.text == '' || personNameTextController.text.length > 80) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -114,7 +120,7 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime selectedDateTime;
|
DateTime selectedDateTime;
|
||||||
DateTime currentDateTime = DateTime.now();
|
DateTime currentDateTime = DateTime.now().add(const Duration(minutes: 59));
|
||||||
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -138,16 +144,4 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
||||||
ownerUUID = StorageUtil().ownerUUID;
|
ownerUUID = StorageUtil().ownerUUID;
|
||||||
setState?.call();
|
setState?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
personNameFocusNode?.dispose();
|
|
||||||
personNameTextController?.dispose();
|
|
||||||
|
|
||||||
dateTimeFocusNode?.dispose();
|
|
||||||
dateTimeTextController?.dispose();
|
|
||||||
|
|
||||||
notesFocusNode?.dispose();
|
|
||||||
notesTextController?.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,8 +303,9 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
||||||
obscureText: false,
|
obscureText: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: true,
|
isDense: true,
|
||||||
labelText: FFLocalizations.of(context).getText(
|
labelText: FFLocalizations.of(context).getVariableText(
|
||||||
'8zgsw5so' /* Data / Hora Limite da Visita */,
|
ptText: "Data de Validade da Visita",
|
||||||
|
enText: "Visit Validity Date",
|
||||||
),
|
),
|
||||||
labelStyle: FlutterFlowTheme.of(context).bodyMedium.override(
|
labelStyle: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
@ -448,6 +449,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
|
model.datePicked = model.datePicked;
|
||||||
model.dateTimeTextController?.text = dateTimeFormat(
|
model.dateTimeTextController?.text = dateTimeFormat(
|
||||||
"dd/MM/yyyy HH:mm:ss",
|
"dd/MM/yyyy HH:mm:ss",
|
||||||
model.datePicked,
|
model.datePicked,
|
||||||
|
@ -580,7 +582,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
||||||
: () async {
|
: () async {
|
||||||
try {
|
try {
|
||||||
model.provVisitSchedule = await PhpGroup.postProvVisitSchedulingCall.call(
|
model.provVisitSchedule = await PhpGroup.postProvVisitSchedulingCall.call(
|
||||||
data: model.dateTimeTextController.text,
|
data: DateFormat('dd/MM/yyyy HH:mm:ss').format(DateFormat('dd/MM/yyyy HH:mm:ss').parse(model.dateTimeTextController.text).add(const Duration(hours: 3))),
|
||||||
motivo: model.notesTextController.text,
|
motivo: model.notesTextController.text,
|
||||||
nome: model.personNameTextController.text,
|
nome: model.personNameTextController.text,
|
||||||
proID: model.ownerUUID,
|
proID: model.ownerUUID,
|
||||||
|
@ -610,8 +612,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
||||||
setState(() {});
|
setState(() {});
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
DialogUtil.errorDefault(context);
|
DialogUtil.errorDefault(context);
|
||||||
LogUtil.requestAPIFailed(
|
LogUtil.requestAPIFailed("processRequest.php", "", "Cadastrar Visita Provisória", e, s);
|
||||||
"processRequest.php", "", "Cadastrar Visita Provisória", e, s);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showLoadingIndicator: true,
|
showLoadingIndicator: true,
|
||||||
|
|
|
@ -24,7 +24,6 @@ export 'dart:typed_data' show Uint8List;
|
||||||
export 'package:intl/intl.dart';
|
export 'package:intl/intl.dart';
|
||||||
export 'package:page_transition/page_transition.dart';
|
export 'package:page_transition/page_transition.dart';
|
||||||
|
|
||||||
export '/app_state.dart';
|
|
||||||
export 'custom_icons.dart' show FFIcons;
|
export 'custom_icons.dart' show FFIcons;
|
||||||
export 'flutter_flow_model.dart';
|
export 'flutter_flow_model.dart';
|
||||||
export 'internationalization.dart' show FFLocalizations;
|
export 'internationalization.dart' show FFLocalizations;
|
||||||
|
|
|
@ -78,6 +78,45 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
showAlertDialog(context, title, content, onConfirm);
|
showAlertDialog(context, title, content, onConfirm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> toggleIdentification(BuildContext context) async {
|
||||||
|
final String title = FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Atualizar Identificador de Acesso',
|
||||||
|
enText: 'Update Access Identifier',
|
||||||
|
);
|
||||||
|
final String content = FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Tem certeza que deseja habilitar seu dispositivo para acesso?',
|
||||||
|
enText: 'Are you sure you want to enable your device for access?',
|
||||||
|
);
|
||||||
|
onConfirm() async {
|
||||||
|
String content;
|
||||||
|
await PhpGroup.updateIDE.call().then((value) async {
|
||||||
|
if (value.jsonBody['error'] == false) {
|
||||||
|
notifyListeners();
|
||||||
|
content = FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Atualização do identificador de acesso realizada com sucesso',
|
||||||
|
enText: 'Access identifier updated successfully',
|
||||||
|
);
|
||||||
|
SnackBarUtil.showSnackBar(context, content);
|
||||||
|
} else {
|
||||||
|
content = FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Erro ao atualizar identificador de acesso',
|
||||||
|
enText: 'Error updating access identifier',
|
||||||
|
);
|
||||||
|
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||||
|
}
|
||||||
|
}).catchError((e, s) {
|
||||||
|
content = FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Erro ao atualizar identificador de acesso',
|
||||||
|
enText: 'Error updating access identifier',
|
||||||
|
);
|
||||||
|
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||||
|
}).whenComplete(() => notifyListeners());
|
||||||
|
context.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
showAlertDialog(context, title, content, onConfirm);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> toggleAccess(BuildContext context) async {
|
Future<void> toggleAccess(BuildContext context) async {
|
||||||
onChange(String key) async {
|
onChange(String key) async {
|
||||||
StorageUtil().accessPass = key;
|
StorageUtil().accessPass = key;
|
||||||
|
|
|
@ -75,7 +75,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: 7, // Assuming 7 items for simplicity
|
itemCount: 8,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
@ -117,6 +117,15 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
icon = Icons.info;
|
||||||
|
onPressed = () => model.toggleIdentification(context);
|
||||||
|
isEnabled = false;
|
||||||
|
content = FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Atualize suas informações de identificação de acesso.',
|
||||||
|
enText: 'Update your access identification information.',
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
icon = Icons.notifications;
|
icon = Icons.notifications;
|
||||||
onPressed = () => model.toggleNotify(context);
|
onPressed = () => model.toggleNotify(context);
|
||||||
isEnabled = StorageUtil().notify;
|
isEnabled = StorageUtil().notify;
|
||||||
|
@ -125,7 +134,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
enText: 'Enable to receive your access notification',
|
enText: 'Enable to receive your access notification',
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 4:
|
||||||
icon = Icons.lock;
|
icon = Icons.lock;
|
||||||
onPressed = () => model.toggleAccess(context);
|
onPressed = () => model.toggleAccess(context);
|
||||||
isEnabled = StorageUtil().access;
|
isEnabled = StorageUtil().access;
|
||||||
|
@ -134,7 +143,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
enText: 'Enable to enter an access credential for the QRCode',
|
enText: 'Enable to enter an access credential for the QRCode',
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 5:
|
||||||
icon = Icons.lock_clock_sharp;
|
icon = Icons.lock_clock_sharp;
|
||||||
onPressed = () => model.togglePanic(context);
|
onPressed = () => model.togglePanic(context);
|
||||||
isEnabled = StorageUtil().panic;
|
isEnabled = StorageUtil().panic;
|
||||||
|
@ -143,7 +152,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
enText: 'Enable to enter a panic credential for the QRCode',
|
enText: 'Enable to enter a panic credential for the QRCode',
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 6:
|
||||||
icon = Icons.landscape;
|
icon = Icons.landscape;
|
||||||
onPressed = () {
|
onPressed = () {
|
||||||
model.localUnlink(context);
|
model.localUnlink(context);
|
||||||
|
@ -154,7 +163,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
enText: 'Enable to unlink from the selected location',
|
enText: 'Enable to unlink from the selected location',
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 7:
|
||||||
icon = Icons.delete;
|
icon = Icons.delete;
|
||||||
onPressed = () => model.deleteAccount(context);
|
onPressed = () => model.deleteAccount(context);
|
||||||
isEnabled = false;
|
isEnabled = false;
|
||||||
|
@ -163,7 +172,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
enText: 'Delete your account and all associated data permanently.',
|
enText: 'Delete your account and all associated data permanently.',
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 8:
|
||||||
icon = Icons.logout;
|
icon = Icons.logout;
|
||||||
onPressed = () => model.logout(context);
|
onPressed = () => model.logout(context);
|
||||||
isEnabled = false;
|
isEnabled = false;
|
||||||
|
|
Loading…
Reference in New Issue