ads schedular & comments

localization_aamir
Aamir.Muhammad 5 months ago
parent 3ca0b9776b
commit 06f11e623b

@ -47,6 +47,7 @@ class ApiConsts {
static String ServiceProviderService_Create = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Create";
static String ServiceProviderService_Update = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Update";
static String GetProviderServices = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Get";
static String setScheduleInactive = "${baseUrlServices}api/ServiceProviders/BranchAppointmentSchedule_IsActiveUpdate";
static String ServiceProviderService_Get = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Get";
static String BranchesAndServices = "${baseUrlServices}api/ServiceProviders/ServiceProviderDetail_Get";

@ -58,6 +58,7 @@ class ScheduleData {
final List<ServiceModel>? scheduleServices;
final List<ServiceModel>? selectedServices;
String branchId;
int? appointmentType;
ScheduleData({
this.id,
@ -77,6 +78,7 @@ class ScheduleData {
this.scheduleServices,
this.selectedServices,
this.branchId = "",
this.appointmentType
});
factory ScheduleData.fromJson(Map<String, dynamic> json) =>
@ -94,6 +96,7 @@ class ScheduleData {
address: json["address"],
latitude: json["latitude"],
longitude: json["longitude"],
appointmentType: json["appointmentType"] == null ? null : json["appointmentType"],
weeklyOffDays: json["weeklyOffDays"] == null ? [] : List<WeeklyOffDay>.from(json["weeklyOffDays"]!.map((x) => WeeklyOffDay.fromJson(x))),
scheduleServices: json["scheduleServices"] == null ? [] : List<ServiceModel>.from(json["scheduleServices"]!.map((x) => ServiceModel.fromJson(x))),
selectedServices: [],
@ -114,6 +117,7 @@ class ScheduleData {
"address": address,
"latitude": latitude,
"longitude": longitude,
"appointmentType": appointmentType,
"scheduleServices": scheduleServices == null ? [] : List<dynamic>.from(scheduleServices!.map((x) => x.toJson())),
};

@ -55,7 +55,7 @@ class ServicesData {
String? descriptionN;
dynamic? serviceIconUrl;
dynamic? serviceImageUrl;
int? serviceCategoryId;
dynamic? serviceCategoryId;
dynamic? categoryName;
bool? isSelected;

@ -111,9 +111,9 @@ class BranchRepoImp implements BranchRepo {
@override
Future<Services> fetchServicesByCategoryId({required int serviceCategoryId}) async {
var postParams = {"ServiceCategoryID": serviceCategoryId};
var postParams = {"ServiceCategoryID": serviceCategoryId.toString()};
String t = AppState().getUser.data!.accessToken ?? "";
return await apiClient.getJsonForObject((json) => Services.fromJson(json), ApiConsts.Services_Get, queryParameters: serviceCategoryId != -1 ? postParams : null, token: t);
return await apiClient.getJsonForObject((json) => Services.fromJson(json), ApiConsts.Services_Get, queryParameters: serviceCategoryId.toString() != "-1" ? postParams : null, token: t);
}
@override

@ -18,6 +18,8 @@ abstract class ScheduleRepo {
Future<Schedule> getSchedules(String branchId);
Future<MResponse> updateServicesInSchedule(Map map);
Future<MResponse> setScheduleInActive(int scheduleId, int branchId);
}
class ScheduleRepoImp implements ScheduleRepo {
@ -47,6 +49,17 @@ class ScheduleRepoImp implements ScheduleRepo {
return await injector.get<ApiClient>().getJsonForObject((json) => Schedule.fromJson(json), ApiConsts.getSchedule, token: t, queryParameters: map);
}
@override
Future<MResponse> setScheduleInActive(int scheduleId, int branchId) async {
Map<String, dynamic> map = {
"id": scheduleId,
"serviceProviderBranchID": branchId,
"isActive": false,
};
String t = AppState().getUser.data!.accessToken ?? "";
return injector.get<ApiClient>().postJsonForObject((json) => MResponse.fromJson(json), ApiConsts.setScheduleInactive, token: t, map);
}
@override
Future<MResponse> updateSchedule(Map map) async {
String t = AppState().getUser.data!.accessToken ?? "";

@ -1,4 +1,5 @@
import 'dart:developer';
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart';
@ -66,16 +67,22 @@ class AppPermissions {
message: "You need to give storage permission to select files.",
onTap: () {
Navigator.pop(context);
openAppSettings();
},
),
);
}
Future<int> getAndroidDeviceInfo() async {
AndroidDeviceInfo deviceInfo = await DeviceInfoPlugin().androidInfo;
return deviceInfo.version.sdkInt;
}
static Future<bool> checkStoragePermissions(BuildContext context) async {
bool permissionStatus;
final deviceInfo = await DeviceInfoPlugin().androidInfo;
if (deviceInfo.version.sdkInt! > 32) {
if (deviceInfo.version.sdkInt > 32) {
permissionStatus = await Permission.photos.request().isGranted;
if (permissionStatus) {
return true;
@ -89,7 +96,6 @@ class AppPermissions {
return true;
} else {
getDialog(context);
return false;
}
}

@ -252,7 +252,25 @@ class _AdsDetailViewState extends State<AdsDetailView> {
).toWhiteContainer(width: double.infinity, allPading: 12);
}
return const SizedBox.shrink();
})
}),
12.height,
if (widget.adDetails.adPostStatus == AdPostStatus.rejected)
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Rejection Comments".toText(fontSize: 18, isBold: true),
Row(
children: [
(widget.adDetails.comment ?? "").toText(
color: MyColors.redColor,
fontSize: 12,
isItalic: true,
),
],
),
],
).toWhiteContainer(width: double.infinity, allPading: 12),
],
),
),
@ -1195,6 +1213,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
case AdPostStatus.buyingService:
case AdPostStatus.reserveCancel:
case AdPostStatus.rejected:
return pendingForReviewAction(pendingText: "Rejected form admin");
case AdPostStatus.cancelled:
case AdPostStatus.pendingForPost:
return pendingForReviewAction(pendingText: "Waiting for admin to post");

