-- kyc api and change password api has been integrated
This commit is contained in:
parent
c30a9b7661
commit
49982dcf92
73
lib/models/profile_response.dart
Normal file
73
lib/models/profile_response.dart
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
class ProfileResponse {
|
||||||
|
bool? success;
|
||||||
|
String? message;
|
||||||
|
MyData? myData;
|
||||||
|
|
||||||
|
ProfileResponse({this.success, this.message, this.myData});
|
||||||
|
|
||||||
|
ProfileResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
success = json['success'];
|
||||||
|
message = json['message'];
|
||||||
|
myData =
|
||||||
|
json['myData'] != null ? MyData.fromJson(json['myData']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['success'] = success;
|
||||||
|
data['message'] = message;
|
||||||
|
if (myData != null) {
|
||||||
|
data['myData'] = myData!.toJson();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyData {
|
||||||
|
String? sId;
|
||||||
|
String? name;
|
||||||
|
String? mobileNumber;
|
||||||
|
bool? isVerified;
|
||||||
|
String? email;
|
||||||
|
String? uniqueId;
|
||||||
|
String? createdAt;
|
||||||
|
String? updatedAt;
|
||||||
|
int? iV;
|
||||||
|
|
||||||
|
MyData(
|
||||||
|
{this.sId,
|
||||||
|
this.name,
|
||||||
|
this.mobileNumber,
|
||||||
|
this.isVerified,
|
||||||
|
this.email,
|
||||||
|
this.uniqueId,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt,
|
||||||
|
this.iV});
|
||||||
|
|
||||||
|
MyData.fromJson(Map<String, dynamic> json) {
|
||||||
|
sId = json['_id'];
|
||||||
|
name = json['name'];
|
||||||
|
mobileNumber = json['mobileNumber'];
|
||||||
|
isVerified = json['isVerified'];
|
||||||
|
email = json['email'];
|
||||||
|
uniqueId = json['uniqueId'];
|
||||||
|
createdAt = json['createdAt'];
|
||||||
|
updatedAt = json['updatedAt'];
|
||||||
|
iV = json['__v'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['_id'] = sId;
|
||||||
|
data['name'] = name;
|
||||||
|
data['mobileNumber'] = mobileNumber;
|
||||||
|
data['isVerified'] = isVerified;
|
||||||
|
data['email'] = email;
|
||||||
|
data['uniqueId'] = uniqueId;
|
||||||
|
data['createdAt'] = createdAt;
|
||||||
|
data['updatedAt'] = updatedAt;
|
||||||
|
data['__v'] = iV;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
46
lib/provider/forgot_password_provider.dart
Normal file
46
lib/provider/forgot_password_provider.dart
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../services/api_client.dart';
|
||||||
|
import '../services/api_urls.dart';
|
||||||
|
|
||||||
|
class ForgotPasswordProvider extends ChangeNotifier{
|
||||||
|
|
||||||
|
final emailController = TextEditingController();
|
||||||
|
bool _isLoading = false;
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
final _apiClient = ApiClient();
|
||||||
|
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
Future<(bool, String)> forgotPassword() async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.post(ApiUrls.forgotPasswordUrl,
|
||||||
|
data: {'email': emailController.text.trim()});
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return (true, response.data['message'].toString());
|
||||||
|
} else {
|
||||||
|
return (false, response.data['message'].toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
on DioException catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
if (e.response != null && e.response?.data != null) {
|
||||||
|
// Extracting the error message from the Dio response
|
||||||
|
return (false, e.response!.data['message'].toString());
|
||||||
|
} else {
|
||||||
|
// When no response or response data is available
|
||||||
|
return (false, 'Something went wrong');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
return (false, 'Something want wrong');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,10 +1,13 @@
|
|||||||
import 'package:cheminova/models/profile_response.dart';
|
import 'package:cheminova/models/profile_response.dart';
|
||||||
import 'package:cheminova/services/api_client.dart';
|
import 'package:cheminova/services/api_client.dart';
|
||||||
import 'package:cheminova/services/api_urls.dart';
|
import 'package:cheminova/services/api_urls.dart';
|
||||||
|
import 'package:cheminova/services/secure__storage_service.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../models/get_pd_response.dart';
|
import '../models/get_pd_response.dart';
|
||||||
|
import '../screens/login_screen.dart';
|
||||||
|
|
||||||
class HomeProvider extends ChangeNotifier {
|
class HomeProvider extends ChangeNotifier {
|
||||||
final _apiClient = ApiClient();
|
final _apiClient = ApiClient();
|
||||||
@ -30,4 +33,19 @@ class HomeProvider extends ChangeNotifier {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> logOut(BuildContext context) async {
|
||||||
|
Response response = await _apiClient.get(ApiUrls.logOutUrl);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
ScaffoldMessenger.of(context)
|
||||||
|
.showSnackBar(SnackBar(
|
||||||
|
content:
|
||||||
|
Text(response.data['message'].toString())));
|
||||||
|
SecureStorageService().clear();
|
||||||
|
Navigator.pushReplacement(context,
|
||||||
|
MaterialPageRoute(builder: (context) => const LoginPage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
91
lib/provider/markleave_provider.dart
Normal file
91
lib/provider/markleave_provider.dart
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import '../services/api_client.dart';
|
||||||
|
import '../services/api_urls.dart';
|
||||||
|
|
||||||
|
class MarkLeaveProvider extends ChangeNotifier{
|
||||||
|
|
||||||
|
final _apiClient = ApiClient();
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
final dateController = TextEditingController(
|
||||||
|
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
||||||
|
|
||||||
|
final timeController =
|
||||||
|
TextEditingController(text: DateFormat('hh:mm a').format(DateTime.now()));
|
||||||
|
|
||||||
|
final locationController = TextEditingController();
|
||||||
|
final notesController = TextEditingController();
|
||||||
|
|
||||||
|
String selectedLeaveType = 'Sick';
|
||||||
|
|
||||||
|
void onLeaveTypeSelected(String leaveType) {
|
||||||
|
selectedLeaveType = leaveType;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildLeaveTypeOption(String leaveType) {
|
||||||
|
bool isSelected = leaveType == selectedLeaveType;
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => onLeaveTypeSelected(leaveType),
|
||||||
|
child: Container(margin: const EdgeInsets.only(bottom: 10),
|
||||||
|
width: 120,
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 5.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isSelected ? Colors.blue : Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
leaveType,
|
||||||
|
style: TextStyle(
|
||||||
|
color: isSelected ? Colors.white : Colors.black,
|
||||||
|
fontSize: 16.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Future<(bool, String)> markLeave(
|
||||||
|
String date, String time, String location, String reason,String leaveType) async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.post(ApiUrls.leaveAttendance,
|
||||||
|
data: {
|
||||||
|
"date": date,
|
||||||
|
"time": time,
|
||||||
|
"reason": reason,
|
||||||
|
"leaveType":leaveType,
|
||||||
|
});
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return (true, response.data['message'].toString());
|
||||||
|
} else {
|
||||||
|
return (false, response.data['message'].toString());
|
||||||
|
}
|
||||||
|
}on DioException catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
if (e.response != null && e.response?.data != null) {
|
||||||
|
// Extracting the error message from the Dio response
|
||||||
|
return (false, e.response!.data['message'].toString());
|
||||||
|
} else {
|
||||||
|
// When no response or response data is available
|
||||||
|
return (false, 'Something went wrong');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
final message = e as DioException;
|
||||||
|
return (false, 'Something want wrong');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
88
lib/screens/Rejected_application.dart
Normal file
88
lib/screens/Rejected_application.dart
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
|
import 'package:cheminova/widgets/common_elevated_button.dart';
|
||||||
|
|
||||||
|
class RejectedApplication extends StatelessWidget {
|
||||||
|
const RejectedApplication({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CommonBackground(
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
appBar: CommonAppBar(
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
|
padding: const EdgeInsets.only(right: 20),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
title: const Text('Rejected Application',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontFamily: 'Anek')),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0,
|
||||||
|
),
|
||||||
|
drawer: const CommonDrawer(),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.white),
|
||||||
|
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
||||||
|
borderRadius: BorderRadius.circular(26.0),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
_buildProductButton('Trade Name 1'),
|
||||||
|
_buildProductButton('Trade Name 2'),
|
||||||
|
_buildProductButton('Trade Name 3'),
|
||||||
|
// _buildProductButton('Product 4'),
|
||||||
|
// _buildProductButton('Product 5'),
|
||||||
|
// _buildProductButton('Product 6'),
|
||||||
|
// _buildProductButton('Product 7'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildProductButton(String productName) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 15),
|
||||||
|
child: CommonElevatedButton(
|
||||||
|
borderRadius: 30,
|
||||||
|
width: double.infinity,
|
||||||
|
height: kToolbarHeight - 10,
|
||||||
|
text: productName,
|
||||||
|
backgroundColor: const Color(0xff004791),
|
||||||
|
onPressed: () {
|
||||||
|
// Handle product button press
|
||||||
|
debugPrint('$productName pressed');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +1,11 @@
|
|||||||
import 'package:cheminova/provider/change_password_provider.dart';
|
import 'package:cheminova/provider/forgot_password_provider.dart';
|
||||||
import 'package:cheminova/screens/verify_phone_screen.dart';
|
import 'package:cheminova/screens/login_screen.dart';
|
||||||
import 'package:cheminova/widgets/common_background.dart';
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
import 'package:cheminova/widgets/common_elevated_button.dart';
|
import 'package:cheminova/widgets/common_elevated_button.dart';
|
||||||
import 'package:cheminova/widgets/common_text_form_field.dart';
|
import 'package:cheminova/widgets/common_text_form_field.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'home_screen.dart';
|
|
||||||
|
|
||||||
class ForgotPasswordScreen extends StatefulWidget {
|
class ForgotPasswordScreen extends StatefulWidget {
|
||||||
const ForgotPasswordScreen({super.key});
|
const ForgotPasswordScreen({super.key});
|
||||||
|
|
||||||
@ -17,9 +15,20 @@ class ForgotPasswordScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
late ForgotPasswordProvider forgotPasswordProvider;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
forgotPasswordProvider = ForgotPasswordProvider();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
|
return ChangeNotifierProvider<ForgotPasswordProvider>(
|
||||||
|
create: (_) => forgotPasswordProvider,
|
||||||
|
builder: (context, child) {
|
||||||
return CommonBackground(
|
return CommonBackground(
|
||||||
isFullWidth: false,
|
isFullWidth: false,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@ -71,7 +80,11 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const CommonTextFormField(title: ' Enter Your Email ID'),
|
Consumer<ForgotPasswordProvider>(
|
||||||
|
builder: (context, value, child) => CommonTextFormField(
|
||||||
|
controller: value.emailController,
|
||||||
|
title: ' Enter Your Email ID'),
|
||||||
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
@ -90,7 +103,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
|||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Consumer<ChangePasswordProvider>(
|
child: Consumer<ForgotPasswordProvider>(
|
||||||
builder: (context, value, child) => CommonElevatedButton(
|
builder: (context, value, child) => CommonElevatedButton(
|
||||||
backgroundColor: const Color(0xff004791),
|
backgroundColor: const Color(0xff004791),
|
||||||
borderRadius: 30,
|
borderRadius: 30,
|
||||||
@ -101,7 +114,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
|||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
value.changePassword().then((result) {
|
value.forgotPassword().then((result) {
|
||||||
var (status, message) = result;
|
var (status, message) = result;
|
||||||
ScaffoldMessenger.of(context)
|
ScaffoldMessenger.of(context)
|
||||||
.showSnackBar(SnackBar(
|
.showSnackBar(SnackBar(
|
||||||
@ -111,19 +124,12 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
const HomePage()));
|
const LoginPage()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// MaterialPageRoute(
|
|
||||||
// builder: (context) => const VerifyPhoneScreen(),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -136,4 +142,6 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:cheminova/provider/home_provider.dart';
|
import 'package:cheminova/provider/home_provider.dart';
|
||||||
|
import 'package:cheminova/screens/Rejected_application.dart';
|
||||||
import 'package:cheminova/screens/calendar_screen.dart';
|
import 'package:cheminova/screens/calendar_screen.dart';
|
||||||
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
||||||
import 'package:cheminova/screens/daily_tasks_screen.dart';
|
import 'package:cheminova/screens/daily_tasks_screen.dart';
|
||||||
@ -158,9 +159,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 5),
|
||||||
height: 5,
|
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -177,6 +176,22 @@ class _HomePageState extends State<HomePage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: _buildCustomCard('Rejected Applications',
|
||||||
|
'Re-upload Rejected Documents', onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
const RejectedApplication(),
|
||||||
|
));
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -210,7 +225,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 5),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -21,7 +21,7 @@ class MarkAttendanceScreen extends StatefulWidget {
|
|||||||
class _MarkAttendanceScreenState extends State<MarkAttendanceScreen> {
|
class _MarkAttendanceScreenState extends State<MarkAttendanceScreen> {
|
||||||
late AttendanceProvider attendanceProvider;
|
late AttendanceProvider attendanceProvider;
|
||||||
final dateController = TextEditingController(
|
final dateController = TextEditingController(
|
||||||
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
text: DateFormat('yyyy/MM/dd').format(DateTime.now()));
|
||||||
|
|
||||||
final timeController =
|
final timeController =
|
||||||
TextEditingController(text: DateFormat('hh:mm a').format(DateTime.now()));
|
TextEditingController(text: DateFormat('hh:mm a').format(DateTime.now()));
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:cheminova/provider/markleave_provider.dart';
|
||||||
import 'package:cheminova/screens/Attendance_success.dart';
|
import 'package:cheminova/screens/Attendance_success.dart';
|
||||||
import 'package:cheminova/widgets/common_drawer.dart';
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -5,6 +6,7 @@ import 'package:cheminova/widgets/common_background.dart';
|
|||||||
import 'package:geocoding/geocoding.dart';
|
import 'package:geocoding/geocoding.dart';
|
||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import '../widgets/common_app_bar.dart';
|
import '../widgets/common_app_bar.dart';
|
||||||
import '../widgets/common_elevated_button.dart';
|
import '../widgets/common_elevated_button.dart';
|
||||||
import '../widgets/common_text_form_field.dart';
|
import '../widgets/common_text_form_field.dart';
|
||||||
@ -17,6 +19,8 @@ class OnLeaveScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
||||||
|
late MarkLeaveProvider _markLeaveProvider;
|
||||||
|
|
||||||
final dateController = TextEditingController(
|
final dateController = TextEditingController(
|
||||||
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
||||||
|
|
||||||
@ -39,7 +43,7 @@ class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
|||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => onLeaveTypeSelected(leaveType),
|
onTap: () => onLeaveTypeSelected(leaveType),
|
||||||
child: Container(margin: EdgeInsets.only(bottom: 10),
|
child: Container(margin: const EdgeInsets.only(bottom: 10),
|
||||||
width: 120,
|
width: 120,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 5.0),
|
padding: const EdgeInsets.symmetric(vertical: 5.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -61,6 +65,7 @@ class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_markLeaveProvider = MarkLeaveProvider();
|
||||||
_getCurrentLocation();
|
_getCurrentLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +104,10 @@ class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CommonBackground(
|
return ChangeNotifierProvider<MarkLeaveProvider>(
|
||||||
|
create: (_) => _markLeaveProvider,
|
||||||
|
builder: (context, child) =>
|
||||||
|
CommonBackground(
|
||||||
child: Scaffold(backgroundColor: Colors.transparent,
|
child: Scaffold(backgroundColor: Colors.transparent,
|
||||||
appBar: CommonAppBar(
|
appBar: CommonAppBar(
|
||||||
actions: [
|
actions: [
|
||||||
@ -177,16 +185,39 @@ class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
|||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: CommonElevatedButton(
|
child: Consumer<MarkLeaveProvider>(
|
||||||
|
builder: (context, value, child) =>CommonElevatedButton(
|
||||||
borderRadius: 30,
|
borderRadius: 30,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: kToolbarHeight - 10,
|
height: kToolbarHeight - 10,
|
||||||
text: 'ON LEAVE',
|
text: 'ON LEAVE',
|
||||||
backgroundColor: const Color(0xff00784C),
|
backgroundColor: const Color(0xff00784C),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const AttendanceSuccess()));
|
value
|
||||||
|
.markLeave(
|
||||||
|
dateController.text.trim(),
|
||||||
|
timeController.text.trim(),
|
||||||
|
locationController.text.trim(),
|
||||||
|
notesController.text.trim(), selectedLeaveType)
|
||||||
|
.then(
|
||||||
|
(result) {
|
||||||
|
var (status, message) = result;
|
||||||
|
ScaffoldMessenger.of(context)
|
||||||
|
.showSnackBar(SnackBar(
|
||||||
|
content: Text(message)));
|
||||||
|
if (status) {
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
const AttendanceSuccess()));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
})
|
// Navigator.push(context, MaterialPageRoute(builder:(context) => const AttendanceSuccess(),));
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -196,6 +227,7 @@ class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),),
|
),),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ import 'package:cheminova/widgets/common_app_bar.dart';
|
|||||||
import 'package:cheminova/widgets/common_elevated_button.dart';
|
import 'package:cheminova/widgets/common_elevated_button.dart';
|
||||||
|
|
||||||
class ProductsManualScreen extends StatelessWidget {
|
class ProductsManualScreen extends StatelessWidget {
|
||||||
const ProductsManualScreen({Key? key}) : super(key: key);
|
const ProductsManualScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
0
lib/screens/reupload_document.dart
Normal file
0
lib/screens/reupload_document.dart
Normal file
@ -7,4 +7,7 @@ class ApiUrls {
|
|||||||
static const String createCollectKycUrl = '${baseUrl}kyc/create';
|
static const String createCollectKycUrl = '${baseUrl}kyc/create';
|
||||||
static const String getProfileUrl = '${baseUrl}salescoordinator/my-profile';
|
static const String getProfileUrl = '${baseUrl}salescoordinator/my-profile';
|
||||||
static const String changePasswordUrl = '${baseUrl}salescoordinator/password/update';
|
static const String changePasswordUrl = '${baseUrl}salescoordinator/password/update';
|
||||||
|
static const String forgotPasswordUrl = '${baseUrl}salescoordinator/forgot-password';
|
||||||
|
static const String leaveAttendance = '${baseUrl}v1/markleave/salescoordinator';
|
||||||
|
static const String logOutUrl = '${baseUrl}salescoordinator/logout';
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import 'package:cheminova/provider/home_provider.dart';
|
|||||||
import 'package:cheminova/screens/change_password_screen.dart';
|
import 'package:cheminova/screens/change_password_screen.dart';
|
||||||
import 'package:cheminova/screens/home_screen.dart';
|
import 'package:cheminova/screens/home_screen.dart';
|
||||||
import 'package:cheminova/screens/login_screen.dart';
|
import 'package:cheminova/screens/login_screen.dart';
|
||||||
|
import 'package:cheminova/services/secure__storage_service.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@ -44,13 +45,13 @@ class CommonDrawer extends StatelessWidget {
|
|||||||
title: const Text('Home'),
|
title: const Text('Home'),
|
||||||
onTap: () => Navigator.push(context,
|
onTap: () => Navigator.push(context,
|
||||||
MaterialPageRoute(builder: (context) => const HomePage()))),
|
MaterialPageRoute(builder: (context) => const HomePage()))),
|
||||||
ListTile(
|
// ListTile(
|
||||||
leading: const Icon(Icons.account_circle),
|
// leading: const Icon(Icons.account_circle),
|
||||||
title: const Text('Profile'),
|
// title: const Text('Profile'),
|
||||||
onTap: () {
|
// onTap: () {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.settings),
|
leading: const Icon(Icons.settings),
|
||||||
title: const Text('Change Password'),
|
title: const Text('Change Password'),
|
||||||
@ -66,8 +67,8 @@ class CommonDrawer extends StatelessWidget {
|
|||||||
leading: const Icon(Icons.exit_to_app),
|
leading: const Icon(Icons.exit_to_app),
|
||||||
title: const Text('Logout'),
|
title: const Text('Logout'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pushReplacement(context,
|
Provider.of<HomeProvider>(context,listen: false).logOut(context);
|
||||||
MaterialPageRoute(builder: (context) => const LoginPage()));
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user