mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 15:29:40 +00:00
add company name and replace it with job title
This commit is contained in:
@ -153,6 +153,7 @@ class EditUserModel {
|
|||||||
final String? jobTitle; // can be empty
|
final String? jobTitle; // can be empty
|
||||||
final String roleType; // e.g. "ADMIN"
|
final String roleType; // e.g. "ADMIN"
|
||||||
final List<UserSpaceModel> spaces;
|
final List<UserSpaceModel> spaces;
|
||||||
|
final String? companyName;
|
||||||
|
|
||||||
EditUserModel({
|
EditUserModel({
|
||||||
required this.uuid,
|
required this.uuid,
|
||||||
@ -167,6 +168,7 @@ class EditUserModel {
|
|||||||
required this.jobTitle,
|
required this.jobTitle,
|
||||||
required this.roleType,
|
required this.roleType,
|
||||||
required this.spaces,
|
required this.spaces,
|
||||||
|
this.companyName,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Create a [UserData] from JSON data
|
/// Create a [UserData] from JSON data
|
||||||
@ -182,6 +184,7 @@ class EditUserModel {
|
|||||||
invitedBy: json['invitedBy'] as String,
|
invitedBy: json['invitedBy'] as String,
|
||||||
phoneNumber: json['phoneNumber'] ?? '',
|
phoneNumber: json['phoneNumber'] ?? '',
|
||||||
jobTitle: json['jobTitle'] ?? '',
|
jobTitle: json['jobTitle'] ?? '',
|
||||||
|
companyName: json['companyName'] as String?,
|
||||||
roleType: json['roleType'] as String,
|
roleType: json['roleType'] as String,
|
||||||
spaces: (json['spaces'] as List<dynamic>)
|
spaces: (json['spaces'] as List<dynamic>)
|
||||||
.map((e) => UserSpaceModel.fromJson(e as Map<String, dynamic>))
|
.map((e) => UserSpaceModel.fromJson(e as Map<String, dynamic>))
|
||||||
|
@ -12,7 +12,7 @@ class RolesUserModel {
|
|||||||
final dynamic jobTitle;
|
final dynamic jobTitle;
|
||||||
final dynamic createdDate;
|
final dynamic createdDate;
|
||||||
final dynamic createdTime;
|
final dynamic createdTime;
|
||||||
|
final String? companyName;
|
||||||
RolesUserModel({
|
RolesUserModel({
|
||||||
required this.uuid,
|
required this.uuid,
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
@ -27,6 +27,7 @@ class RolesUserModel {
|
|||||||
this.jobTitle,
|
this.jobTitle,
|
||||||
required this.createdDate,
|
required this.createdDate,
|
||||||
required this.createdTime,
|
required this.createdTime,
|
||||||
|
this.companyName,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory RolesUserModel.fromJson(Map<String, dynamic> json) {
|
factory RolesUserModel.fromJson(Map<String, dynamic> json) {
|
||||||
@ -47,6 +48,7 @@ class RolesUserModel {
|
|||||||
: json['jobTitle'],
|
: json['jobTitle'],
|
||||||
createdDate: json['createdDate'],
|
createdDate: json['createdDate'],
|
||||||
createdTime: json['createdTime'],
|
createdTime: json['createdTime'],
|
||||||
|
companyName: json['companyName'] as String?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
|
|||||||
final TextEditingController lastNameController = TextEditingController();
|
final TextEditingController lastNameController = TextEditingController();
|
||||||
final TextEditingController emailController = TextEditingController();
|
final TextEditingController emailController = TextEditingController();
|
||||||
final TextEditingController phoneController = TextEditingController();
|
final TextEditingController phoneController = TextEditingController();
|
||||||
final TextEditingController jobTitleController = TextEditingController();
|
final TextEditingController companyNameController = TextEditingController();
|
||||||
final TextEditingController roleSearchController = TextEditingController();
|
final TextEditingController roleSearchController = TextEditingController();
|
||||||
|
|
||||||
bool? isCompleteBasics;
|
bool? isCompleteBasics;
|
||||||
@ -352,7 +352,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
|
|||||||
bool res = await UserPermissionApi().sendInviteUser(
|
bool res = await UserPermissionApi().sendInviteUser(
|
||||||
email: emailController.text,
|
email: emailController.text,
|
||||||
firstName: firstNameController.text,
|
firstName: firstNameController.text,
|
||||||
jobTitle: jobTitleController.text,
|
companyName: companyNameController.text,
|
||||||
lastName: lastNameController.text,
|
lastName: lastNameController.text,
|
||||||
phoneNumber: phoneController.text,
|
phoneNumber: phoneController.text,
|
||||||
roleUuid: roleSelected,
|
roleUuid: roleSelected,
|
||||||
@ -405,7 +405,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
|
|||||||
bool res = await UserPermissionApi().editInviteUser(
|
bool res = await UserPermissionApi().editInviteUser(
|
||||||
userId: event.userId,
|
userId: event.userId,
|
||||||
firstName: firstNameController.text,
|
firstName: firstNameController.text,
|
||||||
jobTitle: jobTitleController.text,
|
companyName: companyNameController.text,
|
||||||
lastName: lastNameController.text,
|
lastName: lastNameController.text,
|
||||||
phoneNumber: phoneController.text,
|
phoneNumber: phoneController.text,
|
||||||
roleUuid: roleSelected,
|
roleUuid: roleSelected,
|
||||||
@ -455,7 +455,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
|
|||||||
Future<void> checkEmail(
|
Future<void> checkEmail(
|
||||||
CheckEmailEvent event, Emitter<UsersState> emit) async {
|
CheckEmailEvent event, Emitter<UsersState> emit) async {
|
||||||
emit(UsersLoadingState());
|
emit(UsersLoadingState());
|
||||||
String? res = await UserPermissionApi().checkEmail(
|
String? res = await UserPermissionApi().checkEmail(
|
||||||
emailController.text,
|
emailController.text,
|
||||||
);
|
);
|
||||||
checkEmailValid = res!;
|
checkEmailValid = res!;
|
||||||
@ -529,7 +529,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
|
|||||||
lastNameController.text = res.lastName;
|
lastNameController.text = res.lastName;
|
||||||
emailController.text = res.email;
|
emailController.text = res.email;
|
||||||
phoneController.text = res.phoneNumber ?? '';
|
phoneController.text = res.phoneNumber ?? '';
|
||||||
jobTitleController.text = res.jobTitle ?? '';
|
companyNameController.text = res.companyName ?? '';
|
||||||
res.roleType;
|
res.roleType;
|
||||||
res.spaces.map((space) {
|
res.spaces.map((space) {
|
||||||
selectedIds.add(space.uuid);
|
selectedIds.add(space.uuid);
|
||||||
@ -645,7 +645,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
|
|||||||
lastNameController.dispose();
|
lastNameController.dispose();
|
||||||
emailController.dispose();
|
emailController.dispose();
|
||||||
phoneController.dispose();
|
phoneController.dispose();
|
||||||
jobTitleController.dispose();
|
companyNameController.dispose();
|
||||||
roleSearchController.dispose();
|
roleSearchController.dispose();
|
||||||
return super.close();
|
return super.close();
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ class BasicsView extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Job Title',
|
'Company Name',
|
||||||
style: context.textTheme.bodyMedium?.copyWith(
|
style: context.textTheme.bodyMedium?.copyWith(
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
@ -328,11 +328,11 @@ class BasicsView extends StatelessWidget {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _blocRole.jobTitleController,
|
controller: _blocRole.companyNameController,
|
||||||
style:
|
style:
|
||||||
const TextStyle(color: ColorsManager.blackColor),
|
const TextStyle(color: ColorsManager.blackColor),
|
||||||
decoration: inputTextFormDeco(
|
decoration: inputTextFormDeco(
|
||||||
hintText: "Job Title (Optional)")
|
hintText: "Comapny Name (Optional)")
|
||||||
.copyWith(
|
.copyWith(
|
||||||
hintStyle: context.textTheme.bodyMedium?.copyWith(
|
hintStyle: context.textTheme.bodyMedium?.copyWith(
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
|
@ -411,7 +411,7 @@ class UsersPage extends StatelessWidget {
|
|||||||
titles: const [
|
titles: const [
|
||||||
"Full Name",
|
"Full Name",
|
||||||
"Email Address",
|
"Email Address",
|
||||||
"Job Title",
|
"Company Name",
|
||||||
"Role",
|
"Role",
|
||||||
"Creation Date",
|
"Creation Date",
|
||||||
"Creation Time",
|
"Creation Time",
|
||||||
@ -424,7 +424,7 @@ class UsersPage extends StatelessWidget {
|
|||||||
return [
|
return [
|
||||||
Text('${user.firstName} ${user.lastName}'),
|
Text('${user.firstName} ${user.lastName}'),
|
||||||
Text(user.email),
|
Text(user.email),
|
||||||
Text(user.jobTitle),
|
Center(child: Text(user.companyName ?? '-')),
|
||||||
Text(user.roleType ?? ''),
|
Text(user.roleType ?? ''),
|
||||||
Text(user.createdDate ?? ''),
|
Text(user.createdDate ?? ''),
|
||||||
Text(user.createdTime ?? ''),
|
Text(user.createdTime ?? ''),
|
||||||
|
@ -34,8 +34,9 @@ class UserPermissionApi {
|
|||||||
path: ApiEndpoints.roleTypes,
|
path: ApiEndpoints.roleTypes,
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
final List<RoleTypeModel> fetchedRoles =
|
final List<RoleTypeModel> fetchedRoles = (json['data'] as List)
|
||||||
(json['data'] as List).map((item) => RoleTypeModel.fromJson(item)).toList();
|
.map((item) => RoleTypeModel.fromJson(item))
|
||||||
|
.toList();
|
||||||
return fetchedRoles;
|
return fetchedRoles;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -47,7 +48,9 @@ class UserPermissionApi {
|
|||||||
path: ApiEndpoints.permission.replaceAll("roleUuid", roleUuid),
|
path: ApiEndpoints.permission.replaceAll("roleUuid", roleUuid),
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
return (json as List).map((data) => PermissionOption.fromJson(data)).toList();
|
return (json as List)
|
||||||
|
.map((data) => PermissionOption.fromJson(data))
|
||||||
|
.toList();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return response ?? [];
|
return response ?? [];
|
||||||
@ -57,7 +60,7 @@ class UserPermissionApi {
|
|||||||
String? firstName,
|
String? firstName,
|
||||||
String? lastName,
|
String? lastName,
|
||||||
String? email,
|
String? email,
|
||||||
String? jobTitle,
|
String? companyName,
|
||||||
String? phoneNumber,
|
String? phoneNumber,
|
||||||
String? roleUuid,
|
String? roleUuid,
|
||||||
List<String>? spaceUuids,
|
List<String>? spaceUuids,
|
||||||
@ -68,7 +71,7 @@ class UserPermissionApi {
|
|||||||
"firstName": firstName,
|
"firstName": firstName,
|
||||||
"lastName": lastName,
|
"lastName": lastName,
|
||||||
"email": email,
|
"email": email,
|
||||||
"jobTitle": jobTitle != '' ? jobTitle : null,
|
"companyName": companyName != '' ? companyName : null,
|
||||||
"phoneNumber": phoneNumber != '' ? phoneNumber : null,
|
"phoneNumber": phoneNumber != '' ? phoneNumber : null,
|
||||||
"roleUuid": roleUuid,
|
"roleUuid": roleUuid,
|
||||||
"projectUuid": projectUuid,
|
"projectUuid": projectUuid,
|
||||||
@ -140,7 +143,7 @@ class UserPermissionApi {
|
|||||||
String? firstName,
|
String? firstName,
|
||||||
String? userId,
|
String? userId,
|
||||||
String? lastName,
|
String? lastName,
|
||||||
String? jobTitle,
|
String? companyName,
|
||||||
String? phoneNumber,
|
String? phoneNumber,
|
||||||
String? roleUuid,
|
String? roleUuid,
|
||||||
List<String>? spaceUuids,
|
List<String>? spaceUuids,
|
||||||
@ -150,8 +153,8 @@ class UserPermissionApi {
|
|||||||
final body = <String, dynamic>{
|
final body = <String, dynamic>{
|
||||||
"firstName": firstName,
|
"firstName": firstName,
|
||||||
"lastName": lastName,
|
"lastName": lastName,
|
||||||
"jobTitle": jobTitle != '' ? jobTitle : " ",
|
"companyName": companyName != '' ? companyName : ' ',
|
||||||
"phoneNumber": phoneNumber != '' ? phoneNumber : " ",
|
"phoneNumber": phoneNumber != '' ? phoneNumber : ' ',
|
||||||
"roleUuid": roleUuid,
|
"roleUuid": roleUuid,
|
||||||
"projectUuid": projectUuid,
|
"projectUuid": projectUuid,
|
||||||
"spaceUuids": spaceUuids,
|
"spaceUuids": spaceUuids,
|
||||||
@ -190,12 +193,17 @@ class UserPermissionApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> changeUserStatusById(userUuid, status, String projectUuid) async {
|
Future<bool> changeUserStatusById(
|
||||||
|
userUuid, status, String projectUuid) async {
|
||||||
try {
|
try {
|
||||||
Map<String, dynamic> bodya = {"disable": status, "projectUuid": projectUuid};
|
Map<String, dynamic> bodya = {
|
||||||
|
"disable": status,
|
||||||
|
"projectUuid": projectUuid
|
||||||
|
};
|
||||||
|
|
||||||
final response = await _httpService.put(
|
final response = await _httpService.put(
|
||||||
path: ApiEndpoints.changeUserStatus.replaceAll("{invitedUserUuid}", userUuid),
|
path: ApiEndpoints.changeUserStatus
|
||||||
|
.replaceAll("{invitedUserUuid}", userUuid),
|
||||||
body: bodya,
|
body: bodya,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
return json['success'];
|
return json['success'];
|
||||||
|
Reference in New Issue
Block a user