feat: update preferredLocations field to List<String> across staff-related entities and mutations
- Changed preferredLocations from AnyValue to List<String> in GetStaffByIdStaff, GetStaffByUserIdStaffs, ListStaffStaffs, and UpdateStaffVariablesBuilder classes. - Updated JSON serialization/deserialization for preferredLocations to handle List<String>. - Modified Staff entity to include preferredLocations as List<String>. - Adjusted ProfileSetupBloc and PersonalInfoBloc to accommodate changes in preferredLocations. - Updated PersonalInfoRepositoryImpl to handle preferredLocations as List<String>. - Refactored PersonalInfoContent and PersonalInfoForm to use locations instead of address. - Updated GraphQL mutations and schema to reflect the new List<String> type for preferredLocations.
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
# Basic Usage
|
# Basic Usage
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
ExampleConnector.instance.createBusiness(createBusinessVariables).execute();
|
ExampleConnector.instance.createTeamHudDepartment(createTeamHudDepartmentVariables).execute();
|
||||||
ExampleConnector.instance.updateBusiness(updateBusinessVariables).execute();
|
ExampleConnector.instance.updateTeamHudDepartment(updateTeamHudDepartmentVariables).execute();
|
||||||
ExampleConnector.instance.deleteBusiness(deleteBusinessVariables).execute();
|
ExampleConnector.instance.deleteTeamHudDepartment(deleteTeamHudDepartmentVariables).execute();
|
||||||
ExampleConnector.instance.listCustomRateCards().execute();
|
ExampleConnector.instance.CreateUser(createUserVariables).execute();
|
||||||
ExampleConnector.instance.getCustomRateCardById(getCustomRateCardByIdVariables).execute();
|
ExampleConnector.instance.UpdateUser(updateUserVariables).execute();
|
||||||
ExampleConnector.instance.listClientFeedbacks(listClientFeedbacksVariables).execute();
|
ExampleConnector.instance.DeleteUser(deleteUserVariables).execute();
|
||||||
ExampleConnector.instance.getClientFeedbackById(getClientFeedbackByIdVariables).execute();
|
ExampleConnector.instance.createVendorBenefitPlan(createVendorBenefitPlanVariables).execute();
|
||||||
ExampleConnector.instance.listClientFeedbacksByBusinessId(listClientFeedbacksByBusinessIdVariables).execute();
|
ExampleConnector.instance.updateVendorBenefitPlan(updateVendorBenefitPlanVariables).execute();
|
||||||
ExampleConnector.instance.listClientFeedbacksByVendorId(listClientFeedbacksByVendorIdVariables).execute();
|
ExampleConnector.instance.deleteVendorBenefitPlan(deleteVendorBenefitPlanVariables).execute();
|
||||||
ExampleConnector.instance.listClientFeedbacksByBusinessAndVendor(listClientFeedbacksByBusinessAndVendorVariables).execute();
|
ExampleConnector.instance.getShiftRoleById(getShiftRoleByIdVariables).execute();
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@ Optional fields can be discovered based on classes that have `Optional` object t
|
|||||||
This is an example of a mutation with an optional field:
|
This is an example of a mutation with an optional field:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
await ExampleConnector.instance.updateActivityLog({ ... })
|
await ExampleConnector.instance.updateStaffAvailabilityStats({ ... })
|
||||||
.userId(...)
|
.needWorkIndex(...)
|
||||||
.execute();
|
.execute();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@ class CreateStaffVariablesBuilder {
|
|||||||
Optional<String> _bio = Optional.optional(nativeFromJson, nativeToJson);
|
Optional<String> _bio = Optional.optional(nativeFromJson, nativeToJson);
|
||||||
Optional<AnyValue> _skills = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
Optional<AnyValue> _skills = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
||||||
Optional<AnyValue> _industries = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
Optional<AnyValue> _industries = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
||||||
Optional<AnyValue> _preferredLocations = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
Optional<List<String>> _preferredLocations = Optional.optional(listDeserializer(nativeFromJson), listSerializer(nativeToJson));
|
||||||
Optional<int> _maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
|
Optional<int> _maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
|
||||||
Optional<AnyValue> _languages = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
Optional<AnyValue> _languages = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
||||||
Optional<AnyValue> _itemsAttire = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
Optional<AnyValue> _itemsAttire = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
||||||
@@ -92,7 +92,7 @@ class CreateStaffVariablesBuilder {
|
|||||||
_industries.value = t;
|
_industries.value = t;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
CreateStaffVariablesBuilder preferredLocations(AnyValue? t) {
|
CreateStaffVariablesBuilder preferredLocations(List<String>? t) {
|
||||||
_preferredLocations.value = t;
|
_preferredLocations.value = t;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -264,7 +264,7 @@ class CreateStaffVariables {
|
|||||||
late final Optional<String>bio;
|
late final Optional<String>bio;
|
||||||
late final Optional<AnyValue>skills;
|
late final Optional<AnyValue>skills;
|
||||||
late final Optional<AnyValue>industries;
|
late final Optional<AnyValue>industries;
|
||||||
late final Optional<AnyValue>preferredLocations;
|
late final Optional<List<String>>preferredLocations;
|
||||||
late final Optional<int>maxDistanceMiles;
|
late final Optional<int>maxDistanceMiles;
|
||||||
late final Optional<AnyValue>languages;
|
late final Optional<AnyValue>languages;
|
||||||
late final Optional<AnyValue>itemsAttire;
|
late final Optional<AnyValue>itemsAttire;
|
||||||
@@ -347,8 +347,10 @@ class CreateStaffVariables {
|
|||||||
industries.value = json['industries'] == null ? null : AnyValue.fromJson(json['industries']);
|
industries.value = json['industries'] == null ? null : AnyValue.fromJson(json['industries']);
|
||||||
|
|
||||||
|
|
||||||
preferredLocations = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
preferredLocations = Optional.optional(listDeserializer(nativeFromJson), listSerializer(nativeToJson));
|
||||||
preferredLocations.value = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']);
|
preferredLocations.value = json['preferredLocations'] == null ? null : (json['preferredLocations'] as List<dynamic>)
|
||||||
|
.map((e) => nativeFromJson<String>(e))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
|
||||||
maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
|
maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -39,7 +39,7 @@ class GetStaffByIdStaff {
|
|||||||
final String? bio;
|
final String? bio;
|
||||||
final AnyValue? skills;
|
final AnyValue? skills;
|
||||||
final AnyValue? industries;
|
final AnyValue? industries;
|
||||||
final AnyValue? preferredLocations;
|
final List<String>? preferredLocations;
|
||||||
final int? maxDistanceMiles;
|
final int? maxDistanceMiles;
|
||||||
final AnyValue? languages;
|
final AnyValue? languages;
|
||||||
final AnyValue? itemsAttire;
|
final AnyValue? itemsAttire;
|
||||||
@@ -79,7 +79,9 @@ class GetStaffByIdStaff {
|
|||||||
bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']),
|
bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']),
|
||||||
skills = json['skills'] == null ? null : AnyValue.fromJson(json['skills']),
|
skills = json['skills'] == null ? null : AnyValue.fromJson(json['skills']),
|
||||||
industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']),
|
industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']),
|
||||||
preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']),
|
preferredLocations = json['preferredLocations'] == null ? null : (json['preferredLocations'] as List<dynamic>)
|
||||||
|
.map((e) => nativeFromJson<String>(e))
|
||||||
|
.toList(),
|
||||||
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
|
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
|
||||||
languages = json['languages'] == null ? null : AnyValue.fromJson(json['languages']),
|
languages = json['languages'] == null ? null : AnyValue.fromJson(json['languages']),
|
||||||
itemsAttire = json['itemsAttire'] == null ? null : AnyValue.fromJson(json['itemsAttire']),
|
itemsAttire = json['itemsAttire'] == null ? null : AnyValue.fromJson(json['itemsAttire']),
|
||||||
@@ -208,7 +210,7 @@ class GetStaffByIdStaff {
|
|||||||
json['industries'] = industries!.toJson();
|
json['industries'] = industries!.toJson();
|
||||||
}
|
}
|
||||||
if (preferredLocations != null) {
|
if (preferredLocations != null) {
|
||||||
json['preferredLocations'] = preferredLocations!.toJson();
|
json['preferredLocations'] = preferredLocations?.map((e) => nativeToJson<String>(e)).toList();
|
||||||
}
|
}
|
||||||
if (maxDistanceMiles != null) {
|
if (maxDistanceMiles != null) {
|
||||||
json['maxDistanceMiles'] = nativeToJson<int?>(maxDistanceMiles);
|
json['maxDistanceMiles'] = nativeToJson<int?>(maxDistanceMiles);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class GetStaffByUserIdStaffs {
|
|||||||
final String? bio;
|
final String? bio;
|
||||||
final AnyValue? skills;
|
final AnyValue? skills;
|
||||||
final AnyValue? industries;
|
final AnyValue? industries;
|
||||||
final AnyValue? preferredLocations;
|
final List<String>? preferredLocations;
|
||||||
final int? maxDistanceMiles;
|
final int? maxDistanceMiles;
|
||||||
final AnyValue? languages;
|
final AnyValue? languages;
|
||||||
final AnyValue? itemsAttire;
|
final AnyValue? itemsAttire;
|
||||||
@@ -77,7 +77,9 @@ class GetStaffByUserIdStaffs {
|
|||||||
bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']),
|
bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']),
|
||||||
skills = json['skills'] == null ? null : AnyValue.fromJson(json['skills']),
|
skills = json['skills'] == null ? null : AnyValue.fromJson(json['skills']),
|
||||||
industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']),
|
industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']),
|
||||||
preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']),
|
preferredLocations = json['preferredLocations'] == null ? null : (json['preferredLocations'] as List<dynamic>)
|
||||||
|
.map((e) => nativeFromJson<String>(e))
|
||||||
|
.toList(),
|
||||||
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
|
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
|
||||||
languages = json['languages'] == null ? null : AnyValue.fromJson(json['languages']),
|
languages = json['languages'] == null ? null : AnyValue.fromJson(json['languages']),
|
||||||
itemsAttire = json['itemsAttire'] == null ? null : AnyValue.fromJson(json['itemsAttire']),
|
itemsAttire = json['itemsAttire'] == null ? null : AnyValue.fromJson(json['itemsAttire']),
|
||||||
@@ -202,7 +204,7 @@ class GetStaffByUserIdStaffs {
|
|||||||
json['industries'] = industries!.toJson();
|
json['industries'] = industries!.toJson();
|
||||||
}
|
}
|
||||||
if (preferredLocations != null) {
|
if (preferredLocations != null) {
|
||||||
json['preferredLocations'] = preferredLocations!.toJson();
|
json['preferredLocations'] = preferredLocations?.map((e) => nativeToJson<String>(e)).toList();
|
||||||
}
|
}
|
||||||
if (maxDistanceMiles != null) {
|
if (maxDistanceMiles != null) {
|
||||||
json['maxDistanceMiles'] = nativeToJson<int?>(maxDistanceMiles);
|
json['maxDistanceMiles'] = nativeToJson<int?>(maxDistanceMiles);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class ListStaffStaffs {
|
|||||||
final String? bio;
|
final String? bio;
|
||||||
final AnyValue? skills;
|
final AnyValue? skills;
|
||||||
final AnyValue? industries;
|
final AnyValue? industries;
|
||||||
final AnyValue? preferredLocations;
|
final List<String>? preferredLocations;
|
||||||
final int? maxDistanceMiles;
|
final int? maxDistanceMiles;
|
||||||
final AnyValue? languages;
|
final AnyValue? languages;
|
||||||
final AnyValue? itemsAttire;
|
final AnyValue? itemsAttire;
|
||||||
@@ -76,7 +76,9 @@ class ListStaffStaffs {
|
|||||||
bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']),
|
bio = json['bio'] == null ? null : nativeFromJson<String>(json['bio']),
|
||||||
skills = json['skills'] == null ? null : AnyValue.fromJson(json['skills']),
|
skills = json['skills'] == null ? null : AnyValue.fromJson(json['skills']),
|
||||||
industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']),
|
industries = json['industries'] == null ? null : AnyValue.fromJson(json['industries']),
|
||||||
preferredLocations = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']),
|
preferredLocations = json['preferredLocations'] == null ? null : (json['preferredLocations'] as List<dynamic>)
|
||||||
|
.map((e) => nativeFromJson<String>(e))
|
||||||
|
.toList(),
|
||||||
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
|
maxDistanceMiles = json['maxDistanceMiles'] == null ? null : nativeFromJson<int>(json['maxDistanceMiles']),
|
||||||
languages = json['languages'] == null ? null : AnyValue.fromJson(json['languages']),
|
languages = json['languages'] == null ? null : AnyValue.fromJson(json['languages']),
|
||||||
itemsAttire = json['itemsAttire'] == null ? null : AnyValue.fromJson(json['itemsAttire']),
|
itemsAttire = json['itemsAttire'] == null ? null : AnyValue.fromJson(json['itemsAttire']),
|
||||||
@@ -201,7 +203,7 @@ class ListStaffStaffs {
|
|||||||
json['industries'] = industries!.toJson();
|
json['industries'] = industries!.toJson();
|
||||||
}
|
}
|
||||||
if (preferredLocations != null) {
|
if (preferredLocations != null) {
|
||||||
json['preferredLocations'] = preferredLocations!.toJson();
|
json['preferredLocations'] = preferredLocations?.map((e) => nativeToJson<String>(e)).toList();
|
||||||
}
|
}
|
||||||
if (maxDistanceMiles != null) {
|
if (maxDistanceMiles != null) {
|
||||||
json['maxDistanceMiles'] = nativeToJson<int?>(maxDistanceMiles);
|
json['maxDistanceMiles'] = nativeToJson<int?>(maxDistanceMiles);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class UpdateStaffVariablesBuilder {
|
|||||||
Optional<String> _bio = Optional.optional(nativeFromJson, nativeToJson);
|
Optional<String> _bio = Optional.optional(nativeFromJson, nativeToJson);
|
||||||
Optional<AnyValue> _skills = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
Optional<AnyValue> _skills = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
||||||
Optional<AnyValue> _industries = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
Optional<AnyValue> _industries = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
||||||
Optional<AnyValue> _preferredLocations = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
Optional<List<String>> _preferredLocations = Optional.optional(listDeserializer(nativeFromJson), listSerializer(nativeToJson));
|
||||||
Optional<int> _maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
|
Optional<int> _maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
|
||||||
Optional<AnyValue> _languages = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
Optional<AnyValue> _languages = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
||||||
Optional<AnyValue> _itemsAttire = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
Optional<AnyValue> _itemsAttire = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
||||||
@@ -101,7 +101,7 @@ class UpdateStaffVariablesBuilder {
|
|||||||
_industries.value = t;
|
_industries.value = t;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
UpdateStaffVariablesBuilder preferredLocations(AnyValue? t) {
|
UpdateStaffVariablesBuilder preferredLocations(List<String>? t) {
|
||||||
_preferredLocations.value = t;
|
_preferredLocations.value = t;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,7 @@ class UpdateStaffVariables {
|
|||||||
late final Optional<String>bio;
|
late final Optional<String>bio;
|
||||||
late final Optional<AnyValue>skills;
|
late final Optional<AnyValue>skills;
|
||||||
late final Optional<AnyValue>industries;
|
late final Optional<AnyValue>industries;
|
||||||
late final Optional<AnyValue>preferredLocations;
|
late final Optional<List<String>>preferredLocations;
|
||||||
late final Optional<int>maxDistanceMiles;
|
late final Optional<int>maxDistanceMiles;
|
||||||
late final Optional<AnyValue>languages;
|
late final Optional<AnyValue>languages;
|
||||||
late final Optional<AnyValue>itemsAttire;
|
late final Optional<AnyValue>itemsAttire;
|
||||||
@@ -365,8 +365,10 @@ class UpdateStaffVariables {
|
|||||||
industries.value = json['industries'] == null ? null : AnyValue.fromJson(json['industries']);
|
industries.value = json['industries'] == null ? null : AnyValue.fromJson(json['industries']);
|
||||||
|
|
||||||
|
|
||||||
preferredLocations = Optional.optional(AnyValue.fromJson, defaultSerializer);
|
preferredLocations = Optional.optional(listDeserializer(nativeFromJson), listSerializer(nativeToJson));
|
||||||
preferredLocations.value = json['preferredLocations'] == null ? null : AnyValue.fromJson(json['preferredLocations']);
|
preferredLocations.value = json['preferredLocations'] == null ? null : (json['preferredLocations'] as List<dynamic>)
|
||||||
|
.map((e) => nativeFromJson<String>(e))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
|
||||||
maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
|
maxDistanceMiles = Optional.optional(nativeFromJson, nativeToJson);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class Staff extends Equatable {
|
|||||||
this.noShowCount,
|
this.noShowCount,
|
||||||
this.cancellationCount,
|
this.cancellationCount,
|
||||||
this.reliabilityScore,
|
this.reliabilityScore,
|
||||||
|
this.preferredLocations,
|
||||||
});
|
});
|
||||||
/// Unique identifier for the staff profile.
|
/// Unique identifier for the staff profile.
|
||||||
final String id;
|
final String id;
|
||||||
@@ -89,6 +90,9 @@ class Staff extends Equatable {
|
|||||||
/// The reliability score (0-100).
|
/// The reliability score (0-100).
|
||||||
final int? reliabilityScore;
|
final int? reliabilityScore;
|
||||||
|
|
||||||
|
/// Preferred work locations.
|
||||||
|
final List<String>? preferredLocations;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object?> get props => <Object?>[
|
List<Object?> get props => <Object?>[
|
||||||
id,
|
id,
|
||||||
@@ -105,5 +109,6 @@ class Staff extends Equatable {
|
|||||||
noShowCount,
|
noShowCount,
|
||||||
cancellationCount,
|
cancellationCount,
|
||||||
reliabilityScore,
|
reliabilityScore,
|
||||||
|
preferredLocations,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class ProfileSetupBloc extends Bloc<ProfileSetupEvent, ProfileSetupState> {
|
|||||||
fullName: state.fullName,
|
fullName: state.fullName,
|
||||||
)
|
)
|
||||||
.bio(state.bio.isEmpty ? null : state.bio)
|
.bio(state.bio.isEmpty ? null : state.bio)
|
||||||
.preferredLocations(fdc.AnyValue(state.preferredLocations))
|
.preferredLocations(state.preferredLocations)
|
||||||
.maxDistanceMiles(state.maxDistanceMiles.toInt())
|
.maxDistanceMiles(state.maxDistanceMiles.toInt())
|
||||||
.industries(fdc.AnyValue(state.industries))
|
.industries(fdc.AnyValue(state.industries))
|
||||||
.skills(fdc.AnyValue(state.skills))
|
.skills(fdc.AnyValue(state.skills))
|
||||||
|
|||||||
@@ -65,7 +65,10 @@ class PersonalInfoRepositoryImpl implements PersonalInfoRepositoryInterface {
|
|||||||
if (data.containsKey('avatar')) {
|
if (data.containsKey('avatar')) {
|
||||||
updateBuilder = updateBuilder.photoUrl(data['avatar'] as String?);
|
updateBuilder = updateBuilder.photoUrl(data['avatar'] as String?);
|
||||||
}
|
}
|
||||||
// Add other fields as they become available in the schema and map
|
if (data.containsKey('preferredLocations')) {
|
||||||
|
// After schema update and SDK regeneration, preferredLocations accepts List<String>
|
||||||
|
updateBuilder = updateBuilder.preferredLocations(data['preferredLocations'] as List<String>);
|
||||||
|
}
|
||||||
|
|
||||||
// Execute the update
|
// Execute the update
|
||||||
final OperationResult<UpdateStaffData, UpdateStaffVariables> result =
|
final OperationResult<UpdateStaffData, UpdateStaffVariables> result =
|
||||||
@@ -107,6 +110,8 @@ class PersonalInfoRepositoryImpl implements PersonalInfoRepositoryInterface {
|
|||||||
noShowCount: dto.noShowCount,
|
noShowCount: dto.noShowCount,
|
||||||
cancellationCount: dto.cancellationCount,
|
cancellationCount: dto.cancellationCount,
|
||||||
reliabilityScore: dto.reliabilityScore,
|
reliabilityScore: dto.reliabilityScore,
|
||||||
|
// After schema update and SDK regeneration, preferredLocations is List<String>?
|
||||||
|
preferredLocations: dto.preferredLocations,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,11 +42,14 @@ class PersonalInfoBloc extends Bloc<PersonalInfoEvent, PersonalInfoState>
|
|||||||
final Staff staff = await _getPersonalInfoUseCase();
|
final Staff staff = await _getPersonalInfoUseCase();
|
||||||
|
|
||||||
// Initialize form values from staff entity
|
// Initialize form values from staff entity
|
||||||
|
// Note: Staff entity currently stores address as a string, but we want to map it to 'preferredLocations'
|
||||||
final Map<String, dynamic> initialValues = {
|
final Map<String, dynamic> initialValues = {
|
||||||
'name': staff.name,
|
'name': staff.name,
|
||||||
'email': staff.email,
|
'email': staff.email,
|
||||||
'phone': staff.phone,
|
'phone': staff.phone,
|
||||||
'address': staff.address,
|
'preferredLocations': staff.address != null
|
||||||
|
? [staff.address]
|
||||||
|
: [], // TODO: Map correctly when Staff entity supports list
|
||||||
'avatar': staff.avatar,
|
'avatar': staff.avatar,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,7 +97,9 @@ class PersonalInfoBloc extends Bloc<PersonalInfoEvent, PersonalInfoState>
|
|||||||
'name': updatedStaff.name,
|
'name': updatedStaff.name,
|
||||||
'email': updatedStaff.email,
|
'email': updatedStaff.email,
|
||||||
'phone': updatedStaff.phone,
|
'phone': updatedStaff.phone,
|
||||||
'address': updatedStaff.address,
|
'preferredLocations': updatedStaff.address != null
|
||||||
|
? [updatedStaff.address]
|
||||||
|
: [],
|
||||||
'avatar': updatedStaff.avatar,
|
'avatar': updatedStaff.avatar,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class PersonalInfoLoadRequested extends PersonalInfoEvent {
|
|||||||
/// Event to update a field value.
|
/// Event to update a field value.
|
||||||
class PersonalInfoFieldUpdated extends PersonalInfoEvent {
|
class PersonalInfoFieldUpdated extends PersonalInfoEvent {
|
||||||
final String field;
|
final String field;
|
||||||
final String value;
|
final dynamic value;
|
||||||
|
|
||||||
const PersonalInfoFieldUpdated({
|
const PersonalInfoFieldUpdated({
|
||||||
required this.field,
|
required this.field,
|
||||||
|
|||||||
@@ -33,23 +33,23 @@ class PersonalInfoContent extends StatefulWidget {
|
|||||||
|
|
||||||
class _PersonalInfoContentState extends State<PersonalInfoContent> {
|
class _PersonalInfoContentState extends State<PersonalInfoContent> {
|
||||||
late final TextEditingController _phoneController;
|
late final TextEditingController _phoneController;
|
||||||
late final TextEditingController _addressController;
|
late final TextEditingController _locationsController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_phoneController = TextEditingController(text: widget.staff.phone ?? '');
|
_phoneController = TextEditingController(text: widget.staff.phone ?? '');
|
||||||
_addressController = TextEditingController(text: widget.staff.address ?? '');
|
_locationsController = TextEditingController(text: widget.staff.preferredLocations?.join(', ')?? '');
|
||||||
|
|
||||||
// Listen to changes and update BLoC
|
// Listen to changes and update BLoC
|
||||||
_phoneController.addListener(_onPhoneChanged);
|
_phoneController.addListener(_onPhoneChanged);
|
||||||
_addressController.addListener(_onAddressChanged);
|
_locationsController.addListener(_onAddressChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_phoneController.dispose();
|
_phoneController.dispose();
|
||||||
_addressController.dispose();
|
_locationsController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,10 +64,18 @@ class _PersonalInfoContentState extends State<PersonalInfoContent> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _onAddressChanged() {
|
void _onAddressChanged() {
|
||||||
|
// Split the comma-separated string into a list for storage
|
||||||
|
// The backend expects List<AnyValue> (JSON/List) for preferredLocations
|
||||||
|
final List<String> locations = _locationsController.text
|
||||||
|
.split(',')
|
||||||
|
.map((e) => e.trim())
|
||||||
|
.where((e) => e.isNotEmpty)
|
||||||
|
.toList();
|
||||||
|
|
||||||
context.read<PersonalInfoBloc>().add(
|
context.read<PersonalInfoBloc>().add(
|
||||||
PersonalInfoFieldUpdated(
|
PersonalInfoFieldUpdated(
|
||||||
field: 'address',
|
field: 'preferredLocations',
|
||||||
value: _addressController.text,
|
value: locations,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -107,7 +115,7 @@ class _PersonalInfoContentState extends State<PersonalInfoContent> {
|
|||||||
fullName: widget.staff.name,
|
fullName: widget.staff.name,
|
||||||
email: widget.staff.email,
|
email: widget.staff.email,
|
||||||
phoneController: _phoneController,
|
phoneController: _phoneController,
|
||||||
addressController: _addressController,
|
locationsController: _locationsController,
|
||||||
enabled: !isSaving,
|
enabled: !isSaving,
|
||||||
),
|
),
|
||||||
const SizedBox(height: UiConstants.space16), // Space for bottom button
|
const SizedBox(height: UiConstants.space16), // Space for bottom button
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class PersonalInfoForm extends StatelessWidget {
|
|||||||
final TextEditingController phoneController;
|
final TextEditingController phoneController;
|
||||||
|
|
||||||
/// Controller for the address field.
|
/// Controller for the address field.
|
||||||
final TextEditingController addressController;
|
final TextEditingController locationsController;
|
||||||
|
|
||||||
/// Whether the form fields are enabled for editing.
|
/// Whether the form fields are enabled for editing.
|
||||||
final bool enabled;
|
final bool enabled;
|
||||||
@@ -30,7 +30,7 @@ class PersonalInfoForm extends StatelessWidget {
|
|||||||
required this.fullName,
|
required this.fullName,
|
||||||
required this.email,
|
required this.email,
|
||||||
required this.phoneController,
|
required this.phoneController,
|
||||||
required this.addressController,
|
required this.locationsController,
|
||||||
this.enabled = true,
|
this.enabled = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ class PersonalInfoForm extends StatelessWidget {
|
|||||||
_FieldLabel(text: i18n.locations_label),
|
_FieldLabel(text: i18n.locations_label),
|
||||||
const SizedBox(height: UiConstants.space2),
|
const SizedBox(height: UiConstants.space2),
|
||||||
_EditableField(
|
_EditableField(
|
||||||
controller: addressController,
|
controller: locationsController,
|
||||||
hint: i18n.locations_hint,
|
hint: i18n.locations_hint,
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ mutation CreateStaff(
|
|||||||
$bio: String
|
$bio: String
|
||||||
$skills: Any
|
$skills: Any
|
||||||
$industries: Any
|
$industries: Any
|
||||||
$preferredLocations: Any
|
$preferredLocations: [String!]
|
||||||
$maxDistanceMiles: Int
|
$maxDistanceMiles: Int
|
||||||
$languages: Any
|
$languages: Any
|
||||||
$itemsAttire: Any
|
$itemsAttire: Any
|
||||||
@@ -108,7 +108,7 @@ mutation UpdateStaff(
|
|||||||
$bio: String
|
$bio: String
|
||||||
$skills: Any
|
$skills: Any
|
||||||
$industries: Any
|
$industries: Any
|
||||||
$preferredLocations: Any
|
$preferredLocations: [String!]
|
||||||
$maxDistanceMiles: Int
|
$maxDistanceMiles: Int
|
||||||
$languages: Any
|
$languages: Any
|
||||||
$itemsAttire: Any
|
$itemsAttire: Any
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ type Staff @table(name: "staffs") {
|
|||||||
bio: String
|
bio: String
|
||||||
skills: Any #changed it for staffRole
|
skills: Any #changed it for staffRole
|
||||||
industries: Any
|
industries: Any
|
||||||
preferredLocations: Any
|
preferredLocations: [String]
|
||||||
maxDistanceMiles: Int
|
maxDistanceMiles: Int
|
||||||
languages: Any
|
languages: Any
|
||||||
itemsAttire: Any
|
itemsAttire: Any
|
||||||
|
|||||||
Reference in New Issue
Block a user