Merge pull request #148 from yaso-meth/NEW-Business-Profile-Set-Up-Business
NEW-Business-Profile-Set-Up-Business
This commit is contained in:
@@ -36,8 +36,8 @@ android {
|
|||||||
compileSdkVersion 35
|
compileSdkVersion 35
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:http/http.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_env/env.dart';
|
import 'package:mzansi_innovation_hub/mih_env/env.dart';
|
||||||
@@ -7,6 +8,47 @@ import '../mih_components/mih_pop_up_messages/mih_error_message.dart';
|
|||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
|
|
||||||
class MihBusinessDetailsApi {
|
class MihBusinessDetailsApi {
|
||||||
|
Future<Response> createBusinessDetails(
|
||||||
|
String appId,
|
||||||
|
String busineName,
|
||||||
|
String businessType,
|
||||||
|
String businessRegistrationNo,
|
||||||
|
String businessPracticeNo,
|
||||||
|
String businessVatNo,
|
||||||
|
String businessEmail,
|
||||||
|
String businessPhoneNumber,
|
||||||
|
String businessLocation,
|
||||||
|
String businessLogoFilename,
|
||||||
|
BuildContext context,
|
||||||
|
) async {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const Mihloadingcircle();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
var response = await http.post(
|
||||||
|
Uri.parse("${AppEnviroment.baseApiUrl}/business/insert/"),
|
||||||
|
headers: <String, String>{
|
||||||
|
"Content-Type": "application/json; charset=UTF-8"
|
||||||
|
},
|
||||||
|
body: jsonEncode(<String, dynamic>{
|
||||||
|
"Name": busineName,
|
||||||
|
"type": businessType,
|
||||||
|
"registration_no": businessRegistrationNo,
|
||||||
|
"logo_name": businessLogoFilename,
|
||||||
|
"logo_path": "$appId/business_files/$businessLogoFilename",
|
||||||
|
"contact_no": businessPhoneNumber,
|
||||||
|
"bus_email": businessEmail,
|
||||||
|
"gps_location": businessLocation,
|
||||||
|
"practice_no": businessPracticeNo,
|
||||||
|
"vat_no": businessVatNo,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
Future<int> updateBusinessDetails(
|
Future<int> updateBusinessDetails(
|
||||||
String business_id,
|
String business_id,
|
||||||
String business_name,
|
String business_name,
|
||||||
|
|||||||
@@ -42,10 +42,13 @@ class MihFileApi {
|
|||||||
var decodedData = jsonDecode(response.body);
|
var decodedData = jsonDecode(response.body);
|
||||||
fileUrl = decodedData['minioURL'];
|
fileUrl = decodedData['minioURL'];
|
||||||
} else {
|
} else {
|
||||||
internetConnectionPopUp(context);
|
// internetConnectionPopUp(context);
|
||||||
|
print("Error: ${response.statusCode}");
|
||||||
|
print("Error: ${response.body}");
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
internetConnectionPopUp(context);
|
// internetConnectionPopUp(context);
|
||||||
|
print("Error getting url");
|
||||||
} finally {
|
} finally {
|
||||||
// Navigator.of(context).pop(); // Always pop loading dialog
|
// Navigator.of(context).pop(); // Always pop loading dialog
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,45 @@ import '../mih_components/mih_pop_up_messages/mih_error_message.dart';
|
|||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
|
|
||||||
class MihMyBusinessUserApi {
|
class MihMyBusinessUserApi {
|
||||||
|
Future<int> createBusinessUser(
|
||||||
|
String business_id,
|
||||||
|
String app_id,
|
||||||
|
String signatureFilename,
|
||||||
|
String title,
|
||||||
|
String access,
|
||||||
|
BuildContext context,
|
||||||
|
) async {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const Mihloadingcircle();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
var response = await http.post(
|
||||||
|
Uri.parse("${AppEnviroment.baseApiUrl}/business-user/insert/"),
|
||||||
|
headers: <String, String>{
|
||||||
|
"Content-Type": "application/json; charset=UTF-8"
|
||||||
|
},
|
||||||
|
body: jsonEncode(<String, dynamic>{
|
||||||
|
"business_id": business_id,
|
||||||
|
"app_id": app_id,
|
||||||
|
"signature": signatureFilename,
|
||||||
|
"sig_path": "$business_id/business_files/$signatureFilename",
|
||||||
|
"title": title,
|
||||||
|
"access": access,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
return 201;
|
||||||
|
} else {
|
||||||
|
internetConnectionPopUp(context);
|
||||||
|
return 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// This function updates the business user details.
|
/// This function updates the business user details.
|
||||||
Future<int> updateBusinessDetails(
|
Future<int> updateBusinessUser(
|
||||||
String app_id,
|
String app_id,
|
||||||
String business_id,
|
String business_id,
|
||||||
String bUserTitle,
|
String bUserTitle,
|
||||||
|
|||||||
@@ -125,6 +125,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
|||||||
userSelectedfile: file,
|
userSelectedfile: file,
|
||||||
frameColor:
|
frameColor:
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
onChange: (selectedImage) {
|
onChange: (selectedImage) {
|
||||||
setState(() {
|
setState(() {
|
||||||
file = selectedImage;
|
file = selectedImage;
|
||||||
@@ -142,6 +144,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
|||||||
MihImageDisplay(
|
MihImageDisplay(
|
||||||
imageFile: imagePreview,
|
imageFile: imagePreview,
|
||||||
width: 300,
|
width: 300,
|
||||||
|
height: 200,
|
||||||
editable: true,
|
editable: true,
|
||||||
fileNameController: _imagefileController,
|
fileNameController: _imagefileController,
|
||||||
userSelectedfile: imageFile,
|
userSelectedfile: imageFile,
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
@@ -13,6 +13,7 @@ class MihCircleAvatar extends StatefulWidget {
|
|||||||
final onChange;
|
final onChange;
|
||||||
final PlatformFile? userSelectedfile;
|
final PlatformFile? userSelectedfile;
|
||||||
final Color frameColor;
|
final Color frameColor;
|
||||||
|
final Color? backgroundColor;
|
||||||
const MihCircleAvatar({
|
const MihCircleAvatar({
|
||||||
super.key,
|
super.key,
|
||||||
required this.imageFile,
|
required this.imageFile,
|
||||||
@@ -21,6 +22,7 @@ class MihCircleAvatar extends StatefulWidget {
|
|||||||
required this.fileNameController,
|
required this.fileNameController,
|
||||||
required this.userSelectedfile,
|
required this.userSelectedfile,
|
||||||
required this.frameColor,
|
required this.frameColor,
|
||||||
|
required this.backgroundColor,
|
||||||
required this.onChange,
|
required this.onChange,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -31,11 +33,29 @@ class MihCircleAvatar extends StatefulWidget {
|
|||||||
class _MihCircleAvatarState extends State<MihCircleAvatar> {
|
class _MihCircleAvatarState extends State<MihCircleAvatar> {
|
||||||
late ImageProvider<Object>? imagePreview;
|
late ImageProvider<Object>? imagePreview;
|
||||||
|
|
||||||
|
ImageProvider<Object>? getAvatar() {
|
||||||
|
Color dark = const Color(0XFF3A4454);
|
||||||
|
if (widget.imageFile == null) {
|
||||||
|
if (widget.backgroundColor == dark) {
|
||||||
|
print("here in light icon");
|
||||||
|
return const AssetImage(
|
||||||
|
'lib/mih_components/mih_package_components/assets/images/i-dont-know-light.png');
|
||||||
|
} else {
|
||||||
|
print("here in dark icon");
|
||||||
|
return const AssetImage(
|
||||||
|
'lib/mih_components/mih_package_components/assets/images/i-dont-know-dark.png');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return widget.imageFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
print("Avatar started");
|
||||||
setState(() {
|
setState(() {
|
||||||
imagePreview = widget.imageFile;
|
imagePreview = getAvatar();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +71,7 @@ class _MihCircleAvatarState extends State<MihCircleAvatar> {
|
|||||||
children: [
|
children: [
|
||||||
CircleAvatar(
|
CircleAvatar(
|
||||||
radius: widget.width / 2.2,
|
radius: widget.width / 2.2,
|
||||||
backgroundColor: widget.frameColor,
|
backgroundColor: widget.backgroundColor,
|
||||||
backgroundImage: imagePreview,
|
backgroundImage: imagePreview,
|
||||||
),
|
),
|
||||||
FittedBox(
|
FittedBox(
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:mzansi_innovation_hub/main.dart';
|
|||||||
class MihImageDisplay extends StatefulWidget {
|
class MihImageDisplay extends StatefulWidget {
|
||||||
final ImageProvider<Object>? imageFile;
|
final ImageProvider<Object>? imageFile;
|
||||||
final double width;
|
final double width;
|
||||||
|
final double height;
|
||||||
final bool editable;
|
final bool editable;
|
||||||
final TextEditingController fileNameController;
|
final TextEditingController fileNameController;
|
||||||
final onChange;
|
final onChange;
|
||||||
@@ -15,6 +16,7 @@ class MihImageDisplay extends StatefulWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.imageFile,
|
required this.imageFile,
|
||||||
required this.width,
|
required this.width,
|
||||||
|
required this.height,
|
||||||
required this.editable,
|
required this.editable,
|
||||||
required this.fileNameController,
|
required this.fileNameController,
|
||||||
required this.userSelectedfile,
|
required this.userSelectedfile,
|
||||||
@@ -28,11 +30,28 @@ class MihImageDisplay extends StatefulWidget {
|
|||||||
class _MihImageDisplayState extends State<MihImageDisplay> {
|
class _MihImageDisplayState extends State<MihImageDisplay> {
|
||||||
late ImageProvider<Object>? imagePreview;
|
late ImageProvider<Object>? imagePreview;
|
||||||
|
|
||||||
|
ImageProvider<Object>? getImage() {
|
||||||
|
Color dark = const Color(0XFF3A4454);
|
||||||
|
if (widget.imageFile == null) {
|
||||||
|
if (MzanziInnovationHub.of(context)!.theme.secondaryColor() == dark) {
|
||||||
|
print("here in light icon");
|
||||||
|
return const AssetImage(
|
||||||
|
'lib/mih_components/mih_package_components/assets/images/i-dont-know-dark.png');
|
||||||
|
} else {
|
||||||
|
print("here in dark icon");
|
||||||
|
return const AssetImage(
|
||||||
|
'lib/mih_components/mih_package_components/assets/images/i-dont-know-light.png');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return widget.imageFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
setState(() {
|
setState(() {
|
||||||
imagePreview = widget.imageFile;
|
imagePreview = getImage();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +61,7 @@ class _MihImageDisplayState extends State<MihImageDisplay> {
|
|||||||
// color: Colors.white,
|
// color: Colors.white,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
width: widget.width,
|
width: widget.width,
|
||||||
|
height: widget.height,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -41,63 +41,56 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
|||||||
// onChange: (newProPic) {},
|
// onChange: (newProPic) {},
|
||||||
// ),
|
// ),
|
||||||
//print(widget.propicFile);
|
//print(widget.propicFile);
|
||||||
ImageProvider logoFrame =
|
return GestureDetector(
|
||||||
MzanziInnovationHub.of(context)!.theme.logoFrame();
|
onTap: () {
|
||||||
if (widget.propicFile != null) {
|
Navigator.of(context).pop();
|
||||||
return GestureDetector(
|
Navigator.of(context).pushNamed(
|
||||||
onTap: () {
|
'/mzansi-profile',
|
||||||
Navigator.of(context).pop();
|
arguments:
|
||||||
Navigator.of(context).pushNamed(
|
AppProfileUpdateArguments(widget.signedInUser, widget.propicFile),
|
||||||
'/mzansi-profile',
|
);
|
||||||
arguments: AppProfileUpdateArguments(
|
},
|
||||||
widget.signedInUser, widget.propicFile),
|
child: MihCircleAvatar(
|
||||||
);
|
imageFile: widget.propicFile,
|
||||||
},
|
|
||||||
child: MihCircleAvatar(
|
|
||||||
imageFile: widget.propicFile,
|
|
||||||
width: 60,
|
|
||||||
editable: false,
|
|
||||||
fileNameController: proPicController,
|
|
||||||
onChange: (_) {},
|
|
||||||
userSelectedfile: null,
|
|
||||||
frameColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
// MIHProfilePicture(
|
|
||||||
// profilePictureFile: widget.propicFile,
|
|
||||||
// proPicController: proPicController,
|
|
||||||
// proPic: null,
|
|
||||||
// width: 60,
|
|
||||||
// radius: 27,
|
|
||||||
// drawerMode: true,
|
|
||||||
// editable: false,
|
|
||||||
// frameColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
// onChange: (newProPic) {},
|
|
||||||
// ),
|
|
||||||
|
|
||||||
// Stack(
|
|
||||||
// alignment: Alignment.center,
|
|
||||||
// fit: StackFit.loose,
|
|
||||||
// children: [
|
|
||||||
// CircleAvatar(
|
|
||||||
// backgroundColor:
|
|
||||||
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
// backgroundImage: widget.propicFile,
|
|
||||||
// //'https://media.licdn.com/dms/image/D4D03AQGd1-QhjtWWpA/profile-displayphoto-shrink_400_400/0/1671698053061?e=2147483647&v=beta&t=a3dJI5yxs5-KeXjj10LcNCFuC9IOfa8nNn3k_Qyr0CA'),
|
|
||||||
// radius: 27,
|
|
||||||
// ),
|
|
||||||
// SizedBox(
|
|
||||||
// width: 60,
|
|
||||||
// child: Image(image: logoFrame),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return SizedBox(
|
|
||||||
width: 60,
|
width: 60,
|
||||||
child: Image(image: logoFrame),
|
editable: false,
|
||||||
);
|
fileNameController: proPicController,
|
||||||
}
|
onChange: (_) {},
|
||||||
|
userSelectedfile: null,
|
||||||
|
frameColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
// MIHProfilePicture(
|
||||||
|
// profilePictureFile: widget.propicFile,
|
||||||
|
// proPicController: proPicController,
|
||||||
|
// proPic: null,
|
||||||
|
// width: 60,
|
||||||
|
// radius: 27,
|
||||||
|
// drawerMode: true,
|
||||||
|
// editable: false,
|
||||||
|
// frameColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
// onChange: (newProPic) {},
|
||||||
|
// ),
|
||||||
|
|
||||||
|
// Stack(
|
||||||
|
// alignment: Alignment.center,
|
||||||
|
// fit: StackFit.loose,
|
||||||
|
// children: [
|
||||||
|
// CircleAvatar(
|
||||||
|
// backgroundColor:
|
||||||
|
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
// backgroundImage: widget.propicFile,
|
||||||
|
// //'https://media.licdn.com/dms/image/D4D03AQGd1-QhjtWWpA/profile-displayphoto-shrink_400_400/0/1671698053061?e=2147483647&v=beta&t=a3dJI5yxs5-KeXjj10LcNCFuC9IOfa8nNn3k_Qyr0CA'),
|
||||||
|
// radius: 27,
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// width: 60,
|
||||||
|
// child: Image(image: logoFrame),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -109,6 +109,8 @@ class _MihHomeState extends State<MihHome> {
|
|||||||
userSelectedfile: null,
|
userSelectedfile: null,
|
||||||
// frameColor: frameColor,
|
// frameColor: frameColor,
|
||||||
frameColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
frameColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
onChange: (_) {},
|
onChange: (_) {},
|
||||||
),
|
),
|
||||||
// MIHProfilePicture(
|
// MIHProfilePicture(
|
||||||
|
|||||||
@@ -35,17 +35,6 @@ class _MIHProfileGetterState extends State<MIHProfileGetter> {
|
|||||||
ImageProvider<Object>? propicFile;
|
ImageProvider<Object>? propicFile;
|
||||||
int _selcetedIndex = 0;
|
int _selcetedIndex = 0;
|
||||||
|
|
||||||
ImageProvider<Object>? isPictureAvailable(String url) {
|
|
||||||
if (url == "") {
|
|
||||||
return const AssetImage(
|
|
||||||
'lib/mih_components/mih_package_components/assets/images/i-dont-know-2.png');
|
|
||||||
} else if (url != "") {
|
|
||||||
return NetworkImage(url);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isUserNew(AppUser signedInUser) {
|
bool isUserNew(AppUser signedInUser) {
|
||||||
if (signedInUser.fname == "") {
|
if (signedInUser.fname == "") {
|
||||||
return true;
|
return true;
|
||||||
@@ -249,7 +238,9 @@ class _MIHProfileGetterState extends State<MIHProfileGetter> {
|
|||||||
business: snapshot.data!.business,
|
business: snapshot.data!.business,
|
||||||
patient: snapshot.data!.patient,
|
patient: snapshot.data!.patient,
|
||||||
notifications: snapshot.data!.notifi,
|
notifications: snapshot.data!.notifi,
|
||||||
propicFile: isPictureAvailable(snapshot.data!.profilePicUrl),
|
propicFile: snapshot.data!.profilePicUrl != ""
|
||||||
|
? NetworkImage(snapshot.data!.profilePicUrl)
|
||||||
|
: null,
|
||||||
isUserNew: isUserNew(snapshot.requireData.signedInUser),
|
isUserNew: isUserNew(snapshot.requireData.signedInUser),
|
||||||
isBusinessUser: isBusinessUser(snapshot.requireData.signedInUser),
|
isBusinessUser: isBusinessUser(snapshot.requireData.signedInUser),
|
||||||
isBusinessUserNew: isBusinessUserNew(snapshot.data!.businessUser),
|
isBusinessUserNew: isBusinessUserNew(snapshot.data!.businessUser),
|
||||||
|
|||||||
@@ -277,6 +277,8 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
|||||||
userSelectedfile: imageFile,
|
userSelectedfile: imageFile,
|
||||||
frameColor:
|
frameColor:
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
onChange: (selectedfile) {
|
onChange: (selectedfile) {
|
||||||
setState(() {
|
setState(() {
|
||||||
imageFile = selectedfile;
|
imageFile = selectedfile;
|
||||||
@@ -286,7 +288,23 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
|||||||
} else if (snapshot.hasError) {
|
} else if (snapshot.hasError) {
|
||||||
return Text("Error: ${snapshot.error}");
|
return Text("Error: ${snapshot.error}");
|
||||||
} else {
|
} else {
|
||||||
return const Text("Error loading image");
|
return MihCircleAvatar(
|
||||||
|
imageFile: null,
|
||||||
|
width: 150,
|
||||||
|
editable: true,
|
||||||
|
fileNameController: fileNameController,
|
||||||
|
userSelectedfile: imageFile,
|
||||||
|
frameColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
onChange: (selectedfile) {
|
||||||
|
setState(() {
|
||||||
|
imageFile = selectedfile;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
// return const Text("Error loading image");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -257,20 +257,6 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageProvider<Object>? isPictureAvailable(String url) {
|
|
||||||
print("logo Url: $url");
|
|
||||||
if (url == "") {
|
|
||||||
return const AssetImage(
|
|
||||||
'lib/mih_components/mih_package_components/assets/images/i-dont-know-2.png');
|
|
||||||
} else if (url != "") {
|
|
||||||
return NetworkImage(url);
|
|
||||||
} else {
|
|
||||||
return const AssetImage(
|
|
||||||
'lib/mih_components/mih_package_components/assets/images/i-dont-know-2.png');
|
|
||||||
// return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
nameController.dispose();
|
nameController.dispose();
|
||||||
@@ -321,7 +307,7 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
logoUri = value;
|
logoUri = value;
|
||||||
});
|
});
|
||||||
logoPreview = isPictureAvailable(logoUri);
|
logoPreview = NetworkImage(logoUri);
|
||||||
});
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
|
|
||||||
Future<bool> uploadFile() async {
|
Future<bool> uploadFile() async {
|
||||||
if (userSignatureFile != null) {
|
if (userSignatureFile != null) {
|
||||||
print(userSignatureFile!.name);
|
|
||||||
print(userSignatureFile!.bytes);
|
|
||||||
int uploadStatusCode = 0;
|
int uploadStatusCode = 0;
|
||||||
uploadStatusCode = await MihFileApi.uploadFile(
|
uploadStatusCode = await MihFileApi.uploadFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
@@ -86,10 +84,8 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> submitForm() async {
|
Future<void> submitForm() async {
|
||||||
print("Here 1");
|
|
||||||
if (isFormFilled()) {
|
if (isFormFilled()) {
|
||||||
print("Here 1");
|
int statusCode = await MihMyBusinessUserApi().updateBusinessUser(
|
||||||
int statusCode = await MihMyBusinessUserApi().updateBusinessDetails(
|
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
widget.arguments.businessUser!.business_id,
|
widget.arguments.businessUser!.business_id,
|
||||||
titleDropdownController.text,
|
titleDropdownController.text,
|
||||||
@@ -98,9 +94,7 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
print("Here 1");
|
|
||||||
bool successfullyUploadedFile = await uploadFile();
|
bool successfullyUploadedFile = await uploadFile();
|
||||||
print("Here 4");
|
|
||||||
if (successfullyUploadedFile) {
|
if (successfullyUploadedFile) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
@@ -259,12 +253,26 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
userSelectedfile: userPicFile,
|
userSelectedfile: userPicFile,
|
||||||
frameColor:
|
frameColor:
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
onChange: (_) {},
|
onChange: (_) {},
|
||||||
);
|
);
|
||||||
} else if (snapshot.hasError) {
|
} else if (snapshot.hasError) {
|
||||||
return Text("Error: ${snapshot.error}");
|
return Text("Error: ${snapshot.error}");
|
||||||
} else {
|
} else {
|
||||||
return const Text("Error loading image");
|
return MihCircleAvatar(
|
||||||
|
imageFile: null,
|
||||||
|
width: 150,
|
||||||
|
editable: false,
|
||||||
|
fileNameController: fileNameController,
|
||||||
|
userSelectedfile: userPicFile,
|
||||||
|
frameColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
onChange: (_) {},
|
||||||
|
);
|
||||||
|
// return const Text("Error loading image");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -319,7 +327,7 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
width: 300,
|
width: 300,
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: const Text(
|
child: const Text(
|
||||||
"Signature",
|
"Signature:",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -352,6 +360,7 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
return MihImageDisplay(
|
return MihImageDisplay(
|
||||||
imageFile: NetworkImage(snapshot.data.toString()),
|
imageFile: NetworkImage(snapshot.data.toString()),
|
||||||
width: 300,
|
width: 300,
|
||||||
|
height: 200,
|
||||||
editable: true,
|
editable: true,
|
||||||
fileNameController: signtureController,
|
fileNameController: signtureController,
|
||||||
userSelectedfile: userSignatureFile,
|
userSelectedfile: userSignatureFile,
|
||||||
@@ -364,7 +373,20 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
} else if (snapshot.hasError) {
|
} else if (snapshot.hasError) {
|
||||||
return Text("Error: ${snapshot.error}");
|
return Text("Error: ${snapshot.error}");
|
||||||
} else {
|
} else {
|
||||||
return const Text("Error loading image");
|
return MihImageDisplay(
|
||||||
|
imageFile: null,
|
||||||
|
width: 300,
|
||||||
|
height: 200,
|
||||||
|
editable: true,
|
||||||
|
fileNameController: signtureController,
|
||||||
|
userSelectedfile: userSignatureFile,
|
||||||
|
onChange: (selectedFile) {
|
||||||
|
setState(() {
|
||||||
|
userSignatureFile = selectedFile;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
// return const Text("Error loading image");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,28 +1,26 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:http/http.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_apis/mih_business_details_apis.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_apis/mih_file_api.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_apis/mih_location_api.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_apis/mih_my_business_user_apis.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_action.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_body.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_header.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_layout_builder.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_env/env.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import '../../../main.dart';
|
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
|
||||||
import 'package:supertokens_flutter/supertokens.dart';
|
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:http/http.dart' as http2;
|
|
||||||
|
|
||||||
import '../../../mih_apis/mih_location_api.dart';
|
|
||||||
import '../../../mih_components/mih_inputs_and_buttons/mih_button.dart';
|
|
||||||
import '../../../mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart';
|
|
||||||
import '../../../mih_components/mih_inputs_and_buttons/mih_file_input.dart';
|
|
||||||
import '../../../mih_components/mih_inputs_and_buttons/mih_text_input.dart';
|
|
||||||
import '../../../mih_components/mih_layout/mih_action.dart';
|
|
||||||
import '../../../mih_components/mih_layout/mih_body.dart';
|
|
||||||
import '../../../mih_components/mih_layout/mih_header.dart';
|
|
||||||
import '../../../mih_components/mih_layout/mih_layout_builder.dart';
|
|
||||||
import '../../../mih_components/mih_pop_up_messages/mih_error_message.dart';
|
|
||||||
import '../../../mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
|
||||||
import '../../../mih_components/mih_pop_up_messages/mih_success_message.dart';
|
|
||||||
import '../../../mih_env/env.dart';
|
|
||||||
import '../../../mih_objects/app_user.dart';
|
|
||||||
|
|
||||||
class ProfileBusinessAdd extends StatefulWidget {
|
class ProfileBusinessAdd extends StatefulWidget {
|
||||||
//final BusinessUserScreenArguments arguments;
|
//final BusinessUserScreenArguments arguments;
|
||||||
@@ -56,48 +54,80 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
final practiceNoController = TextEditingController();
|
final practiceNoController = TextEditingController();
|
||||||
final vatNoController = TextEditingController();
|
final vatNoController = TextEditingController();
|
||||||
|
|
||||||
late PlatformFile selectedLogo;
|
ImageProvider<Object>? logoPreview;
|
||||||
late PlatformFile selectedSignature;
|
ImageProvider<Object>? signaturePreview;
|
||||||
|
PlatformFile? selectedLogo;
|
||||||
|
PlatformFile? selectedSignature;
|
||||||
|
|
||||||
final ValueNotifier<String> busType = ValueNotifier("");
|
final ValueNotifier<String> busType = ValueNotifier("");
|
||||||
|
|
||||||
Future<void> uploadSelectedFile(
|
// Future<void> uploadSelectedFile(
|
||||||
PlatformFile file, TextEditingController controller) async {
|
// PlatformFile file, TextEditingController controller) async {
|
||||||
var token = await SuperTokens.getAccessToken();
|
// var token = await supertokens.getaccesstoken();
|
||||||
var request = http2.MultipartRequest(
|
// var request = http2.multipartrequest(
|
||||||
'POST', Uri.parse("${AppEnviroment.baseApiUrl}/minio/upload/file/"));
|
// 'post', uri.parse("${appenviroment.baseapiurl}/minio/upload/file/"));
|
||||||
request.headers['accept'] = 'application/json';
|
// request.headers['accept'] = 'application/json';
|
||||||
request.headers['Authorization'] = 'Bearer $token';
|
// request.headers['authorization'] = 'bearer $token';
|
||||||
request.headers['Content-Type'] = 'multipart/form-data';
|
// request.headers['content-type'] = 'multipart/form-data';
|
||||||
request.fields['app_id'] = widget.signedInUser.app_id;
|
// request.fields['app_id'] = widget.signedinuser.app_id;
|
||||||
request.fields['folder'] = "business_files";
|
// request.fields['folder'] = "business_files";
|
||||||
request.files.add(await http2.MultipartFile.fromBytes('file', file.bytes!,
|
// request.files.add(await http2.multipartfile.frombytes('file', file.bytes!,
|
||||||
filename: file.name.replaceAll(RegExp(r' '), '-')));
|
// filename: file.name.replaceall(regexp(r' '), '-')));
|
||||||
var response1 = await request.send();
|
// var response1 = await request.send();
|
||||||
if (response1.statusCode == 200) {
|
// if (response1.statuscode == 200) {
|
||||||
|
// } else {
|
||||||
|
// internetconnectionpopup();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
Future<bool> uploadFile(String id, PlatformFile? selectedFile) async {
|
||||||
|
print("Inside uploud file method");
|
||||||
|
int uploadStatusCode = 0;
|
||||||
|
uploadStatusCode = await MihFileApi.uploadFile(
|
||||||
|
id,
|
||||||
|
"business_files",
|
||||||
|
selectedFile,
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
print("Status code: $uploadStatusCode");
|
||||||
|
if (uploadStatusCode == 200) {
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
internetConnectionPopUp();
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> createBusinessUserAPICall(String business_id) async {
|
Future<void> createBusinessUserAPICall(String business_id) async {
|
||||||
var response = await http.post(
|
print("Inside create bus user method");
|
||||||
Uri.parse("$baseAPI/business-user/insert/"),
|
int statusCode = await MihMyBusinessUserApi().createBusinessUser(
|
||||||
headers: <String, String>{
|
business_id,
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
widget.signedInUser.app_id,
|
||||||
},
|
signtureController.text,
|
||||||
body: jsonEncode(<String, dynamic>{
|
titleController.text,
|
||||||
"business_id": business_id,
|
accessController.text,
|
||||||
"app_id": widget.signedInUser.app_id,
|
context,
|
||||||
"signature": signtureController.text,
|
|
||||||
"sig_path":
|
|
||||||
"${widget.signedInUser.app_id}/business_files/${signtureController.text}",
|
|
||||||
"title": titleController.text,
|
|
||||||
"access": accessController.text,
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
if (response.statusCode == 201) {
|
// var response = await http.post(
|
||||||
uploadSelectedFile(selectedSignature, signtureController);
|
// Uri.parse("$baseAPI/business-user/insert/"),
|
||||||
|
// headers: <String, String>{
|
||||||
|
// "Content-Type": "application/json; charset=UTF-8"
|
||||||
|
// },
|
||||||
|
// body: jsonEncode(<String, dynamic>{
|
||||||
|
// "business_id": business_id,
|
||||||
|
// "app_id": widget.signedInUser.app_id,
|
||||||
|
// "signature": signtureController.text,
|
||||||
|
// "sig_path":
|
||||||
|
// "${widget.signedInUser.app_id}/business_files/${signtureController.text}",
|
||||||
|
// "title": titleController.text,
|
||||||
|
// "access": accessController.text,
|
||||||
|
// }),
|
||||||
|
// );
|
||||||
|
print("Status code: $statusCode");
|
||||||
|
if (statusCode == 201) {
|
||||||
|
// uploadSelectedFile(selectedSignature, signtureController);
|
||||||
|
// bool successfullyUploadedFile =
|
||||||
|
// await uploadFile(business_id, selectedSignature);
|
||||||
|
// if (successfullyUploadedFile) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).popAndPushNamed(
|
Navigator.of(context).popAndPushNamed(
|
||||||
'/',
|
'/',
|
||||||
@@ -106,44 +136,58 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
String message =
|
String message =
|
||||||
"Your business profile is now live! You can now start connecting with customers and growing your business.";
|
"Your business profile is now live! You can now start connecting with customers and growing your business.";
|
||||||
successPopUp(message);
|
successPopUp(message);
|
||||||
|
// } else {
|
||||||
|
// internetConnectionPopUp();
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
internetConnectionPopUp();
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> createBusinessProfileAPICall() async {
|
Future<void> createBusinessProfileAPICall() async {
|
||||||
showDialog(
|
print("Inside create business profile method");
|
||||||
context: context,
|
Response response = await MihBusinessDetailsApi().createBusinessDetails(
|
||||||
builder: (context) {
|
widget.signedInUser.app_id,
|
||||||
return const Mihloadingcircle();
|
nameController.text,
|
||||||
},
|
typeController.text,
|
||||||
);
|
regController.text,
|
||||||
|
practiceNoController.text,
|
||||||
var response = await http.post(
|
vatNoController.text,
|
||||||
Uri.parse("$baseAPI/business/insert/"),
|
emailController.text,
|
||||||
headers: <String, String>{
|
contactController.text,
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
locationController.text,
|
||||||
},
|
logonameController.text,
|
||||||
body: jsonEncode(<String, dynamic>{
|
context,
|
||||||
"Name": nameController.text,
|
|
||||||
"type": typeController.text,
|
|
||||||
"registration_no": regController.text,
|
|
||||||
"logo_name": logonameController.text,
|
|
||||||
"logo_path":
|
|
||||||
"${widget.signedInUser.app_id}/business_files/${logonameController.text}",
|
|
||||||
"contact_no": contactController.text,
|
|
||||||
"bus_email": emailController.text,
|
|
||||||
"gps_location": locationController.text,
|
|
||||||
"practice_no": practiceNoController.text,
|
|
||||||
"vat_no": vatNoController.text,
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
// var response = await http.post(
|
||||||
|
// Uri.parse("$baseAPI/business/insert/"),
|
||||||
|
// headers: <String, String>{
|
||||||
|
// "Content-Type": "application/json; charset=UTF-8"
|
||||||
|
// },
|
||||||
|
// body: jsonEncode(<String, dynamic>{
|
||||||
|
// "Name": nameController.text,
|
||||||
|
// "type": typeController.text,
|
||||||
|
// "registration_no": regController.text,
|
||||||
|
// "logo_name": logonameController.text,
|
||||||
|
// "logo_path":
|
||||||
|
// "${widget.signedInUser.app_id}/business_files/${logonameController.text}",
|
||||||
|
// "contact_no": contactController.text,
|
||||||
|
// "bus_email": emailController.text,
|
||||||
|
// "gps_location": locationController.text,
|
||||||
|
// "practice_no": practiceNoController.text,
|
||||||
|
// "vat_no": vatNoController.text,
|
||||||
|
// }),
|
||||||
|
// );
|
||||||
|
print(response.body);
|
||||||
if (response.statusCode == 201) {
|
if (response.statusCode == 201) {
|
||||||
var businessResponse = jsonDecode(response.body);
|
var businessResponse = jsonDecode(response.body);
|
||||||
|
// bool successfullyUploadedFile =
|
||||||
|
// await uploadFile(widget.signedInUser.app_id, selectedSignature);
|
||||||
|
// if (successfullyUploadedFile) {
|
||||||
createBusinessUserAPICall(businessResponse['business_id']);
|
createBusinessUserAPICall(businessResponse['business_id']);
|
||||||
|
// } else {
|
||||||
Navigator.of(context).pop();
|
// internetConnectionPopUp();
|
||||||
// uploadSelectedFile(selectedLogo, logonameController);
|
// }
|
||||||
} else {
|
} else {
|
||||||
internetConnectionPopUp();
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
@@ -174,11 +218,11 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
if (nameController.text.isEmpty ||
|
if (nameController.text.isEmpty ||
|
||||||
typeController.text.isEmpty ||
|
typeController.text.isEmpty ||
|
||||||
regController.text.isEmpty ||
|
regController.text.isEmpty ||
|
||||||
logonameController.text.isEmpty ||
|
// logonameController.text.isEmpty ||
|
||||||
fnameController.text.isEmpty ||
|
fnameController.text.isEmpty ||
|
||||||
lnameController.text.isEmpty ||
|
lnameController.text.isEmpty ||
|
||||||
titleController.text.isEmpty ||
|
titleController.text.isEmpty ||
|
||||||
signtureController.text.isEmpty ||
|
// signtureController.text.isEmpty ||
|
||||||
accessController.text.isEmpty ||
|
accessController.text.isEmpty ||
|
||||||
contactController.text.isEmpty ||
|
contactController.text.isEmpty ||
|
||||||
emailController.text.isEmpty) {
|
emailController.text.isEmpty) {
|
||||||
@@ -189,9 +233,10 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void submitForm() {
|
void submitForm() {
|
||||||
if (!validEmail()) {
|
if (!isEmailValid()) {
|
||||||
emailError();
|
emailError();
|
||||||
} else if (isFieldsFilled()) {
|
} else if (isFieldsFilled()) {
|
||||||
|
print("Inside submit method");
|
||||||
createBusinessProfileAPICall();
|
createBusinessProfileAPICall();
|
||||||
} else {
|
} else {
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -212,12 +257,18 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool validEmail() {
|
bool isEmailValid() {
|
||||||
String text = emailController.text;
|
String text = emailController.text;
|
||||||
var regex = RegExp(r'^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$');
|
var regex = RegExp(r'^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$');
|
||||||
return regex.hasMatch(text);
|
return regex.hasMatch(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bool validEmail() {
|
||||||
|
// String text = emailController.text;
|
||||||
|
// var regex = RegExp(r'^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$');
|
||||||
|
// return regex.hasMatch(text);
|
||||||
|
// }
|
||||||
|
|
||||||
void typeSelected() {
|
void typeSelected() {
|
||||||
if (typeController.text.isNotEmpty) {
|
if (typeController.text.isNotEmpty) {
|
||||||
busType.value = typeController.text;
|
busType.value = typeController.text;
|
||||||
@@ -280,6 +331,33 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
.theme
|
.theme
|
||||||
.secondaryColor()),
|
.secondaryColor()),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
|
// MihCircleAvatar(
|
||||||
|
// imageFile: logoPreview,
|
||||||
|
// width: 150,
|
||||||
|
// editable: true,
|
||||||
|
// fileNameController: logonameController,
|
||||||
|
// userSelectedfile: selectedLogo,
|
||||||
|
// frameColor:
|
||||||
|
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
// backgroundColor:
|
||||||
|
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
// onChange: (selectedfile) {
|
||||||
|
// setState(() {
|
||||||
|
// selectedLogo = selectedfile;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 10.0),
|
||||||
|
// Visibility(
|
||||||
|
// visible: true,
|
||||||
|
// child: MIHTextField(
|
||||||
|
// controller: logonameController,
|
||||||
|
// hintText: "Selected Logo File Name",
|
||||||
|
// editable: false,
|
||||||
|
// required: true,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 10.0),
|
||||||
MIHTextField(
|
MIHTextField(
|
||||||
controller: regController,
|
controller: regController,
|
||||||
hintText: "Registration No.",
|
hintText: "Registration No.",
|
||||||
@@ -339,27 +417,27 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
required: true,
|
required: true,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
MIHFileField(
|
// MIHFileField(
|
||||||
controller: logonameController,
|
// controller: logonameController,
|
||||||
hintText: "Logo",
|
// hintText: "Logo",
|
||||||
editable: false,
|
// editable: false,
|
||||||
required: true,
|
// required: true,
|
||||||
onPressed: () async {
|
// onPressed: () async {
|
||||||
FilePickerResult? result =
|
// FilePickerResult? result =
|
||||||
await FilePicker.platform.pickFiles(
|
// await FilePicker.platform.pickFiles(
|
||||||
type: FileType.custom,
|
// type: FileType.custom,
|
||||||
allowedExtensions: ['jpg', 'png', 'pdf'],
|
// allowedExtensions: ['jpg', 'png', 'pdf'],
|
||||||
);
|
// );
|
||||||
if (result == null) return;
|
// if (result == null) return;
|
||||||
final selectedFile = result.files.first;
|
// final selectedFile = result.files.first;
|
||||||
setState(() {
|
// setState(() {
|
||||||
selectedLogo = selectedFile;
|
// selectedLogo = selectedFile;
|
||||||
});
|
// });
|
||||||
setState(() {
|
// setState(() {
|
||||||
logonameController.text = selectedFile.name;
|
// logonameController.text = selectedFile.name;
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -441,27 +519,59 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
required: true,
|
required: true,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
MIHFileField(
|
// const SizedBox(height: 10),
|
||||||
controller: signtureController,
|
// Container(
|
||||||
hintText: "Signature",
|
// width: 300,
|
||||||
editable: false,
|
// alignment: Alignment.topLeft,
|
||||||
required: true,
|
// child: const Text(
|
||||||
onPressed: () async {
|
// "Signature:",
|
||||||
FilePickerResult? result =
|
// style: TextStyle(
|
||||||
await FilePicker.platform.pickFiles(
|
// fontSize: 15,
|
||||||
type: FileType.custom,
|
// fontWeight: FontWeight.bold,
|
||||||
allowedExtensions: ['jpg', 'png', 'pdf'],
|
// ),
|
||||||
);
|
// ),
|
||||||
if (result == null) return;
|
// ),
|
||||||
final selectedFile = result.files.first;
|
// MihImageDisplay(
|
||||||
setState(() {
|
// imageFile: signaturePreview,
|
||||||
selectedSignature = selectedFile;
|
// width: 300,
|
||||||
});
|
// editable: true,
|
||||||
setState(() {
|
// fileNameController: signtureController,
|
||||||
signtureController.text = selectedFile.name;
|
// userSelectedfile: selectedSignature,
|
||||||
});
|
// onChange: (selectedFile) {
|
||||||
},
|
// setState(() {
|
||||||
),
|
// selectedSignature = selectedFile;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 10.0),
|
||||||
|
// MIHTextField(
|
||||||
|
// controller: signtureController,
|
||||||
|
// hintText: "Selected Signature File Name",
|
||||||
|
// editable: false,
|
||||||
|
// required: true,
|
||||||
|
// ),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
|
// MIHFileField(
|
||||||
|
// controller: signtureController,
|
||||||
|
// hintText: "Signature",
|
||||||
|
// editable: false,
|
||||||
|
// required: true,
|
||||||
|
// onPressed: () async {
|
||||||
|
// FilePickerResult? result =
|
||||||
|
// await FilePicker.platform.pickFiles(
|
||||||
|
// type: FileType.custom,
|
||||||
|
// allowedExtensions: ['jpg', 'png', 'pdf'],
|
||||||
|
// );
|
||||||
|
// if (result == null) return;
|
||||||
|
// final selectedFile = result.files.first;
|
||||||
|
// setState(() {
|
||||||
|
// selectedSignature = selectedFile;
|
||||||
|
// });
|
||||||
|
// setState(() {
|
||||||
|
// signtureController.text = selectedFile.name;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
const SizedBox(height: 15.0),
|
const SizedBox(height: 15.0),
|
||||||
MIHDropdownField(
|
MIHDropdownField(
|
||||||
controller: accessController,
|
controller: accessController,
|
||||||
@@ -232,6 +232,8 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
|||||||
fileNameController: proPicController,
|
fileNameController: proPicController,
|
||||||
userSelectedfile: proPic,
|
userSelectedfile: proPic,
|
||||||
frameColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
frameColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
onChange: (selectedImage) {
|
onChange: (selectedImage) {
|
||||||
setState(() {
|
setState(() {
|
||||||
proPic = selectedImage;
|
proPic = selectedImage;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import '../mih_objects/arguments.dart';
|
|||||||
import '../mih_packages/authentication/forgot_password.dart';
|
import '../mih_packages/authentication/forgot_password.dart';
|
||||||
import '../mih_packages/authentication/reset_password.dart';
|
import '../mih_packages/authentication/reset_password.dart';
|
||||||
import '../mih_packages/patient_profile/pat_profile/components/full_screen_file.dart';
|
import '../mih_packages/patient_profile/pat_profile/components/full_screen_file.dart';
|
||||||
import '../mih_packages/mzansi_profile/manage_business/profile_business_add.dart';
|
import '../mih_packages/mzansi_profile/business_profile/profile_business_add.dart';
|
||||||
|
|
||||||
class RouteGenerator {
|
class RouteGenerator {
|
||||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||||
|
|||||||
Reference in New Issue
Block a user