|
|
|
|
@ -32,8 +32,7 @@ class _SubordinateLeaveState extends State<SubordinateLeave> {
|
|
|
|
|
DateTime selectedDateFrom = DateTime.now();
|
|
|
|
|
DateTime selectedDateTo = DateTime.now();
|
|
|
|
|
bool showList = false;
|
|
|
|
|
// DateTime dateFrom = DateFormat("MMM/DD/YYYY").format(selectedDateFrom) as DateTime;
|
|
|
|
|
// DateTime dateTo = DateFormat("MMM/DD/YYYY").format(selectedDateTo) as DateTime;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -45,9 +44,11 @@ class _SubordinateLeaveState extends State<SubordinateLeave> {
|
|
|
|
|
void getSubordinatesLeaves()async {
|
|
|
|
|
try {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
getSubordinatesLeavesTotalList = await MyTeamApiClient().getSubordinatesLeavesList(selectedDateFrom.toIso8601String(), selectedDateTo.toIso8601String());
|
|
|
|
|
getSubordinatesLeavesTotalList = await MyTeamApiClient().getSubordinatesLeavesList(DateUtil.convertDateToStringLocation(selectedDateFrom), DateUtil.convertDateToStringLocation(selectedDateTo));
|
|
|
|
|
showList= true;
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
} catch (ex) {da
|
|
|
|
|
setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
@ -59,83 +60,94 @@ class _SubordinateLeaveState extends State<SubordinateLeave> {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBarWidget(
|
|
|
|
|
context,
|
|
|
|
|
title: "Subordinate Leave",
|
|
|
|
|
title: LocaleKeys.subordinateLeave.tr(),
|
|
|
|
|
),
|
|
|
|
|
backgroundColor: MyColors.backgroundColor,
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
DynamicTextFieldWidget(
|
|
|
|
|
LocaleKeys.dateFrom.tr(),
|
|
|
|
|
selectedDateFrom.toString().split(" ")[0],
|
|
|
|
|
suffixIconData: Icons.calendar_today,
|
|
|
|
|
isEnable: false,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
selectedDateFrom = await _selectDate(context, DateTime.now());
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
DynamicTextFieldWidget(
|
|
|
|
|
LocaleKeys.dateTo.tr(),
|
|
|
|
|
selectedDateTo.toString().split(" ")[0],
|
|
|
|
|
suffixIconData: Icons.calendar_today,
|
|
|
|
|
isEnable: false,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
selectedDateTo = await _selectDate(context, DateTime.now());
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).objectContainerView(),
|
|
|
|
|
!showList?
|
|
|
|
|
SingleChildScrollView(
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
DynamicTextFieldWidget(
|
|
|
|
|
LocaleKeys.dateFrom.tr(),
|
|
|
|
|
selectedDateFrom.toString().split(" ")[0],
|
|
|
|
|
suffixIconData: Icons.calendar_today,
|
|
|
|
|
isEnable: false,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
selectedDateFrom = await _selectDate(context, DateTime.now());
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
DynamicTextFieldWidget(
|
|
|
|
|
LocaleKeys.dateTo.tr(),
|
|
|
|
|
selectedDateTo.toString().split(" ")[0],
|
|
|
|
|
suffixIconData: Icons.calendar_today,
|
|
|
|
|
isEnable: false,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
selectedDateTo = await _selectDate(context, DateTime.now());
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).objectContainerView(),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 21, right: 21),
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
separatorBuilder: (cxt, index) => 12.height,
|
|
|
|
|
itemCount: getSubordinatesLeavesTotalList.length,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
var diffDays = selectedDateTo.difference(selectedDateFrom).inDays;
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
// CircleAvatar(
|
|
|
|
|
// radius: 25,
|
|
|
|
|
// backgroundImage: MemoryImage(Utils.getPostBytes(getSubordinatesLeavesTotalList[index].eMPLOYEEIMAGE)),
|
|
|
|
|
// backgroundColor: Colors.black,
|
|
|
|
|
// ),
|
|
|
|
|
SvgPicture.asset("assets/images/clock.svg"),
|
|
|
|
|
10.width,
|
|
|
|
|
"${getSubordinatesLeavesTotalList[index].eMPLOYEENAME}".toText16(isBold: true, color: MyColors.grey3AColor),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
children: [
|
|
|
|
|
"From: ${getSubordinatesLeavesTotalList[index].dATESTART}".toText10(isBold: true, color: MyColors.grey57Color),
|
|
|
|
|
"To: ${getSubordinatesLeavesTotalList[index].dATEEND}".toText10(isBold: true, color: MyColors.grey57Color),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
"Number of days: $diffDays".toText13(color: MyColors.grey3AColor),
|
|
|
|
|
],
|
|
|
|
|
).objectContainerView();
|
|
|
|
|
}),
|
|
|
|
|
).objectContainerView()
|
|
|
|
|
:Container(),
|
|
|
|
|
],
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
showList? ListView.separated(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
separatorBuilder: (BuildContext cxt,int index) => 12.height,
|
|
|
|
|
itemCount: getSubordinatesLeavesTotalList.length,
|
|
|
|
|
itemBuilder: (BuildContext context,int index) {
|
|
|
|
|
var diffDays = DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATEEND!).difference(DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATESTART!)).inDays;
|
|
|
|
|
return getSubordinatesLeavesTotalList.isEmpty
|
|
|
|
|
? Utils.getNoDataWidget(context)
|
|
|
|
|
: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
SvgPicture.asset("assets/images/user.svg"),
|
|
|
|
|
14.width,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"${getSubordinatesLeavesTotalList[index].eMPLOYEENAME}".toText16(isBold: true, color: MyColors.grey3AColor),
|
|
|
|
|
10.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
(LocaleKeys.from.tr() + ': ${DateUtil.getFormattedDate(DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATESTART!), "MMM dd yyyy")}').toText10(isBold: true, color: MyColors.grey57Color),
|
|
|
|
|
14.width,
|
|
|
|
|
(LocaleKeys.to.tr() + ': ${DateUtil.getFormattedDate(DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATEEND!), "MMM dd yyyy")}').toText10(isBold: true, color: MyColors.grey57Color),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
(LocaleKeys.numberDays.tr()+ ": $diffDays").toText10(color: MyColors.grey3AColor),
|
|
|
|
|
],
|
|
|
|
|
).expanded
|
|
|
|
|
],
|
|
|
|
|
).objectContainerView();
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
:Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
DefaultButton(
|
|
|
|
|
LocaleKeys.submit.tr(), () async {
|
|
|
|
|
getSubordinatesLeaves();
|
|
|
|
|
setState(() {
|
|
|
|
|
showList= true;
|
|
|
|
|
});
|
|
|
|
|
showList= true;
|
|
|
|
|
}).insideContainer
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
|