Not found svg added, Pending transactions, Announcements.
parent
a55c98c5ba
commit
e045374703
@ -0,0 +1,72 @@
|
|||||||
|
class GetAnnouncementDetails {
|
||||||
|
String? titleEN;
|
||||||
|
String? titleAR;
|
||||||
|
String? emailBodyEN;
|
||||||
|
String? emailBodyAR;
|
||||||
|
String? bodyEN;
|
||||||
|
String? bodyAR;
|
||||||
|
String? bannerImage;
|
||||||
|
String? rowID;
|
||||||
|
String? awarenessName;
|
||||||
|
String? created;
|
||||||
|
String? publishedDesc;
|
||||||
|
String? published;
|
||||||
|
String? twoLanguageTemplateDesc;
|
||||||
|
String? wFStatus;
|
||||||
|
String? totalItems;
|
||||||
|
|
||||||
|
GetAnnouncementDetails(
|
||||||
|
{this.titleEN,
|
||||||
|
this.titleAR,
|
||||||
|
this.emailBodyEN,
|
||||||
|
this.emailBodyAR,
|
||||||
|
this.bodyEN,
|
||||||
|
this.bodyAR,
|
||||||
|
this.bannerImage,
|
||||||
|
this.rowID,
|
||||||
|
this.awarenessName,
|
||||||
|
this.created,
|
||||||
|
this.publishedDesc,
|
||||||
|
this.published,
|
||||||
|
this.twoLanguageTemplateDesc,
|
||||||
|
this.wFStatus,
|
||||||
|
this.totalItems});
|
||||||
|
|
||||||
|
GetAnnouncementDetails.fromJson(Map<String, dynamic> json) {
|
||||||
|
titleEN = json['Title_EN'];
|
||||||
|
titleAR = json['Title_AR'];
|
||||||
|
emailBodyEN = json['EmailBody_EN'];
|
||||||
|
emailBodyAR = json['EmailBody_AR'];
|
||||||
|
bodyEN = json['Body_EN'];
|
||||||
|
bodyAR = json['Body_AR'];
|
||||||
|
bannerImage = json['Banner_Image'];
|
||||||
|
rowID = json['rowID'];
|
||||||
|
awarenessName = json['awarenessName'];
|
||||||
|
created = json['created'];
|
||||||
|
publishedDesc = json['PublishedDesc'];
|
||||||
|
published = json['Published'];
|
||||||
|
twoLanguageTemplateDesc = json['TwoLanguageTemplateDesc'];
|
||||||
|
wFStatus = json['WFStatus'];
|
||||||
|
totalItems = json['TotalItems'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['Title_EN'] = this.titleEN;
|
||||||
|
data['Title_AR'] = this.titleAR;
|
||||||
|
data['EmailBody_EN'] = this.emailBodyEN;
|
||||||
|
data['EmailBody_AR'] = this.emailBodyAR;
|
||||||
|
data['Body_EN'] = this.bodyEN;
|
||||||
|
data['Body_AR'] = this.bodyAR;
|
||||||
|
data['Banner_Image'] = this.bannerImage;
|
||||||
|
data['rowID'] = this.rowID;
|
||||||
|
data['awarenessName'] = this.awarenessName;
|
||||||
|
data['created'] = this.created;
|
||||||
|
data['PublishedDesc'] = this.publishedDesc;
|
||||||
|
data['Published'] = this.published;
|
||||||
|
data['TwoLanguageTemplateDesc'] = this.twoLanguageTemplateDesc;
|
||||||
|
data['WFStatus'] = this.wFStatus;
|
||||||
|
data['TotalItems'] = this.totalItems;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
class GetAnnouncementsObject {
|
||||||
|
String? titleEN;
|
||||||
|
String? titleAR;
|
||||||
|
String? bannerImage;
|
||||||
|
String? rowID;
|
||||||
|
String? awarenessName;
|
||||||
|
String? created;
|
||||||
|
String? publishedDesc;
|
||||||
|
String? published;
|
||||||
|
String? twoLanguageTemplateDesc;
|
||||||
|
String? wFStatus;
|
||||||
|
String? totalItems;
|
||||||
|
String? emailBodyEN;
|
||||||
|
String? emailBodyAR;
|
||||||
|
String? bodyEN;
|
||||||
|
String? bodyAR;
|
||||||
|
|
||||||
|
GetAnnouncementsObject(
|
||||||
|
{this.titleEN,
|
||||||
|
this.titleAR,
|
||||||
|
this.bannerImage,
|
||||||
|
this.rowID,
|
||||||
|
this.awarenessName,
|
||||||
|
this.created,
|
||||||
|
this.publishedDesc,
|
||||||
|
this.published,
|
||||||
|
this.twoLanguageTemplateDesc,
|
||||||
|
this.wFStatus,
|
||||||
|
this.totalItems,
|
||||||
|
this.emailBodyEN,
|
||||||
|
this.emailBodyAR,
|
||||||
|
this.bodyEN,
|
||||||
|
this.bodyAR});
|
||||||
|
|
||||||
|
GetAnnouncementsObject.fromJson(Map<String, dynamic> json) {
|
||||||
|
titleEN = json['Title_EN'];
|
||||||
|
titleAR = json['Title_AR'];
|
||||||
|
bannerImage = json['Banner_Image'];
|
||||||
|
rowID = json['rowID'];
|
||||||
|
awarenessName = json['awarenessName'];
|
||||||
|
created = json['created'];
|
||||||
|
publishedDesc = json['PublishedDesc'];
|
||||||
|
published = json['Published'];
|
||||||
|
twoLanguageTemplateDesc = json['TwoLanguageTemplateDesc'];
|
||||||
|
wFStatus = json['WFStatus'];
|
||||||
|
totalItems = json['TotalItems'];
|
||||||
|
emailBodyEN = json['EmailBody_EN'];
|
||||||
|
emailBodyAR = json['EmailBody_AR'];
|
||||||
|
bodyEN = json['Body_EN'];
|
||||||
|
bodyAR = json['Body_AR'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['Title_EN'] = this.titleEN;
|
||||||
|
data['Title_AR'] = this.titleAR;
|
||||||
|
data['Banner_Image'] = this.bannerImage;
|
||||||
|
data['rowID'] = this.rowID;
|
||||||
|
data['awarenessName'] = this.awarenessName;
|
||||||
|
data['created'] = this.created;
|
||||||
|
data['PublishedDesc'] = this.publishedDesc;
|
||||||
|
data['Published'] = this.published;
|
||||||
|
data['TwoLanguageTemplateDesc'] = this.twoLanguageTemplateDesc;
|
||||||
|
data['WFStatus'] = this.wFStatus;
|
||||||
|
data['TotalItems'] = this.totalItems;
|
||||||
|
data['EmailBody_EN'] = this.emailBodyEN;
|
||||||
|
data['EmailBody_AR'] = this.emailBodyAR;
|
||||||
|
data['Body_EN'] = this.bodyEN;
|
||||||
|
data['Body_AR'] = this.bodyAR;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_html/flutter_html.dart';
|
||||||
|
import 'package:mohem_flutter_app/api/pending_transactions_api_client.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/get_announcement_details.dart';
|
||||||
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||||
|
|
||||||
|
class AnnouncementDetails extends StatefulWidget {
|
||||||
|
const AnnouncementDetails({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AnnouncementDetailsState createState() => _AnnouncementDetailsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AnnouncementDetailsState extends State<AnnouncementDetails> {
|
||||||
|
String jsonResponse = "";
|
||||||
|
int currentPageNo = 0;
|
||||||
|
int rowID = 0;
|
||||||
|
|
||||||
|
GetAnnouncementDetails? getAnnouncementDetailsObj;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
getRequestID();
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
appBar: AppBarWidget(
|
||||||
|
context,
|
||||||
|
title: "Announcements",
|
||||||
|
),
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
margin: const EdgeInsets.all(12.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xff000000).withOpacity(.05),
|
||||||
|
blurRadius: 26,
|
||||||
|
offset: const Offset(0, -3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 150.0,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
child: Image.memory(
|
||||||
|
base64Decode(Utils.getBase64FromJpeg(getAnnouncementDetailsObj?.bannerImage)),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(top: 12.0),
|
||||||
|
child: Html(
|
||||||
|
data: getAnnouncementDetailsObj?.bodyEN,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRequestID() {
|
||||||
|
if (currentPageNo == 0) {
|
||||||
|
final arguments = (ModalRoute.of(context)?.settings.arguments ?? <String, dynamic>{}) as Map;
|
||||||
|
currentPageNo = arguments["currentPageNo"];
|
||||||
|
rowID = arguments["rowID"];
|
||||||
|
getAnnouncementDetails(0, rowID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void getAnnouncementDetails(int itgAwarenessID, int itgRowID) async {
|
||||||
|
try {
|
||||||
|
Utils.showLoading(context);
|
||||||
|
jsonResponse = await PendingTransactionsApiClient().getAnnouncements(itgAwarenessID, currentPageNo, itgRowID);
|
||||||
|
var jsonDecodedData = jsonDecode(jsonDecode(jsonResponse)['result']['data']);
|
||||||
|
getAnnouncementDetailsObj = GetAnnouncementDetails.fromJson(jsonDecodedData[0]);
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
setState(() {});
|
||||||
|
} catch (ex) {
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
Utils.handleException(ex, context, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,168 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mohem_flutter_app/api/pending_transactions_api_client.dart';
|
||||||
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||||
|
import 'package:mohem_flutter_app/config/routes.dart';
|
||||||
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||||
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/get_announcements.dart';
|
||||||
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||||
|
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
|
||||||
|
|
||||||
|
class Announcements extends StatefulWidget {
|
||||||
|
const Announcements({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AnnouncementsState createState() => _AnnouncementsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AnnouncementsState extends State<Announcements> {
|
||||||
|
String jsonResponse = "";
|
||||||
|
int currentPageNo = 1;
|
||||||
|
int currentOpenIndex = -1;
|
||||||
|
|
||||||
|
List<GetAnnouncementsObject> getAnnouncementsObject = [];
|
||||||
|
List<GetAnnouncementsObject> _foundAnnouncements = [];
|
||||||
|
TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
getAnnouncements(0, 0);
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
appBar: AppBarWidget(
|
||||||
|
context,
|
||||||
|
title: "Announcements",
|
||||||
|
),
|
||||||
|
body: getAnnouncementsObject.isNotEmpty
|
||||||
|
? Container(
|
||||||
|
margin: const EdgeInsets.only(top: 10.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
12.height,
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.fromLTRB(12.0, 0.0, 12.0, 0.0),
|
||||||
|
child: DynamicTextFieldWidget(
|
||||||
|
"Search",
|
||||||
|
"Search Announcements",
|
||||||
|
isEnable: true,
|
||||||
|
suffixIconData: Icons.search,
|
||||||
|
isPopup: false,
|
||||||
|
lines: 1,
|
||||||
|
isInputTypeNum: false,
|
||||||
|
isReadOnly: false,
|
||||||
|
onChange: (String value) {
|
||||||
|
_runFilter(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
12.height,
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
openAnnouncementsDetails(int.parse(_foundAnnouncements[index].rowID!));
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
margin: const EdgeInsets.only(left: 12, right: 12, top: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xff000000).withOpacity(.05),
|
||||||
|
blurRadius: 26,
|
||||||
|
offset: const Offset(0, -3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 80.0,
|
||||||
|
height: 80.0,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
child: Image.memory(
|
||||||
|
base64Decode(Utils.getBase64FromJpeg(_foundAnnouncements[index].bannerImage)),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
12.width,
|
||||||
|
SizedBox(
|
||||||
|
height: 80.0,
|
||||||
|
width: 200.0,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppState().isArabic(context) ? _foundAnnouncements[index].titleAR!.toText13() : getAnnouncementsObject[index].titleEN!.toText13(),
|
||||||
|
8.height,
|
||||||
|
_foundAnnouncements[index].created!.toText10(color: MyColors.grey98Color)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) => 1.height,
|
||||||
|
itemCount: _foundAnnouncements.length ?? 0))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Utils.getNoDataWidget(context),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _runFilter(String enteredKeyword) {
|
||||||
|
List<GetAnnouncementsObject> results = [];
|
||||||
|
if (enteredKeyword.isEmpty) {
|
||||||
|
results = getAnnouncementsObject;
|
||||||
|
} else {
|
||||||
|
results = getAnnouncementsObject.where((user) => user.titleEN!.toLowerCase().contains(enteredKeyword.toLowerCase())).toList();
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
_foundAnnouncements = results;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void getAnnouncements(int itgAwarenessID, int itgRowID) async {
|
||||||
|
try {
|
||||||
|
Utils.showLoading(context);
|
||||||
|
jsonResponse = await PendingTransactionsApiClient().getAnnouncements(itgAwarenessID, currentPageNo, itgRowID);
|
||||||
|
var jsonDecodedData = jsonDecode(jsonDecode(jsonResponse)['result']['data']);
|
||||||
|
for (int i = 0; i < jsonDecodedData.length; i++) {
|
||||||
|
getAnnouncementsObject.add(GetAnnouncementsObject.fromJson(jsonDecodedData[i]));
|
||||||
|
}
|
||||||
|
_foundAnnouncements = getAnnouncementsObject;
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
setState(() {});
|
||||||
|
} catch (ex) {
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
Utils.handleException(ex, context, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void openAnnouncementsDetails(int rowID) async {
|
||||||
|
await Navigator.pushNamed(context, AppRoutes.announcementsDetails, arguments: {"currentPageNo": currentPageNo, "rowID": rowID});
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue