diff --git a/lib/models/profile_response.dart b/lib/models/profile_response.dart new file mode 100644 index 0000000..a98a743 --- /dev/null +++ b/lib/models/profile_response.dart @@ -0,0 +1,73 @@ +class ProfileResponse { + bool? success; + String? message; + MyData? myData; + + ProfileResponse({this.success, this.message, this.myData}); + + ProfileResponse.fromJson(Map json) { + success = json['success']; + message = json['message']; + myData = + json['myData'] != null ? MyData.fromJson(json['myData']) : null; + } + + Map toJson() { + final Map data = {}; + 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 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 toJson() { + final Map data = {}; + 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; + } +} diff --git a/lib/provider/forgot_password_provider.dart b/lib/provider/forgot_password_provider.dart new file mode 100644 index 0000000..49270d5 --- /dev/null +++ b/lib/provider/forgot_password_provider.dart @@ -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'); + } + } + +} \ No newline at end of file diff --git a/lib/provider/home_provider.dart b/lib/provider/home_provider.dart index 968cbe6..60e68b6 100644 --- a/lib/provider/home_provider.dart +++ b/lib/provider/home_provider.dart @@ -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 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())); + } + + + } } diff --git a/lib/provider/markleave_provider.dart b/lib/provider/markleave_provider.dart new file mode 100644 index 0000000..0622af7 --- /dev/null +++ b/lib/provider/markleave_provider.dart @@ -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'); + } + } +} \ No newline at end of file diff --git a/lib/screens/Rejected_application.dart b/lib/screens/Rejected_application.dart new file mode 100644 index 0000000..a83c00d --- /dev/null +++ b/lib/screens/Rejected_application.dart @@ -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: [ + 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: [ + _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'); + }, + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/forgot_password_screen.dart b/lib/screens/forgot_password_screen.dart index 1146b4d..9f0ad8d 100644 --- a/lib/screens/forgot_password_screen.dart +++ b/lib/screens/forgot_password_screen.dart @@ -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 { final _formKey = GlobalKey(); + 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: [ - 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( + 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: [ + 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( - 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( + 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( + 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(), - // ), - // ); - // }, + }, + + ), + ), ), - ), + ], ), - ], + ), ), ), ), ), - ), - ), + ); + } ); } } diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index 7817a04..44b0f03 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -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 { ), ], ), - const SizedBox( - height: 5, - ), + const SizedBox(height: 5), Row( children: [ Expanded( @@ -177,6 +176,22 @@ class _HomePageState extends State { ], ), 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 { ), ], ), - const SizedBox(height: 12), + const SizedBox(height: 5), Row( children: [ Expanded( diff --git a/lib/screens/mark_attendence_screen.dart b/lib/screens/mark_attendence_screen.dart index 6430b0d..bb56aca 100644 --- a/lib/screens/mark_attendence_screen.dart +++ b/lib/screens/mark_attendence_screen.dart @@ -21,7 +21,7 @@ class MarkAttendanceScreen extends StatefulWidget { class _MarkAttendanceScreenState extends State { 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())); diff --git a/lib/screens/on_leave_screen.dart b/lib/screens/on_leave_screen.dart index 49b1820..1bf7850 100644 --- a/lib/screens/on_leave_screen.dart +++ b/lib/screens/on_leave_screen.dart @@ -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 { + late MarkLeaveProvider _markLeaveProvider; + final dateController = TextEditingController( text: DateFormat('dd/MM/yyyy').format(DateTime.now())); @@ -39,7 +43,7 @@ class _OnLeaveScreenState extends State { 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 { @override void initState() { super.initState(); + _markLeaveProvider = MarkLeaveProvider(); _getCurrentLocation(); } @@ -99,103 +104,130 @@ class _OnLeaveScreenState extends State { @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: [ - 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: [ - 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( + 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: [ + 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: [ + 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( + 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(),)); + }), + ) + + ), + ], + ), + ), + ], + ), + ), + ),), + ) ); } } \ No newline at end of file diff --git a/lib/screens/products_manual_screen.dart b/lib/screens/products_manual_screen.dart index a54c389..84a7f63 100644 --- a/lib/screens/products_manual_screen.dart +++ b/lib/screens/products_manual_screen.dart @@ -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) { diff --git a/lib/screens/reupload_document.dart b/lib/screens/reupload_document.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/services/api_urls.dart b/lib/services/api_urls.dart index cd21c84..5a9ae99 100644 --- a/lib/services/api_urls.dart +++ b/lib/services/api_urls.dart @@ -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'; } diff --git a/lib/widgets/common_drawer.dart b/lib/widgets/common_drawer.dart index 7a1b098..803338e 100644 --- a/lib/widgets/common_drawer.dart +++ b/lib/widgets/common_drawer.dart @@ -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(context,listen: false).logOut(context); + }, ), ],