Merge branch 'master' of http://34.17.52.79/Haroon6138/mohemm-flutter-app into sultan-dev
# Conflicts: # assets/langs/ar-SA.json # assets/langs/en-US.json # lib/app_state/app_state.dart # lib/generated/codegen_loader.g.dart # lib/generated/locale_keys.g.dartpull/9/head
commit
608a8fcb97
@ -0,0 +1,68 @@
|
|||||||
|
class GetPRActionHistoryList {
|
||||||
|
String? aCTION;
|
||||||
|
String? aCTIONCODE;
|
||||||
|
String? aPPROVALDATE;
|
||||||
|
String? eMAILADDRESS;
|
||||||
|
String? eMPLOYEEIMAGE;
|
||||||
|
int? fROMROWNUM;
|
||||||
|
String? nAME;
|
||||||
|
String? nOTE;
|
||||||
|
int? nOOFROWS;
|
||||||
|
String? pOSITIONTITLE;
|
||||||
|
int? rOWNUM;
|
||||||
|
int? sEQUENCE;
|
||||||
|
int? tOROWNUM;
|
||||||
|
Null? uSERNAME;
|
||||||
|
|
||||||
|
GetPRActionHistoryList(
|
||||||
|
{this.aCTION,
|
||||||
|
this.aCTIONCODE,
|
||||||
|
this.aPPROVALDATE,
|
||||||
|
this.eMAILADDRESS,
|
||||||
|
this.eMPLOYEEIMAGE,
|
||||||
|
this.fROMROWNUM,
|
||||||
|
this.nAME,
|
||||||
|
this.nOTE,
|
||||||
|
this.nOOFROWS,
|
||||||
|
this.pOSITIONTITLE,
|
||||||
|
this.rOWNUM,
|
||||||
|
this.sEQUENCE,
|
||||||
|
this.tOROWNUM,
|
||||||
|
this.uSERNAME});
|
||||||
|
|
||||||
|
GetPRActionHistoryList.fromJson(Map<String, dynamic> json) {
|
||||||
|
aCTION = json['ACTION'];
|
||||||
|
aCTIONCODE = json['ACTION_CODE'];
|
||||||
|
aPPROVALDATE = json['APPROVAL_DATE'];
|
||||||
|
eMAILADDRESS = json['EMAIL_ADDRESS'];
|
||||||
|
eMPLOYEEIMAGE = json['EMPLOYEE_IMAGE'];
|
||||||
|
fROMROWNUM = json['FROM_ROW_NUM'];
|
||||||
|
nAME = json['NAME'];
|
||||||
|
nOTE = json['NOTE'];
|
||||||
|
nOOFROWS = json['NO_OF_ROWS'];
|
||||||
|
pOSITIONTITLE = json['POSITION_TITLE'];
|
||||||
|
rOWNUM = json['ROW_NUM'];
|
||||||
|
sEQUENCE = json['SEQUENCE'];
|
||||||
|
tOROWNUM = json['TO_ROW_NUM'];
|
||||||
|
uSERNAME = json['USER_NAME'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['ACTION'] = this.aCTION;
|
||||||
|
data['ACTION_CODE'] = this.aCTIONCODE;
|
||||||
|
data['APPROVAL_DATE'] = this.aPPROVALDATE;
|
||||||
|
data['EMAIL_ADDRESS'] = this.eMAILADDRESS;
|
||||||
|
data['EMPLOYEE_IMAGE'] = this.eMPLOYEEIMAGE;
|
||||||
|
data['FROM_ROW_NUM'] = this.fROMROWNUM;
|
||||||
|
data['NAME'] = this.nAME;
|
||||||
|
data['NOTE'] = this.nOTE;
|
||||||
|
data['NO_OF_ROWS'] = this.nOOFROWS;
|
||||||
|
data['POSITION_TITLE'] = this.pOSITIONTITLE;
|
||||||
|
data['ROW_NUM'] = this.rOWNUM;
|
||||||
|
data['SEQUENCE'] = this.sEQUENCE;
|
||||||
|
data['TO_ROW_NUM'] = this.tOROWNUM;
|
||||||
|
data['USER_NAME'] = this.uSERNAME;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,148 @@
|
|||||||
|
class SurveyModel {
|
||||||
|
int? surveyId;
|
||||||
|
String? referenceNo;
|
||||||
|
String? title;
|
||||||
|
String? description;
|
||||||
|
List<Questions>? questions;
|
||||||
|
bool? isActive;
|
||||||
|
Null? pageSize;
|
||||||
|
Null? pageNo;
|
||||||
|
Null? languageId;
|
||||||
|
|
||||||
|
SurveyModel({this.surveyId, this.referenceNo, this.title, this.description, this.questions, this.isActive, this.pageSize, this.pageNo, this.languageId});
|
||||||
|
|
||||||
|
SurveyModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
surveyId = json['surveyId'];
|
||||||
|
referenceNo = json['referenceNo'];
|
||||||
|
title = json['title'];
|
||||||
|
description = json['description'];
|
||||||
|
if (json['questions'] != null) {
|
||||||
|
questions = <Questions>[];
|
||||||
|
json['questions'].forEach((v) {
|
||||||
|
questions!.add(new Questions.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
isActive = json['isActive'];
|
||||||
|
pageSize = json['pageSize'];
|
||||||
|
pageNo = json['pageNo'];
|
||||||
|
languageId = json['languageId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['surveyId'] = this.surveyId;
|
||||||
|
data['referenceNo'] = this.referenceNo;
|
||||||
|
data['title'] = this.title;
|
||||||
|
data['description'] = this.description;
|
||||||
|
if (this.questions != null) {
|
||||||
|
data['questions'] = this.questions!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
data['isActive'] = this.isActive;
|
||||||
|
data['pageSize'] = this.pageSize;
|
||||||
|
data['pageNo'] = this.pageNo;
|
||||||
|
data['languageId'] = this.languageId;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Questions {
|
||||||
|
int? questionId;
|
||||||
|
String? title;
|
||||||
|
bool? isRequired;
|
||||||
|
String? type;
|
||||||
|
int? sequenceNo;
|
||||||
|
Null? surveyId;
|
||||||
|
List<Options>? options;
|
||||||
|
Null? rspPercentage;
|
||||||
|
Null? isActive;
|
||||||
|
Null? pageSize;
|
||||||
|
Null? pageNo;
|
||||||
|
Null? languageId;
|
||||||
|
|
||||||
|
Questions({this.questionId, this.title, this.isRequired, this.type, this.sequenceNo, this.surveyId, this.options, this.rspPercentage, this.isActive, this.pageSize, this.pageNo, this.languageId});
|
||||||
|
|
||||||
|
Questions.fromJson(Map<String, dynamic> json) {
|
||||||
|
questionId = json['questionId'];
|
||||||
|
title = json['title'];
|
||||||
|
isRequired = json['isRequired'];
|
||||||
|
type = json['type'];
|
||||||
|
sequenceNo = json['sequenceNo'];
|
||||||
|
surveyId = json['surveyId'];
|
||||||
|
if (json['options'] != null) {
|
||||||
|
options = <Options>[];
|
||||||
|
json['options'].forEach((v) {
|
||||||
|
options!.add(new Options.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
rspPercentage = json['rspPercentage'];
|
||||||
|
isActive = json['isActive'];
|
||||||
|
pageSize = json['pageSize'];
|
||||||
|
pageNo = json['pageNo'];
|
||||||
|
languageId = json['languageId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['questionId'] = this.questionId;
|
||||||
|
data['title'] = this.title;
|
||||||
|
data['isRequired'] = this.isRequired;
|
||||||
|
data['type'] = this.type;
|
||||||
|
data['sequenceNo'] = this.sequenceNo;
|
||||||
|
data['surveyId'] = this.surveyId;
|
||||||
|
if (this.options != null) {
|
||||||
|
data['options'] = this.options!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
data['rspPercentage'] = this.rspPercentage;
|
||||||
|
data['isActive'] = this.isActive;
|
||||||
|
data['pageSize'] = this.pageSize;
|
||||||
|
data['pageNo'] = this.pageNo;
|
||||||
|
data['languageId'] = this.languageId;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Options {
|
||||||
|
int? optionId;
|
||||||
|
String? title;
|
||||||
|
bool? isCommentsRequired;
|
||||||
|
int? sequenceNo;
|
||||||
|
int? questionId;
|
||||||
|
Null? rspPercentage;
|
||||||
|
Null? count;
|
||||||
|
Null? isActive;
|
||||||
|
Null? pageSize;
|
||||||
|
Null? pageNo;
|
||||||
|
Null? languageId;
|
||||||
|
|
||||||
|
Options({this.optionId, this.title, this.isCommentsRequired, this.sequenceNo, this.questionId, this.rspPercentage, this.count, this.isActive, this.pageSize, this.pageNo, this.languageId});
|
||||||
|
|
||||||
|
Options.fromJson(Map<String, dynamic> json) {
|
||||||
|
optionId = json['optionId'];
|
||||||
|
title = json['title'];
|
||||||
|
isCommentsRequired = json['isCommentsRequired'];
|
||||||
|
sequenceNo = json['sequenceNo'];
|
||||||
|
questionId = json['questionId'];
|
||||||
|
rspPercentage = json['rspPercentage'];
|
||||||
|
count = json['count'];
|
||||||
|
isActive = json['isActive'];
|
||||||
|
pageSize = json['pageSize'];
|
||||||
|
pageNo = json['pageNo'];
|
||||||
|
languageId = json['languageId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['optionId'] = this.optionId;
|
||||||
|
data['title'] = this.title;
|
||||||
|
data['isCommentsRequired'] = this.isCommentsRequired;
|
||||||
|
data['sequenceNo'] = this.sequenceNo;
|
||||||
|
data['questionId'] = this.questionId;
|
||||||
|
data['rspPercentage'] = this.rspPercentage;
|
||||||
|
data['count'] = this.count;
|
||||||
|
data['isActive'] = this.isActive;
|
||||||
|
data['pageSize'] = this.pageSize;
|
||||||
|
data['pageNo'] = this.pageNo;
|
||||||
|
data['languageId'] = this.languageId;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,166 @@
|
|||||||
|
import 'package:easy_localization/src/public_ext.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mohem_flutter_app/api/login_api_client.dart';
|
||||||
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||||
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||||
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||||
|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
||||||
|
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/generic_response_model.dart';
|
||||||
|
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
||||||
|
import 'package:mohem_flutter_app/widgets/input_widget.dart';
|
||||||
|
|
||||||
|
class ChangeItgAdPasswordScreen extends StatefulWidget {
|
||||||
|
ChangeItgAdPasswordScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ChangeItgAdPasswordScreenState createState() {
|
||||||
|
return _ChangeItgAdPasswordScreenState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ChangeItgAdPasswordScreenState extends State<ChangeItgAdPasswordScreen> {
|
||||||
|
TextEditingController password = TextEditingController();
|
||||||
|
TextEditingController confirmPassword = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setNewPassword() async {
|
||||||
|
Utils.showLoading(context);
|
||||||
|
try {
|
||||||
|
GenericResponseModel response = await LoginApiClient().changePasswordFromActiveDirectorySession(password.text, AppState().memberInformationList!.eMPLOYEEEMAILADDRESS!);
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
if ((response.messageStatus ?? 0) == 1) {
|
||||||
|
Utils.showToast(LocaleKeys.passwordChangedSuccessfully.tr());
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
} catch (ex) {
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
Utils.handleException(ex, context, (msg) {
|
||||||
|
Utils.confirmDialog(context, msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
ListView(
|
||||||
|
padding: const EdgeInsets.all(21),
|
||||||
|
children: [
|
||||||
|
LocaleKeys.changePassword.tr().toText24(isBold: true),
|
||||||
|
LocaleKeys.typeYourNewActiveDirectoryPasswordBelow.tr().toText16(),
|
||||||
|
16.height,
|
||||||
|
InputWidget(
|
||||||
|
LocaleKeys.password.tr(),
|
||||||
|
"**********",
|
||||||
|
password,
|
||||||
|
onChange: (value) {
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
12.height,
|
||||||
|
InputWidget(
|
||||||
|
LocaleKeys.confirmPassword.tr(),
|
||||||
|
"**********",
|
||||||
|
confirmPassword,
|
||||||
|
isTextIsPassword: true,
|
||||||
|
onChange: (value) {
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
16.height,
|
||||||
|
passwordConstraintsUI(LocaleKeys.doNotUseRecentPassword.tr(), true),
|
||||||
|
8.height,
|
||||||
|
passwordConstraintsUI(LocaleKeys.atLeastOneLowercase.tr(), checkRegEx(r'[a-z]')),
|
||||||
|
// 8.height,
|
||||||
|
// passwordConstraintsUI(LocaleKeys.atLeastOneUppercase.tr(), checkRegEx(r'[A-Z]')),
|
||||||
|
8.height,
|
||||||
|
passwordConstraintsUI(LocaleKeys.atLeastOneNumeric.tr(), checkRegEx(r'[0-9]')),
|
||||||
|
8.height,
|
||||||
|
passwordConstraintsUI(LocaleKeys.minimum8Characters.tr(), password.text.length >= 8),
|
||||||
|
8.height,
|
||||||
|
passwordConstraintsUI(LocaleKeys.doNotAddRepeatingLetters.tr(), checkRepeatedChars(password.text)),
|
||||||
|
// 8.height,
|
||||||
|
// passwordConstraintsUI(LocaleKeys.itShouldContainSpecialCharacter.tr(), checkRegEx(r'[!@#$%^&*(),.?":{}|<>]')),
|
||||||
|
8.height,
|
||||||
|
passwordConstraintsUI(LocaleKeys.confirmPasswordMustMatch.tr(), password.text.isNotEmpty && password.text == confirmPassword.text),
|
||||||
|
],
|
||||||
|
).expanded,
|
||||||
|
DefaultButton(LocaleKeys.changePassword.tr(), (!isPasswordCompliant(password.text, 8)) ? null : setNewPassword).insideContainer
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkRegEx(String pattern) {
|
||||||
|
return RegExp(pattern).hasMatch(password.text);
|
||||||
|
}
|
||||||
|
|
||||||
|
String recentPassword = "";
|
||||||
|
|
||||||
|
bool isPasswordCompliant(String? password, int minLength) {
|
||||||
|
if (password == null || password.isEmpty) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// bool hasUppercase = password.contains(RegExp(r'[A-Z]'));
|
||||||
|
bool hasDigits = password.contains(RegExp(r'[0-9]'));
|
||||||
|
bool hasLowercase = password.contains(RegExp(r'[a-z]'));
|
||||||
|
// bool hasSpecialCharacters = password.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
|
||||||
|
bool hasMinLength = password.length >= minLength;
|
||||||
|
bool isMatched = password == confirmPassword.text;
|
||||||
|
|
||||||
|
return hasDigits && hasLowercase && hasMinLength && isMatched && checkRepeatedChars(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkRepeatedChars(String password) {
|
||||||
|
bool isNonRepeatedLetters = true;
|
||||||
|
if (password.length > 2) {
|
||||||
|
for (int i = 0; i < password.length; i++) {
|
||||||
|
String char = password[i];
|
||||||
|
try {
|
||||||
|
if (char == password[i + 1]) {
|
||||||
|
isNonRepeatedLetters = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (ex) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isNonRepeatedLetters;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget passwordConstraintsUI(String description, bool check) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
4.width,
|
||||||
|
SizedBox(
|
||||||
|
width: 12,
|
||||||
|
height: 12,
|
||||||
|
child: Checkbox(fillColor: MaterialStateProperty.all(MyColors.gradiantEndColor), shape: const CircleBorder(), value: check, onChanged: null),
|
||||||
|
),
|
||||||
|
8.width,
|
||||||
|
description.toText14()
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue