block business details if partial access

This commit is contained in:
2024-09-10 16:23:10 +02:00
parent 9e44ef9f1a
commit b280058fd8

View File

@@ -263,6 +263,14 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
return regex.hasMatch(text); return regex.hasMatch(text);
} }
bool isFullAccess() {
if (widget.arguments.businessUser!.access == "Partial") {
return false;
} else {
return true;
}
}
@override @override
void dispose() { void dispose() {
nameController.dispose(); nameController.dispose();
@@ -332,80 +340,83 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
padding: const EdgeInsets.all(15), padding: const EdgeInsets.all(15),
child: Column( child: Column(
children: [ children: [
Column( Visibility(
children: [ visible: isFullAccess(),
const Text( child: Column(
"Business Profile", children: [
style: TextStyle( const Text(
fontWeight: FontWeight.bold, "Business Profile",
fontSize: 25, style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
), ),
), const SizedBox(height: 25.0),
const SizedBox(height: 25.0), MIHTextField(
MIHTextField( controller: regController,
controller: regController, hintText: "Registration No.",
hintText: "Registration No.", editable: true,
editable: true, required: true,
required: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), MIHTextField(
MIHTextField( controller: nameController,
controller: nameController, hintText: "Business Name",
hintText: "Business Name", editable: true,
editable: true, required: true,
required: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), MIHDropdownField(
MIHDropdownField( controller: typeController,
controller: typeController, hintText: "Business Type",
hintText: "Business Type", dropdownOptions: const ["Doctors Office", "Other"],
dropdownOptions: const ["Doctors Office", "Other"], required: true,
required: true, editable: true,
editable: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), MIHTextField(
MIHTextField( controller: contactController,
controller: contactController, hintText: "Contact Number",
hintText: "Contact Number", editable: true,
editable: true, required: true,
required: true, ),
), const SizedBox(height: 10.0),
const SizedBox(height: 10.0), MIHTextField(
MIHTextField( controller: emailController,
controller: emailController, hintText: "Email",
hintText: "Email", editable: true,
editable: true, 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: 15.0),
const SizedBox(height: 15.0), Divider(
Divider( color: MzanziInnovationHub.of(context)
color: MzanziInnovationHub.of(context) ?.theme
?.theme .secondaryColor(),
.secondaryColor(), ),
), ],
], ),
), ),
Column( Column(
children: [ children: [