WIP
This commit is contained in:
parent
330d86c102
commit
4989ba6b2b
|
@ -343,6 +343,7 @@ Future<bool> visitRequestComponentAction(
|
|||
);
|
||||
|
||||
if (respondeSolicitacaoCall.statusCode == 200) {
|
||||
log('jsonBody: ${respondeSolicitacaoCall.jsonBody}; actionValue: $actionValue; refUUID: $refUUID; responseValue: $responseValue; vteUUID: $vteUUID');
|
||||
return true;
|
||||
} else {
|
||||
log('headers: ${respondeSolicitacaoCall.headers}');
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/app_state.dart';
|
||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||
|
@ -5,15 +7,28 @@ import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
|||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||
import 'package:hub/flutter_flow/internationalization.dart';
|
||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
bool? getStatus(dynamic data) {
|
||||
return data == 'A'
|
||||
? true
|
||||
: data == 'F' || data == 'B' || data == 'C' || data == 'I'
|
||||
? false
|
||||
: null;
|
||||
enum status { active, unknown, canceled, finished, blocked, inactive }
|
||||
|
||||
status? getStatus(dynamic data) {
|
||||
debugPrint('getStatus: $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;
|
||||
}
|
||||
}
|
||||
|
||||
Widget buildDetails(
|
||||
|
@ -34,10 +49,10 @@ Widget buildDetails(
|
|||
vawUUID: 'Lorem Ipsus',
|
||||
vawName: 'Lorem Ipsus',
|
||||
vawRef: 'Lorem Ipsus',
|
||||
|
||||
changeStatusAction: changeStatusAction,
|
||||
buttons: [
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == null) // ACCEPT ACTION
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||
status.active) // ACCEPT ACTION
|
||||
FlutterFlowIconButton(
|
||||
icon: const Icon(Icons.done),
|
||||
onPressed: () async {
|
||||
|
@ -93,9 +108,9 @@ Widget buildDetails(
|
|||
await changeStatusAction?.call(
|
||||
context,
|
||||
'L',
|
||||
visitaWrapItem['VAW_REF'] ?? '',
|
||||
visitaWrapItem['VAW_ID'] ?? '',
|
||||
'Mensagem',
|
||||
visitaWrapItem['VTE_ID'] ?? '',
|
||||
visitaWrapItem['VTE_DOCUMENTO'] ?? '',
|
||||
);
|
||||
},
|
||||
options: FFButtonOptions(
|
||||
|
@ -118,7 +133,8 @@ Widget buildDetails(
|
|||
});
|
||||
},
|
||||
),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == null) // REJECT ACTION
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||
status.active) // REJECT ACTION
|
||||
FlutterFlowIconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () async {
|
||||
|
@ -199,185 +215,45 @@ Widget buildDetails(
|
|||
});
|
||||
},
|
||||
),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == false) // RECALL ACTION
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||
status.finished) // RECALL ACTION
|
||||
FlutterFlowIconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
onPressed: () async {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Bloquear Visita',
|
||||
enText: 'Block Visit',
|
||||
),
|
||||
),
|
||||
content: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText:
|
||||
'Você tem certeza que deseja bloquear essa visita?',
|
||||
enText: 'Are you sure you want to block this visit?',
|
||||
),
|
||||
),
|
||||
backgroundColor:
|
||||
FlutterFlowTheme.of(context).primaryBackground,
|
||||
actions: [
|
||||
FFButtonWidget(
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'No',
|
||||
ptText: 'Não',
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
options: FFButtonOptions(
|
||||
width: 100,
|
||||
height: 40,
|
||||
color:
|
||||
FlutterFlowTheme.of(context).primaryBackground,
|
||||
textStyle: TextStyle(
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
Navigator.pop(context);
|
||||
context.pushNamed(
|
||||
'scheduleCompleteVisitPage',
|
||||
queryParameters: {
|
||||
'visitorStrList': serializeParam(
|
||||
visitaWrapItem['VTE_DOCUMENTO'],
|
||||
ParamType.String,
|
||||
),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground,
|
||||
width: 1,
|
||||
'visitorJsonList': serializeParam(
|
||||
[visitaWrapItem],
|
||||
ParamType.JSON,
|
||||
isList: true,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
FFButtonWidget(
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Yes',
|
||||
ptText: 'Sim',
|
||||
),
|
||||
onPressed: () async {
|
||||
// await changeStatusAction?.call(
|
||||
// context,
|
||||
// 'B',
|
||||
// visitaWrapItem['VAW_REF'] ?? '',
|
||||
// 'Mensagem',
|
||||
// visitaWrapItem['VTE_ID'] ?? '',
|
||||
// );
|
||||
},
|
||||
options: FFButtonOptions(
|
||||
width: 100,
|
||||
height: 40,
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
textStyle: TextStyle(
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
),
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
FlutterFlowTheme.of(context).primaryBackground,
|
||||
width: 1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
],
|
||||
}.withoutNulls,
|
||||
);
|
||||
});
|
||||
},
|
||||
),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == false) // SHARE ACTION
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||
status.finished) // SHARE ACTION
|
||||
FlutterFlowIconButton(
|
||||
icon: const Icon(Icons.share),
|
||||
onPressed: () async {
|
||||
Share.share(r'''
|
||||
Olá ${visitaWrapItem['VTE_NOME']}
|
||||
Você foi convidado para ${visitaWrapItem['NAC_DESCRICAO']}
|
||||
Share.share('''
|
||||
Olá, \*${visitaWrapItem['VTE_NOME']}\*! Você foi convidado para \*${visitaWrapItem['NAC_DESCRICAO']}\*.
|
||||
|
||||
Validade do Convite:
|
||||
visitaWrapItem['VAW_DTINICIO']
|
||||
visitaWrapItem['VAW_DTFIM']
|
||||
\*Validade do Convite\*:
|
||||
- Início: ${visitaWrapItem['VAW_DTINICIO']}
|
||||
- Fim: ${visitaWrapItem['VAW_DTFIM']}
|
||||
|
||||
URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${visitaWrapItem['CLI_ID']}/${visitaWrapItem['VAW_CHAVE']}
|
||||
''');
|
||||
},
|
||||
),
|
||||
|
||||
// if (getStatus(visitaWrapItem['VAW_STATUS']) == null) // SEND ACTION
|
||||
// FlutterFlowIconButton(
|
||||
// icon: const Icon(Icons.send),
|
||||
// onPressed: () async {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return AlertDialog(
|
||||
// title: Text(
|
||||
// FFLocalizations.of(context).getVariableText(
|
||||
// ptText: 'Bloquear Visita',
|
||||
// enText: 'Block Visit',
|
||||
// ),
|
||||
// ),
|
||||
// content: Text(
|
||||
// FFLocalizations.of(context).getVariableText(
|
||||
// ptText:
|
||||
// 'Você tem certeza que deseja bloquear essa visita?',
|
||||
// enText: 'Are you sure you want to block this visit?',
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor:
|
||||
// FlutterFlowTheme.of(context).primaryBackground,
|
||||
// actions: [
|
||||
// FFButtonWidget(
|
||||
// text: FFLocalizations.of(context).getVariableText(
|
||||
// enText: 'No',
|
||||
// ptText: 'Não',
|
||||
// ),
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// options: FFButtonOptions(
|
||||
// width: 100,
|
||||
// height: 40,
|
||||
// color:
|
||||
// FlutterFlowTheme.of(context).primaryBackground,
|
||||
// textStyle: TextStyle(
|
||||
// color: FlutterFlowTheme.of(context).primaryText,
|
||||
// ),
|
||||
// borderSide: BorderSide(
|
||||
// color: FlutterFlowTheme.of(context)
|
||||
// .primaryBackground,
|
||||
// width: 1,
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(10)),
|
||||
// ),
|
||||
// FFButtonWidget(
|
||||
// text: FFLocalizations.of(context).getVariableText(
|
||||
// enText: 'Yes',
|
||||
// ptText: 'Sim',
|
||||
// ),
|
||||
// onPressed: () async {
|
||||
// // await changeStatusAction?.call(
|
||||
// // context,
|
||||
// // 'B',
|
||||
// // visitaWrapItem['VAW_REF'] ?? '',
|
||||
// // 'Mensagem',
|
||||
// // visitaWrapItem['VTE_ID'] ?? '',
|
||||
// // );
|
||||
// },
|
||||
// options: FFButtonOptions(
|
||||
// width: 100,
|
||||
// height: 40,
|
||||
// color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
// textStyle: TextStyle(
|
||||
// color: FlutterFlowTheme.of(context).primaryText,
|
||||
// ),
|
||||
// borderSide: BorderSide(
|
||||
// color:
|
||||
// FlutterFlowTheme.of(context).primaryBackground,
|
||||
// width: 1,
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
labelsHashMap: Map<String, String>.from({
|
||||
'Nome': visitaWrapItem['VTE_NOME'] ?? '',
|
||||
|
@ -389,27 +265,48 @@ Widget buildDetails(
|
|||
'value': 'E',
|
||||
}),
|
||||
statusHashMap: [
|
||||
getStatus(visitaWrapItem['VAW_STATUS']) == true
|
||||
? Map<String, Color>.from({
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Ativo',
|
||||
enText: 'Active',
|
||||
): FlutterFlowTheme.of(context).success,
|
||||
})
|
||||
: getStatus(visitaWrapItem['VAW_STATUS']) == null
|
||||
? Map<String, Color>.from({
|
||||
): FlutterFlowTheme.of(context).warning,
|
||||
}),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.unknown)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Pendente',
|
||||
enText: 'Pending',
|
||||
): FlutterFlowTheme.of(context).warning,
|
||||
})
|
||||
: Map<String, Color>.from({
|
||||
): FlutterFlowTheme.of(context).alternate,
|
||||
}),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.canceled)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Cancelado',
|
||||
enText: 'Canceled',
|
||||
): FlutterFlowTheme.of(context).error,
|
||||
}),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.finished)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Finalizado',
|
||||
enText: 'Finished',
|
||||
): FlutterFlowTheme.of(context).success,
|
||||
}),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.blocked)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Bloqueado',
|
||||
enText: 'Blocked',
|
||||
): FlutterFlowTheme.of(context).error,
|
||||
}),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.inactive)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Inativo',
|
||||
enText: 'Inactive',
|
||||
): FlutterFlowTheme.of(context).error,
|
||||
}),
|
||||
],
|
||||
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -154,7 +154,8 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
24.0, 0.0, 24.0, 0.0),
|
||||
child: TextFormField(
|
||||
child: Column(children: [
|
||||
TextFormField(
|
||||
controller: _model.textController2,
|
||||
focusNode: _model.textFieldFocusNode2,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
|
@ -172,21 +173,22 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
labelStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
fontFamily: FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).labelMediumFamily),
|
||||
FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily),
|
||||
),
|
||||
hintStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
hintStyle:
|
||||
FlutterFlowTheme.of(context).labelMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).labelMediumFamily),
|
||||
useGoogleFonts: GoogleFonts.asMap()
|
||||
.containsKey(FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
|
@ -235,14 +237,14 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
],
|
||||
),
|
||||
),
|
||||
FutureBuilder(
|
||||
future: _model.textController2.text.isNotEmpty
|
||||
? _model.getVisitanteByDocument(
|
||||
_model.textController2.text, context)
|
||||
: null,
|
||||
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
if (snapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
return const SizedBox();
|
||||
} else if (snapshot.hasError ||
|
||||
snapshot.data == null ||
|
||||
|
@ -258,25 +260,27 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
? const SizedBox()
|
||||
: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
right: MediaQuery.sizeOf(context).width *
|
||||
0.1),
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
top: 5, start: 12),
|
||||
child: Text(
|
||||
FFLocalizations.of(context)
|
||||
.getVariableText(
|
||||
enText: 'Visitor already registered',
|
||||
enText:
|
||||
'Visitor already registered',
|
||||
ptText: 'Visitante já cadastrado',
|
||||
),
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodySmall
|
||||
.labelSmall
|
||||
.override(
|
||||
fontFamily: 'Nunito',
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.error,
|
||||
fontSize: 14.0,
|
||||
color: Color.alphaBlend(
|
||||
Colors.white
|
||||
.withOpacity(0.7),
|
||||
Colors.red),
|
||||
fontSize: 13.0,
|
||||
letterSpacing: 0.0,
|
||||
)),
|
||||
),
|
||||
|
@ -285,6 +289,8 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
}
|
||||
},
|
||||
),
|
||||
]),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
24.0, 0.0, 24.0, 0.0),
|
||||
|
@ -419,8 +425,13 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
),
|
||||
if (_model.dropDownValue == null ||
|
||||
_model.dropDownValue == '')
|
||||
Align(
|
||||
alignment: const AlignmentDirectional(0.4, 0),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
top: 5, start: 15),
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
enText: 'This field is required',
|
||||
|
@ -442,6 +453,8 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Builder(
|
||||
builder: (context) {
|
||||
|
|
|
@ -73,23 +73,6 @@ class _VisitDetailsModalTemplateComponentWidgetState
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
log('------------------ VisitDetailsModalTemplateComponentWidget ------------------');
|
||||
log('visitStatusStr: ${widget.visitStatusStr}');
|
||||
log('visitStartDateStr: ${widget.visitStartDateStr}');
|
||||
log('visitEndDateStr: ${widget.visitEndDateStr}');
|
||||
log('visitReasonStr: ${widget.visitReasonStr}');
|
||||
log('visitLevelStr: ${widget.visitLevelStr}');
|
||||
log('visitTempStr: ${widget.visitTempStr}');
|
||||
log('visitObsStr: ${widget.visitObsStr}');
|
||||
log('visitorStrList: ${widget.visitorStrList}');
|
||||
log('visitorJsonList: ${widget.visitorJsonList}');
|
||||
log('visitorImgPath: ${widget.visitorImgPath}');
|
||||
log('visitorImgList: ${widget.visitorImgList}');
|
||||
log('visitIdStr: ${widget.visitIdStr}');
|
||||
log('updateToggleIdx: ${widget.updateToggleIdx}');
|
||||
log('repeatVisitSchedule: ${widget.repeatVisitSchedule}');
|
||||
log('visitStatusColor: ${widget.visitStatusColor}');
|
||||
log('-----------------------------------------------------------------------------');
|
||||
return Builder(
|
||||
builder: (context) {
|
||||
if (widget.visitStatusStr != null && widget.visitStatusStr != '') {
|
||||
|
|
|
@ -98,6 +98,51 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
}
|
||||
|
||||
void toggleNotify(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
title: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
enText: FFAppState().notify
|
||||
? 'Access Notification'
|
||||
: 'Disable Access Notification',
|
||||
ptText: FFAppState().notify
|
||||
? 'Notificação de acesso'
|
||||
: 'Desativar notificação de acesso',
|
||||
),
|
||||
),
|
||||
content: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Tem certeza que deseja desvincular este dispositivo?',
|
||||
enText: 'Are you sure you want to unlink this device?',
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
FFButtonWidget(
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Cancel',
|
||||
ptText: 'Cancelar',
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
options: FFButtonOptions(
|
||||
width: 100,
|
||||
height: 40,
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
textStyle: TextStyle(
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
width: 1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
FFButtonWidget(
|
||||
onPressed: () async {
|
||||
FFAppState().notify = !FFAppState().notify;
|
||||
PhpGroup.changeNotifica
|
||||
.call(
|
||||
|
@ -115,7 +160,8 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
ptText: 'Notificação alterada com sucesso',
|
||||
enText: 'Notification changed successfully',
|
||||
),
|
||||
style: TextStyle(color: FlutterFlowTheme.of(context).info)),
|
||||
style: TextStyle(
|
||||
color: FlutterFlowTheme.of(context).info)),
|
||||
backgroundColor: FlutterFlowTheme.of(context).success,
|
||||
duration: const Duration(seconds: 3),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
|
@ -133,7 +179,8 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
enText: 'Error changing notification',
|
||||
ptText: 'Erro ao alterar notificação',
|
||||
),
|
||||
style: TextStyle(color: FlutterFlowTheme.of(context).info)),
|
||||
style: TextStyle(
|
||||
color: FlutterFlowTheme.of(context).info)),
|
||||
backgroundColor: FlutterFlowTheme.of(context).error,
|
||||
duration: const Duration(seconds: 3),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
|
@ -142,6 +189,28 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
),
|
||||
),
|
||||
);
|
||||
}).whenComplete(() => notifyListeners());
|
||||
},
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Unlink',
|
||||
ptText: 'Desvincular',
|
||||
),
|
||||
options: FFButtonOptions(
|
||||
width: 100,
|
||||
height: 40,
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
textStyle: TextStyle(
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
width: 1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
notifyListeners();
|
||||
}
|
||||
|
|
|
@ -160,12 +160,24 @@ class _ScheduleCompleteVisitPageWidgetState
|
|||
}
|
||||
}
|
||||
|
||||
bool? getStatus(dynamic data) {
|
||||
return data == 'A'
|
||||
? true
|
||||
: data == 'F' || data == 'B' || data == 'C' || data == 'I'
|
||||
? null
|
||||
: false;
|
||||
enum status { active, unknown, canceled, finished, blocked, inactive }
|
||||
|
||||
status? getStatus(dynamic data) {
|
||||
debugPrint('getStatus: $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;
|
||||
}
|
||||
}
|
||||
|
||||
PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
|
||||
|
@ -1739,28 +1751,54 @@ Widget visitHistory(
|
|||
'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '',
|
||||
}),
|
||||
statusHashMap: [
|
||||
getStatus(visitaWrapItem['VAW_STATUS']) == true
|
||||
? Map<String, Color>.from({
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||
status.active)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Ativo',
|
||||
enText: 'Active',
|
||||
): FlutterFlowTheme.of(context).success,
|
||||
})
|
||||
: getStatus(visitaWrapItem['VAW_STATUS']) == null
|
||||
? Map<String, Color>.from({
|
||||
FFLocalizations.of(context)
|
||||
.getVariableText(
|
||||
ptText: 'Pendente',
|
||||
enText: 'Pending',
|
||||
): FlutterFlowTheme.of(context).warning,
|
||||
})
|
||||
: Map<String, Color>.from({
|
||||
FFLocalizations.of(context)
|
||||
.getVariableText(
|
||||
}),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||
status.finished)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Finalizado',
|
||||
enText: 'Finished',
|
||||
): FlutterFlowTheme.of(context).success,
|
||||
}),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||
status.unknown)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Desconhecido',
|
||||
enText: 'Unknown',
|
||||
): FlutterFlowTheme.of(context).alternate,
|
||||
}),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||
status.canceled)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Cancelado',
|
||||
enText: 'Canceled',
|
||||
): FlutterFlowTheme.of(context).error,
|
||||
}),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||
status.blocked)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Bloqueado',
|
||||
enText: 'Blocked',
|
||||
): FlutterFlowTheme.of(context).error,
|
||||
}),
|
||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||
status.inactive)
|
||||
Map<String, Color>.from({
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Inactive',
|
||||
enText: 'Inactive',
|
||||
): FlutterFlowTheme.of(context).error,
|
||||
}),
|
||||
],
|
||||
onTapCardItemAction: () async {
|
||||
showModalBottomSheet(
|
||||
|
|
Loading…
Reference in New Issue