add env to mzansi profile
This commit is contained in:
parent
f9fd6d374b
commit
3604793690
5 changed files with 41 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_circle_avatar.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_circle_avatar.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_env/env.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||||
|
|
||||||
class MihBusinessDetails extends StatefulWidget {
|
class MihBusinessDetails extends StatefulWidget {
|
||||||
|
|
@ -38,6 +39,7 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
||||||
final contactController = TextEditingController();
|
final contactController = TextEditingController();
|
||||||
final emailController = TextEditingController();
|
final emailController = TextEditingController();
|
||||||
final locationController = TextEditingController();
|
final locationController = TextEditingController();
|
||||||
|
late String env;
|
||||||
|
|
||||||
Future<void> submitForm() async {
|
Future<void> submitForm() async {
|
||||||
if (!isEmailValid()) {
|
if (!isEmailValid()) {
|
||||||
|
|
@ -136,6 +138,7 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
||||||
int uploadStatusCode = 0;
|
int uploadStatusCode = 0;
|
||||||
uploadStatusCode = await MihFileApi.uploadFile(
|
uploadStatusCode = await MihFileApi.uploadFile(
|
||||||
widget.arguments.business!.business_id,
|
widget.arguments.business!.business_id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
imageFile!,
|
imageFile!,
|
||||||
context,
|
context,
|
||||||
|
|
@ -144,6 +147,7 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
||||||
int deleteStatusCode = 0;
|
int deleteStatusCode = 0;
|
||||||
deleteStatusCode = await MihFileApi.deleteFile(
|
deleteStatusCode = await MihFileApi.deleteFile(
|
||||||
widget.arguments.business!.logo_path.split("/").first,
|
widget.arguments.business!.logo_path.split("/").first,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
widget.arguments.business!.logo_path.split("/").last,
|
widget.arguments.business!.logo_path.split("/").last,
|
||||||
context,
|
context,
|
||||||
|
|
@ -220,6 +224,11 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
||||||
emailController.text = widget.arguments.business!.bus_email;
|
emailController.text = widget.arguments.business!.bus_email;
|
||||||
locationController.text = widget.arguments.business!.gps_location;
|
locationController.text = widget.arguments.business!.gps_location;
|
||||||
});
|
});
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
||||||
late String oldLogoPath;
|
late String oldLogoPath;
|
||||||
late String oldSigPath;
|
late String oldSigPath;
|
||||||
String logoUri = "";
|
String logoUri = "";
|
||||||
|
late String env;
|
||||||
|
|
||||||
Future<void> updateBusinessProfileAPICall(String business_id) async {
|
Future<void> updateBusinessProfileAPICall(String business_id) async {
|
||||||
print("inside update business profile api call");
|
print("inside update business profile api call");
|
||||||
|
|
@ -145,6 +146,7 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
||||||
print("Inside upload selected file");
|
print("Inside upload selected file");
|
||||||
var response = await MihFileApi.uploadFile(
|
var response = await MihFileApi.uploadFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
file,
|
file,
|
||||||
context,
|
context,
|
||||||
|
|
@ -160,6 +162,7 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
||||||
// delete file from minio
|
// delete file from minio
|
||||||
var response = await MihFileApi.deleteFile(
|
var response = await MihFileApi.deleteFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
filePath.split("/").last,
|
filePath.split("/").last,
|
||||||
context,
|
context,
|
||||||
|
|
@ -309,6 +312,11 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
||||||
});
|
});
|
||||||
logoPreview = NetworkImage(logoUri);
|
logoPreview = NetworkImage(logoUri);
|
||||||
});
|
});
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_image_display.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_image_display.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_env/env.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||||
|
|
||||||
class MihMyBusinessUser extends StatefulWidget {
|
class MihMyBusinessUser extends StatefulWidget {
|
||||||
|
|
@ -41,6 +42,7 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
||||||
final lnameController = TextEditingController();
|
final lnameController = TextEditingController();
|
||||||
final accessController = TextEditingController();
|
final accessController = TextEditingController();
|
||||||
final signtureController = TextEditingController();
|
final signtureController = TextEditingController();
|
||||||
|
late String env;
|
||||||
|
|
||||||
bool isFormFilled() {
|
bool isFormFilled() {
|
||||||
if (signtureController.text.isEmpty ||
|
if (signtureController.text.isEmpty ||
|
||||||
|
|
@ -60,6 +62,7 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
||||||
int uploadStatusCode = 0;
|
int uploadStatusCode = 0;
|
||||||
uploadStatusCode = await MihFileApi.uploadFile(
|
uploadStatusCode = await MihFileApi.uploadFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
userSignatureFile!,
|
userSignatureFile!,
|
||||||
context,
|
context,
|
||||||
|
|
@ -68,6 +71,7 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
||||||
int deleteStatusCode = 0;
|
int deleteStatusCode = 0;
|
||||||
deleteStatusCode = await MihFileApi.deleteFile(
|
deleteStatusCode = await MihFileApi.deleteFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
widget.arguments.businessUser!.sig_path.split("/").last,
|
widget.arguments.businessUser!.sig_path.split("/").last,
|
||||||
context,
|
context,
|
||||||
|
|
@ -192,6 +196,11 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
||||||
lnameController.text = widget.arguments.signedInUser.lname;
|
lnameController.text = widget.arguments.signedInUser.lname;
|
||||||
accessController.text = widget.arguments.businessUser!.access;
|
accessController.text = widget.arguments.businessUser!.access;
|
||||||
});
|
});
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
||||||
PlatformFile? selectedSignature;
|
PlatformFile? selectedSignature;
|
||||||
|
|
||||||
final ValueNotifier<String> busType = ValueNotifier("");
|
final ValueNotifier<String> busType = ValueNotifier("");
|
||||||
|
late String env;
|
||||||
|
|
||||||
// Future<void> uploadSelectedFile(
|
// Future<void> uploadSelectedFile(
|
||||||
// PlatformFile file, TextEditingController controller) async {
|
// PlatformFile file, TextEditingController controller) async {
|
||||||
|
|
@ -85,6 +86,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
||||||
int uploadStatusCode = 0;
|
int uploadStatusCode = 0;
|
||||||
uploadStatusCode = await MihFileApi.uploadFile(
|
uploadStatusCode = await MihFileApi.uploadFile(
|
||||||
id,
|
id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
selectedFile,
|
selectedFile,
|
||||||
context,
|
context,
|
||||||
|
|
@ -632,6 +634,11 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
||||||
lnameController.text = widget.signedInUser.lname;
|
lnameController.text = widget.signedInUser.lname;
|
||||||
accessController.text = "Full";
|
accessController.text = "Full";
|
||||||
});
|
});
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
||||||
late ImageProvider<Object>? propicPreview;
|
late ImageProvider<Object>? propicPreview;
|
||||||
late bool businessUser;
|
late bool businessUser;
|
||||||
late String oldProPicName;
|
late String oldProPicName;
|
||||||
|
late String env;
|
||||||
|
|
||||||
Future<void> submitForm() async {
|
Future<void> submitForm() async {
|
||||||
// print("============\nsubmiit form\n=================");
|
// print("============\nsubmiit form\n=================");
|
||||||
|
|
@ -82,6 +83,7 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
||||||
Future<void> uploadSelectedFile(PlatformFile? file) async {
|
Future<void> uploadSelectedFile(PlatformFile? file) async {
|
||||||
var response = await MihFileApi.uploadFile(
|
var response = await MihFileApi.uploadFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"profile_files",
|
"profile_files",
|
||||||
file,
|
file,
|
||||||
context,
|
context,
|
||||||
|
|
@ -144,6 +146,7 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
||||||
Future<void> deleteFileApiCall(String filename) async {
|
Future<void> deleteFileApiCall(String filename) async {
|
||||||
var response = await MihFileApi.deleteFile(
|
var response = await MihFileApi.deleteFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"profile_files",
|
"profile_files",
|
||||||
filename,
|
filename,
|
||||||
context,
|
context,
|
||||||
|
|
@ -200,6 +203,11 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
||||||
if (widget.arguments.signedInUser.pro_pic_path.isNotEmpty) {
|
if (widget.arguments.signedInUser.pro_pic_path.isNotEmpty) {
|
||||||
proPicName = widget.arguments.signedInUser.pro_pic_path.split("/").last;
|
proPicName = widget.arguments.signedInUser.pro_pic_path.split("/").last;
|
||||||
}
|
}
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
propicPreview = widget.arguments.propicFile;
|
propicPreview = widget.arguments.propicFile;
|
||||||
oldProPicName = proPicName;
|
oldProPicName = proPicName;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue