| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632 |
- import 'package:easy_localization/easy_localization.dart';
- import 'package:easy_refresh/easy_refresh.dart';
- import 'package:flutter/material.dart';
- import 'package:lazy_load_scrollview/lazy_load_scrollview.dart';
- import 'package:provider/provider.dart';
- import 'package:telnow_mobile_new/src/api/api_auth_provider.dart';
- import 'package:telnow_mobile_new/src/layouts/functions/history.dart';
- import 'package:telnow_mobile_new/src/layouts/mobile/history_detail.dart';
- import 'package:telnow_mobile_new/src/layouts/mobile/history_detail_pending.dart';
- import 'package:telnow_mobile_new/src/layouts/components/template.dart';
- import 'package:telnow_mobile_new/src/layouts/mobile/history_rating.dart';
- import 'package:telnow_mobile_new/src/utils/U.dart';
- import 'package:telnow_mobile_new/src/utils/dio_logging_interceptors.dart';
- import 'package:telnow_mobile_new/src/utils/provider.dart';
- class MobHistoryPage extends StatefulWidget {
- const MobHistoryPage({super.key});
- @override
- State<MobHistoryPage> createState() => _MobHistoryPageState();
- }
- class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStateMixin {
- final HistoryFunction hisFunc = HistoryFunction();
- late AnimationController _animationController;
- var rating = [
- {'key': 1, 'image': "assets/image/icon/very_dissatisfied.png", 'label': 'disatisfied'.tr()},
- {'key': 2, 'image': "assets/image/icon/dissatisfied.png", 'label': 'lessSatisfied'.tr()},
- {'key': 3, 'image': "assets/image/icon/neutral.png", 'label': 'satisfied'.tr()},
- {'key': 4, 'image': "assets/image/icon/satisfied.png", 'label': 'verySatisfied'.tr()},
- {'key': 5, 'image': "assets/image/icon/very_satisfied.png", 'label': 'reallyPleased'.tr()},
- ];
- bool _timeLimit = false;
- @override
- void initState() {
- Provider.of<HistoryModule>(context, listen: false).reset();
- _animationController = new AnimationController(vsync: this, duration: Duration(seconds: 1));
- _animationController.repeat(reverse: true);
-
- WidgetsBinding.instance.addPostFrameCallback((_) {
- hisFunc.getActiveForum(context);
- });
- // TODO: implement initState
- super.initState();
- }
- @override
- void dispose() {
- _animationController.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- eventBus.on().listen((event){
- print(event.toString());
- });
- return Provider.of<UserModule>(context).resetData() ? RefreshPage(() {
- Provider.of<UserModule>(context, listen: false).setResetData(false);
- hisFunc.getActiveForum(context);
- }) : _timeLimit ? showButton(context) : Scaffold(
- backgroundColor: backgroundColor,
- appBar: AppBar(
- elevation: 0,
- bottomOpacity: 0,
- backgroundColor: backgroundColor,
- titleSpacing: 16,
- title: Text('history'.tr(), style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
- actions: Provider.of<HistoryModule>(context).multiSelectMode() ? [
- Center(
- child: GestureDetector(
- child: Container(
- margin: EdgeInsets.only(right: 16),
- padding: EdgeInsets.fromLTRB(16, 9, 16, 9),
- child: Row(
- children: [
- Text('delete'.tr(), style: TextStyle(color: primaryColor, fontSize: 14)),
- SizedBox(width: 5),
- U.iconsax('trash', color: primaryColor, size: 20)
- ],
- ),
- decoration: BoxDecoration(
- color: primaryColor.withValues(alpha: 0.1), border: Border.all(color: primaryColor), borderRadius: BorderRadius.all(Radius.circular(50))),
- ),
- onTap: () => hisFunc.deleteData(context),
- ),
- )
- ] : null,
- ),
- body: Column(
- children: [
- divider(),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox(height: 16),
- Row(
- children: [
- GestureDetector(
- child: Container(
- margin: EdgeInsets.only(left: 16),
- padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
- child: Text('ongoing'.tr(), style: TextStyle(color: Provider.of<HistoryModule>(context).selectedFilter() == 1 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
- decoration: BoxDecoration(
- color: Colors.white,
- border: Border(bottom: BorderSide(color: Provider.of<HistoryModule>(context).selectedFilter() == 1 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: Provider.of<HistoryModule>(context).selectedFilter() == 1 ? 2 : 1))),
- ),
- onTap: () {
- if (!Provider.of<HistoryModule>(context, listen: false).isLoadHistory()) {
- Provider.of<HistoryModule>(context, listen: false).setPressAttention(0);
- Provider.of<HistoryModule>(context, listen: false).setSelectedFilter(1);
- hisFunc.onRefresh(context);
- }
- },
- ),
- GestureDetector(
- child: Container(
- padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
- child: Text('done'.tr(), style: TextStyle(color: Provider.of<HistoryModule>(context).selectedFilter() == 0 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
- decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: Provider.of<HistoryModule>(context).selectedFilter() == 0 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: Provider.of<HistoryModule>(context).selectedFilter() == 0 ? 2 : 1))),
- ),
- onTap: () {
- if (!Provider.of<HistoryModule>(context, listen: false).isLoadHistory()) {
- Provider.of<HistoryModule>(context, listen: false).setPressAttention(0);
- Provider.of<HistoryModule>(context, listen: false).setSelectedFilter(0);
- hisFunc.onRefresh(context);
- }
- },
- ),
- ],
- ),
- SizedBox(height: 20),
- Provider.of<HistoryModule>(context).selectedFilter() == 0 ? doneFilter() : ongoingFilter(),
- SizedBox(height: 20),
- ],
- ),
- Expanded(
- child: Provider.of<UserModule>(context).user().isNotEmpty ? Container(
- alignment: Alignment.topCenter,
- width: U.bodyWidth(context),
- child: LazyLoadScrollView(
- onEndOfPage: () => hisFunc.getMission(context),
- scrollOffset: 500,
- child: EasyRefresh(
- header: MaterialHeader(clamping: true, color: primaryColor),
- onRefresh: ()=>hisFunc.onRefresh(context),
- child: Provider.of<HistoryModule>(context).selectedFilter() == 0 ? doneContainer() : ongoingContainer(),
- ),
- ),
- ) : Provider.of<UserModule>(context).resetData() ? Container() : loadingTemplate(() {
- if(mounted) setState(()=>_timeLimit=true);
- },),
- )
- ],
- ),
- );
- }
- Widget ongoingFilter() {
- return SingleChildScrollView(
- scrollDirection: Axis.horizontal,
- child: Row(
- children: List.generate(hisFunc.ongoingList.length, (i) {
- return GestureDetector(
- child: Container(
- margin: EdgeInsets.only(left: 16),
- padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
- child: Text(hisFunc.ongoingList[i]['title'], style: TextStyle(color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
- decoration: BoxDecoration(
- color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.ongoingList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
- border: Border.all(color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.ongoingList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
- borderRadius: BorderRadius.all(Radius.circular(50))),
- ),
- onTap: () {
- if (!Provider.of<HistoryModule>(context, listen: false).isLoadHistory()) {
- if (Provider.of<HistoryModule>(context, listen: false).checkPressAttention(hisFunc.ongoingList[i]['value'])) {
- Provider.of<HistoryModule>(context, listen: false).setPressAttention(0);
- hisFunc.onRefresh(context);
- } else {
- Provider.of<HistoryModule>(context, listen: false).setPressAttention(hisFunc.ongoingList[i]['value']);
- hisFunc.onRefresh(context);
- }
- }
- },
- );
- }),
- ),
- );
- }
- Widget ongoingContainer() {
- return SingleChildScrollView(
- child: Column(
- children: [
- U.newServerVersion(1709864293) && !U.getInternetStatus() ? Column(
- children: List.generate(Provider.of<HistoryModule>(context).dataPending().length, (i) {
- return GestureDetector(
- child: Container(
- padding: EdgeInsets.all(16),
- child: Column(
- children: [
- Row(
- children: [
- imageTiles(imageUrl: Provider.of<HistoryModule>(context).dataPending()[i]['image'] ?? "null"),
- SizedBox(width: 16),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(Provider.of<HistoryModule>(context).dataPending()[i]['title'], style: TextStyle(color: textColor, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
- SizedBox(height: 6),
- Text(Provider.of<HistoryModule>(context).dataPending()[i][U.langColumn(context, 'sub')], style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
- SizedBox(height: 6),
- Text(convertDate(Provider.of<HistoryModule>(context).dataPending()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: textColor, fontSize: 13, fontWeight: FontWeight.w300)),
- ],
- ),
- )
- ],
- ),
- SizedBox(height: 16),
- divider(),
- Container(
- width: double.infinity,
- margin: EdgeInsets.only(top: 16),
- child: Row(
- children: [
- Container(
- width: 25, height: 25,
- decoration: BoxDecoration(image: DecorationImage(image: AssetImage('assets/image/general/Hourglass.png'), fit: BoxFit.cover)),
- ),
- SizedBox(width: 8),
- Expanded(child: Text('pending_info_tiles'.tr(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis))
- ],
- ),
- )
- ],
- ),
- decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: Color(0xffF3F3F3), width: 8))),
- ),
- onTap: () {
- if(!U.getInternetStatus()){
- navigateTo(context, MobHistoryDetailPendingPage(data: Provider.of<HistoryModule>(context, listen: false).dataPending()[i])).then((val) {
- val = val??false;
- if(val) hisFunc.onRefresh(context);
- });
- }
- else{
- hisFunc.onRefresh(context);
- }
- },
- );
- }),
- ) : Container(),
- Column(
- children: List.generate(Provider.of<HistoryModule>(context).dataMisi().length, (i) {
- return GestureDetector(
- child: Container(
- padding: EdgeInsets.all(16),
- decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: Color(0xffF3F3F3), width: 8))),
- child: Column(
- children: [
- Row(
- children: [
- imageTiles(imageUrl: Provider.of<HistoryModule>(context).dataMisi()[i]['_requestImage'] ?? "null"),
- SizedBox(width: 16),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(Provider.of<HistoryModule>(context).dataMisi()[i][U.langColumn(context, 'requestGroupDescription')]??'', style: TextStyle(color: textColor, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
- SizedBox(height: 6),
- Text(Provider.of<HistoryModule>(context).dataMisi()[i][U.langColumn(context, 'requestSubject')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
- SizedBox(height: 6),
- renderRequested(Provider.of<HistoryModule>(context).dataMisi()[i]),
- Text(convertDate(Provider.of<HistoryModule>(context).dataMisi()[i]['datetimeRequest']??'', context.locale.toString()), style: TextStyle(color: textColor, fontSize: 13, fontWeight: FontWeight.w300)),
- ],
- ),
- )
- ],
- ),
- Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'DIMULAI' || Provider.of<HistoryModule>(context).dataMisi()[i]['_hasForum'] ? Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox(height: 16),
- divider(),
- ],
- ) : Container(),
- Provider.of<HistoryModule>(context).dataMisi()[i]['_activeHoldRequest'] != null ? Container(
- width: double.infinity,
- margin: EdgeInsets.only(top: 16),
- child: Row(
- children: [
- Container(
- width: 25, height: 25,
- decoration: BoxDecoration(image: DecorationImage(image: AssetImage('assets/image/general/Watch.png'), fit: BoxFit.cover)),
- ),
- SizedBox(width: 8),
- Expanded(child: Text(Provider.of<HistoryModule>(context).dataMisi()[i]['_activeHoldRequest']['description'], style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis))
- ],
- ),
- ) : Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'DIMULAI' ? Container(
- width: double.infinity,
- margin: EdgeInsets.only(top: 16),
- child: Row(
- children: [
- Container(
- width: 25, height: 25,
- decoration: BoxDecoration(
- border: Border.all(color: primaryColor),
- borderRadius: BorderRadius.all(Radius.circular(25)),
- image: DecorationImage(image: AssetImage('assets/image/general/Avatar.jpg'), fit: BoxFit.cover)),
- ),
- SizedBox(width: 8),
- Expanded(child: Text(Provider.of<HistoryModule>(context).dataMisi()[i]['servantNameStart'] + 'isWorking'.tr(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis))
- ],
- ),
- ) : Container(),
- !Provider.of<HistoryModule>(context).dataMisi()[i]['autoResponse'] && Provider.of<HistoryModule>(context).dataMisi()[i]['_hasForum'] && Provider.of<HistoryModule>(context).dataMisi()[i]['_forumMsg'] != null ? Container(
- width: double.infinity,
- margin: EdgeInsets.only(top: 16),
- child: Row(
- children: [
- FadeTransition(opacity: _animationController, child: U.iconsax('messages-3', color: primaryColor)),
- SizedBox(width: 8),
- Expanded(child: Text('“${Provider.of<HistoryModule>(context).dataMisi()[i]['_forumMsg']}”', style: TextStyle(color: textColor.withValues(alpha: 0.75), fontSize: 14, fontStyle: FontStyle.italic), overflow: TextOverflow.ellipsis,))
- ],
- ),
- )
- : Container(),
- ],
- ),
- ),
- onTap: () => navigateTo(context, MobHistoryDetailPage(index: i)).then((val) {
- val = val??false;
- if(val) Provider.of<HistoryModule>(context, listen: false).cancelMisi(i);
- }),
- );
- }),
- ),
- !Provider.of<HistoryModule>(context).stopLoadHistory() || (Provider.of<HistoryModule>(context).isLoadHistory() && Provider.of<HistoryModule>(context).page() > 0)
- ? Container(margin: EdgeInsets.only(top: Provider.of<HistoryModule>(context).page() > 0 ? 0 : 50), child: loadingTemplateNoVoid())
- : Provider.of<HistoryModule>(context).dataMisi().length == 0 && Provider.of<HistoryModule>(context).dataPending().length == 0
- ? NoDataPage()
- : Container(),
- ],
- ),
- );
- }
- Widget doneFilter() {
- return Row(
- children: List.generate(hisFunc.doneList.length, (i) {
- return GestureDetector(
- child: Container(
- margin: EdgeInsets.only(left: 16),
- padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
- child: Text(hisFunc.doneList[i]['title'], style: TextStyle(color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.doneList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
- decoration: BoxDecoration(
- color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.doneList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
- border: Border.all(color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.doneList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
- borderRadius: BorderRadius.all(Radius.circular(50))),
- ),
- onTap: () {
- if (!Provider.of<HistoryModule>(context, listen: false).isLoadHistory()) {
- if (Provider.of<HistoryModule>(context, listen: false).checkPressAttention(hisFunc.doneList[i]['value'])) {
- Provider.of<HistoryModule>(context, listen: false).setPressAttention(0);
- hisFunc.onRefresh(context);
- } else {
- Provider.of<HistoryModule>(context, listen: false).setPressAttention(hisFunc.doneList[i]['value']);
- hisFunc.onRefresh(context);
- }
- }
- },
- );
- }),
- );
- }
- Widget doneContainer() {
- return SingleChildScrollView(
- child: Column(
- children: [
- Column(
- children: List.generate(Provider.of<HistoryModule>(context).dataMisi().length, (i) {
- return GestureDetector(
- child: Container(
- padding: EdgeInsets.all(16),
- decoration: BoxDecoration(
- color: Provider.of<HistoryModule>(context).selectedIndexes().contains(i) ? primaryColor.withValues(alpha: 0.05) : Colors.white,
- border: Border(bottom: BorderSide(color: Color(0xffF3F3F3), width: 8))),
- child: Column(
- children: [
- Row(
- // crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- imageTiles(imageUrl: Provider.of<HistoryModule>(context).dataMisi()[i]['_requestImage'] ?? "null"),
- SizedBox(width: 16),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(Provider.of<HistoryModule>(context).dataMisi()[i][U.langColumn(context, 'requestGroupDescription')]??"",
- style: TextStyle(color: textColor, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
- SizedBox(height: 6),
- Text(Provider.of<HistoryModule>(context).dataMisi()[i][U.langColumn(context, 'requestSubject')]??"", style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
- SizedBox(height: 6),
- renderRequested(Provider.of<HistoryModule>(context).dataMisi()[i]),
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(convertDate(Provider.of<HistoryModule>(context).dataMisi()[i]['datetimeRequest'], context.locale.toString()),
- style: TextStyle(color: textColor, fontSize: 13, fontWeight: FontWeight.w300)),
- Text(
- ' - ${Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'DISELESAIKAN' || Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'TUNTAS' ? 'stateFinish'.tr() : 'stateCancel'.tr()}',
- style: TextStyle(
- color: Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'DISELESAIKAN' ||
- Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'TUNTAS'
- ? primaryColor
- : Color(0xffD81010),
- fontSize: 13,
- fontWeight: FontWeight.w300))
- ],
- )
- ],
- ),
- )
- ],
- ),
- SizedBox(height: 16),
- divider(),
- SizedBox(height: 16),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- !Provider.of<HistoryModule>(context).dataMisi()[i]['autoResponse'] && Provider.of<HistoryModule>(context).dataMisi()[i]['servantIdentityStart'] != '#system' && (Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'TUNTAS' || Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'DISELESAIKAN') ? Container(
- child: hisFunc.askForRate(Provider.of<HistoryModule>(context, listen: true).dataMisi()[i]) ? GestureDetector(
- child: Container(
- padding: EdgeInsets.symmetric(vertical: 4, horizontal: 16),
- decoration: BoxDecoration(
- color: Colors.white,
- border: Border.all(color: secondaryColor),
- borderRadius: BorderRadius.all(Radius.circular(50))),
- child: Text('rateReq'.tr(), style: TextStyle(color: secondaryColor, fontSize: 14), overflow: TextOverflow.ellipsis),
- ),
- onTap: () {
- U.newServerVersion(1716279633) ? navigateTo(context, MobHistoryRatingPage(Provider.of<HistoryModule>(context, listen: false).dataMisi()[i])).then((tempRating) {
- if(tempRating != null){
- Provider.of<HistoryModule>(context, listen: false).setSatisfaction(i, tempRating);
- }
- }) : rateMission(context, Provider.of<HistoryModule>(context, listen: false).dataMisi()[i], i);
- },
- ) : !hisFunc.isAutoResponse(Provider.of<HistoryModule>(context).dataMisi()[i]) ? Row(
- children: [
- Image(image: AssetImage(rating[Provider.of<HistoryModule>(context).dataMisi()[i]['satisfactionRate'] - 1]['image'].toString()), width: 25),
- SizedBox(width: 5),
- Text(rating[Provider.of<HistoryModule>(context).dataMisi()[i]['satisfactionRate'] - 1]['label'].toString(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
- ],
- ) : Container(),
- ) : message(Provider.of<HistoryModule>(context).dataMisi()[i]['_hasForum'], Provider.of<HistoryModule>(context).dataMisi()[i]['_forumMsg'] ?? "null"),
- GestureDetector(
- child: Container(
- padding: EdgeInsets.symmetric(vertical: 4, horizontal: 16),
- child: Text('reqAgain'.tr(), style: TextStyle(color: primaryColor, fontSize: 14)),
- decoration: BoxDecoration(color: Colors.white, border: Border.all(color: primaryColor), borderRadius: BorderRadius.all(Radius.circular(50))),
- ),
- onTap: () => hisFunc.requestAgainAction(context, i),
- )
- ],
- ),
- (!Provider.of<HistoryModule>(context).dataMisi()[i]['autoResponse'] && Provider.of<HistoryModule>(context).dataMisi()[i]['servantIdentityStart'] != '#system' && (Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'TUNTAS' || Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'DISELESAIKAN')) ? message(Provider.of<HistoryModule>(context).dataMisi()[i]['_hasForum'], Provider.of<HistoryModule>(context).dataMisi()[i]['_forumMsg'] ?? "null", top: 16) : Container()
- ],
- ),
- ),
- onTap: () {
- if (Provider.of<HistoryModule>(context, listen: false).multiSelectMode()) {
- hisFunc.selectedController(context, i);
- } else {
- navigateTo(context, MobHistoryDetailPage(index: i));
- }
- },
- onLongPress: () => hisFunc.selectedController(context, i),
- );
- })),
- !Provider.of<HistoryModule>(context).stopLoadHistory() || (Provider.of<HistoryModule>(context).isLoadHistory() && Provider.of<HistoryModule>(context).page() > 0)
- ? Container(margin: EdgeInsets.only(top: Provider.of<HistoryModule>(context).page() > 0 ? 0 : 50), child: loadingTemplateNoVoid())
- : Provider.of<HistoryModule>(context).dataMisi().length == 0
- ? NoDataPage()
- : Container(),
- ],
- ),
- );
- }
- Widget renderRequested(list){
- if(list['receptionistId'] != null){
- var user = Provider.of<UserModule>(context, listen: false).user();
- if(user['roomAttendant'] && user['userId'] != list['informantUserId'] && user['userId'] == list['receptionistId']){
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${'requestedFor'.tr()}: ${list['informantName']??'-'}' ,style: TextStyle(color: textColor, fontSize: 13, fontWeight: FontWeight.w300)),
- SizedBox(height: 6),
- ],
- );
- }
- if(user['userId'] == list['informantUserId'] && user['userId'] != list['receptionistId']){
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${'requestedBy'.tr()}: ${list['receptionistName']??''}' ,style: TextStyle(color: textColor, fontSize: 13, fontWeight: FontWeight.w300)),
- SizedBox(height: 6),
- ],
- );
- }
- }
- return Container();
- }
- Widget message(bool _hasForum, String _forumMsg, {double top = 0}) {
- return _hasForum ? Container(
- margin: EdgeInsets.only(top: top),
- child: Row(
- children: [
- FadeTransition(opacity: _animationController, child: U.iconsax('messages-3', color: primaryColor)),
- SizedBox(width: 8),
- Text('“$_forumMsg”',
- style: TextStyle(color: textColor.withValues(alpha: 0.75), fontSize: 14, fontStyle: FontStyle.italic),
- overflow: TextOverflow.ellipsis),
- ],
- ),
- ) : Container();
- }
- rateMission(BuildContext context, list, index) {
- showModalBottomSheet(
- context: context,
- backgroundColor: Colors.transparent,
- isScrollControlled: true,
- builder: (contexts) {
- int tempRating = 0;
- String description = '';
- return StatefulBuilder(
- builder: (contextt, setStates) {
- return Container(
- decoration: BoxDecoration(color: secondaryColor, borderRadius: BorderRadius.only(topLeft: Radius.circular(24), topRight: Radius.circular(24))),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(list[U.langColumn(context, 'requestSubject')], style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.w600)),
- SizedBox(height: 4),
- Text(convertDate(list['datetimeRequest'], context.locale.toString()), style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w300)),
- ],
- ),
- ),
- Container(
- padding: EdgeInsets.fromLTRB(30, 0, 30, 16),
- child: Column(
- children: [
- Container(
- margin: EdgeInsets.all(10),
- width: 40,
- height: 4,
- decoration: BoxDecoration(color: Color(0xff292D32).withValues(alpha: 0.2), borderRadius: BorderRadius.all(Radius.circular(10))),
- ),
- SizedBox(height: 12),
- Text('satisfactionAsk'.tr(), style: TextStyle(fontSize: 16)),
- SizedBox(height: 12),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: List.generate(rating.length, (i) {
- return Expanded(
- child: GestureDetector(
- child: Image(
- image: AssetImage(rating[i]['image'].toString()),
- color: Colors.white.withValues(alpha: tempRating == rating[i]['key'] ? 1 : 0.3),
- colorBlendMode: BlendMode.modulate,
- ),
- // child: Icon(rating[i]['icon'] as IconData, color: tempRating == rating[i]['key']?rating[i]['color'] as Color:Colors.grey),
- onTap: () {
- setStates(() {
- tempRating = rating[i]['key'] as int;
- description = rating[i]['label'] as String;
- });
- },
- ),
- );
- }),
- ),
- SizedBox(height: 6),
- Text(description, style: TextStyle(color: textColor, fontSize: 14, fontWeight: FontWeight.w300), textAlign: TextAlign.center),
- SizedBox(height: 10),
- Opacity(
- opacity: tempRating > 0 ? 1 : 0,
- child: buttonTemplate(text: 'save_rating'.tr(), backgroundColor: secondaryColor, borderColor: secondaryColor, height: 40, action: ()async{
- if (tempRating > 0) {
- var data = {"ticketNo": list['ticketNo'], "rateSatisfy": tempRating};
- var res = await ApiAuthProvider() .postData('/api/requestHistories/rateSatisfy', null, data, contexts);
- if (res != null) {
- Provider.of<HistoryModule>(context, listen: false).setSatisfaction(index, tempRating);
- navigateBack(contexts);
- }
- }
- }),
- )
- ],
- ),
- decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.only(topLeft: Radius.circular(24), topRight: Radius.circular(24))),
- )
- ],
- ),
- );
- },
- );
- });
- }
- }
- Widget mbuh(context){
- return Text('data');
- }
|