|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:mc_common_app/classes/app_state.dart';
|
|
|
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
@ -17,20 +19,42 @@ import 'package:mc_common_app/view_models/ad_view_model.dart';
|
|
|
|
|
import 'package:mc_common_app/view_models/payment_view_model.dart';
|
|
|
|
|
import 'package:mc_common_app/views/advertisement/ad_duration_selection_sheet_content.dart';
|
|
|
|
|
import 'package:mc_common_app/views/advertisement/ads_images_slider.dart';
|
|
|
|
|
import 'package:mc_common_app/views/appointments/widgets/custom_calender_widget.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/bottom_sheet.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/common_widgets/info_bottom_sheet.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/common_widgets/time_slots.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:sizer/sizer.dart';
|
|
|
|
|
|
|
|
|
|
class AdsDetailView extends StatelessWidget {
|
|
|
|
|
class AdsDetailView extends StatefulWidget {
|
|
|
|
|
final AdDetailsModel adDetails;
|
|
|
|
|
|
|
|
|
|
const AdsDetailView({Key? key, required this.adDetails}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<AdsDetailView> createState() => _AdsDetailViewState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _AdsDetailViewState extends State<AdsDetailView> {
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
scheduleMicrotask(() {
|
|
|
|
|
onAdDetailsLoaded();
|
|
|
|
|
});
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> onAdDetailsLoaded() async {
|
|
|
|
|
context.read<PaymentVM>().updateCurrentAdId(id: widget.adDetails.id!);
|
|
|
|
|
if ((widget.adDetails.isMyAd ?? false) && (widget.adDetails.adPostStatus == AdPostStatus.reserved)) {
|
|
|
|
|
await context.read<AdVM>().getAdBankingAccountInfo(adId: widget.adDetails.id!);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void deleteAdBottomSheet(BuildContext context) {
|
|
|
|
|
AdVM adVM = context.read<AdVM>();
|
|
|
|
|
return actionConfirmationBottomSheet(
|
|
|
|
@ -44,7 +68,7 @@ class AdsDetailView extends StatelessWidget {
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
adVM.deleteMyAd(context, adId: adDetails.id!);
|
|
|
|
|
adVM.deleteMyAd(context, adId: widget.adDetails.id!);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -66,9 +90,6 @@ class AdsDetailView extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
print("adId: ${adDetails.id}");
|
|
|
|
|
print("statusID: ${adDetails.specialservice!.first.name}");
|
|
|
|
|
context.read<PaymentVM>().updateCurrentAdId(id: adDetails.id!);
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: CustomAppBar(
|
|
|
|
|
title: "Ads",
|
|
|
|
@ -76,7 +97,7 @@ class AdsDetailView extends StatelessWidget {
|
|
|
|
|
isRemoveBackButton: false,
|
|
|
|
|
isDrawerEnabled: false,
|
|
|
|
|
actions: [
|
|
|
|
|
(adDetails.isMyAd ?? false
|
|
|
|
|
((widget.adDetails.isMyAd ?? false) && (widget.adDetails.adPostStatus != AdPostStatus.reserved)
|
|
|
|
|
? IconButton(
|
|
|
|
|
icon: const Icon(Icons.delete_outline, color: MyColors.redColor),
|
|
|
|
|
onPressed: () {
|
|
|
|
@ -111,12 +132,12 @@ class AdsDetailView extends StatelessWidget {
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
CarouselWithIndicatorDemo(vehicleImages: adDetails.vehicle!.image!),
|
|
|
|
|
CarouselWithIndicatorDemo(vehicleImages: widget.adDetails.vehicle!.image!),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"${adDetails.vehicle!.vehicleTitle} | ${adDetails.vehicle!.color!.label}".toText(fontSize: 18, isBold: true),
|
|
|
|
|
(adDetails.vehicle!.cityName ?? "").toText(fontSize: 10, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
"${widget.adDetails.vehicle!.vehicleTitle} | ${widget.adDetails.vehicle!.color!.label}".toText(fontSize: 18, isBold: true),
|
|
|
|
|
(widget.adDetails.vehicle!.cityName ?? "").toText(fontSize: 10, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
@ -125,13 +146,13 @@ class AdsDetailView extends StatelessWidget {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"Model: ".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
"${adDetails.vehicle!.modelyear!.label}".toText(
|
|
|
|
|
"${widget.adDetails.vehicle!.modelyear!.label}".toText(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
isBold: true,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
"${adDetails.vehicle!.countryID}".toText(fontSize: 10, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
"${widget.adDetails.vehicle!.countryID}".toText(fontSize: 10, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
@ -140,19 +161,21 @@ class AdsDetailView extends StatelessWidget {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"Mileage: ".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
"${adDetails.vehicle!.mileage!.mileageEnd}Km".toText(
|
|
|
|
|
"${widget.adDetails.vehicle!.mileage!.mileageEnd}Km".toText(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
isBold: true,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
adDetails.createdOn != null ? DateTime.parse(adDetails.createdOn!).getTimeAgo().toText(fontSize: 10, isBold: true, color: MyColors.lightTextColor) : const SizedBox(),
|
|
|
|
|
widget.adDetails.createdOn != null
|
|
|
|
|
? DateTime.parse(widget.adDetails.createdOn!).getTimeAgo().toText(fontSize: 10, isBold: true, color: MyColors.lightTextColor)
|
|
|
|
|
: const SizedBox(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"Transmission: ".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
"${adDetails.vehicle!.transmission!.label}".toText(
|
|
|
|
|
"${widget.adDetails.vehicle!.transmission!.label}".toText(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
isBold: true,
|
|
|
|
|
),
|
|
|
|
@ -160,21 +183,21 @@ class AdsDetailView extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
"Description: ".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
"${adDetails.vehicle!.vehicleDescription}".toText(
|
|
|
|
|
"${widget.adDetails.vehicle!.vehicleDescription}".toText(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
isBold: true,
|
|
|
|
|
),
|
|
|
|
|
if (adDetails.isMyAd ?? false) ...[
|
|
|
|
|
if (widget.adDetails.isMyAd ?? false) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
"Demand: ".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
adDetails.vehicle!.demandAmount!.toInt().toString().toText(fontSize: 30, height: 1.2, isBold: true),
|
|
|
|
|
widget.adDetails.vehicle!.demandAmount!.toInt().toString().toText(fontSize: 30, height: 1.2, isBold: true),
|
|
|
|
|
" SAR".toText(fontSize: 15, isBold: true, color: MyColors.lightTextColor).paddingOnly(bottom: 5),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (adDetails.adPostStatus == AdPostStatus.expired) ...[
|
|
|
|
|
if (widget.adDetails.adPostStatus == AdPostStatus.expired) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(thickness: 1, height: 1),
|
|
|
|
|
8.height,
|
|
|
|
@ -187,25 +210,65 @@ class AdsDetailView extends StatelessWidget {
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
).toWhiteContainer(width: double.infinity, allPading: 12),
|
|
|
|
|
12.height,
|
|
|
|
|
Consumer(builder: (BuildContext context, AdVM adVM, Widget? child) {
|
|
|
|
|
if (adVM.adsBankDetailsModel != null) {
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Bank Details".toText(fontSize: 18, isBold: true),
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// "Full Name: ".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
// "${widget.adDetails.vehicle!.vehicleDescription}".toText(
|
|
|
|
|
// fontSize: 14,
|
|
|
|
|
// isBold: true,
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"Bank Name: ".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
(adVM.adsBankDetailsModel!.bankName ?? "").toText(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
isBold: true,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"IBAN: ".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor),
|
|
|
|
|
(adVM.adsBankDetailsModel!.iban ?? "").toText(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
isBold: true,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).toWhiteContainer(width: double.infinity, allPading: 12);
|
|
|
|
|
}
|
|
|
|
|
return const SizedBox.shrink();
|
|
|
|
|
})
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
if (!(adDetails.isMyAd ?? false)) ...[
|
|
|
|
|
if (!(widget.adDetails.isMyAd ?? false)) ...[
|
|
|
|
|
const Divider(thickness: 1, height: 1),
|
|
|
|
|
18.height,
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
adDetails.vehicle!.demandAmount!.toInt().toString().toText(fontSize: 30, isBold: true),
|
|
|
|
|
widget.adDetails.vehicle!.demandAmount!.toInt().toString().toText(fontSize: 30, isBold: true),
|
|
|
|
|
" SAR".toText(fontSize: 15, isBold: true, color: MyColors.lightTextColor).paddingOnly(bottom: 5),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
14.height,
|
|
|
|
|
],
|
|
|
|
|
adDetails.isMyAd ?? false ? BuildAdDetailsActionButtonForMyAds(adDetailsModel: adDetails) : BuildAdDetailsActionButtonForExploreAds(adDetailsModel: adDetails),
|
|
|
|
|
widget.adDetails.isMyAd ?? false ? BuildAdDetailsActionButtonForMyAds(adDetailsModel: widget.adDetails) : BuildAdDetailsActionButtonForExploreAds(adDetailsModel: widget.adDetails),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
@ -358,24 +421,6 @@ class BuildAdDetailsActionButtonForExploreAds extends StatelessWidget {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget cancelReservationAction(BuildContext context) {
|
|
|
|
|
return Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
borderColor: MyColors.redColor,
|
|
|
|
|
txtColor: MyColors.redColor,
|
|
|
|
|
isFilled: false,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
title: "Cancel Reservation",
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget reserveAdAction(BuildContext context, AdDetailsModel adDetailsModel) {
|
|
|
|
|
return Row(
|
|
|
|
|
children: [
|
|
|
|
@ -457,26 +502,6 @@ class BuildAdDetailsActionButtonForExploreAds extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
// switch (adPostStatus) {
|
|
|
|
|
// case AdPostStatus.pendingForPayment:
|
|
|
|
|
// break;
|
|
|
|
|
// case AdPostStatus.active:
|
|
|
|
|
// break;
|
|
|
|
|
// case AdPostStatus.reserved:
|
|
|
|
|
// return cancelReservationAction(context);
|
|
|
|
|
//
|
|
|
|
|
// case AdPostStatus.buyingService:
|
|
|
|
|
// case AdPostStatus.reserveCancel:
|
|
|
|
|
// case AdPostStatus.rejected:
|
|
|
|
|
// case AdPostStatus.cancelled:
|
|
|
|
|
// case AdPostStatus.pendingForPost:
|
|
|
|
|
// case AdPostStatus.pendingForReview:
|
|
|
|
|
// case AdPostStatus.sold:
|
|
|
|
|
// case AdPostStatus.expired:
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// return defaultAction(context);
|
|
|
|
|
|
|
|
|
|
switch (adDetailsModel.createdByRoleEnum!) {
|
|
|
|
|
case CreatedByRoleEnum.customer:
|
|
|
|
|
case CreatedByRoleEnum.provider:
|
|
|
|
@ -494,10 +519,10 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
const BuildAdDetailsActionButtonForMyAds({Key? key, required this.adDetailsModel}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
void onBookPhotographyServiceClicked(BuildContext context) async {
|
|
|
|
|
void onBookPhotographyServiceClicked(BuildContext context, {required AdDetailsModel adDetailsModel}) async {
|
|
|
|
|
AdVM adVM = context.read<AdVM>();
|
|
|
|
|
if (adVM.photoOfficeSelectedId.selectedId == -1) {
|
|
|
|
|
adVM.getPhotographyServiceScheduleListByOffices(latitude: 46.703430, longitude: 24.625720);
|
|
|
|
|
adVM.getPhotographyServiceScheduleListByOffices(latitude: 46.703430, longitude: 24.625720, isNeedToRebuild: true); // TODO: These Lat Long need to be dynamic
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return showModalBottomSheet(
|
|
|
|
@ -505,70 +530,78 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
enableDrag: true,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return InfoBottomSheet(
|
|
|
|
|
title: "Set Date and Time".toText(fontSize: 28, isBold: true, letterSpacing: -1.44, height: 1.2),
|
|
|
|
|
description: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
25.height,
|
|
|
|
|
Builder(
|
|
|
|
|
builder: (context) {
|
|
|
|
|
List<DropValue> vehicleCitiesDrop = [];
|
|
|
|
|
for (var element in adVM.photoSSSchedulesByOffices) {
|
|
|
|
|
vehicleCitiesDrop.add(DropValue(element.photoOfficeID?.toInt() ?? 0, element.photoOfficeName ?? "", ""));
|
|
|
|
|
}
|
|
|
|
|
return DropdownField(
|
|
|
|
|
(DropValue value) => adVM.updatePhotoOfficeSelectedId(SelectionModel(selectedId: value.id, selectedOption: value.value)),
|
|
|
|
|
list: vehicleCitiesDrop,
|
|
|
|
|
dropdownValue: adVM.photoOfficeSelectedId.selectedId != -1 ? DropValue(adVM.photoOfficeSelectedId.selectedId, adVM.photoOfficeSelectedId.selectedOption, "") : null,
|
|
|
|
|
hint: "Select Office",
|
|
|
|
|
errorValue: adVM.photoOfficeSelectedId.errorValue,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if (adVM.photoOfficeSelectedId.selectedId != -1) ...[
|
|
|
|
|
9.height,
|
|
|
|
|
// CustomCalenderWidget(customTimeDateSlotList: [], scheduleIndex: scheduleIndex),
|
|
|
|
|
// if (appointmentsVM.serviceAppointmentScheduleList[scheduleIndex].selectedDateIndex != null) ...[
|
|
|
|
|
// 5.height,
|
|
|
|
|
// Row(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// ("Available Slots").toText(fontSize: 14, isBold: true),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// 5.height,
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// width: double.infinity,
|
|
|
|
|
// child: BuildTimeSlots(
|
|
|
|
|
// timeSlots: appointmentsVM.serviceAppointmentScheduleList[scheduleIndex].customTimeDateSlotList![appointmentsVM.serviceAppointmentScheduleList[scheduleIndex].selectedDateIndex!]
|
|
|
|
|
// .availableSlots ??
|
|
|
|
|
// [],
|
|
|
|
|
// onPressed: (slotIndex) {
|
|
|
|
|
// appointmentsVM.updateSelectedAppointmentSlotByDate(scheduleIndex: scheduleIndex, slotIndex: slotIndex);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
5.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
title: "Book and Pay",
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
return Consumer(builder: (BuildContext context, AdVM adVM, Widget? child) {
|
|
|
|
|
return InfoBottomSheet(
|
|
|
|
|
title: "Set Date and Time".toText(fontSize: 28, isBold: true, letterSpacing: -1.44, height: 1.2),
|
|
|
|
|
description: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
25.height,
|
|
|
|
|
adVM.state == ViewState.busy
|
|
|
|
|
? const Center(child: CircularProgressIndicator())
|
|
|
|
|
: Builder(
|
|
|
|
|
builder: (context) {
|
|
|
|
|
List<DropValue> vehicleCitiesDrop = [];
|
|
|
|
|
for (int i = 0; i < adVM.photoSSSchedulesByOffices.length; i++) {
|
|
|
|
|
var element = adVM.photoSSSchedulesByOffices[i];
|
|
|
|
|
vehicleCitiesDrop.add(DropValue(element.photoOfficeID?.toInt() ?? 0, element.photoOfficeName ?? "", i.toString()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DropdownField(
|
|
|
|
|
(DropValue value) => adVM.updatePhotoOfficeSelectedId(SelectionModel(selectedId: value.id, selectedOption: value.value, itemPrice: value.subValue)),
|
|
|
|
|
// here the item price is the index of the selected option
|
|
|
|
|
list: vehicleCitiesDrop,
|
|
|
|
|
dropdownValue: adVM.photoOfficeSelectedId.selectedId != -1 ? DropValue(adVM.photoOfficeSelectedId.selectedId, adVM.photoOfficeSelectedId.selectedOption, "") : null,
|
|
|
|
|
hint: "Select Office",
|
|
|
|
|
errorValue: adVM.photoOfficeSelectedId.errorValue,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if (adVM.photoOfficeSelectedId.selectedId != -1) ...[
|
|
|
|
|
9.height,
|
|
|
|
|
CustomCalenderAppointmentWidget(
|
|
|
|
|
customTimeDateSlotList: adVM.selectedPhotoSSSchedulesByOffice.customTimeDateSlotList ?? [],
|
|
|
|
|
onDateSelected: (dateIndex) => adVM.updateSelectedPhotoOfficeAppointmentDate(dateIndex: dateIndex),
|
|
|
|
|
selectedCustomTimeDateSlotModel: adVM.selectedPhotoSSSchedulesByOffice.selectedCustomTimeDateSlotModel,
|
|
|
|
|
),
|
|
|
|
|
if (adVM.selectedPhotoSSSchedulesByOffice.selectedCustomTimeDateSlotModel != null && adVM.selectedPhotoSSSchedulesByOffice.selectedCustomTimeDateSlotModel!.date != null) ...[
|
|
|
|
|
5.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
("Available Slots").toText(fontSize: 14, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
5.height,
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: BuildTimeSlots(
|
|
|
|
|
timeSlots: adVM.selectedPhotoSSSchedulesByOffice.customTimeDateSlotList![adVM.selectedPhotoSSSchedulesByOffice.selectedDateIndex!].availableSlots ?? [],
|
|
|
|
|
onPressed: (slotIndex) => adVM.updateSelectedAppointmentSlotByDate(slotIndex: slotIndex),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
20.height,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
5.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
title: "Book and Pay",
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
adVM.onAdSSBookAppointmentPressed(context, adDetailsModel: adDetailsModel, adsSpecialServiceID: 1); //1 for photography Service
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
19.height,
|
|
|
|
|
],
|
|
|
|
|
19.height,
|
|
|
|
|
],
|
|
|
|
|
));
|
|
|
|
|
));
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -717,7 +750,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget pendingForReviewAction({required bool isPendingPost}) {
|
|
|
|
|
Widget pendingForReviewAction({required String pendingText}) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
@ -728,7 +761,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
|
|
|
|
|
backgroundColor: MyColors.grey98Color.withOpacity(0.3),
|
|
|
|
|
txtColor: MyColors.lightTextColor,
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
title: isPendingPost ? "Waiting for admin to post" : "Waiting for Admins Approval",
|
|
|
|
|
title: pendingText,
|
|
|
|
|
isBold: false,
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
),
|
|
|
|
@ -746,10 +779,11 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
|
|
|
|
|
photoSpecialServiceModel = element;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bool payButtonStatus = photoSpecialServiceModel != null && photoSpecialServiceModel.appointmentStatusId == 0;
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
if (photoSpecialServiceModel != null) ...[
|
|
|
|
|
if (photoSpecialServiceModel != null && photoSpecialServiceModel.appointmentStatusId == 0) ...[
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
@ -760,7 +794,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
|
|
|
|
|
title: "Book ${photoSpecialServiceModel.name}",
|
|
|
|
|
txtColor: MyColors.darkPrimaryColor,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
onBookPhotographyServiceClicked(context);
|
|
|
|
|
onBookPhotographyServiceClicked(context, adDetailsModel: adDetailsModel);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -773,12 +807,14 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
backgroundColor: MyColors.grey98Color.withOpacity(0.3),
|
|
|
|
|
txtColor: MyColors.lightTextColor,
|
|
|
|
|
backgroundColor: payButtonStatus ? MyColors.grey98Color.withOpacity(0.3) : MyColors.darkPrimaryColor,
|
|
|
|
|
txtColor: payButtonStatus ? MyColors.lightTextColor : MyColors.white,
|
|
|
|
|
isBold: false,
|
|
|
|
|
title: "Pay Now",
|
|
|
|
|
onPressed: () {
|
|
|
|
|
navigateWithName(context, AppRoutes.paymentMethodsView, arguments: PaymentTypes.ads);
|
|
|
|
|
if (photoSpecialServiceModel == null) {
|
|
|
|
|
navigateWithName(context, AppRoutes.paymentMethodsView, arguments: PaymentTypes.ads);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -856,19 +892,49 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget cancelReservationAction(BuildContext context) {
|
|
|
|
|
Widget cancelReservationAction(BuildContext context, {required AdDetailsModel adDetails}) {
|
|
|
|
|
return Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
borderColor: MyColors.redColor,
|
|
|
|
|
txtColor: MyColors.redColor,
|
|
|
|
|
isFilled: false,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
title: "Cancel Reservation",
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
),
|
|
|
|
|
borderColor: MyColors.redColor,
|
|
|
|
|
txtColor: MyColors.redColor,
|
|
|
|
|
isFilled: false,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
title: "Cancel Reservation",
|
|
|
|
|
onPressed: () {
|
|
|
|
|
AdVM adVM = context.read<AdVM>();
|
|
|
|
|
return actionConfirmationBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
title: "Do you want to cancel the reservation?".toText(fontSize: 28, isBold: true, letterSpacing: -1.44),
|
|
|
|
|
subtitle: "Your ad reservation will be cancelled and this ad will be again visible to everyone to buy.",
|
|
|
|
|
actionButtonYes: Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
title: "Yes",
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
adVM.cancelMyAdReservation(context, adId: adDetails.id!);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
actionButtonNo: Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
isFilled: false,
|
|
|
|
|
borderColor: MyColors.darkPrimaryColor,
|
|
|
|
|
title: "No",
|
|
|
|
|
txtColor: MyColors.darkPrimaryColor,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
@ -927,40 +993,6 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget defaultAction(BuildContext context) {
|
|
|
|
|
return Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
title: "Reserve Ad",
|
|
|
|
|
onPressed: () {
|
|
|
|
|
reserveAdPriceBreakDownClicked(context);
|
|
|
|
|
// navigateWithName(context, AppRoutes.paymentMethodsView);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
8.width,
|
|
|
|
|
Container(
|
|
|
|
|
height: 55,
|
|
|
|
|
width: 55,
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(border: Border.all(color: MyColors.black, width: 2)),
|
|
|
|
|
//TODO: It Will be replaced by a WhatsApp Icon
|
|
|
|
|
child: const Icon(Icons.message, color: MyColors.black),
|
|
|
|
|
).onPress(() {}),
|
|
|
|
|
8.width,
|
|
|
|
|
Container(
|
|
|
|
|
height: 55,
|
|
|
|
|
width: 55,
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(border: Border.all(color: MyColors.black, width: 2)),
|
|
|
|
|
child: const Icon(Icons.phone, color: MyColors.black),
|
|
|
|
|
).onPress(() {}),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
switch (adDetailsModel.adPostStatus!) {
|
|
|
|
@ -969,16 +1001,16 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
|
|
|
|
|
case AdPostStatus.active:
|
|
|
|
|
return markAsSoldAction(context);
|
|
|
|
|
case AdPostStatus.reserved:
|
|
|
|
|
break;
|
|
|
|
|
return cancelReservationAction(context, adDetails: adDetailsModel);
|
|
|
|
|
case AdPostStatus.buyingService:
|
|
|
|
|
case AdPostStatus.reserveCancel:
|
|
|
|
|
case AdPostStatus.rejected:
|
|
|
|
|
case AdPostStatus.cancelled:
|
|
|
|
|
case AdPostStatus.pendingForPost:
|
|
|
|
|
return pendingForReviewAction(isPendingPost: true);
|
|
|
|
|
return pendingForReviewAction(pendingText: "Waiting for admin to post");
|
|
|
|
|
|
|
|
|
|
case AdPostStatus.pendingForReview:
|
|
|
|
|
return pendingForReviewAction(isPendingPost: false);
|
|
|
|
|
return pendingForReviewAction(pendingText: "Waiting for Admins Approval");
|
|
|
|
|
|
|
|
|
|
case AdPostStatus.sold:
|
|
|
|
|
case AdPostStatus.expired:
|
|
|
|
|