@ -46,8 +46,10 @@ class _LoginWithPasswordState extends State<LoginWithPassword> {
void initState() {
super.initState();
if (AppState().currentAppType == AppType.provider) {
phoneNum = "966580816976";
password = "123@Shf";
// phoneNum = "966580816976";
// password = "123@Shf";
phoneNum = "966530896018";
password = "Amir@123";
}
scheduleMicrotask(() {
userVM = Provider.of(context, listen: false);

@ -29,15 +29,18 @@ class _RegisterPageState extends State<RegisterProviderPage> {
String phoneNum = "", countryCode = "";
int role = -1, countryId = -1;
DropValue? selectedDrop;
TextEditingController emailController = TextEditingController();
Future<Role>? futureRoles;
Future<Country>? futureCountries;
UserVM? userVM;
@override
void initState() {
super.initState();
userVM = context.read<UserVM>();
fetchData();
}
@ -57,7 +60,6 @@ class _RegisterPageState extends State<RegisterProviderPage> {
@override
Widget build(BuildContext context) {
final UserVM userVM = context.read<UserVM>();
return Scaffold(
appBar: const CustomAppBar(isRemoveBackButton: false, title: ""),
body: Container(
@ -129,13 +131,15 @@ class _RegisterPageState extends State<RegisterProviderPage> {
10.height,
DropdownField(
(DropValue value) {
selectedDrop = value;
setState(() {
countryCode = value.subValue;
countryId = value.id;
});
},
dropdownValue: selectedDrop,
list: dropList,
hint: LocaleKeys.chooseCountry.tr(),
hint: LocaleKeys.chooseCountry .tr(),
),
],
);
@ -205,7 +209,7 @@ class _RegisterPageState extends State<RegisterProviderPage> {
title: LocaleKeys.continu.tr(),
maxWidth: double.infinity,
onPressed: () {
if (validation()) userVM.performBasicOtpRegisterPage(context, countryCode: countryCode, phoneNum: phoneNum, role: role);
if (validation()) userVM!.performBasicOtpRegisterPage(context, countryCode: countryCode, phoneNum: phoneNum, role: role);
// if (validation()) performBasicOtp(context);
},
),

@ -31,19 +31,21 @@ class _RoleTypeTabState extends State<RoleTypeTab> {
});
},
child: Container(
width: widget.width ?? (MediaQuery
.of(context)
.size
.width / 2) - 30,
width: widget.width ?? (MediaQuery.of(context).size.width / 2) - 30,
height: 45,
decoration: BoxDecoration(
color: widget.selectedIndex == index ? MyColors.darkPrimaryColor : Colors.grey[200],
// border: Border.all(color: type == ClassType.NUMBER ? MyColors.darkPrimaryColor : Colors.transparent, width: 2),
borderRadius: const BorderRadius.all(Radius.circular(0)),
borderRadius: const BorderRadius.all(
Radius.circular(0),
),
),
child: Center(
child: Text(
widget.dropList[index].value,
(widget.dropList[index].value) == "ServiceProvider_Dealership" || (widget.dropList[index].value) == "ServiceProvider_Individual"
? widget.dropList[index].value.split("_").first + "\n" + widget.dropList[index].value.split("_").last
: widget.dropList[index].value,
textAlign: TextAlign.center,
style: TextStyle(
color: widget.selectedIndex == index ? MyColors.white : Colors.black,
fontSize: 15,

@ -17,7 +17,7 @@ dependencies:
provider: ^6.0.0
easy_localization: ^3.0.3
http: ^0.13.3
permission_handler: ^10.2.0
permission_handler: ^11.3.1
flutter_svg: ^1.0.3
sizer: ^2.0.15
fluttertoast: ^8.0.8

Loading…
Cancel
Save