WIP
This commit is contained in:
parent
09b339da8d
commit
ccd63168bd
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import '/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart';
|
import '/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_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';
|
||||||
|
@ -12,10 +11,7 @@ export 'local_profile_component_model.dart';
|
||||||
////
|
////
|
||||||
|
|
||||||
class LocalProfileComponentWidget extends StatefulWidget {
|
class LocalProfileComponentWidget extends StatefulWidget {
|
||||||
const LocalProfileComponentWidget({
|
const LocalProfileComponentWidget({required bool localStatus, super.key});
|
||||||
required bool localStatus,
|
|
||||||
super.key
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<LocalProfileComponentWidget> createState() =>
|
State<LocalProfileComponentWidget> createState() =>
|
||||||
|
@ -87,8 +83,7 @@ class _LocalProfileComponentWidgetState
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
padding: MediaQuery.viewInsetsOf(context),
|
||||||
child: const SizedBox(
|
child: const SizedBox(
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
child:
|
child: BottomArrowLinkedLocalsComponentWidget(),
|
||||||
BottomArrowLinkedLocalsComponentWidget(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -96,23 +91,23 @@ class _LocalProfileComponentWidgetState
|
||||||
},
|
},
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(200.0),
|
borderRadius: BorderRadius.circular(200.0),
|
||||||
child:
|
child: Image.network(
|
||||||
Image.network(
|
|
||||||
'https://freaccess.com.br/freaccess/Images/Clients/${FFAppState().cliUUID}.png',
|
'https://freaccess.com.br/freaccess/Images/Clients/${FFAppState().cliUUID}.png',
|
||||||
width: 80.0,
|
width: 80.0,
|
||||||
height: 80.0,
|
height: 80.0,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
alignment: const Alignment(0.0, 0.0),
|
alignment: const Alignment(0.0, 0.0),
|
||||||
errorBuilder: (context, error, stackTrace) => Image.network(
|
errorBuilder: (context, error, stackTrace) =>
|
||||||
|
Image.network(
|
||||||
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
||||||
width: 80.0,
|
width: 80.0,
|
||||||
height: 80.0,
|
height: 80.0,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
alignment: const Alignment(0.0, 0.0),
|
alignment: const Alignment(0.0, 0.0),
|
||||||
errorBuilder: (context, error, stackTrace) => Image.asset('assets/images/error_image.svg'),
|
errorBuilder: (context, error, stackTrace) =>
|
||||||
),
|
Image.asset('assets/images/error_image.svg'),
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -125,8 +120,7 @@ class _LocalProfileComponentWidgetState
|
||||||
functions.convertToUppercase(FFAppState().local),
|
functions.convertToUppercase(FFAppState().local),
|
||||||
'NOME DO LOCAL',
|
'NOME DO LOCAL',
|
||||||
),
|
),
|
||||||
style:
|
style: FlutterFlowTheme.of(context).labelMedium.override(
|
||||||
FlutterFlowTheme.of(context).labelMedium.override(
|
|
||||||
fontFamily: 'Nunito',
|
fontFamily: 'Nunito',
|
||||||
color: FlutterFlowTheme.of(context).info,
|
color: FlutterFlowTheme.of(context).info,
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
|
|
|
@ -84,7 +84,6 @@ Widget buildDetails(
|
||||||
)
|
)
|
||||||
.then((value) {
|
.then((value) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
|
||||||
if (value == false) {
|
if (value == false) {
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context,
|
context,
|
||||||
|
@ -105,6 +104,8 @@ Widget buildDetails(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}).catchError((err, stack) {
|
}).catchError((err, stack) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context,
|
context,
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
|
|
@ -91,9 +91,7 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
|
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
return Padding(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
||||||
child: Container(
|
|
||||||
width: constraints.maxWidth,
|
width: constraints.maxWidth,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
@ -151,8 +149,7 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
color: FlutterFlowTheme.of(context).info,
|
color: FlutterFlowTheme.of(context).info,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
useGoogleFonts: GoogleFonts.asMap()
|
||||||
.containsKey(
|
.containsKey(FlutterFlowTheme.of(context)
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.labelMediumFamily),
|
.labelMediumFamily),
|
||||||
),
|
),
|
||||||
hintStyle: FlutterFlowTheme.of(context)
|
hintStyle: FlutterFlowTheme.of(context)
|
||||||
|
@ -163,8 +160,7 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
color: FlutterFlowTheme.of(context).info,
|
color: FlutterFlowTheme.of(context).info,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
useGoogleFonts: GoogleFonts.asMap()
|
||||||
.containsKey(
|
.containsKey(FlutterFlowTheme.of(context)
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.labelMediumFamily),
|
.labelMediumFamily),
|
||||||
),
|
),
|
||||||
focusedBorder: InputBorder.none,
|
focusedBorder: InputBorder.none,
|
||||||
|
@ -172,7 +168,7 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
focusedErrorBorder: InputBorder.none,
|
focusedErrorBorder: InputBorder.none,
|
||||||
suffixIcon: Icon(
|
suffixIcon: Icon(
|
||||||
Icons.info,
|
Icons.info,
|
||||||
color: FlutterFlowTheme.of(context).accent1,
|
color: FlutterFlowTheme.of(context).info,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context)
|
||||||
|
@ -182,8 +178,8 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
.bodyMediumFamily,
|
.bodyMediumFamily,
|
||||||
color: FlutterFlowTheme.of(context).info,
|
color: FlutterFlowTheme.of(context).info,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
.containsKey(FlutterFlowTheme.of(context)
|
FlutterFlowTheme.of(context)
|
||||||
.bodyMediumFamily),
|
.bodyMediumFamily),
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
|
@ -240,8 +236,7 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
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)
|
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||||
.labelMediumFamily,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
hintStyle: FlutterFlowTheme.of(context)
|
hintStyle: FlutterFlowTheme.of(context)
|
||||||
|
@ -252,8 +247,7 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
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)
|
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||||
.labelMediumFamily,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
|
@ -302,7 +296,6 @@ class _VisitRequestTemplateComponentWidgetState
|
||||||
.addToEnd(const SizedBox(height: 20.0))
|
.addToEnd(const SizedBox(height: 20.0))
|
||||||
.addToStart(const SizedBox(height: 20.0)),
|
.addToStart(const SizedBox(height: 20.0)),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -97,38 +97,10 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
|
||||||
name: 'scheduleCompleteVisitPage',
|
name: 'scheduleCompleteVisitPage',
|
||||||
path: '/scheduleCompleteVisitPage',
|
path: '/scheduleCompleteVisitPage',
|
||||||
builder: (context, params) => ScheduleCompleteVisitPageWidget(
|
builder: (context, params) => ScheduleCompleteVisitPageWidget(
|
||||||
// get current datatime picker dd/mm/aaaa hh:mm:ss
|
|
||||||
// visitStartDateStr: DateTime.now().toString(),
|
|
||||||
// post 1 day
|
|
||||||
// visitEndDateStr: DateTime.now().add(const Duration(days: 1)).toString(),
|
|
||||||
visitorStrList: params.getParam(
|
visitorStrList: params.getParam(
|
||||||
'visitorStrList',
|
'visitorStrList',
|
||||||
ParamType.String,
|
ParamType.String,
|
||||||
),
|
),
|
||||||
visitStartDateStr: params.getParam(
|
|
||||||
'visitStartDateStr',
|
|
||||||
ParamType.String,
|
|
||||||
),
|
|
||||||
visitEndDateStr: params.getParam(
|
|
||||||
'visitEndDateStr',
|
|
||||||
ParamType.String,
|
|
||||||
),
|
|
||||||
visitReasonStr: params.getParam(
|
|
||||||
'visitReasonStr',
|
|
||||||
ParamType.String,
|
|
||||||
),
|
|
||||||
visitLevelStr: params.getParam(
|
|
||||||
'visitLevelStr',
|
|
||||||
ParamType.String,
|
|
||||||
),
|
|
||||||
visitTempBol: params.getParam(
|
|
||||||
'visitTempBol',
|
|
||||||
ParamType.bool,
|
|
||||||
),
|
|
||||||
visitObsStr: params.getParam(
|
|
||||||
'visitObsStr',
|
|
||||||
ParamType.String,
|
|
||||||
),
|
|
||||||
visitorJsonList: params.getParam<dynamic>(
|
visitorJsonList: params.getParam<dynamic>(
|
||||||
'visitorJsonList',
|
'visitorJsonList',
|
||||||
ParamType.JSON,
|
ParamType.JSON,
|
||||||
|
|
|
@ -20,14 +20,14 @@ void main() async {
|
||||||
DeviceOrientation.portraitUp,
|
DeviceOrientation.portraitUp,
|
||||||
DeviceOrientation.portraitDown,
|
DeviceOrientation.portraitDown,
|
||||||
]);
|
]);
|
||||||
await initializeApp();
|
await init();
|
||||||
runApp(ChangeNotifierProvider(
|
runApp(ChangeNotifierProvider(
|
||||||
create: (context) => FFAppState(),
|
create: (context) => FFAppState(),
|
||||||
child: const MyApp(),
|
child: const MyApp(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initializeApp() async {
|
Future<void> init() async {
|
||||||
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
||||||
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
|
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
|
||||||
await FlutterFlowTheme.initialize();
|
await FlutterFlowTheme.initialize();
|
||||||
|
|
|
@ -330,14 +330,16 @@ Widget liberationHistoryItemCard(
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
onTapCardItemAction: () async {
|
onTapCardItemAction: () async {
|
||||||
showModalBottomSheet(
|
showDialog(
|
||||||
isScrollControlled: true,
|
// isScrollControlled: true,
|
||||||
isDismissible: true,
|
// isDismissible: true,
|
||||||
backgroundColor: Colors.transparent,
|
// backgroundColor: Colors.transparent,
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return VisitRequestTemplateComponentWidget(
|
return Dialog(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: VisitRequestTemplateComponentWidget(
|
||||||
// vteName: liberationHistoryItem['VTE_NOME'],
|
// vteName: liberationHistoryItem['VTE_NOME'],
|
||||||
// vteReason: liberationHistoryItem['NOT_MOTIVO'],
|
// vteReason: liberationHistoryItem['NOT_MOTIVO'],
|
||||||
// vawDate: liberationHistoryItem['NOT_STATUS'] == 'S'
|
// vawDate: liberationHistoryItem['NOT_STATUS'] == 'S'
|
||||||
|
@ -382,12 +384,12 @@ Widget liberationHistoryItemCard(
|
||||||
'Are you sure you want to approve this visit?',
|
'Are you sure you want to approve this visit?',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
backgroundColor:
|
backgroundColor: FlutterFlowTheme.of(context)
|
||||||
FlutterFlowTheme.of(context).primaryBackground,
|
.primaryBackground,
|
||||||
actions: [
|
actions: [
|
||||||
FFButtonWidget(
|
FFButtonWidget(
|
||||||
text:
|
text: FFLocalizations.of(context)
|
||||||
FFLocalizations.of(context).getVariableText(
|
.getVariableText(
|
||||||
enText: 'No',
|
enText: 'No',
|
||||||
ptText: 'Não',
|
ptText: 'Não',
|
||||||
),
|
),
|
||||||
|
@ -411,8 +413,8 @@ Widget liberationHistoryItemCard(
|
||||||
borderRadius: BorderRadius.circular(10)),
|
borderRadius: BorderRadius.circular(10)),
|
||||||
),
|
),
|
||||||
FFButtonWidget(
|
FFButtonWidget(
|
||||||
text:
|
text: FFLocalizations.of(context)
|
||||||
FFLocalizations.of(context).getVariableText(
|
.getVariableText(
|
||||||
enText: 'Yes',
|
enText: 'Yes',
|
||||||
ptText: 'Sim',
|
ptText: 'Sim',
|
||||||
),
|
),
|
||||||
|
@ -475,12 +477,12 @@ Widget liberationHistoryItemCard(
|
||||||
'Are you sure you want to block this visit?',
|
'Are you sure you want to block this visit?',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
backgroundColor:
|
backgroundColor: FlutterFlowTheme.of(context)
|
||||||
FlutterFlowTheme.of(context).primaryBackground,
|
.primaryBackground,
|
||||||
actions: [
|
actions: [
|
||||||
FFButtonWidget(
|
FFButtonWidget(
|
||||||
text:
|
text: FFLocalizations.of(context)
|
||||||
FFLocalizations.of(context).getVariableText(
|
.getVariableText(
|
||||||
enText: 'No',
|
enText: 'No',
|
||||||
ptText: 'Não',
|
ptText: 'Não',
|
||||||
),
|
),
|
||||||
|
@ -504,18 +506,20 @@ Widget liberationHistoryItemCard(
|
||||||
borderRadius: BorderRadius.circular(10)),
|
borderRadius: BorderRadius.circular(10)),
|
||||||
),
|
),
|
||||||
FFButtonWidget(
|
FFButtonWidget(
|
||||||
text:
|
text: FFLocalizations.of(context)
|
||||||
FFLocalizations.of(context).getVariableText(
|
.getVariableText(
|
||||||
enText: 'Yes',
|
enText: 'Yes',
|
||||||
ptText: 'Sim',
|
ptText: 'Sim',
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await answersRequest.call(
|
await answersRequest.call(
|
||||||
context,
|
context,
|
||||||
liberationHistoryItem['NOT_ID'].toString(),
|
liberationHistoryItem['NOT_ID']
|
||||||
|
.toString(),
|
||||||
'B',
|
'B',
|
||||||
'Mensagem',
|
'Mensagem',
|
||||||
liberationHistoryItem['VTE_ID'].toString(),
|
liberationHistoryItem['VTE_ID']
|
||||||
|
.toString(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
options: FFButtonOptions(
|
options: FFButtonOptions(
|
||||||
|
@ -569,6 +573,7 @@ Widget liberationHistoryItemCard(
|
||||||
}),
|
}),
|
||||||
// changeStatusAction: answersRequest,
|
// changeStatusAction: answersRequest,
|
||||||
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
|
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).then((_) {
|
).then((_) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ 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/flutter_flow_util.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/request_manager.dart';
|
import 'package:hub/flutter_flow/request_manager.dart';
|
||||||
|
@ -164,11 +165,21 @@ class ScheduleCompleteVisitPageModel
|
||||||
);
|
);
|
||||||
|
|
||||||
textFieldFocusNode1 = FocusNode();
|
textFieldFocusNode1 = FocusNode();
|
||||||
textController1 = TextEditingController();
|
textController1 = TextEditingController(
|
||||||
|
text: dateTimeFormat(
|
||||||
|
'd/M/y H:mm:ss',
|
||||||
|
DateTime.now().add(const Duration(minutes: 10)),
|
||||||
|
// locale: FFLocalizations.of(context).languageCode,
|
||||||
|
));
|
||||||
textController1Validator = _textController1Validator;
|
textController1Validator = _textController1Validator;
|
||||||
|
|
||||||
textFieldFocusNode2 = FocusNode();
|
textFieldFocusNode2 = FocusNode();
|
||||||
textController2 = TextEditingController();
|
textController2 = TextEditingController(
|
||||||
|
text: dateTimeFormat(
|
||||||
|
'd/M/y H:mm:ss',
|
||||||
|
DateTime.now().add(const Duration(days: 1)),
|
||||||
|
// locale: FFLocalizations.of(context).languageCode,
|
||||||
|
));
|
||||||
textController2Validator = _textController2Validator;
|
textController2Validator = _textController2Validator;
|
||||||
|
|
||||||
textFieldFocusNode3 = FocusNode();
|
textFieldFocusNode3 = FocusNode();
|
||||||
|
|
|
@ -29,22 +29,10 @@ class ScheduleCompleteVisitPageWidget extends StatefulWidget {
|
||||||
const ScheduleCompleteVisitPageWidget({
|
const ScheduleCompleteVisitPageWidget({
|
||||||
super.key,
|
super.key,
|
||||||
this.visitorStrList,
|
this.visitorStrList,
|
||||||
this.visitStartDateStr,
|
|
||||||
this.visitEndDateStr,
|
|
||||||
this.visitReasonStr,
|
|
||||||
this.visitLevelStr,
|
|
||||||
this.visitTempBol,
|
|
||||||
this.visitObsStr,
|
|
||||||
this.visitorJsonList,
|
this.visitorJsonList,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String? visitorStrList;
|
final String? visitorStrList;
|
||||||
final String? visitStartDateStr;
|
|
||||||
final String? visitEndDateStr;
|
|
||||||
final String? visitReasonStr;
|
|
||||||
final String? visitLevelStr;
|
|
||||||
final bool? visitTempBol;
|
|
||||||
final String? visitObsStr;
|
|
||||||
final List<dynamic>? visitorJsonList;
|
final List<dynamic>? visitorJsonList;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -250,10 +238,7 @@ Widget bodyScheduleCompleteVisit(
|
||||||
scheduleVisit(context, _model, setState, safeSetState),
|
scheduleVisit(context, _model, setState, safeSetState),
|
||||||
wrapWithModel(
|
wrapWithModel(
|
||||||
model: _model,
|
model: _model,
|
||||||
child: VisitHistoryWidget(
|
child: VisitHistoryWidget(),
|
||||||
model: _model,
|
|
||||||
safeSetState: safeSetState,
|
|
||||||
),
|
|
||||||
updateCallback: () {
|
updateCallback: () {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
import 'package:hub/actions/actions.dart';
|
||||||
import 'package:hub/app_state.dart';
|
import 'package:hub/app_state.dart';
|
||||||
|
@ -6,33 +8,24 @@ import 'package:hub/backend/api_requests/api_manager.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/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/internationalization.dart';
|
import 'package:hub/flutter_flow/internationalization.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:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class VisitHistoryWidget extends StatelessWidget {
|
class VisitHistoryWidget extends StatefulWidget {
|
||||||
final ScheduleCompleteVisitPageModel _model;
|
VisitHistoryWidget({
|
||||||
final Function safeSetState;
|
|
||||||
|
|
||||||
const VisitHistoryWidget({
|
|
||||||
Key? key,
|
Key? key,
|
||||||
required ScheduleCompleteVisitPageModel model,
|
}) : super(key: key);
|
||||||
required this.safeSetState,
|
|
||||||
}) : _model = model,
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
_VisitHistoryWidgetState createState() => _VisitHistoryWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _VisitHistoryWidgetState extends State<VisitHistoryWidget> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
var response = ScheduleCompleteVisitPageModel().visitHistory(
|
||||||
width: double.infinity,
|
|
||||||
height: 900.0,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
),
|
|
||||||
child: Consumer<ScheduleCompleteVisitPageModel>(
|
|
||||||
builder: (context, model, _) {
|
|
||||||
return StreamBuilder<ApiCallResponse>(
|
|
||||||
stream: model.visitHistory(
|
|
||||||
requestFn: () => PhpGroup.getVisitsCall.call(
|
requestFn: () => PhpGroup.getVisitsCall.call(
|
||||||
devUUID: FFAppState().devUUID,
|
devUUID: FFAppState().devUUID,
|
||||||
userUUID: FFAppState().userUUID,
|
userUUID: FFAppState().userUUID,
|
||||||
|
@ -41,7 +34,16 @@ class VisitHistoryWidget extends StatelessWidget {
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNumber: 1,
|
pageNumber: 1,
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
return Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 900.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
),
|
),
|
||||||
|
// child: Consumer<ScheduleCompleteVisitPageModel>(
|
||||||
|
child: StreamBuilder<dynamic>(
|
||||||
|
stream: response,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
return Center(
|
return Center(
|
||||||
|
@ -56,11 +58,13 @@ class VisitHistoryWidget extends StatelessWidget {
|
||||||
} else if (!snapshot.hasData || snapshot.data!.jsonBody == null) {
|
} else if (!snapshot.hasData || snapshot.data!.jsonBody == null) {
|
||||||
return const Center(child: Text('No visits found'));
|
return const Center(child: Text('No visits found'));
|
||||||
}
|
}
|
||||||
final wrapGetVisitsResponse = snapshot.data!;
|
var wrapGetVisitsResponse = snapshot.data!;
|
||||||
final visitaWrap = PhpGroup.getVisitsCall
|
var visitaWrap = PhpGroup.getVisitsCall
|
||||||
.visitasList(wrapGetVisitsResponse.jsonBody)
|
.visitasList(wrapGetVisitsResponse.jsonBody)
|
||||||
?.toList() ??
|
?.toList() ??
|
||||||
[];
|
[];
|
||||||
|
log('updated');
|
||||||
|
log('visitaWrap: ${visitaWrap[0]}');
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: visitaWrap.length,
|
itemCount: visitaWrap.length,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
|
@ -78,8 +82,7 @@ class VisitHistoryWidget extends StatelessWidget {
|
||||||
'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '',
|
'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '',
|
||||||
},
|
},
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
|
||||||
status.active)
|
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Ativo',
|
ptText: 'Ativo',
|
||||||
|
@ -94,8 +97,7 @@ class VisitHistoryWidget extends StatelessWidget {
|
||||||
enText: 'Finished',
|
enText: 'Finished',
|
||||||
): FlutterFlowTheme.of(context).success,
|
): FlutterFlowTheme.of(context).success,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.unknown)
|
||||||
status.unknown)
|
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Desconhecido',
|
ptText: 'Desconhecido',
|
||||||
|
@ -110,8 +112,7 @@ class VisitHistoryWidget extends StatelessWidget {
|
||||||
enText: 'Canceled',
|
enText: 'Canceled',
|
||||||
): FlutterFlowTheme.of(context).error,
|
): FlutterFlowTheme.of(context).error,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.blocked)
|
||||||
status.blocked)
|
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Bloqueado',
|
ptText: 'Bloqueado',
|
||||||
|
@ -128,22 +129,53 @@ class VisitHistoryWidget extends StatelessWidget {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
onTapCardItemAction: () async {
|
onTapCardItemAction: () async {
|
||||||
showModalBottomSheet(
|
await showDialog(
|
||||||
isScrollControlled: true,
|
// isScrollControlled: true,
|
||||||
isDismissible: true,
|
// isDismissible: true,
|
||||||
backgroundColor: Colors.transparent,
|
// backgroundColor: Colors.transparent,
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
context: context,
|
context: context,
|
||||||
|
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return buildDetails(
|
return Dialog(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: buildDetails(
|
||||||
visitaWrapItem,
|
visitaWrapItem,
|
||||||
context,
|
context,
|
||||||
changeStatusAction,
|
changeStatusAction,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
).whenComplete(() async {
|
||||||
|
log('Complete');
|
||||||
|
final newResponseStream =
|
||||||
|
ScheduleCompleteVisitPageModel().visitHistory(
|
||||||
|
requestFn: () => PhpGroup.getVisitsCall.call(
|
||||||
|
devUUID: FFAppState().devUUID,
|
||||||
|
userUUID: FFAppState().userUUID,
|
||||||
|
cliID: FFAppState().cliUUID,
|
||||||
|
atividade: 'getVisitas',
|
||||||
|
pageSize: 100,
|
||||||
|
pageNumber: 1,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
newResponseStream.listen((newResponse) {
|
||||||
);
|
log('New response received: $newResponse');
|
||||||
|
if (mounted) {
|
||||||
|
safeSetState(() {
|
||||||
|
response = newResponse.jsonBody;
|
||||||
|
log('Response updated: $response');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
log('Widget is not mounted, skipping state update.');
|
||||||
|
}
|
||||||
|
}).onError((err) {
|
||||||
|
log('Error: $err');
|
||||||
|
});
|
||||||
|
}).catchError((err, stack) {
|
||||||
|
log('Error: $err');
|
||||||
|
log('Stack: $stack');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue