Skip to content

Commit

Permalink
Merge pull request #421 from sinfo/staging
Browse files Browse the repository at this point in the history
Update 1.0.18
  • Loading branch information
PMax5 committed Nov 28, 2023
2 parents e06c13a + de19ec4 commit 826e5f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 37 deletions.
54 changes: 20 additions & 34 deletions frontend/lib/components/DisplayContactCompany.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
import 'package:frontend/models/contact.dart';
import 'package:frontend/models/company.dart';
import 'package:frontend/components/EditContact.dart';
import 'package:frontend/services/authService.dart';
import 'package:frontend/services/contactService.dart';
import 'package:provider/provider.dart';
import 'InformationBox.dart';

class DisplayContactsCompany extends StatefulWidget {
Expand All @@ -26,38 +24,26 @@ class _DisplayContactsState extends State<DisplayContactsCompany> {
this.contact = contactService.getContact(widget.rep.contactID);
}

_isEditable(Contact cont) {
return FutureBuilder(
future: Provider.of<AuthService>(context).role,
builder: (context, snapshot) {
if (snapshot.hasData) {
Role r = snapshot.data as Role;

if (r == Role.ADMIN || r == Role.COORDINATOR || r == Role.MEMBER) {
return FloatingActionButton.extended(
onPressed: () async {
final bool? shouldRefresh = await Navigator.push<bool>(
context,
MaterialPageRoute(
builder: (context) =>
EditContact(contact: cont, person: widget.rep),
),
);
if (shouldRefresh ?? false) {
this.contact =
contactService.getContact(widget.rep.contactID);
setState(() {});
}
},
label: const Text('Edit Contacts'),
icon: const Icon(Icons.edit),
backgroundColor: Color(0xff5C7FF2),
);
} else
return Container();
} else
return Container();
});
_isEditable(Contact cont) {
return FloatingActionButton.extended(
onPressed: () async {
final bool? shouldRefresh = await Navigator.push<bool>(
context,
MaterialPageRoute(
builder: (context) =>
EditContact(contact: cont, person: widget.rep),
),
);
if (shouldRefresh ?? false) {
this.contact =
contactService.getContact(widget.rep.contactID);
setState(() {});
}
},
label: const Text('Edit Contacts'),
icon: const Icon(Icons.edit),
backgroundColor: Color(0xff5C7FF2),
);
}

@override
Expand Down
5 changes: 2 additions & 3 deletions frontend/lib/routes/company/CreateRep.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,8 @@ class _CreateRepState extends State<CreateRep> {
final representative = _Reps[index];
return ListTile(
key: Key(representative.id.toString()),
leading: Icon(Icons
.person), // Add your representative image here
title: Text(representative.name ?? 'N/A'),
leading: Icon(Icons.person), // Add your representative image here
title: SelectableText(representative.name),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
Expand Down

0 comments on commit 826e5f5

Please sign in to comment.