WIP
This commit is contained in:
parent
330d86c102
commit
4989ba6b2b
|
@ -343,6 +343,7 @@ Future<bool> visitRequestComponentAction(
|
||||||
);
|
);
|
||||||
|
|
||||||
if (respondeSolicitacaoCall.statusCode == 200) {
|
if (respondeSolicitacaoCall.statusCode == 200) {
|
||||||
|
log('jsonBody: ${respondeSolicitacaoCall.jsonBody}; actionValue: $actionValue; refUUID: $refUUID; responseValue: $responseValue; vteUUID: $vteUUID');
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
log('headers: ${respondeSolicitacaoCall.headers}');
|
log('headers: ${respondeSolicitacaoCall.headers}');
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/app_state.dart';
|
import 'package:hub/app_state.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';
|
||||||
|
@ -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_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
import 'package:hub/flutter_flow/flutter_flow_widgets.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:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
bool? getStatus(dynamic data) {
|
enum status { active, unknown, canceled, finished, blocked, inactive }
|
||||||
return data == 'A'
|
|
||||||
? true
|
status? getStatus(dynamic data) {
|
||||||
: data == 'F' || data == 'B' || data == 'C' || data == 'I'
|
debugPrint('getStatus: $data');
|
||||||
? false
|
switch (data) {
|
||||||
: null;
|
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(
|
Widget buildDetails(
|
||||||
|
@ -34,10 +49,10 @@ Widget buildDetails(
|
||||||
vawUUID: 'Lorem Ipsus',
|
vawUUID: 'Lorem Ipsus',
|
||||||
vawName: 'Lorem Ipsus',
|
vawName: 'Lorem Ipsus',
|
||||||
vawRef: 'Lorem Ipsus',
|
vawRef: 'Lorem Ipsus',
|
||||||
|
|
||||||
changeStatusAction: changeStatusAction,
|
changeStatusAction: changeStatusAction,
|
||||||
buttons: [
|
buttons: [
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == null) // ACCEPT ACTION
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
status.active) // ACCEPT ACTION
|
||||||
FlutterFlowIconButton(
|
FlutterFlowIconButton(
|
||||||
icon: const Icon(Icons.done),
|
icon: const Icon(Icons.done),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
@ -93,9 +108,9 @@ Widget buildDetails(
|
||||||
await changeStatusAction?.call(
|
await changeStatusAction?.call(
|
||||||
context,
|
context,
|
||||||
'L',
|
'L',
|
||||||
visitaWrapItem['VAW_REF'] ?? '',
|
visitaWrapItem['VAW_ID'] ?? '',
|
||||||
'Mensagem',
|
'Mensagem',
|
||||||
visitaWrapItem['VTE_ID'] ?? '',
|
visitaWrapItem['VTE_DOCUMENTO'] ?? '',
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
options: FFButtonOptions(
|
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(
|
FlutterFlowIconButton(
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
onPressed: () async {
|
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(
|
FlutterFlowIconButton(
|
||||||
icon: const Icon(Icons.refresh),
|
icon: const Icon(Icons.refresh),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
showDialog(
|
Navigator.pop(context);
|
||||||
context: context,
|
Navigator.pop(context);
|
||||||
builder: (context) {
|
context.pushNamed(
|
||||||
return AlertDialog(
|
'scheduleCompleteVisitPage',
|
||||||
title: Text(
|
queryParameters: {
|
||||||
FFLocalizations.of(context).getVariableText(
|
'visitorStrList': serializeParam(
|
||||||
ptText: 'Bloquear Visita',
|
visitaWrapItem['VTE_DOCUMENTO'],
|
||||||
enText: 'Block Visit',
|
ParamType.String,
|
||||||
),
|
),
|
||||||
),
|
'visitorJsonList': serializeParam(
|
||||||
content: Text(
|
[visitaWrapItem],
|
||||||
FFLocalizations.of(context).getVariableText(
|
ParamType.JSON,
|
||||||
ptText:
|
isList: true,
|
||||||
'Você tem certeza que deseja bloquear essa visita?',
|
),
|
||||||
enText: 'Are you sure you want to block this visit?',
|
}.withoutNulls,
|
||||||
),
|
);
|
||||||
),
|
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == false) // SHARE ACTION
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
status.finished) // SHARE ACTION
|
||||||
FlutterFlowIconButton(
|
FlutterFlowIconButton(
|
||||||
icon: const Icon(Icons.share),
|
icon: const Icon(Icons.share),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Share.share(r'''
|
Share.share('''
|
||||||
Olá ${visitaWrapItem['VTE_NOME']}
|
Olá, \*${visitaWrapItem['VTE_NOME']}\*! Você foi convidado para \*${visitaWrapItem['NAC_DESCRICAO']}\*.
|
||||||
Você foi convidado para ${visitaWrapItem['NAC_DESCRICAO']}
|
|
||||||
|
|
||||||
Validade do Convite:
|
\*Validade do Convite\*:
|
||||||
visitaWrapItem['VAW_DTINICIO']
|
- Início: ${visitaWrapItem['VAW_DTINICIO']}
|
||||||
visitaWrapItem['VAW_DTFIM']
|
- Fim: ${visitaWrapItem['VAW_DTFIM']}
|
||||||
|
|
||||||
URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${visitaWrapItem['CLI_ID']}/${visitaWrapItem['VAW_CHAVE']}
|
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({
|
labelsHashMap: Map<String, String>.from({
|
||||||
'Nome': visitaWrapItem['VTE_NOME'] ?? '',
|
'Nome': visitaWrapItem['VTE_NOME'] ?? '',
|
||||||
|
@ -389,27 +265,48 @@ Widget buildDetails(
|
||||||
'value': 'E',
|
'value': 'E',
|
||||||
}),
|
}),
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
getStatus(visitaWrapItem['VAW_STATUS']) == true
|
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
|
||||||
? Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Ativo',
|
ptText: 'Ativo',
|
||||||
enText: 'Active',
|
enText: 'Active',
|
||||||
): FlutterFlowTheme.of(context).success,
|
): FlutterFlowTheme.of(context).warning,
|
||||||
})
|
}),
|
||||||
: getStatus(visitaWrapItem['VAW_STATUS']) == null
|
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.unknown)
|
||||||
? Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Pendente',
|
ptText: 'Pendente',
|
||||||
enText: 'Pending',
|
enText: 'Pending',
|
||||||
): FlutterFlowTheme.of(context).warning,
|
): FlutterFlowTheme.of(context).alternate,
|
||||||
})
|
}),
|
||||||
: Map<String, Color>.from({
|
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.canceled)
|
||||||
FFLocalizations.of(context).getVariableText(
|
Map<String, Color>.from({
|
||||||
ptText: 'Cancelado',
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Canceled',
|
ptText: 'Cancelado',
|
||||||
): FlutterFlowTheme.of(context).error,
|
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,136 +154,142 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
24.0, 0.0, 24.0, 0.0),
|
24.0, 0.0, 24.0, 0.0),
|
||||||
child: TextFormField(
|
child: Column(children: [
|
||||||
controller: _model.textController2,
|
TextFormField(
|
||||||
focusNode: _model.textFieldFocusNode2,
|
controller: _model.textController2,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
focusNode: _model.textFieldFocusNode2,
|
||||||
autofocus: false,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
textCapitalization: TextCapitalization.none,
|
autofocus: false,
|
||||||
autofillHints: const [AutofillHints.password],
|
textCapitalization: TextCapitalization.none,
|
||||||
keyboardType: TextInputType.number,
|
autofillHints: const [AutofillHints.password],
|
||||||
textInputAction: TextInputAction.next,
|
keyboardType: TextInputType.number,
|
||||||
obscureText: false,
|
textInputAction: TextInputAction.next,
|
||||||
decoration: InputDecoration(
|
obscureText: false,
|
||||||
isDense: true,
|
decoration: InputDecoration(
|
||||||
labelText: FFLocalizations.of(context).getText(
|
isDense: true,
|
||||||
'rl8tvwnr' /* Documento */,
|
labelText: FFLocalizations.of(context).getText(
|
||||||
|
'rl8tvwnr' /* Documento */,
|
||||||
|
),
|
||||||
|
labelStyle: FlutterFlowTheme.of(context)
|
||||||
|
.labelMedium
|
||||||
|
.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context)
|
||||||
|
.labelMediumFamily,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).customColor6,
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primary,
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).error,
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
focusedErrorBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).error,
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
suffixIcon: Icon(
|
||||||
|
Icons.document_scanner,
|
||||||
|
color: FlutterFlowTheme.of(context).accent1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
labelStyle: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
.labelMedium
|
|
||||||
.override(
|
|
||||||
fontFamily:
|
fontFamily:
|
||||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
FlutterFlowTheme.of(context).labelMediumFamily),
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
),
|
),
|
||||||
hintStyle: FlutterFlowTheme.of(context)
|
validator:
|
||||||
.labelMedium
|
_model.textController2Validator.asValidator(context),
|
||||||
.override(
|
inputFormatters: [
|
||||||
fontFamily:
|
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
],
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).labelMediumFamily),
|
|
||||||
),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).customColor6,
|
|
||||||
width: 0.5,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).primary,
|
|
||||||
width: 0.5,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
|
||||||
),
|
|
||||||
errorBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).error,
|
|
||||||
width: 0.5,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
|
||||||
),
|
|
||||||
focusedErrorBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).error,
|
|
||||||
width: 0.5,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
|
||||||
),
|
|
||||||
suffixIcon: Icon(
|
|
||||||
Icons.document_scanner,
|
|
||||||
color: FlutterFlowTheme.of(context).accent1,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
FutureBuilder(
|
||||||
fontFamily:
|
future: _model.textController2.text.isNotEmpty
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
? _model.getVisitanteByDocument(
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
_model.textController2.text, context)
|
||||||
letterSpacing: 0.0,
|
: null,
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
if (snapshot.connectionState ==
|
||||||
),
|
ConnectionState.waiting) {
|
||||||
validator:
|
return const SizedBox();
|
||||||
_model.textController2Validator.asValidator(context),
|
} else if (snapshot.hasError ||
|
||||||
inputFormatters: [
|
snapshot.data == null ||
|
||||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
snapshot.data == '') {
|
||||||
],
|
// safeSetState(() => _isVisitorRegistered = false);
|
||||||
),
|
_isVisitorRegistered = false;
|
||||||
),
|
visitorAlreadyRegistered.add(true);
|
||||||
FutureBuilder(
|
return const SizedBox();
|
||||||
future: _model.textController2.text.isNotEmpty
|
} else {
|
||||||
? _model.getVisitanteByDocument(
|
_isVisitorRegistered = true;
|
||||||
_model.textController2.text, context)
|
visitorAlreadyRegistered.add(false);
|
||||||
: null,
|
return _model.textController2.text.isEmpty
|
||||||
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
? const SizedBox()
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
: Row(
|
||||||
return const SizedBox();
|
mainAxisSize: MainAxisSize.max,
|
||||||
} else if (snapshot.hasError ||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
snapshot.data == null ||
|
children: [
|
||||||
snapshot.data == '') {
|
Padding(
|
||||||
// safeSetState(() => _isVisitorRegistered = false);
|
padding: const EdgeInsetsDirectional.only(
|
||||||
_isVisitorRegistered = false;
|
top: 5, start: 12),
|
||||||
visitorAlreadyRegistered.add(true);
|
child: Text(
|
||||||
return const SizedBox();
|
FFLocalizations.of(context)
|
||||||
} else {
|
.getVariableText(
|
||||||
_isVisitorRegistered = true;
|
enText:
|
||||||
visitorAlreadyRegistered.add(false);
|
'Visitor already registered',
|
||||||
return _model.textController2.text.isEmpty
|
ptText: 'Visitante já cadastrado',
|
||||||
? const SizedBox()
|
),
|
||||||
: Row(
|
style: FlutterFlowTheme.of(context)
|
||||||
mainAxisSize: MainAxisSize.max,
|
.labelSmall
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
.override(
|
||||||
children: [
|
fontFamily: 'Nunito',
|
||||||
Padding(
|
color: Color.alphaBlend(
|
||||||
padding: EdgeInsets.only(
|
Colors.white
|
||||||
right: MediaQuery.sizeOf(context).width *
|
.withOpacity(0.7),
|
||||||
0.1),
|
Colors.red),
|
||||||
child: Text(
|
fontSize: 13.0,
|
||||||
FFLocalizations.of(context)
|
letterSpacing: 0.0,
|
||||||
.getVariableText(
|
)),
|
||||||
enText: 'Visitor already registered',
|
),
|
||||||
ptText: 'Visitante já cadastrado',
|
],
|
||||||
),
|
);
|
||||||
style: FlutterFlowTheme.of(context)
|
}
|
||||||
.bodySmall
|
},
|
||||||
.override(
|
),
|
||||||
fontFamily: 'Nunito',
|
]),
|
||||||
color: FlutterFlowTheme.of(context)
|
|
||||||
.error,
|
|
||||||
fontSize: 14.0,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
|
@ -419,26 +425,33 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
),
|
),
|
||||||
if (_model.dropDownValue == null ||
|
if (_model.dropDownValue == null ||
|
||||||
_model.dropDownValue == '')
|
_model.dropDownValue == '')
|
||||||
Align(
|
Row(
|
||||||
alignment: const AlignmentDirectional(0.4, 0),
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
child: Text(
|
mainAxisSize: MainAxisSize.max,
|
||||||
FFLocalizations.of(context).getVariableText(
|
children: [
|
||||||
enText: 'This field is required',
|
Padding(
|
||||||
ptText: 'Este campo é obrigatório',
|
padding: const EdgeInsetsDirectional.only(
|
||||||
),
|
top: 5, start: 15),
|
||||||
style: FlutterFlowTheme.of(context)
|
child: Text(
|
||||||
.bodySmall
|
FFLocalizations.of(context).getVariableText(
|
||||||
.override(
|
enText: 'This field is required',
|
||||||
fontFamily: FlutterFlowTheme.of(context)
|
ptText: 'Este campo é obrigatório',
|
||||||
.bodySmallFamily,
|
),
|
||||||
color: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context)
|
||||||
.customColor6,
|
.bodySmall
|
||||||
letterSpacing: 0.0,
|
.override(
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
fontFamily: FlutterFlowTheme.of(context)
|
||||||
.containsKey(
|
.bodySmallFamily,
|
||||||
FlutterFlowTheme.of(context)
|
color: FlutterFlowTheme.of(context)
|
||||||
.bodySmallFamily),
|
.customColor6,
|
||||||
)),
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap()
|
||||||
|
.containsKey(
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.bodySmallFamily),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -73,23 +73,6 @@ class _VisitDetailsModalTemplateComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return Builder(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
if (widget.visitStatusStr != null && widget.visitStatusStr != '') {
|
if (widget.visitStatusStr != null && widget.visitStatusStr != '') {
|
||||||
|
|
|
@ -98,51 +98,120 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleNotify(BuildContext context) {
|
void toggleNotify(BuildContext context) {
|
||||||
FFAppState().notify = !FFAppState().notify;
|
showDialog(
|
||||||
PhpGroup.changeNotifica
|
context: context,
|
||||||
.call(
|
builder: (context) {
|
||||||
userUUID: FFAppState().userUUID,
|
return AlertDialog(
|
||||||
devUUID: FFAppState().devUUID,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
cliID: FFAppState().cliUUID,
|
title: Text(
|
||||||
atividade: 'updVisitado',
|
|
||||||
notifica: FFAppState().notify ? 'S' : 'N',
|
|
||||||
)
|
|
||||||
.then((value) {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: Text(
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Notificação alterada com sucesso',
|
enText: FFAppState().notify
|
||||||
enText: 'Notification changed successfully',
|
? 'Access Notification'
|
||||||
|
: 'Disable Access Notification',
|
||||||
|
ptText: FFAppState().notify
|
||||||
|
? 'Notificação de acesso'
|
||||||
|
: 'Desativar notificação de acesso',
|
||||||
),
|
),
|
||||||
style: TextStyle(color: FlutterFlowTheme.of(context).info)),
|
),
|
||||||
backgroundColor: FlutterFlowTheme.of(context).success,
|
content: Text(
|
||||||
duration: const Duration(seconds: 3),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(30),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}).catchError((err) {
|
|
||||||
log(err.toString());
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: Text(
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Error changing notification',
|
ptText: 'Tem certeza que deseja desvincular este dispositivo?',
|
||||||
ptText: 'Erro ao alterar notificação',
|
enText: 'Are you sure you want to unlink this device?',
|
||||||
),
|
),
|
||||||
style: TextStyle(color: FlutterFlowTheme.of(context).info)),
|
),
|
||||||
backgroundColor: FlutterFlowTheme.of(context).error,
|
actions: [
|
||||||
duration: const Duration(seconds: 3),
|
FFButtonWidget(
|
||||||
behavior: SnackBarBehavior.floating,
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
shape: RoundedRectangleBorder(
|
enText: 'Cancel',
|
||||||
borderRadius: BorderRadius.circular(30),
|
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(
|
||||||
|
userUUID: FFAppState().userUUID,
|
||||||
|
devUUID: FFAppState().devUUID,
|
||||||
|
cliID: FFAppState().cliUUID,
|
||||||
|
atividade: 'updVisitado',
|
||||||
|
notifica: FFAppState().notify ? 'S' : 'N',
|
||||||
|
)
|
||||||
|
.then((value) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Notificação alterada com sucesso',
|
||||||
|
enText: 'Notification changed successfully',
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).info)),
|
||||||
|
backgroundColor: FlutterFlowTheme.of(context).success,
|
||||||
|
duration: const Duration(seconds: 3),
|
||||||
|
behavior: SnackBarBehavior.floating,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(30),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).catchError((err) {
|
||||||
|
log(err.toString());
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Error changing notification',
|
||||||
|
ptText: 'Erro ao alterar notificação',
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).info)),
|
||||||
|
backgroundColor: FlutterFlowTheme.of(context).error,
|
||||||
|
duration: const Duration(seconds: 3),
|
||||||
|
behavior: SnackBarBehavior.floating,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(30),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).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();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,12 +160,24 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool? getStatus(dynamic data) {
|
enum status { active, unknown, canceled, finished, blocked, inactive }
|
||||||
return data == 'A'
|
|
||||||
? true
|
status? getStatus(dynamic data) {
|
||||||
: data == 'F' || data == 'B' || data == 'C' || data == 'I'
|
debugPrint('getStatus: $data');
|
||||||
? null
|
switch (data) {
|
||||||
: false;
|
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) {
|
PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
|
||||||
|
@ -1739,28 +1751,54 @@ Widget visitHistory(
|
||||||
'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '',
|
'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '',
|
||||||
}),
|
}),
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
getStatus(visitaWrapItem['VAW_STATUS']) == true
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
? Map<String, Color>.from({
|
status.active)
|
||||||
FFLocalizations.of(context).getVariableText(
|
Map<String, Color>.from({
|
||||||
ptText: 'Ativo',
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Active',
|
ptText: 'Ativo',
|
||||||
): FlutterFlowTheme.of(context).success,
|
enText: 'Active',
|
||||||
})
|
): FlutterFlowTheme.of(context).warning,
|
||||||
: getStatus(visitaWrapItem['VAW_STATUS']) == null
|
}),
|
||||||
? Map<String, Color>.from({
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
FFLocalizations.of(context)
|
status.finished)
|
||||||
.getVariableText(
|
Map<String, Color>.from({
|
||||||
ptText: 'Pendente',
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Pending',
|
ptText: 'Finalizado',
|
||||||
): FlutterFlowTheme.of(context).warning,
|
enText: 'Finished',
|
||||||
})
|
): FlutterFlowTheme.of(context).success,
|
||||||
: Map<String, Color>.from({
|
}),
|
||||||
FFLocalizations.of(context)
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
.getVariableText(
|
status.unknown)
|
||||||
ptText: 'Cancelado',
|
Map<String, Color>.from({
|
||||||
enText: 'Canceled',
|
FFLocalizations.of(context).getVariableText(
|
||||||
): FlutterFlowTheme.of(context).error,
|
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 {
|
onTapCardItemAction: () async {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
|
Loading…
Reference in New Issue