Merge branch 'aamir_dev' into faiz_development_common

# Conflicts:
#	lib/view_models/service_view_model.dart
master_new_changes
Faiz Hashmi 1 year ago
commit 5eb1a939dc

@ -40,7 +40,7 @@
"forgetPass": "Forget Password ?",
"phoneNumberVerified": "Phone Number Verified",
"verifyNewPassword": "Verify New Password",
"EnterPass": "Enter Password ?",
"EnterPass": "Enter Password",
"alreadySigned": " Already Signed Up and Logged In",
"emailChangedSuccessfully": "Email is Changed Successfully",
"passwordIsUpdated": "Password is Updated",

@ -707,7 +707,7 @@ static const Map<String,dynamic> en_US = {
"forgetPass": "Forget Password ?",
"phoneNumberVerified": "Phone Number Verified",
"verifyNewPassword": "Verify New Password",
"EnterPass": "Enter Password ?",
"EnterPass": "Enter Password",
"alreadySigned": " Already Signed Up and Logged In",
"emailChangedSuccessfully": "Email is Changed Successfully",
"passwordIsUpdated": "Password is Updated",

@ -21,16 +21,14 @@ class Document {
int? messageStatus;
String? message;
factory Document.fromJson(Map<String, dynamic> json) =>
Document(
factory Document.fromJson(Map<String, dynamic> json) => Document(
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
data: json["data"] == null ? null : List<DocumentData>.from(json["data"].map((x) => DocumentData.fromJson(x))),
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() =>
{
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
"data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
"messageStatus": messageStatus == null ? null : messageStatus,
@ -39,7 +37,19 @@ class Document {
}
class DocumentData {
DocumentData({this.id, this.serviceProviderId, this.documentId, this.documentUrl, this.status, this.comment, this.isActive, this.document, this.fileExt, this.documentName});
DocumentData({
this.id,
this.serviceProviderId,
this.documentId,
this.documentUrl,
this.status,
this.comment,
this.isActive,
this.document,
this.fileExt,
this.documentName,
this.isLocalFile,
});
int? id;
int? serviceProviderId;
@ -51,23 +61,22 @@ class DocumentData {
String? document;
String? fileExt;
String? documentName;
bool? isLocalFile;
factory DocumentData.fromJson(Map<String, dynamic> json) =>
DocumentData(
id: json["id"] == null ? null : json["id"],
serviceProviderId: json["serviceProviderID"] == null ? null : json["serviceProviderID"],
documentId: json["documentID"] == null ? null : json["documentID"],
documentUrl: json["documentURL"],
status: json["status"] == null ? null : json["status"],
comment: json["comment"],
isActive: json["isActive"] == null ? null : json["isActive"],
document: null,
fileExt: null,
documentName: json["documentName"] == null ? null : json["documentName"],
);
factory DocumentData.fromJson(Map<String, dynamic> json) => DocumentData(
id: json["id"] == null ? null : json["id"],
serviceProviderId: json["serviceProviderID"] == null ? null : json["serviceProviderID"],
documentId: json["documentID"] == null ? null : json["documentID"],
documentUrl: json["documentURL"],
status: json["status"] == null ? null : json["status"],
comment: json["comment"],
isActive: json["isActive"] == null ? null : json["isActive"],
document: null,
fileExt: null,
documentName: json["documentName"] == null ? null : json["documentName"],
isLocalFile: false);
Map<String, dynamic> toJson() =>
{
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"serviceProviderID": serviceProviderId == null ? null : serviceProviderId,
"documentID": documentId == null ? null : documentId,

@ -109,4 +109,6 @@ class CommonServicesImp implements CommonAppServices {
return 0.0;
}
}
}

@ -229,7 +229,9 @@ class AppointmentsVM extends BaseVM {
}
void removeServiceInCurrentAppointment(int index) {
int serviceId = servicesInCurrentAppointment.elementAt(index).serviceProviderServiceId ?? -1;
int serviceId = servicesInCurrentAppointment
.elementAt(index)
.serviceProviderServiceId ?? -1;
allSelectedItemsInAppointments.removeWhere((element) => element.serviceProviderServiceId == serviceId);
servicesInCurrentAppointment.removeAt(index);
notifyListeners();
@ -350,7 +352,8 @@ class AppointmentsVM extends BaseVM {
myAppointments = await appointmentRepo.getMyAppointmentsForCustomersByFilters();
// myFilteredAppointments = myAppointments;
myUpComingAppointments = myAppointments.where((element) => element.appointmentStatusEnum == AppointmentStatusEnum.booked || element.appointmentStatusEnum == AppointmentStatusEnum.confirmed).toList();
myUpComingAppointments =
myAppointments.where((element) => element.appointmentStatusEnum == AppointmentStatusEnum.booked || element.appointmentStatusEnum == AppointmentStatusEnum.confirmed).toList();
setState(ViewState.idle);
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments);
notifyListeners();
@ -421,7 +424,8 @@ class AppointmentsVM extends BaseVM {
bool inNeedToEnableMergeButton = false;
updateCheckBoxInMergeRequest(int currentIndex) {
myFilteredAppointments2[selectedAppointmentIndex].customerAppointmentList![currentIndex].isSelected = !(myFilteredAppointments2[selectedAppointmentIndex].customerAppointmentList?[currentIndex].isSelected ?? false);
myFilteredAppointments2[selectedAppointmentIndex].customerAppointmentList![currentIndex].isSelected =
!(myFilteredAppointments2[selectedAppointmentIndex].customerAppointmentList?[currentIndex].isSelected ?? false);
int count = countSelected(myFilteredAppointments2[selectedAppointmentIndex].customerAppointmentList ?? []);
if (count > 1)
@ -432,7 +436,10 @@ class AppointmentsVM extends BaseVM {
}
int countSelected(List<AppointmentListModel> appointments) {
return appointments.where((appointment) => appointment.isSelected == true).toList().length;
return appointments
.where((appointment) => appointment.isSelected == true)
.toList()
.length;
}
updateSelectedAppointmentDate({required int dateIndex, required int scheduleIndex}) {
@ -494,7 +501,8 @@ class AppointmentsVM extends BaseVM {
for (var element in allSelectedItemsInAppointments) {
if (!ifItemAlreadySelected(element.id!)) {
servicesInCurrentAppointment[serviceIndex].serviceItems!.add(serviceItemsFromApi[index]);
servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice = servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice + double.parse((serviceItemsFromApi[index].price) ?? "0.0");
servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice =
servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice + double.parse((serviceItemsFromApi[index].price) ?? "0.0");
}
}
} else {
@ -504,7 +512,8 @@ class AppointmentsVM extends BaseVM {
log("currentServiceSelection!.serviceItems: ${currentServiceSelection!.serviceItems!.length}");
allSelectedItemsInAppointments.removeWhere((element) => element.id == itemId);
servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice = servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice - double.parse((serviceItemsFromApi[index].price) ?? "0.0");
servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice =
servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice - double.parse((serviceItemsFromApi[index].price) ?? "0.0");
servicesInCurrentAppointment[serviceIndex].serviceItems!.removeWhere((element) => element.id == itemId);
}
notifyListeners();
@ -604,13 +613,14 @@ class AppointmentsVM extends BaseVM {
Column(
children: List.generate(
selectedService.serviceItems!.length,
(index) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
"${selectedService.serviceItems![index].name}".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
"${selectedService.serviceItems![index].price} SAR".toText(fontSize: 12, isBold: true),
],
),
(index) =>
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
"${selectedService.serviceItems![index].name}".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
"${selectedService.serviceItems![index].price} SAR".toText(fontSize: 12, isBold: true),
],
),
),
),
Row(
@ -645,7 +655,8 @@ class AppointmentsVM extends BaseVM {
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
(selectedService.isHomeSelected ? "${(selectedService.currentTotalServicePrice) + (double.parse((selectedService.rangePricePerKm ?? "0.0")) * totalKms)}" : "${selectedService.currentTotalServicePrice}")
(selectedService.isHomeSelected ? "${(selectedService.currentTotalServicePrice) + (double.parse((selectedService.rangePricePerKm ?? "0.0")) * totalKms)}" : "${selectedService
.currentTotalServicePrice}")
.toText(fontSize: 29, isBold: true),
2.width,
LocaleKeys.sar.tr().toText(color: MyColors.lightTextColor, fontSize: 16, isBold: true).paddingOnly(bottom: 5),
@ -1069,10 +1080,10 @@ class AppointmentsVM extends BaseVM {
DropValue(
element.id ?? 0,
((element.categoryName!.isEmpty
? "N/A"
: countryCode == "SA"
? element.categoryNameN
: element.categoryName) ??
? "N/A"
: countryCode == "SA"
? element.categoryNameN
: element.categoryName) ??
"N/A"),
""),
);
@ -1487,4 +1498,11 @@ class AppointmentsVM extends BaseVM {
}
setState(ViewState.idle);
}
bool isShowMergeButton() {
return myFilteredAppointments2[selectedAppointmentIndex]
.customerAppointmentList!
.every((appointment) => appointment.appointmentStatusEnum == AppointmentStatusEnum.confirmed);
}
}

@ -64,6 +64,7 @@ class ServiceVM extends BaseVM {
List<ImageModel> commercialCertificates = [];
List<ImageModel> vatCertificates = [];
List<BranchDetailModel> homePageBranches = [];
List<CategoryData> categories = [];
void updateSelectionOpenTime(String date) {
openTime = date;
@ -118,68 +119,111 @@ class ServiceVM extends BaseVM {
notifyListeners();
}
// Future<String?> selectFile(BuildContext context, int index) async {
// final status = await AppPermissions.checkStoragePermissions(context);
// if (status) {
// final File? file = await commonServices.pickFile(
// context,
// fileType: FileType.custom,
// allowedExtensions: ['png', 'pdf', 'jpeg'],
// );
// if (file != null) {
// int sizeInBytes = file.lengthSync();
// // double sizeInMb = sizeInBytes / (1024 * 1024);
// if (sizeInBytes > 1000000) {
// Utils.showToast(LocaleKeys.fileLarger.tr());
// } else {
// document!.data![index].document = Utils.convertFileToBase64(file);
// document!.data![index].fileExt = Utils.checkFileExt(file.path);
// document!.data![index].documentUrl = file.path;
// setState(ViewState.idle);
// // return document!.data![index].document;
// }
// } else {
// // User canceled the picker
// }
// }
// }
// Future<String?> selectFile(BuildContext context, int index) async {
// File? file = await commonServices.pickFile(context, fileType: FileType.custom, allowedExtensions: ['png', 'pdf', 'jpeg']);
//
// if (file != null) {
// int sizeInBytes = file.lengthSync();
// // double sizeInMb = sizeInBytes / (1024 * 1024);
// if (sizeInBytes > 1000000) {
// Utils.showToast(LocaleKeys.fileLarger.tr());
// } else {
// document!.data![index].document = Utils.convertFileToBase64(file);
// document!.data![index].fileExt = Utils.checkFileExt(file.path);
// document!.data![index].documentUrl = file.path;
// document!.data![index].isFileAttached = true;
// return Utils.convertFileToBase64(file);
// }
// } else {
// // User canceled the picker
// }
// return null;
// }
filterUserBranchCategories() {
categories = [];
print("Filter Branch Executed");
List<BranchDetailModel>? localbranches;
if (branches!.data != null) {
if (selectedBranchStatus == 3) {
localbranches = branches!.data!.serviceProviderBranch!.where((element) => element.statusId == 3).toList();
} else {
localbranches = branches!.data!.serviceProviderBranch!.where((element) => element.statusId != 3).toList();
}
}
for (var branch in localbranches!) {
for (var element in branch.branchServices!) {
categories.add(
CategoryData(
id: element.categoryId,
categoryName: element.categoryName,
categoryNameN: element.categoryName,
),
);
}
categories = categories.toSet().toList();
for (var payment in categories) {
for (var element in branch.branchServices!) {
if (payment.id == element.categoryId) {
payment.services ??= [];
payment.services!.add(element);
}
}
}
}
categories = categories;
}
// Future<String?> selectFile(BuildContext context, int index) async {
// final status = await AppPermissions.checkStoragePermissions(context);
// if (status) {
// final File? file = await commonServices.pickFile(
// context,
// fileType: FileType.custom,
// allowedExtensions: ['png', 'pdf', 'jpeg'],
// );
// if (file != null) {
// int sizeInBytes = file.lengthSync();
// // double sizeInMb = sizeInBytes / (1024 * 1024);
// if (sizeInBytes > 1000000) {
// Utils.showToast(LocaleKeys.fileLarger.tr());
// } else {
// document!.data![index].document = Utils.convertFileToBase64(file);
// document!.data![index].fileExt = Utils.checkFileExt(file.path);
// document!.data![index].documentUrl = file.path;
// setState(ViewState.idle);
// // return document!.data![index].document;
// }
// } else {
// // User canceled the picker
// }
// }
// }
// Future<String?> selectFile(BuildContext context, int index) async {
// File? file = await commonServices.pickFile(context, fileType: FileType.custom, allowedExtensions: ['png', 'pdf', 'jpeg']);
//
// if (file != null) {
// int sizeInBytes = file.lengthSync();
// // double sizeInMb = sizeInBytes / (1024 * 1024);
// if (sizeInBytes > 1000000) {
// Utils.showToast(LocaleKeys.fileLarger.tr());
// } else {
// document!.data![index].document = Utils.convertFileToBase64(file);
// document!.data![index].fileExt = Utils.checkFileExt(file.path);
// document!.data![index].documentUrl = file.path;
// document!.data![index].isFileAttached = true;
// return Utils.convertFileToBase64(file);
// }
// } else {
// // User canceled the picker
// }
// return null;
// }
Future<void> pickPdfReceiptFile(BuildContext context, int documentID, int index) async {
List<ImageModel> imageModels = [];
List<File>? files = await commonServices.pickMultipleFiles(context, allowMultiple: false);
List<File>? files = await commonServices.pickMultipleFiles(
context,
allowMultiple: false,
);
if (files == null) return null;
for (var element in files) {
imageModels.add(ImageModel(filePath: element.path, isFromNetwork: false));
imageModels.add(ImageModel(
filePath: element.path,
isFromNetwork: false,
));
}
documentID == 1
? commerceCertificates.addAll(imageModels)
: documentID == 2
? commercialCertificates.addAll(imageModels)
: vatCertificates.addAll(imageModels);
? commercialCertificates.addAll(imageModels)
: vatCertificates.addAll(imageModels);
document!.data![index].document = Utils.convertFileToBase64(files.first);
document!.data![index].fileExt = Utils.checkFileExt(files.first.path);
document!.data![index].documentUrl = files.first.path;
document!.data![index].isLocalFile = true;
notifyListeners();
}
@ -192,6 +236,16 @@ class ServiceVM extends BaseVM {
notifyListeners();
}
Future<void> removeNetworkImag(String filePath) async {
int index = document!.data!.indexWhere((element) => element.documentUrl == filePath);
if (index == -1) {
return;
}
document!.data![index].documentUrl = null;
document!.data![index].isLocalFile = true;
notifyListeners();
}
Future<void> commercialRemove(String filePath) async {
int index = commercialCertificates.indexWhere((element) => element.filePath == filePath);
if (index == -1) {
@ -214,7 +268,7 @@ class ServiceVM extends BaseVM {
return await branchRepo.serviceProviderDocumentsUpdate(data);
}
// Create new branch
// Create new branch
Future<void> getBranchAndServices() async {
setState(ViewState.busy);
branches = await branchRepo.getBranchAndServices();
@ -319,7 +373,7 @@ class ServiceVM extends BaseVM {
pickedBranchImages.clear();
}
// Create Services
// Create Services
Services? services;
List<DropValue> categoryDropList = [];
List<DropValue> servicesDropList = [];
@ -335,10 +389,10 @@ class ServiceVM extends BaseVM {
DropValue(
element.id ?? 0,
((element.categoryName!.isEmpty
? "N/A"
: countryCode == "SA"
? element.categoryNameN
: element.categoryName) ??
? "N/A"
: countryCode == "SA"
? element.categoryNameN
: element.categoryName) ??
"N/A"),
"",
),
@ -382,7 +436,9 @@ class ServiceVM extends BaseVM {
}
Future<GenericRespModel> createService(List<Map<String, dynamic>> map) async {
setState(ViewState.busy);
return await branchRepo.createService(map);
setState(ViewState.idle);
}
Future<GenericRespModel> updateServices(List<Map<String, dynamic>> map) async {
@ -435,7 +491,7 @@ class ServiceVM extends BaseVM {
return await branchRepo.duplicateItems(map);
}
// Branch Users
// Branch Users
List<BranchUser> allProviderDealersList = [];
List<BranchUser> branchUserList = [];
@ -449,6 +505,28 @@ class ServiceVM extends BaseVM {
setState(ViewState.idle);
}
// filterUserBranchCategories() {
// for (var element in branchData.branchServices!) {
// categories.add(
// CategoryData(
// id: element.categoryId,
// categoryName: element.categoryName,
// categoryNameN: element.categoryName,
// ),
// );
// }
// categories = categories.toSet().toList();
// for (var payment in categories) {
// for (var element in branchData.branchServices!) {
// if (payment.id == element.categoryId) {
// payment.services ??= [];
// payment.services!.add(element);
// }
// }
// }
// branchData.categories = categories;
// }
Future<void> getBranchUsers(Map<String, dynamic> map) async {
setState(ViewState.busy);
GenericRespModel response = await branchRepo.getBranchUsers(map);
@ -482,7 +560,9 @@ class ServiceVM extends BaseVM {
File file = File(imageModel.filePath!);
List<int> imageBytes = await file.readAsBytes();
String image = base64Encode(imageBytes);
String fileName = file.path.split('/').last;
String fileName = file.path
.split('/')
.last;
branchPostingImages = BranchPostingImages(
imageName: fileName,
imageStr: image,

@ -24,7 +24,7 @@ class _CarouselWithIndicatorState extends State<ImagesCorouselWidget> {
if (widget.imagesList.isEmpty) {
return Center(
child: SizedBox(
height: 25.h,
height: 26.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -39,17 +39,18 @@ class _CarouselWithIndicatorState extends State<ImagesCorouselWidget> {
);
}
return SizedBox(
height: 25.h,
child: Column(children: [
height: 26.h,
child: ListView(shrinkWrap: true, children: [
CarouselSlider(
items: widget.imagesList
.map((item) => Container(
margin: const EdgeInsets.all(5.0),
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(5.0)),
child: item.imageUrl.buildNetworkImage(),
),
))
.map((item) =>
Container(
margin: const EdgeInsets.all(5.0),
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(5.0)),
child: item.imageUrl.buildNetworkImage(),
),
))
.toList(),
carouselController: _controller,
options: CarouselOptions(
@ -64,7 +65,10 @@ class _CarouselWithIndicatorState extends State<ImagesCorouselWidget> {
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: widget.imagesList.asMap().entries.map((entry) {
children: widget.imagesList
.asMap()
.entries
.map((entry) {
return GestureDetector(
onTap: () => _controller.animateToPage(entry.key),
child: Container(

@ -34,7 +34,7 @@ class AdsListWidget extends StatelessWidget {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
LocaleKeys.noAdsShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor),
LocaleKeys.noAdsShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor, fontWeight: MyFonts.Medium),
],
);
}

@ -37,7 +37,7 @@ class _DamagePicturesListState extends State<DamagePicturesList> {
return const Center(child: CircularProgressIndicator());
}
return appointmentsVM.serviceItemsFromApi.isEmpty
? const EmptyWidget()
? const EmptyWidget(text: "No Items Found", isWrapedColumn: false,)
: ListView.separated(
itemCount: appointmentsVM.serviceItemsFromApi.length,
itemBuilder: (BuildContext context, int index) {

@ -167,7 +167,7 @@ class AppointmentHomeTileWidget extends StatelessWidget {
height: 19 / 12,
)
: const SizedBox(),
(AppState().currentAppType == AppType.provider ? appointmentListModel!.providerName ?? "" : appointmentListModel!.branchName ?? "").toText(color: MyColors.black, fontSize: 16, letterSpacing: -0.64, height: 24 / 16),
(AppState().currentAppType == AppType.provider ? appointmentListModel!.customerName ?? "" : appointmentListModel!.branchName ?? "").toText(color: MyColors.black, fontSize: 16, letterSpacing: -0.64, height: 24 / 16),
Row(
children: [
!isForProvider ? MyAssets.miniClock.buildSvg(height: 12) : const SizedBox(),

@ -15,6 +15,7 @@ import 'package:mc_common_app/models/provider_branches_models/profile/document.d
import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/ad_view_model.dart';
import 'package:mc_common_app/view_models/service_view_model.dart';
import 'package:mc_common_app/views/advertisement/components/picked_images_container_widget.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
@ -40,8 +41,8 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
void initState() {
super.initState();
scheduleMicrotask(() {
branchVM = Provider.of<ServiceVM>(context, listen: false);
branchVM.getServiceProviderDocument(AppState().getUser.data!.userInfo!.providerId ?? 0);
// branchVM = Provider.of<ServiceVM>(context, listen: false);
context.read<ServiceVM>().getServiceProviderDocument(AppState().getUser.data!.userInfo!.providerId ?? 0);
});
}
@ -106,11 +107,11 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
updateDocument(ServiceVM model) async {
Utils.showLoading(context);
GenericRespModel res = await model.updateDocument(model.document!.data);
Utils.hideLoading(context);
if (res.messageStatus == 1) {
Utils.showToast(LocaleKeys.documentsUploadedSuccessfully.tr());
Navigator.of(context).pop();
} else {
Utils.showToast(res.message ?? "");
}
@ -138,27 +139,24 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
isBackgroundEnabled: true,
),
10.height,
if (document.documentId == 1
? model.commerceCertificates.isNotEmpty
: document.documentId == 2
? model.commercialCertificates.isNotEmpty
: model.vatCertificates.isNotEmpty) ...[
if (isNeedToShow(model: model, document: document)) ...[
PickedFilesContainer(
pickedFiles: document.documentId == 1
? model.commerceCertificates
: document.documentId == 2
? model.commercialCertificates
: model.vatCertificates,
onCrossPressedPrimary: document.documentId == 1
// isReview: document.status == 3 ? true : false,
pickedFiles: isLocalOrNetworkFiles(model: model, document: document),
onCrossPressedPrimary: chkIsLocalOrNetwork(document: document)
? model.removeNetworkImag
: document.documentId == 1
? model.commerceRemove
: document.documentId == 2
? model.commercialRemove
: model.vatRemove,
isPdf: model.document!.data![index].fileExt == "pdf",
isFromNetwork: document.isLocalFile! ? false : true,
onAddFilePressed: () {
model.pickPdfReceiptFile(context, document.documentId!, index);
},
),
if (document.comment != null && document.comment.isNotEmpty && document.status == 4) ...[buildStatusContainer(document: document)]
] else
...[
10.height,
@ -222,4 +220,80 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
);
}
}
List<ImageModel> isLocalOrNetworkFiles({required ServiceVM model, required DocumentData document}) {
bool isNetworkImage = false;
if (!document.isLocalFile!) {
isNetworkImage = document.documentUrl != null && document.documentUrl.isNotEmpty ? true : false;
}
if (isNetworkImage) {
return [ImageModel(id: document.id, isFromNetwork: isNetworkImage, filePath: document.documentUrl)];
} else if (document.documentId == 1) {
return model.commerceCertificates;
} else if (document.documentId == 2) {
return model.commercialCertificates;
} else {
return model.vatCertificates;
}
}
bool isNeedToShow({required ServiceVM model, required DocumentData document}) {
bool allow = false;
bool isNetworkImage = document.documentUrl != null && document.documentUrl.isNotEmpty ? true : false;
if (isNetworkImage) {
allow = true;
} else {
if (document.documentId == 1 && model.commerceCertificates.isNotEmpty) {
allow = true;
}
if (document.documentId == 2 && model.commercialCertificates.isNotEmpty) {
allow = true;
}
if (document.documentId == 3 && model.vatCertificates.isNotEmpty) {
allow = true;
}
}
return allow;
}
dynamic checkOnCrossPress({required ServiceVM model, required DocumentData document}) async {
bool isNetworkImage = document.documentUrl != null && document.documentUrl.isNotEmpty ? true : false;
if (isNetworkImage) {
return document.documentUrl;
} else {
if (document.documentId == 1) {
model.commerceRemove;
}
if (document.documentId == 2) {
model.commercialRemove;
}
if (document.documentId == 3) {
model.vatRemove;
}
}
}
bool chkIsLocalOrNetwork({required DocumentData document}) {
bool isNetworkImage = false;
if (!document.isLocalFile!) {
isNetworkImage = document.documentUrl != null && document.documentUrl.isNotEmpty ? true : false;
}
return isNetworkImage;
}
Widget buildStatusContainer({required DocumentData document}) {
return Center(
child: document.comment.toString().toText(
color: MyColors.adCancelledStatusColor,
fontSize: 14,
// isItalic: true,
),
).toContainer(
marginAll: 10,
paddingAll: 10,
borderRadius: 8,
width: double.infinity,
backgroundColor: MyColors.adCancelledStatusColor.withOpacity(0.16),
);
}
}

@ -29,13 +29,13 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
ClassType type = ClassType.EMAIL;
Country? _country;
String countryCode = "";
DropValue? tempCountry;
late UserVM userVM;
@override
void initState() {
super.initState();
scheduleMicrotask(() {
userVM = Provider.of(context, listen: false);
getCountryList();
@ -142,8 +142,12 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
);
return Padding(
padding: const EdgeInsets.all(2.0),
child: DropdownField((DropValue value) {
child: DropdownField( dropdownValue: tempCountry ,(DropValue value) {
countryCode = value.subValue;
tempCountry = value;
setState(() {
});
}, list: dropList, hint: LocaleKeys.selectCountryCode.tr()),
);
} else {

@ -35,7 +35,7 @@ class _LoginWithPasswordState extends State<LoginWithPassword> {
//TODO: ONLY FOR DEVELOPMENT PURPOSE
// String phoneNum = "966504278212", password = "Fa@1234";
// String phoneNum = "966504278213", password = "Fa@1234";
String phoneNum = "966504278213", password = "Fa@1234";
String phoneNum = "", password = "";
String email = "";
String countryCode = "";
Country? _country;
@ -48,23 +48,23 @@ class _LoginWithPasswordState extends State<LoginWithPassword> {
scheduleMicrotask(() {
userVM = Provider.of(context, listen: false);
context.read<UserVM>().getAvailBio();
if (AppState().currentAppType == AppType.provider) {
phoneNum = "966530896018";
password = "Amir@1234";
// phoneNum = "966569755630";
// password = "Amir12345@"; //AAmir Sal
// phoneNum = "966598646795";
// password = "Zahoor@123";
// User Details
// phoneNum = "966554870506";
// password = "Sikander123@"; // "lastName": "sik",
// "email": "sikander@gmail.com",
// phoneNum = "966569755630";
// password = "Amir12345@";
}
// if (AppState().currentAppType == AppType.provider) {
// phoneNum = "966530896018";
// password = "Amir@1234";
//
// // phoneNum = "966569755630";
// // password = "Amir12345@"; //AAmir Sal
//
// // phoneNum = "966598646795";
// // password = "Zahoor@123";
//
// // User Details
// // phoneNum = "966554870506";
// // password = "Sikander123@"; // "lastName": "sik",
// // "email": "sikander@gmail.com",
// // phoneNum = "966569755630";
// // password = "Amir12345@";
// }
getCountryList();
});
@ -78,7 +78,7 @@ class _LoginWithPasswordState extends State<LoginWithPassword> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const CustomAppBar(isRemoveBackButton: true, title: ""),
appBar: const CustomAppBar(isRemoveBackButton: true, title: ""),
body: Container(
width: double.infinity,
height: double.infinity,

@ -1,11 +1,25 @@
import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/theme/colors.dart';
class EmptyWidget extends StatelessWidget {
const EmptyWidget({Key? key}) : super(key: key);
final String text;
final bool isWrapedColumn;
const EmptyWidget({Key? key, required this.text, this.isWrapedColumn = true}) : super(key: key);
@override
Widget build(BuildContext context) {
return Center(child: "No Data Found".toText());
if (isWrapedColumn) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
text.toText(fontSize: 16, color: MyColors.lightTextColor, fontWeight: MyFonts.Medium),
],
);
}
return Center(child: text.toText(fontSize: 16, color: MyColors.lightTextColor, fontWeight: MyFonts.Medium));
}
}

Loading…
Cancel
Save