Skip to content

Commit

Permalink
Implement hr-request form
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-pratik-k committed Jul 14, 2023
1 parent da74f10 commit dfd8fb4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/data/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"ok_tag":"OK",
"type_tag":"Type",
"description_tag":"Description",
"submit_button_tag":"Submit",


"spaces_title":"Spaces",
Expand Down Expand Up @@ -241,7 +242,6 @@
"admin_home_add_member_error_name": "Name is too short!!",
"admin_home_add_member_complete_mandatory_field_error": "Please complete this mandatory field",
"admin_home_add_member_employee_added_message" : "An employee has been added successfully!!",
"admin_home_add_member_submit_button_tag":"Submit",
"admin_home_add_member_designation_tag":"Designation",
"admin_home_add_member_addMember_tag":"Add Member",
"admin_home_add_member_name_hint_text":"Andrew Jhone",
Expand Down Expand Up @@ -391,6 +391,7 @@

"hr_requests_title":"HR Requests",
"new_request_tag":"New Request",
"hr_request_title":"HR Request",

"hr_request_status":"{status, select, 0{Pending} 1{Resolved} 2{Canceled} other{Other}}",
"@hr_request_status":{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class HrRequestFormBloc extends Bloc<HrRequestFormEvents, HrRequestFormState> {
ApplyHrRequest event, Emitter<HrRequestFormState> emit) async {
emit(state.copyWith(status: Status.loading));
try {
if (state.type != null && state.description.isNotEmpty) {
if (state.isProvidedDataValid) {
final hrRequest = HrRequest(
id: _hrRequestService.generateNewId,
type: state.type!,
Expand All @@ -43,7 +43,7 @@ class HrRequestFormBloc extends Bloc<HrRequestFormEvents, HrRequestFormState> {
await _hrRequestService.setHrRequest(hrRequest);
emit(state.copyWith(status: Status.success));
} else {
emit(state.copyWith(error: fillDetailsError));
emit(state.copyWith(error: fillDetailsError, status: Status.error));
}
} on Exception {
emit(
Expand Down
5 changes: 3 additions & 2 deletions lib/ui/user/hr_requests/apply_hr_request/hr_request_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class _HrRequestFormScreenState extends State<HrRequestFormScreen> {
final locale = AppLocalizations.of(context);
return Scaffold(
appBar: AppBar(
title: const Text('Hr Request Form'),
title: Text(locale.hr_request_title),
actions: [
BlocBuilder<HrRequestFormBloc, HrRequestFormState>(
buildWhen: (previous, current) =>
Expand All @@ -58,7 +58,8 @@ class _HrRequestFormScreenState extends State<HrRequestFormScreen> {
.add(ApplyHrRequest());
}
: null,
child: Text(AppLocalizations.of(context).save_tag)),
child: Text(
AppLocalizations.of(context).submit_button_tag)),
)),
],
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localization.dart';

import '../../../../../data/configs/colors.dart';
import '../../../../../data/configs/text_style.dart';
import '../../../../../data/configs/theme.dart';
Expand Down

0 comments on commit dfd8fb4

Please sign in to comment.