Skip to content

Commit 8612085

Browse files
committed
Updated signed forms
1 parent b993c2e commit 8612085

File tree

15 files changed

+4255
-4082
lines changed

15 files changed

+4255
-4082
lines changed

lib/controllers/env/env.g.dart

Lines changed: 4000 additions & 4000 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/models/full_form.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ class SmartShedForm {
7979
access: json['access'].cast<String>(),
8080
createdBy: SmartShedUser.fromJson(json['createdBy']),
8181
history: json['history'],
82-
createdAt: DateTime.parse(json['createdAt']),
83-
updatedAt: DateTime.parse(json['updatedAt']),
82+
createdAt: DateTime.parse(json['createdAt']).toLocal(),
83+
updatedAt: DateTime.parse(json['updatedAt']).toLocal(),
8484
isSignedBySupervisor: json['signedBySupervisor']['isSigned'],
8585
isSignedByAuthority: json['signedByAuthority']['isSigned'],
8686
signedSupervisor: json['signedBySupervisor']['supervisor'] != null
@@ -92,10 +92,10 @@ class SmartShedForm {
9292
json['signedByAuthority']['authority'] as Map<String, dynamic>)
9393
: null,
9494
signedSupervisorAt: json['signedBySupervisor']['signedAt'] != null
95-
? DateTime.parse(json['signedBySupervisor']['signedAt'])
95+
? DateTime.parse(json['signedBySupervisor']['signedAt']).toLocal()
9696
: null,
9797
signedAuthorityAt: json['signedByAuthority']['signedAt'] != null
98-
? DateTime.parse(json['signedByAuthority']['signedAt'])
98+
? DateTime.parse(json['signedByAuthority']['signedAt']).toLocal()
9999
: null,
100100
);
101101
}

lib/models/notification.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SmartShedNotification {
2626
id: json['_id'],
2727
contentEnglish: json['contentEnglish'],
2828
contentHindi: json['contentHindi'],
29-
createdAt: DateTime.parse(json['createdAt']),
29+
createdAt: DateTime.parse(json['createdAt']).toLocal(),
3030
isRead: json['isRead'],
3131
formId: json['formId'],
3232
userId: json['userId'],

lib/models/opened_form.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class SmartShedOpenedForm {
3636
descriptionHindi: json['descriptionHindi'],
3737
locoName: json['locoName'],
3838
locoNumber: json['locoNumber'],
39-
createdAt: DateTime.parse(json['createdAt']),
40-
updatedAt: DateTime.parse(json['updatedAt']),
39+
createdAt: DateTime.parse(json['createdAt']).toLocal(),
40+
updatedAt: DateTime.parse(json['updatedAt']).toLocal(),
4141
createdBy: SmartShedUser.fromJson(json['createdBy']),
4242
lockStatus: json['lockStatus'],
4343
);

lib/views/localization/approve_forms.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,23 @@ mixin ApproveForms_LocaleData {
44
static const String title = 'approve_forms_title';
55
static const String no_form_found = 'approve_forms_no_form_found';
66
static const String forms_to_approve = 'approve_forms_forms_to_approve';
7+
static const String approved_forms = 'approve_forms_approved_forms';
8+
static const String approved_forms_empty =
9+
'approve_forms_approved_forms_empty';
710

811
static const Map<String, dynamic> EN = {
912
title: 'APPROVE FORMS',
10-
no_form_found: 'No Forms Found',
13+
no_form_found: 'No forms found to approve',
1114
forms_to_approve: 'Forms to Approve',
15+
approved_forms: 'Approved Forms',
16+
approved_forms_empty: 'No approved forms found',
1217
};
1318

1419
static const Map<String, dynamic> HI = {
1520
title: 'फॉर्मों स्वीकृति',
16-
no_form_found: 'कोई फॉर्म नहीं मिला',
21+
no_form_found: 'स्वीकृति के लिए कोई फॉर्म नहीं मिला',
1722
forms_to_approve: 'स्वीकृति के लिए फॉर्म',
23+
approved_forms: 'स्वीकृत फॉर्म',
24+
approved_forms_empty: 'कोई स्वीकृत फॉर्म नहीं मिला',
1825
};
1926
}

lib/views/pages/approve_forms_page/const.dart

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import '../../../models/opened_form.dart';
77
import '../../widgets/opened_form_tile.dart';
88

99
List<SmartShedOpenedForm> forms = [];
10+
List<SmartShedOpenedForm> approvedForms = [];
1011
bool isFormsLoading = true;
12+
bool isApprovedFormsLoading = true;
1113

1214
late BuildContext context;
1315
late void Function(void Function()) changeState;
@@ -19,6 +21,7 @@ void initConst(void Function(void Function()) setState) {
1921
isFormsLoading = true;
2022

2123
_initForms();
24+
_initApprovedForms();
2225
}
2326

2427
void disposeConst() {
@@ -32,6 +35,12 @@ Future<void> _initForms() async {
3235
changeState(() => isFormsLoading = false);
3336
}
3437

38+
Future<void> _initApprovedForms() async {
39+
changeState(() => isApprovedFormsLoading = true);
40+
approvedForms = await FormApprovingController.getApprovedForms();
41+
changeState(() => isApprovedFormsLoading = false);
42+
}
43+
3544
AppBar buildAppBar() {
3645
return AppBar(
3746
title: Text(
@@ -85,6 +94,43 @@ Widget buildBody() {
8594
return const SizedBox(height: 12);
8695
},
8796
),
97+
const SizedBox(height: 20),
98+
Text(
99+
!isApprovedFormsLoading && approvedForms.isEmpty
100+
? ApproveForms_LocaleData.approved_forms_empty.getString(context)
101+
: ApproveForms_LocaleData.approved_forms.getString(context),
102+
style: const TextStyle(
103+
fontWeight: FontWeight.w600,
104+
fontSize: 20,
105+
),
106+
),
107+
const SizedBox(height: 20),
108+
isApprovedFormsLoading
109+
? ListView.separated(
110+
shrinkWrap: true,
111+
physics: const NeverScrollableScrollPhysics(),
112+
itemCount: 6,
113+
itemBuilder: (context, index) {
114+
return const OpenedFormTileShimmer();
115+
},
116+
separatorBuilder: (context, index) {
117+
return const SizedBox(height: 12);
118+
},
119+
)
120+
: ListView.separated(
121+
shrinkWrap: true,
122+
physics: const NeverScrollableScrollPhysics(),
123+
itemCount: approvedForms.length,
124+
itemBuilder: (context, index) {
125+
return OpenedFormTile(
126+
index: index,
127+
openedForm: approvedForms[index],
128+
);
129+
},
130+
separatorBuilder: (context, index) {
131+
return const SizedBox(height: 12);
132+
},
133+
),
88134
],
89135
);
90136
}

lib/views/pages/dashboard_page/const.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ AppBar buildAppBar() {
110110
key: ValueKey<int>(notificationsController.unreadNotificationsCount),
111111
iconData: Icons.notifications,
112112
onTap: () {
113-
GoRouter.of(context).push(Pages.notifications);
113+
GoRouter.of(context)
114+
.push(Pages.notifications)
115+
.then((value) => notificationsController.fetchNotifications(
116+
onDone: () => changeState(() {}),
117+
));
114118
},
115119
notificationCount: notificationsController.unreadNotificationsCount,
116120
),

lib/views/pages/form_page/const.dart

Lines changed: 47 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ late bool isSearchBoxOpen;
3737
late bool isEmployeeNameFilter;
3838
late bool isEmployeeSectionFilter;
3939
late bool isShowDetails;
40+
late bool isShowApprovalDetails;
4041
late bool isDesktop;
4142

4243
late TextEditingController searchController;
@@ -75,6 +76,7 @@ void initConst(
7576
isEmployeeNameFilter = false;
7677
isEmployeeSectionFilter = false;
7778
isShowDetails = false;
79+
isShowApprovalDetails = false;
7880

7981
searchController = TextEditingController();
8082
employeeNameController = TextEditingController();
@@ -347,9 +349,9 @@ Widget buildTopInfoBar({bool fromForm = true}) {
347349
buildTopInfoDetails(fromForm: fromForm),
348350
if (fromForm &&
349351
form!.submittedCount > 0 &&
350-
form!.isSignedBySupervisor) ...[
352+
(form!.isSignedBySupervisor || form!.isSignedByAuthority)) ...[
351353
const SizedBox(height: 10),
352-
buildApprovalIndoBar(),
354+
buildApprovalInfoBar(),
353355
]
354356
],
355357
),
@@ -607,7 +609,7 @@ Widget buildTopInfoDetails({bool fromForm = true}) {
607609
);
608610
}
609611

