add practice and vat no to set up and update business
This commit is contained in:
@@ -48,14 +48,13 @@ class _BusinessDetailsState extends State<BusinessDetails> {
|
|||||||
final contactController = TextEditingController();
|
final contactController = TextEditingController();
|
||||||
final emailController = TextEditingController();
|
final emailController = TextEditingController();
|
||||||
final locationController = TextEditingController();
|
final locationController = TextEditingController();
|
||||||
|
final practiceNoController = TextEditingController();
|
||||||
|
final vatNoController = TextEditingController();
|
||||||
|
|
||||||
late PlatformFile? selectedLogo = null;
|
late PlatformFile? selectedLogo = null;
|
||||||
late PlatformFile? selectedSignature = null;
|
late PlatformFile? selectedSignature = null;
|
||||||
|
|
||||||
// late Future<BusinessUser?> futureBusinessUser;
|
final ValueNotifier<String> busType = ValueNotifier("");
|
||||||
// BusinessUser? businessUser;
|
|
||||||
// late Future<Business?> futureBusiness;
|
|
||||||
// Business? business;
|
|
||||||
|
|
||||||
late String business_id;
|
late String business_id;
|
||||||
late String oldLogoPath;
|
late String oldLogoPath;
|
||||||
@@ -79,32 +78,6 @@ class _BusinessDetailsState extends State<BusinessDetails> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<BusinessUser?> getBusinessUserDetails() async {
|
|
||||||
// var response = await http
|
|
||||||
// .get(Uri.parse("$baseAPI/business-user/${widget.signedInUser.app_id}"));
|
|
||||||
// if (response.statusCode == 200) {
|
|
||||||
// String body = response.body;
|
|
||||||
// var decodedData = jsonDecode(body);
|
|
||||||
// BusinessUser business_User = BusinessUser.fromJson(decodedData);
|
|
||||||
// return business_User;
|
|
||||||
// } else {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Future<Business?> getBusinessDetails() async {
|
|
||||||
// var response = await http.get(
|
|
||||||
// Uri.parse("$baseAPI/business/app_id/${widget.signedInUser.app_id}"));
|
|
||||||
// if (response.statusCode == 200) {
|
|
||||||
// String body = response.body;
|
|
||||||
// var decodedData = jsonDecode(body);
|
|
||||||
// Business business = Business.fromJson(decodedData);
|
|
||||||
// return business;
|
|
||||||
// } else {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Future<void> uploadSelectedFile(
|
Future<void> uploadSelectedFile(
|
||||||
PlatformFile? file, TextEditingController controller) async {
|
PlatformFile? file, TextEditingController controller) async {
|
||||||
//to-do delete file when changed
|
//to-do delete file when changed
|
||||||
@@ -183,6 +156,8 @@ class _BusinessDetailsState extends State<BusinessDetails> {
|
|||||||
"contact_no": contactController.text,
|
"contact_no": contactController.text,
|
||||||
"bus_email": emailController.text,
|
"bus_email": emailController.text,
|
||||||
"gps_location": locationController.text,
|
"gps_location": locationController.text,
|
||||||
|
"practice_no": practiceNoController.text,
|
||||||
|
"vat_no": vatNoController.text,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
@@ -275,6 +250,14 @@ class _BusinessDetailsState extends State<BusinessDetails> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void typeSelected() {
|
||||||
|
if (typeController.text.isNotEmpty) {
|
||||||
|
busType.value = typeController.text;
|
||||||
|
} else {
|
||||||
|
busType.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
nameController.dispose();
|
nameController.dispose();
|
||||||
@@ -289,12 +272,15 @@ class _BusinessDetailsState extends State<BusinessDetails> {
|
|||||||
contactController.dispose();
|
contactController.dispose();
|
||||||
emailController.dispose();
|
emailController.dispose();
|
||||||
locationController.dispose();
|
locationController.dispose();
|
||||||
|
practiceNoController.dispose();
|
||||||
|
vatNoController.dispose();
|
||||||
_focusNode.dispose();
|
_focusNode.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
typeController.addListener(typeSelected);
|
||||||
setState(() {
|
setState(() {
|
||||||
//businessUser = results;
|
//businessUser = results;
|
||||||
titleController.text = widget.arguments.businessUser!.title;
|
titleController.text = widget.arguments.businessUser!.title;
|
||||||
@@ -316,6 +302,8 @@ class _BusinessDetailsState extends State<BusinessDetails> {
|
|||||||
contactController.text = widget.arguments.business!.contact_no;
|
contactController.text = widget.arguments.business!.contact_no;
|
||||||
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;
|
||||||
|
practiceNoController.text = widget.arguments.business!.practice_no;
|
||||||
|
vatNoController.text = widget.arguments.business!.vat_no;
|
||||||
});
|
});
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -374,6 +362,29 @@ class _BusinessDetailsState extends State<BusinessDetails> {
|
|||||||
editable: true,
|
editable: true,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
|
ValueListenableBuilder(
|
||||||
|
valueListenable: busType,
|
||||||
|
builder:
|
||||||
|
(BuildContext context, String value, Widget? child) {
|
||||||
|
return Visibility(
|
||||||
|
visible: value == "Doctors Office",
|
||||||
|
child: MIHTextField(
|
||||||
|
controller: practiceNoController,
|
||||||
|
hintText: "Practice Number",
|
||||||
|
editable: true,
|
||||||
|
required: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
|
MIHTextField(
|
||||||
|
controller: vatNoController,
|
||||||
|
hintText: "VAT Number",
|
||||||
|
editable: true,
|
||||||
|
required: true,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
MIHTextField(
|
MIHTextField(
|
||||||
controller: contactController,
|
controller: contactController,
|
||||||
hintText: "Contact Number",
|
hintText: "Contact Number",
|
||||||
|
|||||||
@@ -52,10 +52,14 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
final contactController = TextEditingController();
|
final contactController = TextEditingController();
|
||||||
final emailController = TextEditingController();
|
final emailController = TextEditingController();
|
||||||
final locationController = TextEditingController();
|
final locationController = TextEditingController();
|
||||||
|
final practiceNoController = TextEditingController();
|
||||||
|
final vatNoController = TextEditingController();
|
||||||
|
|
||||||
late PlatformFile selectedLogo;
|
late PlatformFile selectedLogo;
|
||||||
late PlatformFile selectedSignature;
|
late PlatformFile selectedSignature;
|
||||||
|
|
||||||
|
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();
|
||||||
@@ -125,6 +129,8 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
"contact_no": contactController.text,
|
"contact_no": contactController.text,
|
||||||
"bus_email": emailController.text,
|
"bus_email": emailController.text,
|
||||||
"gps_location": locationController.text,
|
"gps_location": locationController.text,
|
||||||
|
"practice_no": practiceNoController.text,
|
||||||
|
"vat_no": vatNoController.text,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 201) {
|
if (response.statusCode == 201) {
|
||||||
@@ -205,6 +211,14 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
return regex.hasMatch(text);
|
return regex.hasMatch(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void typeSelected() {
|
||||||
|
if (typeController.text.isNotEmpty) {
|
||||||
|
busType.value = typeController.text;
|
||||||
|
} else {
|
||||||
|
busType.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MIHAction getActionButton() {
|
MIHAction getActionButton() {
|
||||||
return MIHAction(
|
return MIHAction(
|
||||||
icon: const Icon(Icons.arrow_back),
|
icon: const Icon(Icons.arrow_back),
|
||||||
@@ -281,6 +295,28 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
editable: true,
|
editable: true,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
|
ValueListenableBuilder(
|
||||||
|
valueListenable: busType,
|
||||||
|
builder: (BuildContext context, String value, Widget? child) {
|
||||||
|
return Visibility(
|
||||||
|
visible: value == "Doctors Office",
|
||||||
|
child: MIHTextField(
|
||||||
|
controller: practiceNoController,
|
||||||
|
hintText: "Practice Number",
|
||||||
|
editable: true,
|
||||||
|
required: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
|
MIHTextField(
|
||||||
|
controller: vatNoController,
|
||||||
|
hintText: "VAT Number",
|
||||||
|
editable: true,
|
||||||
|
required: true,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
MIHTextField(
|
MIHTextField(
|
||||||
controller: contactController,
|
controller: contactController,
|
||||||
hintText: "Contact Number",
|
hintText: "Contact Number",
|
||||||
@@ -462,12 +498,15 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
contactController.dispose();
|
contactController.dispose();
|
||||||
emailController.dispose();
|
emailController.dispose();
|
||||||
locationController.dispose();
|
locationController.dispose();
|
||||||
|
practiceNoController.dispose();
|
||||||
|
vatNoController.dispose();
|
||||||
_focusNode.dispose();
|
_focusNode.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
typeController.addListener(typeSelected);
|
||||||
setState(() {
|
setState(() {
|
||||||
fnameController.text = widget.signedInUser.fname;
|
fnameController.text = widget.signedInUser.fname;
|
||||||
lnameController.text = widget.signedInUser.lname;
|
lnameController.text = widget.signedInUser.lname;
|
||||||
@@ -489,197 +528,5 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
pullDownToRefresh: false,
|
pullDownToRefresh: false,
|
||||||
onPullDown: () async {},
|
onPullDown: () async {},
|
||||||
);
|
);
|
||||||
|
|
||||||
// return Scaffold(
|
|
||||||
// // appBar: const MIHAppBar(
|
|
||||||
// // barTitle: "Add Business",
|
|
||||||
// // propicFile: null,
|
|
||||||
// // ),
|
|
||||||
// //drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
|
|
||||||
// body: SafeArea(
|
|
||||||
// child: Stack(
|
|
||||||
// children: [
|
|
||||||
// KeyboardListener(
|
|
||||||
// focusNode: _focusNode,
|
|
||||||
// autofocus: true,
|
|
||||||
// onKeyEvent: (event) async {
|
|
||||||
// if (event is KeyDownEvent &&
|
|
||||||
// event.logicalKey == LogicalKeyboardKey.enter) {
|
|
||||||
// submitForm();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// child: SingleChildScrollView(
|
|
||||||
// padding: const EdgeInsets.all(15),
|
|
||||||
// child: Column(
|
|
||||||
// children: [
|
|
||||||
// //const SizedBox(height: 15),
|
|
||||||
// const Text(
|
|
||||||
// "Add Business Profile",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// fontSize: 25,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 25.0),
|
|
||||||
// MIHTextField(
|
|
||||||
// controller: regController,
|
|
||||||
// hintText: "Registration No.",
|
|
||||||
// editable: true,
|
|
||||||
// required: true,
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 10.0),
|
|
||||||
// MIHTextField(
|
|
||||||
// controller: nameController,
|
|
||||||
// hintText: "Business Name",
|
|
||||||
// editable: true,
|
|
||||||
// required: true,
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 10.0),
|
|
||||||
// MIHDropdownField(
|
|
||||||
// controller: typeController,
|
|
||||||
// hintText: "Business Type",
|
|
||||||
// dropdownOptions: const ["Doctors Office", "Other"],
|
|
||||||
// required: true,
|
|
||||||
// editable: true,
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 10.0),
|
|
||||||
// MIHTextField(
|
|
||||||
// controller: contactController,
|
|
||||||
// hintText: "Contact Number",
|
|
||||||
// editable: true,
|
|
||||||
// required: true,
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 10.0),
|
|
||||||
// MIHTextField(
|
|
||||||
// controller: emailController,
|
|
||||||
// hintText: "Email",
|
|
||||||
// editable: true,
|
|
||||||
// required: true,
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 10.0),
|
|
||||||
// MIHFileField(
|
|
||||||
// controller: logonameController,
|
|
||||||
// hintText: "Logo",
|
|
||||||
// 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(() {
|
|
||||||
// selectedLogo = selectedFile;
|
|
||||||
// });
|
|
||||||
// setState(() {
|
|
||||||
// logonameController.text = selectedFile.name;
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 15.0),
|
|
||||||
// Divider(
|
|
||||||
// color: MzanziInnovationHub.of(context)
|
|
||||||
// ?.theme
|
|
||||||
// .secondaryColor(),
|
|
||||||
// ),
|
|
||||||
// //const SizedBox(height: 15.0),
|
|
||||||
// const Text(
|
|
||||||
// "My Business User",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// fontSize: 25,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 25.0),
|
|
||||||
// MIHDropdownField(
|
|
||||||
// controller: titleController,
|
|
||||||
// hintText: "Title",
|
|
||||||
// dropdownOptions: const ["Doctor", "Assistant"],
|
|
||||||
// required: true,
|
|
||||||
// editable: true,
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 10.0),
|
|
||||||
// MIHTextField(
|
|
||||||
// controller: fnameController,
|
|
||||||
// hintText: "Name",
|
|
||||||
// editable: false,
|
|
||||||
// required: true,
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 10.0),
|
|
||||||
// MIHTextField(
|
|
||||||
// controller: lnameController,
|
|
||||||
// hintText: "Surname",
|
|
||||||
// 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),
|
|
||||||
// MIHDropdownField(
|
|
||||||
// controller: accessController,
|
|
||||||
// hintText: "Access",
|
|
||||||
// dropdownOptions: const ["Full", "Partial"],
|
|
||||||
// required: true,
|
|
||||||
// editable: false,
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 30.0),
|
|
||||||
// SizedBox(
|
|
||||||
// width: 500.0,
|
|
||||||
// height: 50.0,
|
|
||||||
// child: MIHButton(
|
|
||||||
// buttonText: "Add",
|
|
||||||
// buttonColor: MzanziInnovationHub.of(context)!
|
|
||||||
// .theme
|
|
||||||
// .secondaryColor(),
|
|
||||||
// textColor: MzanziInnovationHub.of(context)!
|
|
||||||
// .theme
|
|
||||||
// .primaryColor(),
|
|
||||||
// onTap: () {
|
|
||||||
// submitForm();
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Positioned(
|
|
||||||
// top: 10,
|
|
||||||
// left: 5,
|
|
||||||
// width: 50,
|
|
||||||
// height: 50,
|
|
||||||
// child: IconButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.of(context).pop();
|
|
||||||
// },
|
|
||||||
// icon: const Icon(Icons.arrow_back),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user