-- 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/services/api_client.dart';
|
||||
import 'package:cheminova/services/api_urls.dart';
|
||||
import 'package:cheminova/services/secure__storage_service.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../models/get_pd_response.dart';
|
||||
import '../screens/login_screen.dart';
|
||||
|
||||
class HomeProvider extends ChangeNotifier {
|
||||
final _apiClient = ApiClient();
|
||||
@ -30,4 +33,19 @@ class HomeProvider extends ChangeNotifier {
|
||||
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/screens/verify_phone_screen.dart';
|
||||
import 'package:cheminova/provider/forgot_password_provider.dart';
|
||||
import 'package:cheminova/screens/login_screen.dart';
|
||||
import 'package:cheminova/widgets/common_background.dart';
|
||||
import 'package:cheminova/widgets/common_elevated_button.dart';
|
||||
import 'package:cheminova/widgets/common_text_form_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'home_screen.dart';
|
||||
|
||||
class ForgotPasswordScreen extends StatefulWidget {
|
||||
const ForgotPasswordScreen({super.key});
|
||||
|
||||
@ -17,123 +15,133 @@ class ForgotPasswordScreen extends StatefulWidget {
|
||||
|
||||
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
late ForgotPasswordProvider forgotPasswordProvider;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
forgotPasswordProvider = ForgotPasswordProvider();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CommonBackground(
|
||||
isFullWidth: false,
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(leading: InkWell(onTap:() {
|
||||
Navigator.pop(context);
|
||||
},child: Image.asset('assets/Back_attendance.png')),backgroundColor: Colors.transparent,),
|
||||
body: Center(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 30.0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.white),
|
||||
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
||||
borderRadius: BorderRadius.circular(26.0),
|
||||
),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Image.asset(
|
||||
'assets/lock_logo2.png',
|
||||
height: 50.0, // Adjust the height as needed
|
||||
width: 50.0, // Adjust the width as needed
|
||||
|
||||
return ChangeNotifierProvider<ForgotPasswordProvider>(
|
||||
create: (_) => forgotPasswordProvider,
|
||||
builder: (context, child) {
|
||||
return CommonBackground(
|
||||
isFullWidth: false,
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(leading: InkWell(onTap:() {
|
||||
Navigator.pop(context);
|
||||
},child: Image.asset('assets/Back_attendance.png')),backgroundColor: Colors.transparent,),
|
||||
body: Center(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 30.0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.white),
|
||||
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
||||
borderRadius: BorderRadius.circular(26.0),
|
||||
),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Image.asset(
|
||||
'assets/lock_logo2.png',
|
||||
height: 50.0, // Adjust the height as needed
|
||||
width: 50.0, // Adjust the width as needed
|
||||
),
|
||||
),
|
||||
),
|
||||
const Text(
|
||||
'Forgot Password',
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: 'Anek',
|
||||
),
|
||||
),
|
||||
const Text(
|
||||
'Enter Registered Email ID to generate new password',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w300,
|
||||
fontFamily: 'Roboto',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const CommonTextFormField(title: ' Enter Your Email ID'),
|
||||
const SizedBox(height: 20),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Back to Login',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontFamily: 'Roboto')),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Consumer<ChangePasswordProvider>(
|
||||
builder: (context, value, child) => CommonElevatedButton(
|
||||
backgroundColor: const Color(0xff004791),
|
||||
borderRadius: 30,
|
||||
width: double.infinity,
|
||||
height: kToolbarHeight - 10,
|
||||
text: 'SEND',
|
||||
onPressed: value.isLoading
|
||||
? null
|
||||
: () async {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
value.changePassword().then((result) {
|
||||
var (status, message) = result;
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(
|
||||
content: Text(message)));
|
||||
if (status) {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
const HomePage()));
|
||||
const Text(
|
||||
'Forgot Password',
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: 'Anek',
|
||||
),
|
||||
),
|
||||
const Text(
|
||||
'Enter Registered Email ID to generate new password',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w300,
|
||||
fontFamily: 'Roboto',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Consumer<ForgotPasswordProvider>(
|
||||
builder: (context, value, child) => CommonTextFormField(
|
||||
controller: value.emailController,
|
||||
title: ' Enter Your Email ID'),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Back to Login',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontFamily: 'Roboto')),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Consumer<ForgotPasswordProvider>(
|
||||
builder: (context, value, child) => CommonElevatedButton(
|
||||
backgroundColor: const Color(0xff004791),
|
||||
borderRadius: 30,
|
||||
width: double.infinity,
|
||||
height: kToolbarHeight - 10,
|
||||
text: 'SEND',
|
||||
onPressed: value.isLoading
|
||||
? null
|
||||
: () async {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
value.forgotPassword().then((result) {
|
||||
var (status, message) = result;
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(
|
||||
content: Text(message)));
|
||||
if (status) {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
const LoginPage()));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// onPressed: () {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) => const VerifyPhoneScreen(),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
},
|
||||
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
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/collect_kyc_screen.dart';
|
||||
import 'package:cheminova/screens/daily_tasks_screen.dart';
|
||||
@ -158,9 +159,7 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -177,6 +176,22 @@ class _HomePageState extends State<HomePage> {
|
||||
],
|
||||
),
|
||||
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(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -210,7 +225,7 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 5),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
|
@ -21,7 +21,7 @@ class MarkAttendanceScreen extends StatefulWidget {
|
||||
class _MarkAttendanceScreenState extends State<MarkAttendanceScreen> {
|
||||
late AttendanceProvider attendanceProvider;
|
||||
final dateController = TextEditingController(
|
||||
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
||||
text: DateFormat('yyyy/MM/dd').format(DateTime.now()));
|
||||
|
||||
final timeController =
|
||||
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/widgets/common_drawer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -5,6 +6,7 @@ import 'package:cheminova/widgets/common_background.dart';
|
||||
import 'package:geocoding/geocoding.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../widgets/common_app_bar.dart';
|
||||
import '../widgets/common_elevated_button.dart';
|
||||
import '../widgets/common_text_form_field.dart';
|
||||
@ -17,6 +19,8 @@ class OnLeaveScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
||||
late MarkLeaveProvider _markLeaveProvider;
|
||||
|
||||
final dateController = TextEditingController(
|
||||
text: DateFormat('dd/MM/yyyy').format(DateTime.now()));
|
||||
|
||||
@ -39,7 +43,7 @@ class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => onLeaveTypeSelected(leaveType),
|
||||
child: Container(margin: EdgeInsets.only(bottom: 10),
|
||||
child: Container(margin: const EdgeInsets.only(bottom: 10),
|
||||
width: 120,
|
||||
padding: const EdgeInsets.symmetric(vertical: 5.0),
|
||||
decoration: BoxDecoration(
|
||||
@ -61,6 +65,7 @@ class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_markLeaveProvider = MarkLeaveProvider();
|
||||
_getCurrentLocation();
|
||||
}
|
||||
|
||||
@ -99,103 +104,130 @@ class _OnLeaveScreenState extends State<OnLeaveScreen> {
|
||||
|
||||
@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('On Leave',
|
||||
style: TextStyle(
|
||||
fontSize: 28,
|
||||
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),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 30.0),
|
||||
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>[
|
||||
CommonTextFormField(
|
||||
title: 'Date',
|
||||
readOnly: true,
|
||||
fillColor: Colors.white,
|
||||
controller: dateController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
title: 'Time',
|
||||
readOnly: true,
|
||||
fillColor: Colors.white,
|
||||
controller: timeController),
|
||||
const SizedBox(height: 15),
|
||||
const Text('Leave type',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontFamily: 'Anek')),
|
||||
const SizedBox(height:3 ),
|
||||
Wrap(direction: Axis.horizontal,
|
||||
children: [
|
||||
buildLeaveTypeOption('Sick'),
|
||||
const SizedBox(width: 10),
|
||||
buildLeaveTypeOption('Personal'),
|
||||
const SizedBox(width: 10),
|
||||
buildLeaveTypeOption('Privilege '),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
height: 100,
|
||||
title: 'Reason',
|
||||
fillColor: Colors.white,
|
||||
maxLines: 4,
|
||||
controller: notesController),
|
||||
const SizedBox(height: 16),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: CommonElevatedButton(
|
||||
borderRadius: 30,
|
||||
width: double.infinity,
|
||||
height: kToolbarHeight - 10,
|
||||
text: 'ON LEAVE',
|
||||
backgroundColor: const Color(0xff00784C),
|
||||
onPressed: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const AttendanceSuccess()));
|
||||
|
||||
})
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
return ChangeNotifierProvider<MarkLeaveProvider>(
|
||||
create: (_) => _markLeaveProvider,
|
||||
builder: (context, child) =>
|
||||
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('On Leave',
|
||||
style: TextStyle(
|
||||
fontSize: 28,
|
||||
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),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 30.0),
|
||||
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>[
|
||||
CommonTextFormField(
|
||||
title: 'Date',
|
||||
readOnly: true,
|
||||
fillColor: Colors.white,
|
||||
controller: dateController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
title: 'Time',
|
||||
readOnly: true,
|
||||
fillColor: Colors.white,
|
||||
controller: timeController),
|
||||
const SizedBox(height: 15),
|
||||
const Text('Leave type',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontFamily: 'Anek')),
|
||||
const SizedBox(height:3 ),
|
||||
Wrap(direction: Axis.horizontal,
|
||||
children: [
|
||||
buildLeaveTypeOption('Sick'),
|
||||
const SizedBox(width: 10),
|
||||
buildLeaveTypeOption('Personal'),
|
||||
const SizedBox(width: 10),
|
||||
buildLeaveTypeOption('Privilege '),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
height: 100,
|
||||
title: 'Reason',
|
||||
fillColor: Colors.white,
|
||||
maxLines: 4,
|
||||
controller: notesController),
|
||||
const SizedBox(height: 16),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Consumer<MarkLeaveProvider>(
|
||||
builder: (context, value, child) =>CommonElevatedButton(
|
||||
borderRadius: 30,
|
||||
width: double.infinity,
|
||||
height: kToolbarHeight - 10,
|
||||
text: 'ON LEAVE',
|
||||
backgroundColor: const Color(0xff00784C),
|
||||
onPressed: () {
|
||||
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(),));
|
||||
}),
|
||||
)
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ import 'package:cheminova/widgets/common_app_bar.dart';
|
||||
import 'package:cheminova/widgets/common_elevated_button.dart';
|
||||
|
||||
class ProductsManualScreen extends StatelessWidget {
|
||||
const ProductsManualScreen({Key? key}) : super(key: key);
|
||||
const ProductsManualScreen({super.key});
|
||||
|
||||
@override
|
||||
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 getProfileUrl = '${baseUrl}salescoordinator/my-profile';
|
||||
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/home_screen.dart';
|
||||
import 'package:cheminova/screens/login_screen.dart';
|
||||
import 'package:cheminova/services/secure__storage_service.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@ -44,13 +45,13 @@ class CommonDrawer extends StatelessWidget {
|
||||
title: const Text('Home'),
|
||||
onTap: () => Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) => const HomePage()))),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.account_circle),
|
||||
title: const Text('Profile'),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.account_circle),
|
||||
// title: const Text('Profile'),
|
||||
// onTap: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// ),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.settings),
|
||||
title: const Text('Change Password'),
|
||||
@ -66,8 +67,8 @@ class CommonDrawer extends StatelessWidget {
|
||||
leading: const Icon(Icons.exit_to_app),
|
||||
title: const Text('Logout'),
|
||||
onTap: () {
|
||||
Navigator.pushReplacement(context,
|
||||
MaterialPageRoute(builder: (context) => const LoginPage()));
|
||||
Provider.of<HomeProvider>(context,listen: false).logOut(context);
|
||||
|
||||
},
|
||||
),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user