|
|
|
@ -30,11 +30,26 @@ class FxMitraAddDialog extends HookConsumerWidget {
|
|
|
|
|
final errorMou = useState<String?>(null); |
|
|
|
|
final errorLogin = useState<String?>(null); |
|
|
|
|
|
|
|
|
|
final fcPassword = FocusNode(); |
|
|
|
|
final fcRePassword = FocusNode(); |
|
|
|
|
final errorPassword = useState<String?>(null); |
|
|
|
|
final errorRePassword = useState<String?>(null); |
|
|
|
|
|
|
|
|
|
final ctrlLogin = useTextEditingController(text: ""); |
|
|
|
|
final ctrlPassword = useTextEditingController(text: ""); |
|
|
|
|
final ctrlRePassword = useTextEditingController(text: ""); |
|
|
|
|
|
|
|
|
|
bool Function() validationError; |
|
|
|
|
validationError = () { |
|
|
|
|
bool haveError = false; |
|
|
|
|
if (ctrlPassword.text == "") { |
|
|
|
|
errorPassword.value = "Password is mandatory"; |
|
|
|
|
haveError = true; |
|
|
|
|
} |
|
|
|
|
if (ctrlRePassword.text != ctrlPassword.text) { |
|
|
|
|
errorRePassword.value = "Password confirmation error"; |
|
|
|
|
haveError = true; |
|
|
|
|
} |
|
|
|
|
if (company == null) { |
|
|
|
|
errorCompany.value = "Company is mandatory"; |
|
|
|
|
haveError = true; |
|
|
|
@ -102,12 +117,31 @@ class FxMitraAddDialog extends HookConsumerWidget {
|
|
|
|
|
errorMessage: errorLogin.value, |
|
|
|
|
), |
|
|
|
|
const SizedBox(height: 10), |
|
|
|
|
FxTextField( |
|
|
|
|
ctrl: ctrlPassword, |
|
|
|
|
fc: fcPassword, |
|
|
|
|
hint: "Password", |
|
|
|
|
label: "Password", |
|
|
|
|
obscureText: true, |
|
|
|
|
errorMessage: errorPassword.value, |
|
|
|
|
), |
|
|
|
|
const SizedBox(height: 10), |
|
|
|
|
FxTextField( |
|
|
|
|
ctrl: ctrlRePassword, |
|
|
|
|
fc: fcRePassword, |
|
|
|
|
hint: "Retype Password", |
|
|
|
|
label: "Retype Password", |
|
|
|
|
obscureText: true, |
|
|
|
|
errorMessage: errorRePassword.value, |
|
|
|
|
), |
|
|
|
|
const SizedBox(height: 10), |
|
|
|
|
const FxTextField( |
|
|
|
|
hint: "ID", |
|
|
|
|
label: "ID", |
|
|
|
|
isReadOnly: true, |
|
|
|
|
isEnabled: false, |
|
|
|
|
suffixText: "Auto Generated"), |
|
|
|
|
suffixText: "Auto Generated", |
|
|
|
|
), |
|
|
|
|
const SizedBox(height: 10), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end, |
|
|
|
@ -128,7 +162,10 @@ class FxMitraAddDialog extends HookConsumerWidget {
|
|
|
|
|
doctorAddressID: |
|
|
|
|
doctorAddress!.mDoctorAddressID, |
|
|
|
|
login: ctrlLogin.text, |
|
|
|
|
password: ctrlPassword.text, |
|
|
|
|
query: "", |
|
|
|
|
); |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
child: const Text("Save"), |
|
|
|
|