610-
Widget buildApprovalIndoBar() {
612+
Widget buildApprovalInfoBar() {
611613
return Container(
612614
decoration: BoxDecoration(
613615
color: Colors.white,
@@ -634,7 +636,7 @@ Widget buildApprovalIndoBar() {
634636
trailing: const SizedBox(),
635637
collapsedIconColor: Colors.grey.shade700,
636638
onExpansionChanged: (value) => changeState(() {
637-
isShowDetails = value;
639+
isShowApprovalDetails = value;
638640
}),
639641
collapsedShape: const Border(),
640642
expandedAlignment: Alignment.centerLeft,
@@ -645,7 +647,7 @@ Widget buildApprovalIndoBar() {
645647
crossAxisAlignment: CrossAxisAlignment.center,
646648
children: [
647649
Text(
648-
isShowDetails
650+
isShowApprovalDetails
649651
? Form_LocaleData.hide_approval_details.getString(context)
650652
: Form_LocaleData.show_approval_details.getString(context),
651653
style: TextStyle(
@@ -656,7 +658,7 @@ Widget buildApprovalIndoBar() {
656658
),
657659
const SizedBox(width: 5),
658660
Icon(
659-
isShowDetails
661+
isShowApprovalDetails
660662
? Icons.keyboard_arrow_up
661663
: Icons.keyboard_arrow_down,
662664
color: Colors.grey.shade700,
@@ -670,51 +672,53 @@ Widget buildApprovalIndoBar() {
670672
child: Column(
671673
crossAxisAlignment: CrossAxisAlignment.stretch,
672674
children: [
673-
Text(
674-
Form_LocaleData.supervisor_approved_by.getString(context),
675-
style: TextStyle(
676-
fontSize: 12,
677-
color: Colors.grey.shade700,
675+
if (form!.isSignedBySupervisor) ...[
676+
Text(
677+
Form_LocaleData.supervisor_approved_by.getString(context),
678+
style: TextStyle(
679+
fontSize: 12,
680+
color: Colors.grey.shade700,
681+
),
682+
textAlign: TextAlign.center,
678683
),
679-
textAlign: TextAlign.center,
680-
),
681-
const SizedBox(height: 5),
682-
GestureDetector(
683-
onTap: () {
684-
GoRouter.of(context).push(
685-
Pages.profile,
686-
extra: form!.signedSupervisor,
687-
);
688-
},
689-
child: Text(
690-
"${form!.signedSupervisor!.name} (${form!.signedSupervisor!.section})",
684+
const SizedBox(height: 5),
685+
GestureDetector(
686+
onTap: () {
687+
GoRouter.of(context).push(
688+
Pages.profile,
689+
extra: form!.signedSupervisor,
690+
);
691+
},
692+
child: Text(
693+
"${form!.signedSupervisor!.name} (${form!.signedSupervisor!.section})",
694+
style: const TextStyle(
695+
fontSize: 16,
696+
fontWeight: FontWeight.w600,
697+
),
698+
textAlign: TextAlign.center,
699+
),
700+
),
701+
const SizedBox(height: 10),
702+
Text(
703+
Form_LocaleData.supervisor_approved_at.getString(context),
704+
style: TextStyle(
705+
fontSize: 12,
706+
color: Colors.grey.shade700,
707+
),
708+
textAlign: TextAlign.center,
709+
),
710+
const SizedBox(height: 5),
711+
Text(
712+
form!.signedSupervisorAtString,
691713
style: const TextStyle(
692714
fontSize: 16,
693715
fontWeight: FontWeight.w600,
694716
),
695717
textAlign: TextAlign.center,
696718
),
697-
),
698-
const SizedBox(height: 10),
699-
Text(
700-
Form_LocaleData.supervisor_approved_at.getString(context),
701-
style: TextStyle(
702-
fontSize: 12,
703-
color: Colors.grey.shade700,
704-
),
705-
textAlign: TextAlign.center,
706-
),
707-
const SizedBox(height: 5),
708-
Text(
709-
form!.signedSupervisorAtString,
710-
style: const TextStyle(
711-
fontSize: 16,
712-
fontWeight: FontWeight.w600,
713-
),
714-
textAlign: TextAlign.center,
715-
),
716-
if (form!.isSignedByAuthority) ...[
717719
const SizedBox(height: 10),
720+
],
721+
if (form!.isSignedByAuthority) ...[
718722
Text(
719723
Form_LocaleData.authority_approved_by.getString(context),
720724
style: TextStyle(

0 commit comments

Comments
 (0)