Jira fixes for announcements & attachments

merge-requests/87/head
haroon amjad 3 years ago
parent 01a37d253e
commit c7dca3c377

@ -20,7 +20,7 @@ class DateUtil {
} }
static DateTime convertSimpleStringDateToDate(String date) { static DateTime convertSimpleStringDateToDate(String date) {
return DateFormat("MM/dd/yyyy hh:mm:ss a").parse(date); return DateFormat("MM/dd/yyyy hh:mm:ss aaa").parse(date);
} }
static DateTime convertSimpleStringDateToDateddMMyyyy(String date) { static DateTime convertSimpleStringDateToDateddMMyyyy(String date) {

@ -22,6 +22,7 @@ import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/button/simple_button.dart'; import 'package:mohem_flutter_app/widgets/button/simple_button.dart';
import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart'; import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
import 'package:mohem_flutter_app/widgets/image_picker.dart';
import 'package:mohem_flutter_app/widgets/input_widget.dart'; import 'package:mohem_flutter_app/widgets/input_widget.dart';
class RequestSubmitScreenParams { class RequestSubmitScreenParams {
@ -48,6 +49,7 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
List<GetApprovesList> approverList = []; List<GetApprovesList> approverList = [];
List<File> attachmentFiles = []; List<File> attachmentFiles = [];
List<String> attachments = [];
@override @override
void initState() { void initState() {
@ -72,16 +74,16 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
Utils.showLoading(context); Utils.showLoading(context);
List<Map<String, dynamic>> list = []; List<Map<String, dynamic>> list = [];
if (attachmentFiles.isNotEmpty) { if (attachmentFiles.isNotEmpty) {
attachmentFiles.asMap().forEach((index, value) async { attachments.asMap().forEach((index, value) async {
String type = value.path.split('.').last; String type = attachmentFiles[index].path.split('.').last;
String name = value.path.split('/').last; String name = attachmentFiles[index].path.split('/').last;
List<int> fileContent = await value.readAsBytes(); // List<int> fileContent = await value.readAsBytes();
String encodedFile = base64Encode(fileContent); // String encodedFile = base64Encode(fileContent);
list.add(AttachmentModel( list.add(AttachmentModel(
attachmentID: index, attachmentID: index,
pFILECONTENTTYPE: type, pFILECONTENTTYPE: type,
pFILENAME: name, pFILENAME: name,
pFILEDATA: encodedFile, pFILEDATA: value,
pTRANSACTIONID: params!.transactionId, pTRANSACTIONID: params!.transactionId,
).toJson()); ).toJson());
}); });
@ -261,12 +263,18 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
title.toText16().expanded, title.toText16().expanded,
6.width, 6.width,
SimpleButton(LocaleKeys.add.tr(), () async { SimpleButton(LocaleKeys.add.tr(), () async {
FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true); ImageOptions.showImageOptionsNew(context, false, (String image, File file) {
if (result != null) { setState(() {
attachmentFiles = attachmentFiles + result.paths.map((path) => File(path!)).toList(); attachmentFiles.add(file);
attachmentFiles = attachmentFiles.toSet().toList(); attachments.add(image);
setState(() {}); Navigator.of(context).pop();
} });
});
// if (result != null) {
// attachmentFiles = attachmentFiles + result.paths.map((path) => File(path!)).toList();
// attachmentFiles = attachmentFiles.toSet().toList();
// setState(() {});
// }
}, fontSize: 14), }, fontSize: 14),
], ],
), ),

@ -95,7 +95,7 @@ class _AnnouncementsState extends State<Announcements> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
(AppState().isArabic(context) ? _foundAnnouncements[index].titleAR! : getAnnouncementsObject[index].titleEN!).toText13(), (AppState().isArabic(context) ? _foundAnnouncements[index].titleAR! : _foundAnnouncements[index].titleEN!).toText13(),
8.height, 8.height,
_foundAnnouncements[index].created!.toText10(color: MyColors.grey98Color) _foundAnnouncements[index].created!.toText10(color: MyColors.grey98Color)
], ],

@ -528,7 +528,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
10.height, 10.height,
Row( Row(
children: [ children: [
DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDate(workData.bEGINDATE!), false).toText10(color: MyColors.lightTextColor).expanded, DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDateddMMyyyy(workData.bEGINDATE!), false).toText10(color: MyColors.lightTextColor).expanded,
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor)), RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor)),
], ],
), ),

Loading…
Cancel
Save