|
|
|
@ -65,6 +65,7 @@ class ServiceVM extends BaseVM {
|
|
|
|
List<ImageModel> commerceCertificates = [];
|
|
|
|
List<ImageModel> commerceCertificates = [];
|
|
|
|
List<ImageModel> commercialCertificates = [];
|
|
|
|
List<ImageModel> commercialCertificates = [];
|
|
|
|
List<ImageModel> vatCertificates = [];
|
|
|
|
List<ImageModel> vatCertificates = [];
|
|
|
|
|
|
|
|
List<CategoryData> categories = [];
|
|
|
|
|
|
|
|
|
|
|
|
void updateSelectionOpenTime(String date) {
|
|
|
|
void updateSelectionOpenTime(String date) {
|
|
|
|
openTime = date;
|
|
|
|
openTime = date;
|
|
|
|
@ -119,6 +120,42 @@ class ServiceVM extends BaseVM {
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
// Future<String?> selectFile(BuildContext context, int index) async {
|
|
|
|
// final status = await AppPermissions.checkStoragePermissions(context);
|
|
|
|
// final status = await AppPermissions.checkStoragePermissions(context);
|
|
|
|
// if (status) {
|
|
|
|
// if (status) {
|
|
|
|
@ -168,10 +205,16 @@ class ServiceVM extends BaseVM {
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> pickPdfReceiptFile(BuildContext context, int documentID, int index) async {
|
|
|
|
Future<void> pickPdfReceiptFile(BuildContext context, int documentID, int index) async {
|
|
|
|
List<ImageModel> imageModels = [];
|
|
|
|
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;
|
|
|
|
if (files == null) return null;
|
|
|
|
for (var element in files) {
|
|
|
|
for (var element in files) {
|
|
|
|
imageModels.add(ImageModel(filePath: element.path, isFromNetwork: false));
|
|
|
|
imageModels.add(ImageModel(
|
|
|
|
|
|
|
|
filePath: element.path,
|
|
|
|
|
|
|
|
isFromNetwork: false,
|
|
|
|
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
documentID == 1
|
|
|
|
documentID == 1
|
|
|
|
? commerceCertificates.addAll(imageModels)
|
|
|
|
? commerceCertificates.addAll(imageModels)
|
|
|
|
@ -181,6 +224,7 @@ class ServiceVM extends BaseVM {
|
|
|
|
document!.data![index].document = Utils.convertFileToBase64(files.first);
|
|
|
|
document!.data![index].document = Utils.convertFileToBase64(files.first);
|
|
|
|
document!.data![index].fileExt = Utils.checkFileExt(files.first.path);
|
|
|
|
document!.data![index].fileExt = Utils.checkFileExt(files.first.path);
|
|
|
|
document!.data![index].documentUrl = files.first.path;
|
|
|
|
document!.data![index].documentUrl = files.first.path;
|
|
|
|
|
|
|
|
document!.data![index].isLocalFile = true;
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -193,6 +237,16 @@ class ServiceVM extends BaseVM {
|
|
|
|
notifyListeners();
|
|
|
|
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 {
|
|
|
|
Future<void> commercialRemove(String filePath) async {
|
|
|
|
int index = commercialCertificates.indexWhere((element) => element.filePath == filePath);
|
|
|
|
int index = commercialCertificates.indexWhere((element) => element.filePath == filePath);
|
|
|
|
if (index == -1) {
|
|
|
|
if (index == -1) {
|
|
|
|
@ -382,7 +436,9 @@ class ServiceVM extends BaseVM {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<GenericRespModel> createService(List<Map<String, dynamic>> map) async {
|
|
|
|
Future<GenericRespModel> createService(List<Map<String, dynamic>> map) async {
|
|
|
|
|
|
|
|
setState(ViewState.busy);
|
|
|
|
return await branchRepo.createService(map);
|
|
|
|
return await branchRepo.createService(map);
|
|
|
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<GenericRespModel> updateServices(List<Map<String, dynamic>> map) async {
|
|
|
|
Future<GenericRespModel> updateServices(List<Map<String, dynamic>> map) async {
|
|
|
|
@ -449,6 +505,28 @@ class ServiceVM extends BaseVM {
|
|
|
|
setState(ViewState.idle);
|
|
|
|
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 {
|
|
|
|
Future<void> getBranchUsers(Map<String, dynamic> map) async {
|
|
|
|
setState(ViewState.busy);
|
|
|
|
setState(ViewState.busy);
|
|
|
|
GenericRespModel response = await branchRepo.getBranchUsers(map);
|
|
|
|
GenericRespModel response = await branchRepo.getBranchUsers(map);
|
|
|
|
@ -482,7 +560,9 @@ class ServiceVM extends BaseVM {
|
|
|
|
File file = File(imageModel.filePath!);
|
|
|
|
File file = File(imageModel.filePath!);
|
|
|
|
List<int> imageBytes = await file.readAsBytes();
|
|
|
|
List<int> imageBytes = await file.readAsBytes();
|
|
|
|
String image = base64Encode(imageBytes);
|
|
|
|
String image = base64Encode(imageBytes);
|
|
|
|
String fileName = file.path.split('/').last;
|
|
|
|
String fileName = file.path
|
|
|
|
|
|
|
|
.split('/')
|
|
|
|
|
|
|
|
.last;
|
|
|
|
branchPostingImages = BranchPostingImages(
|
|
|
|
branchPostingImages = BranchPostingImages(
|
|
|
|
imageName: fileName,
|
|
|
|
imageName: fileName,
|
|
|
|
imageStr: image,
|
|
|
|
imageStr: image,
|
|
|
|
|