diff --git a/lib/Components/side_drawer.dart b/lib/Components/side_drawer.dart index be08db0e..5e738857 100644 --- a/lib/Components/side_drawer.dart +++ b/lib/Components/side_drawer.dart @@ -116,6 +116,11 @@ class _SideDrawerState extends State { pageMover: '/academic_home_page', isActive: true, ), + ModulesPadding( + line: 'PurchaseStore Module', + pageMover: '/purchase_store_homepage', + isActive: true, + ), ModulesPadding( line: 'Programme Curriculum', pageMover: '/programme_curriculum_home', diff --git a/lib/Components/side_drawer2.dart b/lib/Components/side_drawer2.dart index 97c80e8d..db7578db 100644 --- a/lib/Components/side_drawer2.dart +++ b/lib/Components/side_drawer2.dart @@ -129,8 +129,8 @@ class _SideDrawerState extends State { if ((type == "student" )) ModulesCard(cardLine: 'Leave Module'), - if ((type == "student" )) - ModulesCard(cardLine: 'Purchase and Store'), + if ((type != "student" )) + ModulesCard(cardLine: 'Purchase and Store',pageMover: '/purchase_store_homepage'), if ((type == "student" )) ModulesCard(cardLine: 'Human Resource'), diff --git a/lib/main.dart b/lib/main.dart index 4cd5af87..b4173852 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -38,6 +38,7 @@ import 'package:fusion/screens/Programme_Curriculum/Discipline/discipline.dart'; import 'package:fusion/screens/Programme_Curriculum/Programme/programme_home_page.dart'; import 'package:fusion/screens/Programme_Curriculum/Programme_Info/programme_info.dart'; import 'package:fusion/screens/Programme_Curriculum/programme_curriculum_home.dart'; +import 'package:fusion/screens/PurchaseStore/Indenter_View.dart'; import 'package:fusion/screens/landing_page.dart'; import 'package:fusion/screens/Healthcenter/healthcentermodule.dart'; import 'package:fusion/screens/Healthcenter/feedback.dart'; @@ -45,6 +46,26 @@ import 'package:fusion/screens/Healthcenter/viewschedule.dart'; import 'package:fusion/screens/Healthcenter/history.dart'; import 'package:fusion/screens/Healthcenter/HealthCenter.dart'; import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/screens/PurchaseStore/purchase_store_homepage.dart'; +import 'package:fusion/screens/PurchaseStore/Approved_Request.dart'; +import 'package:fusion/screens/PurchaseStore/Audit_Bill.dart'; +import 'package:fusion/screens/PurchaseStore/Global_STOCK.dart'; +// import 'package:fusion/screens/PurchaseStore/Indent_form.dart'; +import 'package:fusion/screens/PurchaseStore/Process_Bill.dart'; +import 'package:fusion/screens/PurchaseStore/Rejected_Request.dart'; +import 'package:fusion/screens/PurchaseStore/Saved_indent.dart'; +import 'package:fusion/screens/PurchaseStore/Transfer_Funds.dart'; +import 'package:fusion/screens/PurchaseStore/filed_Indent.dart'; +import 'package:fusion/screens/PurchaseStore/inbox.dart'; +import 'package:fusion/screens/PurchaseStore/new_request.dart'; +import 'package:fusion/screens/PurchaseStore/pending.dart'; +import 'package:fusion/screens/PurchaseStore/admin_homepage.dart'; +import 'package:fusion/screens/PurchaseStore/ps_admin.dart'; +import 'package:fusion/screens/PurchaseStore/head_homepage.dart'; +import 'package:fusion/screens/PurchaseStore/indent_form.dart'; +import 'package:fusion/screens/PurchaseStore/pending.dart'; +import 'package:fusion/screens/PurchaseStore/flow_chart.dart'; + void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -63,7 +84,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { MediaQueryData windowData = - MediaQueryData.fromView(WidgetsBinding.instance.window); + MediaQueryData.fromView(WidgetsBinding.instance.window); windowData = windowData.copyWith( textScaler: TextScaler.linear(1), ); @@ -74,19 +95,19 @@ class MyApp extends StatelessWidget { title: 'Fusion', debugShowCheckedModeBanner: false, theme: ThemeData( - // primarySwatch: Colors.blueGrey, + // primarySwatch: Colors.blueGrey, // colorSchemeSeed: Color(0xFF2085D0), colorSchemeSeed: Color(0xFFF36C35), - fontFamily: 'Nunito', + fontFamily: 'Nunito', useMaterial3: true, ), initialRoute: '/landing', routes: { '/landing': (context) => LandingPage(), '/login_page': (context) => LoginPage(), - '/notification':(context)=>Notify(), - '/news':(context)=>News(), - '/announcement':(context)=>Announcement(), + '/notification': (context) => Notify(), + '/news': (context) => News(), + '/announcement': (context) => Announcement(), '/dashboard': (context) => Dashboard(), '/academic_home_page': (context) => AcademicHomePage( ModalRoute.of(context)!.settings.arguments.toString()), @@ -133,8 +154,33 @@ class MyApp extends StatelessWidget { '/health_center/feedback': (context) => FeedBack(), '/health_center/viewschedule': (context) => ViewSchedule(), '/health_center/history': (context) => History(), + '/purchase_store_homepage': (context) => FlowChartPage(), + // '/purchase_store/indent_form': (context) => IndentForm(), + '/purchase_store/indent_form': (context) => IndentForm(), + + '/purchase_store/inbox': (context) => Inbox(), + '/purchase_store/saved_indent': (context) => SavedIndent(), + '/purchase_store/filed_indent': (context) => FiledIndent(), + '/purchase_store/': (context) => PurchaseStoreHomePage(), + '/purchase_store/new_request': (context) => NewRequest(), + '/purchase_store/pending': (context) => Pending(), + '/purchase_store/approved': (context) => ApprovedRequest(), + '/purchase_store/rejected': (context) => RejectedRequest(), + '/purchase_store/audit': (context) => AuditBill(), + '/purchase_store/process_bill': (context) => ProcessBill(), + '/purchase_store/global_stock': (context) => GlobalStock(), + '/purchase_store/transfer_funds': (context) => TransferFunds(), + '/purchase_store/employee': (context) => PurchaseStoreHomePage(), + '/purchase_store/admin': (context) => adminHomePage(), + '/purchase_store/psadmin': (context) => psadminPage(), + '/purchase_store/head': (context) => headHomePage(), + '/purchase_store/indent_view': (context) => IndentView(), + '/purchase_store/transfer': (context) => TransferFunds(), + '/purchase_store/stocks':(context)=>GlobalStock() + + }, ), ); } -} \ No newline at end of file +} diff --git a/lib/screens/PurchaseStore/ALL_Filed_Indent.dart b/lib/screens/PurchaseStore/ALL_Filed_Indent.dart new file mode 100644 index 00000000..95f52e28 --- /dev/null +++ b/lib/screens/PurchaseStore/ALL_Filed_Indent.dart @@ -0,0 +1,115 @@ +import 'package:flutter/material.dart'; + +class AllFiledIndent extends StatefulWidget { + @override + _AllFiledIndentPageState createState() => _AllFiledIndentPageState(); +} + +class _AllFiledIndentPageState extends State { + // Define the list of DrawingFileInfo objects + List drawingFiles = [ + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19'), + // Add more DrawingFileInfo objects as needed + ]; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('All Filed Indent'), + backgroundColor: Colors.deepOrangeAccent, + ), + body: ListView.builder( + itemCount: drawingFiles.length, + itemBuilder: (context, index) { + final drawingFile = drawingFiles[index]; + return DrawingFile( + fileId: drawingFile.fileId, + idententItem: drawingFile.idententItem, + date: drawingFile.date, + index: index, + ); + }, + ), + ); + } +} + +class DrawingFile extends StatelessWidget { + final int fileId; + final String idententItem; + final String date; + final int index; + + DrawingFile({ + required this.fileId, + required this.idententItem, + required this.date, + required this.index, + }); + + @override + Widget build(BuildContext context) { + // Determine background color based on index + Color backgroundColor = index.isOdd ? Colors.grey[200]! : Colors.white; + + return Container( + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + padding: EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: backgroundColor, + border: Border.all(width: 1.0, color: Colors.grey), + borderRadius: BorderRadius.circular(8.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'File Id: $fileId', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Identent Item: $idententItem', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Date: $date', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Remarks:', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Row( + children: [ + IconButton(onPressed: (){}, icon: Icon(Icons.edit),color:Colors.black), + IconButton(onPressed: (){}, icon: Icon(Icons.delete),color: Colors.redAccent), + + + + ], + ) + ], + ), + ); + } +} + +class DrawingFileInfo { + final int fileId; + final String idententItem; + final String date; + + DrawingFileInfo({ + required this.fileId, + required this.idententItem, + required this.date, + }); +} + +void main() { + runApp(MaterialApp( + title: 'Saved Indents App', + home: AllFiledIndent(), + )); +} diff --git a/lib/screens/PurchaseStore/Approved_Request.dart b/lib/screens/PurchaseStore/Approved_Request.dart new file mode 100644 index 00000000..0b1e3a2e --- /dev/null +++ b/lib/screens/PurchaseStore/Approved_Request.dart @@ -0,0 +1,196 @@ + + +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class ApprovedRequest extends StatefulWidget { + @override + _ApprovedRequestPageState createState() => _ApprovedRequestPageState(); +} + +class _ApprovedRequestPageState extends State { + List drawingFiles = [ + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan'), + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan'), + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan') + // Add more DrawingFileInfo objects as needed + ]; + BoxDecoration myBoxDecoration() { + return BoxDecoration( + border: Border.all( + color: Colors.deepOrangeAccent, + width: 2.0, + style: BorderStyle.solid, + ), + borderRadius: BorderRadius.all(Radius.circular(15.0)), + ); + } + + Text myText(String text) { + return Text( + text, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), + ); + } + + Padding myContainer(String text) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: myText(text), + ), + decoration: myBoxDecoration(), + ), + ); + } + + @override + Widget build(BuildContext context) { + final data = ''; + return Scaffold( + appBar: AppBar( + title: Text('Approved Request'), // Add your title here + // You can customize other properties of the AppBar as needed + backgroundColor: Colors.deepOrangeAccent, + // Add other properties like actions, leading, etc. if needed + ), + body: ListView.builder( + itemCount: drawingFiles.length, + itemBuilder: (context, index) { + final drawingFile = drawingFiles[index]; + return DrawingFile( + fileId: drawingFile.fileId, + idententItem: drawingFile.idententItem, + date: drawingFile.date, + index: index, + subject:drawingFile.subject, + from: drawingFile.from, + + ); + }, + ), + ); + } +} +class DrawingFile extends StatelessWidget { + final int fileId; + final String idententItem; + final String date; + final int index; + final String subject; + final String from; + + + DrawingFile({ + required this.fileId, + required this.idententItem, + required this.date, + required this.index, + required this.subject, + required this.from + }); + + @override + Widget build(BuildContext context) { + final data=''; + // Determine background color based on index + Color backgroundColor = index.isOdd ? Colors.grey[200]! : Colors.white; + + return Container( + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + padding: EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: backgroundColor, + border: Border.all(width: 1.0, color: Colors.grey), + borderRadius: BorderRadius.circular(8.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '$subject', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'from: $from', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Date: $date', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 8.0), // Adjust the spacing as needed + child: ElevatedButton( + onPressed: () { + Navigator.pushNamed( + context, + '/purchase_store/indent_view', + arguments: data, + ); + print('Details'); + }, + child: Text( + 'Details', + style: TextStyle(color: Colors.white), + ), + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Color(0xFFF36C35)), + ), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0), // Adjust the spacing as needed + child: ElevatedButton( + onPressed: () { + + print('Open form'); + }, + child: Text( + 'Approved', + style: TextStyle(color: Colors.white), + ), + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Colors.green), + ), + ), + ), + ], + ) + + ] +, + ), + ); + } +} + +class DrawingFileInfo { + final int fileId; + final String idententItem; + final String date; + final String subject; + final String from; + + DrawingFileInfo({ + required this.fileId, + required this.idententItem, + required this.date, + this.subject = '', // Provide a default value for subject + this.from = '', // Provide a default value for from + }); +} + +void main() { + runApp(MaterialApp( + title: 'ApprovedRequest', + home: ApprovedRequest(), + )); +} + + diff --git a/lib/screens/PurchaseStore/Audit_Bill.dart b/lib/screens/PurchaseStore/Audit_Bill.dart new file mode 100644 index 00000000..d9f2cc38 --- /dev/null +++ b/lib/screens/PurchaseStore/Audit_Bill.dart @@ -0,0 +1,192 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class AuditBill extends StatefulWidget { + @override + _AuditBillPageState createState() => _AuditBillPageState(); +} + +class _AuditBillPageState extends State { + List drawingFiles = [ + DrawingFileInfo( + fileId: 1, + idententItem: 'Item 1', + date: '2024-02-19', + subject: 'Order for a new Computer', + from: 'Hritik Ranjan', + indentId: '309040567', + price: '30000', + approved: 'Atul Gupta' + ), + // Add more DrawingFileInfo objects as needed + ]; + BoxDecoration myBoxDecoration() { + return BoxDecoration( + border: Border.all( + color: Colors.deepOrangeAccent, + width: 2.0, + style: BorderStyle.solid, + ), + borderRadius: BorderRadius.all(Radius.circular(15.0)), + ); + } + + Text myText(String text) { + return Text( + text, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), + ); + } + + Padding myContainer(String text) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: myText(text), + ), + decoration: myBoxDecoration(), + ), + ); + } + + @override + Widget build(BuildContext context) { + final data = ''; + return Scaffold( + appBar:AppBar( + title: Text('Audit Bill'), // Add your title here + // You can customize other properties of the AppBar as needed + backgroundColor: Colors.deepOrangeAccent, + // Add other properties like actions, leading, etc. if needed + ), + + body: ListView.builder( + itemCount: drawingFiles.length, + itemBuilder: (context, index) { + final drawingFile = drawingFiles[index]; + return DrawingFile( + fileId: drawingFile.fileId, + idententItem: drawingFile.idententItem, + date: drawingFile.date, + index: index, + subject:drawingFile.subject, + from: drawingFile.from, + + ); + }, + ), + ); + } +} +class DrawingFile extends StatelessWidget { + final int fileId; + final String idententItem; + final String date; + final int index; + final String subject; + final String from; + final String indentId; + final String price; + final String approved; + + + DrawingFile({ + required this.fileId, + required this.idententItem, + required this.date, + required this.index, + required this.subject, + required this.from, + this.indentId='', + this.price='', + this.approved='' + + + + }); + + @override + Widget build(BuildContext context) { + final data=''; + // Determine background color based on index + Color backgroundColor = index.isOdd ? Colors.grey[200]! : Colors.white; + + return Container( + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + padding: EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: backgroundColor, + border: Border.all(width: 1.0, color: Colors.grey), + borderRadius: BorderRadius.circular(8.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Indent Id :$indentId', + style: TextStyle(fontWeight: FontWeight.bold), + ), + + Text( + 'Date: $date', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Approved By: $approved', + style: TextStyle(fontWeight: FontWeight.bold), + ), + ElevatedButton( + onPressed: () { + Navigator.pushNamed( + context, + '/purchase_store/indent_view', + arguments: data, + ); + print('Open form'); + }, + child: Text( + 'Open Form', + style: TextStyle(color: Colors.white), + ), + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Color(0xFFF36C35)), + ), + ) + ], + ), + ); + } +} + +class DrawingFileInfo { + final int fileId; + final String idententItem; + final String date; + final String subject; + final String from; + final String indentId; + final String price; + final String approved; + + DrawingFileInfo({ + required this.fileId, + required this.idententItem, + required this.date, + this.subject = '', // Provide a default value for subject + this.from = '', // Provide a default value for from + this.indentId='', + this.price='', + this.approved='' + + }); +} + +void main() { + runApp(MaterialApp( + title: 'AuditBill', + home: AuditBill(), + )); +} diff --git a/lib/screens/PurchaseStore/Global_Stock.dart b/lib/screens/PurchaseStore/Global_Stock.dart new file mode 100644 index 00000000..d56b4f19 --- /dev/null +++ b/lib/screens/PurchaseStore/Global_Stock.dart @@ -0,0 +1,155 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(GlobalStock()); +} + +class GlobalStock extends StatefulWidget { + @override + _GlobalStockState createState() => _GlobalStockState(); +} + +class _GlobalStockState extends State { + int _currentIndex = 0; + PageController _pageController = PageController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Global'), + backgroundColor: Colors.deepOrangeAccent, + ), + body: PageView( + controller: _pageController, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + children: [ + Container( + color: Colors.white, + child: Center( + child: ItemListScreen(), + ), + ), + Container( + color: Colors.white, + child: Center( + child: DownloadButton( + onPressed: () { + // Add your download logic here + print('Downloading...'); + }, + ), + ), + ), + Container( + color: Colors.white, + child: Center( + child: ItemListScreen(), + ), + ), + ], + ), + bottomNavigationBar: BottomNavigationBar( + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + _pageController.animateToPage( + index, + duration: Duration(milliseconds: 300), + curve: Curves.ease, + ); + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + label: 'Stock', + ), + BottomNavigationBarItem( + icon: Icon(Icons.insert_chart), + label: 'Generate Report', + ), + BottomNavigationBarItem( + icon: Icon(Icons.add_shopping_cart), + label: 'Add Stock', + ), + ], + + ), + ); + } +} + +class DownloadButton extends StatelessWidget { + final VoidCallback onPressed; + + const DownloadButton({ + Key? key, + required this.onPressed, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return ElevatedButton.icon( + onPressed: onPressed, + icon: Icon(Icons.download), + label: Text('Download Report'), + ); + } +} + +class ItemListScreen extends StatefulWidget { + @override + _ItemListScreenState createState() => _ItemListScreenState(); +} + +class _ItemListScreenState extends State { + List items = [ + Item(name: 'Computer', count: 5), + Item(name: 'Fan', count: 3), + Item(name: 'Table', count: 7), + Item(name: 'Lights', count: 7), + + ]; + + @override + Widget build(BuildContext context) { + return Scaffold( + + body: ListView.builder( + itemCount: items.length, + itemBuilder: (context, index) { + return ListTile( + title: Text(items[index].name), + subtitle: Text('Count: ${items[index].count}'), + trailing: IconButton( + icon: Icon(Icons.edit), + onPressed: () { + _editItem(index); + }, + ), + ); + }, + ), + ); + } + + void _editItem(int index) { + // Placeholder for edit logic + print('Editing item at index $index'); + } +} + +class Item { + final String name; + final int count; + + Item({required this.name, required this.count}); +} + + diff --git a/lib/screens/PurchaseStore/Indenter_View.dart b/lib/screens/PurchaseStore/Indenter_View.dart new file mode 100644 index 00000000..42fd9a31 --- /dev/null +++ b/lib/screens/PurchaseStore/Indenter_View.dart @@ -0,0 +1,220 @@ + + +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; + + +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'package:image_picker/image_picker.dart'; + +class IndentView extends StatefulWidget { + const IndentView({Key? key}) : super(key: key); + + @override + State< IndentView> createState() => _IndentViewState(); +} + +class _IndentViewState extends State< IndentView> { + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + + TextEditingController nameController = TextEditingController(text:"Shyam"); + TextEditingController designationController = TextEditingController(text:"Professor"); + TextEditingController mobileController = TextEditingController(text:"hello"); + TextEditingController itemNameController = TextEditingController(text:"Furniture"); + TextEditingController quantityController = TextEditingController(text:"10"); + TextEditingController presentStockController = TextEditingController(text:"5"); + TextEditingController estimatedCostController = TextEditingController(text:"15000"); + TextEditingController purchaseJustificationController = TextEditingController(text:"furniture is broken"); + TextEditingController itemTypeController = TextEditingController(text:"furniture"); + TextEditingController replaceDetailsController = TextEditingController(text:"No"); + TextEditingController budgetaryHeadController = TextEditingController(text:""); + TextEditingController expectedDeliveryController = TextEditingController(text:"13-11-2025"); + TextEditingController sourceOfSupplyController = TextEditingController(text:"mahesh"); + TextEditingController forwardToController = TextEditingController(); + TextEditingController receiverDesignationController = TextEditingController(); + TextEditingController remarksController= TextEditingController(); + + _IndentFormState() { + designationController.text = curr_desig; + } + + File? attachment; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrangeAccent, + title: Text( + "Indent Form", + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold, + ), + ), + leading: IconButton( + icon: Icon(Icons.arrow_back), + onPressed: () { + Navigator.pop(context); + }, + ), + ), + body: Padding( + padding: const EdgeInsets.all(20), + child: ListView( + shrinkWrap: true, + children: [ + buildTextField("Name of the indenter", nameController,readOnly: true), + SizedBox(height: 10), + buildTextField("Item Name", itemNameController,readOnly:true), + SizedBox(height: 10), + buildTextField("Designation", designationController,readOnly:true), + SizedBox(height: 10), + SizedBox(height: 10), + + + buildTextField("Quantity", quantityController,readOnly:true), + SizedBox(height: 10), + buildTextField("Present Stock", presentStockController,readOnly:true), + SizedBox(height: 10), + buildTextField("Estimated Cost", estimatedCostController,readOnly:true), + SizedBox(height: 10), + buildTextField("Purchase & Justification", purchaseJustificationController,readOnly:true), + SizedBox(height: 10), + buildTextField("Item Type", itemTypeController,readOnly:true), + SizedBox(height: 10), + buildTextField("If Replace(give details)", replaceDetailsController,readOnly:true), + SizedBox(height: 10), + buildTextField("Budgetary Head", budgetaryHeadController,readOnly:true), + SizedBox(height: 10), + buildTextField("Expected Delivery", expectedDeliveryController,readOnly:true), + SizedBox(height: 10), + buildTextField("Source of Supply", sourceOfSupplyController,readOnly:true), + SizedBox(height: 10), + + ElevatedButton( + onPressed: () { + pickAttachment(); + }, + child: Text( + 'Attached File', + style: TextStyle( + fontSize: 20, + ), + ), + ), + + buildTextField("Remarks",remarksController ), + SizedBox(height: 10), + + buildTextField("Forward To", forwardToController), + SizedBox(height: 10), + buildTextField("Receiver Designation", receiverDesignationController), + SizedBox(height: 10), + ElevatedButton( + onPressed: () { + submitForm(); + }, + child: Text( + 'Submit', + style: TextStyle( + fontSize: 30, + ), + ), + ), + SizedBox(height: 20), + + attachment != null + ? Text( + 'Attachment: ${attachment!.path}', + style: TextStyle(fontSize: 16), + ) + : SizedBox(), + ], + ), + ), + ); + } + + Widget buildTextField(String label, TextEditingController controller, {bool readOnly = false}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + label, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 5), + TextField( + controller: controller, + readOnly: readOnly, // Set readOnly property + decoration: InputDecoration( + border: OutlineInputBorder(), + hintText: '', + ), + ), + ], + ); + } + + + void pickAttachment() async { + final picker = ImagePicker(); + final pickedFile = await picker.pickImage(source: ImageSource.gallery); + + setState(() { + if (pickedFile != null) { + attachment = File(pickedFile.path); + } + }); + } + + void submitForm() async { + var formData = { + 'name': nameController.text, + 'designation': designationController.text, + 'itemName': itemNameController.text, + 'quantity': quantityController.text, + 'presentStock': presentStockController.text, + 'estimatedCost': estimatedCostController.text, + 'purchaseJustification': purchaseJustificationController.text, + 'itemType': itemTypeController.text, + 'replaceDetails': replaceDetailsController.text, + 'budgetaryHead': budgetaryHeadController.text, + 'expectedDelivery': expectedDeliveryController.text, + 'sourceOfSupply': sourceOfSupplyController.text, + 'forwardTo': forwardToController.text, + 'receiverDesignation': receiverDesignationController.text, + }; + + if (attachment != null) { + // formData['attachment'] = await http.MultipartFile.fromPath('attachment', attachment!.path); + } + + var response = await http.post( + Uri.parse('YOUR_API_ENDPOINT_HERE'), + body: formData, + ); + + if (response.statusCode == 200) { + // Form submitted successfully + // Handle success scenario + } else { + // Form submission failed + // Handle error scenario + } + } +} + + diff --git a/lib/screens/PurchaseStore/Process_Bill.dart b/lib/screens/PurchaseStore/Process_Bill.dart new file mode 100644 index 00000000..9504967d --- /dev/null +++ b/lib/screens/PurchaseStore/Process_Bill.dart @@ -0,0 +1,97 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class ProcessBill extends StatefulWidget { + @override + _ProcessBillFormState createState() => _ProcessBillFormState(); +} + +class _ProcessBillFormState extends State { + final _formKey = GlobalKey(); + String _billAmount = ''; + String _department = ''; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Process Bill'), + backgroundColor: Colors.deepOrangeAccent, + ), + + body: Form( + key: _formKey, + child: Padding( + padding: EdgeInsets.all(20.0), + child: Column( + children: [ + TextFormField( + decoration: InputDecoration( + labelText: 'Amount', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + ), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter the bill amount'; + } + return null; + }, + onSaved: (value) => _billAmount = value ?? '', + ), + SizedBox(height: 20), + TextFormField( + decoration: InputDecoration( + labelText: 'Department', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + ), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter the department'; + } + return null; + }, + onSaved: (value) => _department = value ?? '', + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + if (_formKey.currentState != null && + _formKey.currentState!.validate()) { + _formKey.currentState!.save(); + print('Bill Amount: $_billAmount'); + print('Department: $_department'); + } + }, + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Colors.green), + ), + child: Padding( + padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 24.0), + child: Text( + 'Process Bill', + style: TextStyle( + color: Colors.white, + fontSize: 18.0, + ), + ), + ), + ), + ], + ), + ), + ), + ); + } +} + +void main() { + runApp(MaterialApp( + title: 'ProcessBill', + home: ProcessBill(), + )); +} diff --git a/lib/screens/PurchaseStore/Rejected_Request.dart b/lib/screens/PurchaseStore/Rejected_Request.dart new file mode 100644 index 00000000..bf2d0d6f --- /dev/null +++ b/lib/screens/PurchaseStore/Rejected_Request.dart @@ -0,0 +1,196 @@ + + +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class RejectedRequest extends StatefulWidget { + @override + _RejectedRequestPageState createState() => _RejectedRequestPageState(); +} + +class _RejectedRequestPageState extends State { + List drawingFiles = [ + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan'), + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan'), + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan') + // Add more DrawingFileInfo objects as needed + ]; + BoxDecoration myBoxDecoration() { + return BoxDecoration( + border: Border.all( + color: Colors.deepOrangeAccent, + width: 2.0, + style: BorderStyle.solid, + ), + borderRadius: BorderRadius.all(Radius.circular(15.0)), + ); + } + + Text myText(String text) { + return Text( + text, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), + ); + } + + Padding myContainer(String text) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: myText(text), + ), + decoration: myBoxDecoration(), + ), + ); + } + + @override + Widget build(BuildContext context) { + final data = ''; + return Scaffold( + appBar: AppBar( + title: Text('Rejected request'), // Add your title here + // You can customize other properties of the AppBar as needed + backgroundColor: Colors.deepOrangeAccent, + // Add other properties like actions, leading, etc. if needed + ), + body: ListView.builder( + itemCount: drawingFiles.length, + itemBuilder: (context, index) { + final drawingFile = drawingFiles[index]; + return DrawingFile( + fileId: drawingFile.fileId, + idententItem: drawingFile.idententItem, + date: drawingFile.date, + index: index, + subject:drawingFile.subject, + from: drawingFile.from, + + ); + }, + ), + ); + } +} +class DrawingFile extends StatelessWidget { + final int fileId; + final String idententItem; + final String date; + final int index; + final String subject; + final String from; + + + DrawingFile({ + required this.fileId, + required this.idententItem, + required this.date, + required this.index, + required this.subject, + required this.from + }); + + @override + Widget build(BuildContext context) { + final data=''; + // Determine background color based on index + Color backgroundColor = index.isOdd ? Colors.grey[200]! : Colors.white; + + return Container( + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + padding: EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: backgroundColor, + border: Border.all(width: 1.0, color: Colors.grey), + borderRadius: BorderRadius.circular(8.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '$subject', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'from: $from', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Date: $date', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 8.0), // Adjust the spacing as needed + child: ElevatedButton( + onPressed: () { + Navigator.pushNamed( + context, + '/purchase_store/indent_view', + arguments: data, + ); + print('Details'); + }, + child: Text( + 'Details', + style: TextStyle(color: Colors.white), + ), + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Color(0xFFF36C35)), + ), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0), // Adjust the spacing as needed + child: ElevatedButton( + onPressed: () { + // Add your onPressed callback here + print('Rejected'); + }, + child: Text( + 'Rejected', + style: TextStyle(color: Colors.white), + ), + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Colors.red), + ), + ), + ), + ], + ) + + ] + , + ), + ); + } +} + +class DrawingFileInfo { + final int fileId; + final String idententItem; + final String date; + final String subject; + final String from; + + DrawingFileInfo({ + required this.fileId, + required this.idententItem, + required this.date, + this.subject = '', // Provide a default value for subject + this.from = '', // Provide a default value for from + }); +} + +void main() { + runApp(MaterialApp( + title: 'RejectedRequest', + home: RejectedRequest(), + )); +} + + diff --git a/lib/screens/PurchaseStore/Saved_indent.dart b/lib/screens/PurchaseStore/Saved_indent.dart new file mode 100644 index 00000000..cfcb7ae6 --- /dev/null +++ b/lib/screens/PurchaseStore/Saved_indent.dart @@ -0,0 +1,113 @@ +import 'package:flutter/material.dart'; + +class SavedIndent extends StatefulWidget { + @override + _SavedIndentPageState createState() => _SavedIndentPageState(); +} + +class _SavedIndentPageState extends State { + // Define the list of DrawingFileInfo objects + List drawingFiles = [ + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19'), + DrawingFileInfo(fileId: 2, idententItem: 'Item 2', date: '2024-02-18'), + DrawingFileInfo(fileId: 3, idententItem: 'Item 3', date: '2024-02-17'), + // Add more DrawingFileInfo objects as needed + ]; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Saved Indents'), + backgroundColor: Colors.deepOrangeAccent, + ), + body: ListView.builder( + itemCount: drawingFiles.length, + itemBuilder: (context, index) { + final drawingFile = drawingFiles[index]; + return DrawingFile( + fileId: drawingFile.fileId, + idententItem: drawingFile.idententItem, + date: drawingFile.date, + index: index, + ); + }, + ), + ); + } +} + +class DrawingFile extends StatelessWidget { + final int fileId; + final String idententItem; + final String date; + final int index; + + DrawingFile({ + required this.fileId, + required this.idententItem, + required this.date, + required this.index, + }); + + @override + Widget build(BuildContext context) { + // Determine background color based on index + Color backgroundColor = index.isOdd ? Colors.grey[200]! : Colors.white; + + return Container( + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + padding: EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: backgroundColor, + border: Border.all(width: 1.0, color: Colors.grey), + borderRadius: BorderRadius.circular(8.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'File Id: $fileId', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Identent Item: $idententItem', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Date: $date', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Row( + children: [ + IconButton(onPressed: (){}, icon: Icon(Icons.edit),color:Colors.black), + IconButton(onPressed: (){}, icon: Icon(Icons.delete),color: Colors.redAccent), + + + + ], + ) + ], + ), + ); + } +} + +class DrawingFileInfo { + final int fileId; + final String idententItem; + final String date; + + DrawingFileInfo({ + required this.fileId, + required this.idententItem, + required this.date, + }); +} + +void main() { + runApp(MaterialApp( + title: 'Saved Indents App', + home: SavedIndent(), + )); +} diff --git a/lib/screens/PurchaseStore/Transfer_Funds.dart b/lib/screens/PurchaseStore/Transfer_Funds.dart new file mode 100644 index 00000000..35298d1e --- /dev/null +++ b/lib/screens/PurchaseStore/Transfer_Funds.dart @@ -0,0 +1,185 @@ +import 'package:flutter/material.dart'; + +void main() { + runApp(TransferFunds()); +} + + +class TransferFunds extends StatefulWidget { + @override + _TransferFundsState createState() => _TransferFundsState(); +} + +class _TransferFundsState extends State { + int _currentIndex = 0; + PageController _pageController = PageController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrangeAccent, + + title: Text('Transfer Funds'), + + ), + body: PageView( + controller: _pageController, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + children: [ + Container( + color: Colors.white, + child: Center( + child: ProcessBill1(), + ), + ), + Container( + color: Colors.white, + child: Center( + child: DownloadButton( + onPressed: () { + // Add your download logic here + print('Downloading...'); + }, + ), + ), + ), + ], + ), + bottomNavigationBar: BottomNavigationBar( + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + _pageController.animateToPage( + index, + duration: Duration(milliseconds: 300), + curve: Curves.ease, + ); + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.swap_horiz), // Transfer icon + label: 'Transfer', + ), + BottomNavigationBarItem( + icon: Icon(Icons.history), // History icon + label: 'History', + ), + ], + ), + ); + } +} + +class DownloadButton extends StatelessWidget { + final VoidCallback onPressed; + + const DownloadButton({ + Key? key, + required this.onPressed, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return ElevatedButton.icon( + onPressed: onPressed, + icon: Icon(Icons.download), + label: Text('Download Report'), + ); + } +} + +class ProcessBill1 extends StatefulWidget { + @override + _ProcessBill1FormState createState() => _ProcessBill1FormState(); +} + +class _ProcessBill1FormState extends State { + final _formKey = GlobalKey(); + String _billAmount = ''; + String _department = ''; + + @override + Widget build(BuildContext context) { + return Scaffold( + + body: Form( + key: _formKey, + child: Padding( + padding: EdgeInsets.all(20.0), + child: Column( + children: [ + TextFormField( + decoration: InputDecoration( + labelText: 'Amount', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + ), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter the bill amount'; + } + return null; + }, + onSaved: (value) => _billAmount = value ?? '', + ), + SizedBox(height: 20), + TextFormField( + decoration: InputDecoration( + labelText: 'Department', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + ), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter the department'; + } + return null; + }, + onSaved: (value) => _department = value ?? '', + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + if (_formKey.currentState != null && + _formKey.currentState!.validate()) { + _formKey.currentState!.save(); + print('Bill Amount: $_billAmount'); + print('Department: $_department'); + } + }, + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Colors.green), + ), + child: Padding( + padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 24.0), + child: Text( + 'Process Bill', + style: TextStyle( + color: Colors.white, + fontSize: 18.0, + ), + ), + ), + ), + ], + ), + ), + ), + ); + } +} + + + + + + diff --git a/lib/screens/PurchaseStore/admin_homepage.dart b/lib/screens/PurchaseStore/admin_homepage.dart new file mode 100644 index 00000000..43b333ba --- /dev/null +++ b/lib/screens/PurchaseStore/admin_homepage.dart @@ -0,0 +1,373 @@ + +import 'dart:async'; +import 'dart:convert'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; +import 'package:fusion/models/dashboard.dart'; +import 'package:fusion/screens/LoginandDashboard/DashboardComponents/cardItems.dart'; +import 'package:fusion/services/dashboard_service.dart'; +import 'package:http/http.dart'; +import 'package:fusion/services/appBar_services.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; + +class adminHomePage extends StatefulWidget { + static String tag = 'home-page'; + adminHomePage(); + @override + _adminHomePageState createState() => _adminHomePageState(); +} + +class _adminHomePageState extends State< adminHomePage> { + bool _notificationsBool = false; + bool _newsBool = false; + bool _announcementsBool = false; + bool _homeBool = true; + + bool _loading = true; + late String name; + late String studentType; + // Stream Controller for API + late StreamController _dashboardController; + late DashboardService dashboardService; + late DashboardData data; + late StreamController _profileController; + late ProfileService profileService; + late ProfileData data2; + late List designationsArray; + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + bool isStudent = false; + + final appBarServices _appBarServices = appBarServices(); + @override + void initState() { + super.initState(); + _dashboardController = StreamController(); + dashboardService = DashboardService(); + _profileController = StreamController(); + profileService = ProfileService(); + getData(); + } + + getData() async { + try { + print("gfsgsgd"); + Response response = await dashboardService.getDashboard(); + print("1"); + Response response2 = await profileService.getProfile(); + print("2"); + print(response); + print(response2); + + setState(() { + data = DashboardData.fromJson(jsonDecode(response.body)); + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + print(data2.user!); + print( + '-----------------------------------=---------------------------------------'); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; + studentType = data2.profile!['department']!['name']; + + if (data2.profile!['user_type'] == 'student') { + isStudent = true; + } + } catch (e) { + print(e); + } + } + + loadData() async { + getData().then((res) { + _dashboardController.add(res); + _profileController.add(res); + }); + } + + fetchDesignations() async { + try { + designationsArray = await _appBarServices.getDesignations(); + } catch (e) { + print("Error fetching designations: $e"); + return null; + } + } + + final GlobalKey scaffoldKey = new GlobalKey(); + showSnack() { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text('New Content Loaded'), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + curr_desig: curr_desig, + headerTitle: "P & S", + onDesignationChanged: (newValue) { + setState(() { + curr_desig = newValue; + }); + + }, + ), // This is default app bar used in all modules + drawer: SideDrawer(curr_desig: curr_desig), + bottomNavigationBar: MyBottomNavigationBar(), // This is sideDrawer used in all modules + body: Column( + children: [ + Expanded( + child: _loading == true + ? Center(child: CircularProgressIndicator()) + : ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + // Display user information + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 30.0), + color: Colors.white, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 170.0, + height: 190.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/profile_pic.png'), + fit: BoxFit.cover, + ), + ), + ), + SizedBox(height: 10.0), + Text( + name, //Display name of User + style: TextStyle( + fontSize: 20.0, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10.0), + Text( + studentType + " " + curr_desig, // Display Type of User + style: TextStyle( + fontSize: 17.0, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10.0), + ], + ), + ), + + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/stocks', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'View Stock', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/stocks', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Generate Report', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/filed_indent', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Add Stock', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/transfer', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Perform Transfer', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/saved_indent', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Transfer History', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + + // Display Administrative Profile section if not a student and not HOD + + ], + ), + ), + // Place the BottomNavigationBar here + ], + ), + ); + } + + @override + void dispose() { + _dashboardController.close(); + super.dispose(); + } +} \ No newline at end of file diff --git a/lib/screens/PurchaseStore/filed_Indent.dart b/lib/screens/PurchaseStore/filed_Indent.dart new file mode 100644 index 00000000..25de62bc --- /dev/null +++ b/lib/screens/PurchaseStore/filed_Indent.dart @@ -0,0 +1,167 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class FiledIndent extends StatefulWidget { + @override + _FiledIndentPageState createState() => _FiledIndentPageState(); +} + +class _FiledIndentPageState extends State { + List drawingFiles = [ + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19'), + DrawingFileInfo(fileId: 2, idententItem: 'Item 2', date: '2024-02-18'), + DrawingFileInfo(fileId: 3, idententItem: 'Item 3', date: '2024-02-17'), + // Add more DrawingFileInfo objects as needed + ]; + BoxDecoration myBoxDecoration() { + return BoxDecoration( + border: Border.all( + color: Colors.deepOrangeAccent, + width: 2.0, + style: BorderStyle.solid, + ), + borderRadius: BorderRadius.all(Radius.circular(15.0)), + ); + } + + Text myText(String text) { + return Text( + text, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), + ); + } + + Padding myContainer(String text) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: myText(text), + ), + decoration: myBoxDecoration(), + ), + ); + } + + @override + Widget build(BuildContext context) { + final data = ''; + return Scaffold( + appBar: AppBar( + title: Text('Indent Data'), + backgroundColor: Colors.deepOrangeAccent, + ), + body: ListView.builder( + itemCount: drawingFiles.length, + itemBuilder: (context, index) { + final drawingFile = drawingFiles[index]; + return DrawingFile( + fileId: drawingFile.fileId, + idententItem: drawingFile.idententItem, + date: drawingFile.date, + index: index, + ); + }, + ), + ); + } +} +class DrawingFile extends StatelessWidget { + final int fileId; + final String idententItem; + final String date; + final int index; + + DrawingFile({ + required this.fileId, + required this.idententItem, + required this.date, + required this.index, + }); + + @override + Widget build(BuildContext context) { + final data = ''; + + // Determine background color based on index + Color backgroundColor = index.isOdd ? Colors.grey[200]! : Colors.white; + + return Container( + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + padding: EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: backgroundColor, + border: Border.all(width: 1.0, color: Colors.grey), + borderRadius: BorderRadius.circular(8.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'File Id: $fileId', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Identent Item: $idententItem', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Date: $date', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Row( + children: [ + ElevatedButton( + onPressed: () { + // Add your onPressed callback here + Navigator.pushNamed( + context, + '/purchase_store/indent_view', + arguments: data, + ); + }, + child: Text('View'), + ), + SizedBox(width: 80), // Adding horizontal space between buttons + Text( + 'Status', + style: TextStyle(fontWeight: FontWeight.bold), + ), + SizedBox(width: 8), // Adding horizontal space between buttons + ElevatedButton( + onPressed: (){ + + }, + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Colors.orangeAccent), + ), + child: Text('Pending'), + ), + ], + ) + ], + ), + ); + } +} +class DrawingFileInfo { + final int fileId; + final String idententItem; + final String date; + + DrawingFileInfo({ + required this.fileId, + required this.idententItem, + required this.date, + }); +} + +void main() { + runApp(MaterialApp( + title: 'All filed Indent', + home: FiledIndent(), + )); +} + diff --git a/lib/screens/PurchaseStore/flow_chart.dart b/lib/screens/PurchaseStore/flow_chart.dart new file mode 100644 index 00000000..09eb5d32 --- /dev/null +++ b/lib/screens/PurchaseStore/flow_chart.dart @@ -0,0 +1,208 @@ + +import 'dart:async'; +import 'dart:convert'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; +import 'package:fusion/models/dashboard.dart'; +import 'package:fusion/screens/LoginandDashboard/DashboardComponents/cardItems.dart'; +import 'package:fusion/services/dashboard_service.dart'; +import 'package:http/http.dart'; +import 'package:fusion/services/appBar_services.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; + +class FlowChartPage extends StatefulWidget { + static String tag = 'home-page'; + FlowChartPage(); + @override + _FlowChartPageState createState() => _FlowChartPageState(); +} + +class _FlowChartPageState extends State { + bool _notificationsBool = false; + bool _newsBool = false; + bool _announcementsBool = false; + bool _homeBool = true; + + bool _loading = true; + late String name; + late String studentType; + // Stream Controller for API + late StreamController _dashboardController; + late DashboardService dashboardService; + late DashboardData data; + late StreamController _profileController; + late ProfileService profileService; + late ProfileData data2; + late List designationsArray; + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + bool isStudent = false; + + final appBarServices _appBarServices = appBarServices(); + @override + void initState() { + super.initState(); + _dashboardController = StreamController(); + dashboardService = DashboardService(); + _profileController = StreamController(); + profileService = ProfileService(); + getData(); + } + + getData() async { + try { + + Response response = await dashboardService.getDashboard(); + print("1"); + Response response2 = await profileService.getProfile(); + print("2"); + print(response); + print(response2); + + setState(() { + data = DashboardData.fromJson(jsonDecode(response.body)); + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + print(data2.user!); + print( + '-----------------------------------=---------------------------------------'); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; + studentType = data2.profile!['department']!['name']; + + if (data2.profile!['user_type'] == 'student') { + isStudent = true; + } + } catch (e) { + print(e); + } + } + + loadData() async { + getData().then((res) { + _dashboardController.add(res); + _profileController.add(res); + }); + } + + fetchDesignations() async { + try { + designationsArray = await _appBarServices.getDesignations(); + } catch (e) { + print("Error fetching designations: $e"); + return null; + } + } + + final GlobalKey scaffoldKey = new GlobalKey(); + showSnack() { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text('New Content Loaded'), + ), + ); + } + + @override + Widget build(BuildContext context) { + + if (curr_desig == "ps_admin") { + Future.delayed(Duration.zero, () { + Navigator.pushNamed( + context, + '/purchase_store/psadmin', + arguments: data, + ); + }); + } + + + else if (curr_desig.contains('admin')) { + Future.delayed(Duration.zero, () { + Navigator.pushNamed( + context, + '/purchase_store/admin', + arguments: data, + ); + }); + } + + + // Check if the current designation is "professor" and navigate automatically + else if (curr_desig.contains("Professor")) { + Future.delayed(Duration.zero, () { + Navigator.pushNamed( + context, + '/purchase_store/employee', + arguments: data, + ); + }); + } + + // Check if the current designation is "professor" and navigate automatically + + + + // Check if the current designation is "professor" and navigate automatically + else if (curr_desig.contains("HOD") || curr_desig == "Director") { + Future.delayed(Duration.zero, () { + Navigator.pushNamed( + context, + '/purchase_store/head', + arguments: data, + ); + }); + } + + + return Scaffold( + appBar: CustomAppBar( + curr_desig: curr_desig, + headerTitle: "Purchase And Store", + onDesignationChanged: (newValue) { + setState(() { + curr_desig = newValue; + }); + }, + ), // This is default app bar used in all modules + drawer: SideDrawer(curr_desig: curr_desig), + bottomNavigationBar: MyBottomNavigationBar(), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Select Appropriate Designation", + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + Navigator.pushNamed( + context, + '/purchase_store_homepage', + arguments: data, + ); + }, + child: Text("Refresh"), + ), + ], + ), + ), + ); + } + + + + + @override + void dispose() { + _dashboardController.close(); + super.dispose(); + } +} \ No newline at end of file diff --git a/lib/screens/PurchaseStore/head_homepage.dart b/lib/screens/PurchaseStore/head_homepage.dart new file mode 100644 index 00000000..7a776fd0 --- /dev/null +++ b/lib/screens/PurchaseStore/head_homepage.dart @@ -0,0 +1,797 @@ +// import 'package:flutter/material.dart'; +// import 'package:fusion/Components/appBar.dart'; +// import 'package:fusion/Components/side_drawer.dart'; +// +// class headHomePage extends StatefulWidget { +// @override +// headHomePageState createState() => headHomePageState(); +// } +// +// class headHomePageState extends State { +// BoxDecoration myBoxDecoration() { +// return BoxDecoration( +// border: Border.all( +// color: Colors.deepOrangeAccent, +// width: 2.0, +// style: BorderStyle.solid, +// ), +// borderRadius: BorderRadius.all(Radius.circular(15.0)), +// ); +// } +// +// Text myText(String text) { +// return Text( +// text, +// style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), +// ); +// } +// +// Padding myContainer(String text) { +// return Padding( +// padding: const EdgeInsets.all(8.0), +// child: Container( +// child: Padding( +// padding: const EdgeInsets.all(8.0), +// child: myText(text), +// ), +// decoration: myBoxDecoration(), +// ), +// ); +// } +// +// @override +// Widget build(BuildContext context) { +// final data = ''; +// return Scaffold( +// appBar: AppBar( +// title: Text('Head'), +// backgroundColor: Colors.deepOrangeAccent, +// ), +// +// body: ListView( +// shrinkWrap: true, +// physics: ClampingScrollPhysics(), +// children: [ +// Card( +// elevation: 2.0, +// margin: EdgeInsets.symmetric(horizontal: 50.0, vertical: 20.0), +// shadowColor: Colors.black, +// child: Column( +// children: [ +// Container( +// margin: EdgeInsets.only(top: 20.0), +// width: 170.0, +// height: 170.0, +// decoration: BoxDecoration( +// image: DecorationImage( +// image: AssetImage('assets/unknown.jpg'), +// fit: BoxFit.cover, +// ), +// ), +// ), +// SizedBox( +// height: 10.0, +// ), +// Text( +// 'Arihant Jain', +// style: TextStyle(fontSize: 20.0, color: Colors.black), +// ), +// SizedBox( +// height: 10.0, +// ), +// Text( +// 'CSE', +// ), +// SizedBox( +// height: 10.0, +// ), +// ], +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Container( +// child: Padding( +// padding: const EdgeInsets.all(8.0), +// child: Center( +// child: Text( +// "Purchase And Store", +// style: TextStyle( +// fontSize: 20.0, +// color: Colors.white, +// ), +// ), +// ), +// ), +// decoration: BoxDecoration( +// color: Colors.deepOrangeAccent, +// boxShadow: [ +// BoxShadow( +// color: Colors.black, +// offset: Offset(0.0, 1.0), +// blurRadius: 2.0, +// ) +// ], +// borderRadius: BorderRadius.all(Radius.circular(5.0)), +// ), +// ), +// ), +// Card( +// elevation: 2.0, +// margin: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), +// shadowColor: Colors.black, +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.stretch, +// children: [ +// InkWell( +// child: myContainer("New Request"), +// onTap: () { +// Navigator.pushNamed( +// context, +// '/purchase_store/new_request', +// arguments: data, +// ); +// }, +// ), +// InkWell( +// child: myContainer("Pending"), +// onTap: () { +// Navigator.pushNamed( +// context, +// '/purchase_store/pending', +// arguments: data, +// ); +// }, +// ), +// InkWell( +// child: myContainer("Approved Request"), +// onTap: () { +// Navigator.pushNamed( +// context, +// '/purchase_store/approved', +// arguments: data, +// ); +// }, +// ), +// InkWell( +// child: myContainer("Rejected Request"), +// onTap: () { +// Navigator.pushNamed( +// context, +// '/purchase_store/rejected', +// arguments: data, +// ); +// }, +// ), +// ], +// ), +// ), +// ], +// ), +// ); +// } +// } + + + +// import 'package:flutter/material.dart'; +// import 'package:fusion/Components/appBar.dart'; +// import 'package:fusion/Components/side_drawer.dart'; +// +// class adminHomePage extends StatefulWidget { +// @override +// adminHomePageState createState() => adminHomePageState(); +// } +// +// class adminHomePageState extends State { +// BoxDecoration myBoxDecoration() { +// return BoxDecoration( +// border: Border.all( +// color: Colors.deepOrangeAccent, +// width: 2.0, +// style: BorderStyle.solid, +// ), +// borderRadius: BorderRadius.all(Radius.circular(15.0)), +// ); +// } +// +// Text myText(String text) { +// return Text( +// text, +// style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), +// ); +// } +// +// Padding myContainer(String text) { +// return Padding( +// padding: const EdgeInsets.all(8.0), +// child: Container( +// child: Padding( +// padding: const EdgeInsets.all(8.0), +// child: myText(text), +// ), +// decoration: myBoxDecoration(), +// ), +// ); +// } +// +// @override +// Widget build(BuildContext context) { +// final data = ''; +// return Scaffold( +// appBar: DefaultAppBar().buildAppBar(), +// drawer: SideDrawer(), +// body: ListView( +// shrinkWrap: true, +// physics: ClampingScrollPhysics(), +// children: [ +// Card( +// elevation: 2.0, +// margin: EdgeInsets.symmetric(horizontal: 50.0, vertical: 20.0), +// shadowColor: Colors.black, +// child: Column( +// children: [ +// Container( +// margin: EdgeInsets.only(top: 20.0), +// width: 170.0, +// height: 170.0, +// decoration: BoxDecoration( +// image: DecorationImage( +// image: AssetImage('assets/unknown.jpg'), +// fit: BoxFit.cover, +// ), +// ), +// ), +// SizedBox( +// height: 10.0, +// ), +// Text( +// 'Arihant Jain', +// style: TextStyle(fontSize: 20.0, color: Colors.black), +// ), +// SizedBox( +// height: 10.0, +// ), +// Text( +// 'CSE', +// ), +// SizedBox( +// height: 10.0, +// ), +// ], +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Container( +// child: Padding( +// padding: const EdgeInsets.all(8.0), +// child: Center( +// child: Text( +// "Account Admin", +// style: TextStyle( +// fontSize: 20.0, +// color: Colors.white, +// ), +// ), +// ), +// ), +// decoration: BoxDecoration( +// color: Colors.deepOrangeAccent, +// boxShadow: [ +// BoxShadow( +// color: Colors.black, +// offset: Offset(0.0, 1.0), +// blurRadius: 2.0, +// ) +// ], +// borderRadius: BorderRadius.all(Radius.circular(5.0)), +// ), +// ), +// ), +// Card( +// elevation: 2.0, +// margin: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), +// shadowColor: Colors.black, +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.stretch, +// children: [ +// InkWell( +// child: myContainer("Audit"), +// onTap: () { +// Navigator.pushNamed( +// context, +// '/purchase_store/audit', +// arguments: data, +// ); +// }, +// ), +// InkWell( +// child: myContainer("Process Bill"), +// onTap: () { +// Navigator.pushNamed( +// context, +// '/purchase_store/process_bill', +// arguments: data, +// ); +// }, +// ), +// +// ], +// ), +// ), +// ], +// ), +// ); +// } +// } +// +// +// // import 'package:flutter/material.dart'; +// // import 'package:fusion/Components/appBar2.dart'; +// // import 'package:fusion/Components/side_drawer2.dart'; +// // import 'package:fusion/services/service_locator.dart'; +// // import 'package:fusion/services/storage_service.dart'; +// // import 'package:fusion/Components/bottom_navigation_bar.dart'; +// // +// // +// // class PurchaseStoreHomePage extends StatefulWidget { +// // @override +// // _PurchaseStoreHomePageState createState() => _PurchaseStoreHomePageState(); +// // } +// // +// // class _PurchaseStoreHomePageState extends State { +// // var service = locator(); +// // late String curr_desig = service.getFromDisk("Current_designation"); +// // +// // BoxDecoration myBoxDecoration() { +// // return BoxDecoration( +// // border: Border.all( +// // color: Colors.deepOrangeAccent, +// // width: 2.0, +// // style: BorderStyle.solid, +// // ), +// // borderRadius: BorderRadius.all(Radius.circular(15.0)), +// // ); +// // } +// // +// // Text myText(String text) { +// // return Text( +// // text, +// // style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), +// // ); +// // } +// // +// // Padding myContainer(String text) { +// // return Padding( +// // padding: const EdgeInsets.all(8.0), +// // child: Container( +// // child: Padding( +// // padding: const EdgeInsets.all(8.0), +// // child: myText(text), +// // ), +// // decoration: myBoxDecoration(), +// // ), +// // ); +// // } +// // +// // @override +// // Widget build(BuildContext context) { +// // final data = ''; +// // return Scaffold( +// // appBar: CustomAppBar( +// // curr_desig: curr_desig, +// // headerTitle: "Purchase And Store", +// // onDesignationChanged: (newValue) { +// // setState(() { +// // curr_desig = newValue; +// // }); +// // +// // }, +// // ), // This is default app bar used in all modules +// // drawer: SideDrawer(curr_desig: curr_desig), +// // bottomNavigationBar: +// // MyBottomNavigationBar(), +// // +// // body: ListView( +// // shrinkWrap: true, +// // physics: ClampingScrollPhysics(), +// // children: [ +// // +// // +// // Card( +// // elevation: 2.0, +// // margin: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), +// // shadowColor: Colors.black, +// // child: Column( +// // crossAxisAlignment: CrossAxisAlignment.stretch, +// // children: [ +// // +// // +// // InkWell( +// // child: myContainer("Indent Form"), +// // onTap: () { +// // Navigator.pushNamed( +// // context, +// // '/purchase_store/indent_form', +// // arguments: data, +// // ); +// // }, +// // ), +// // InkWell( +// // child: myContainer("Inbox"), +// // onTap: () { +// // Navigator.pushNamed( +// // context, +// // '/purchase_store/inbox', +// // arguments: data, +// // ); +// // }, +// // ), +// // InkWell( +// // child: myContainer("Saved Indent"), +// // onTap: () { +// // Navigator.pushNamed( +// // context, +// // '/purchase_store/saved_indent', +// // arguments: data, +// // ); +// // }, +// // ), +// // InkWell( +// // child: myContainer("Filed Indent"), +// // onTap: () { +// // Navigator.pushNamed( +// // context, +// // '/purchase_store/filed_indent', +// // arguments: data, +// // ); +// // }, +// // ), +// // ], +// // ), +// // ), +// // ], +// // ), +// // ); +// // } +// // } + + +import 'dart:async'; +import 'dart:convert'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; +import 'package:fusion/models/dashboard.dart'; +import 'package:fusion/screens/LoginandDashboard/DashboardComponents/cardItems.dart'; +import 'package:fusion/services/dashboard_service.dart'; +import 'package:http/http.dart'; +import 'package:fusion/services/appBar_services.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; + +class headHomePage extends StatefulWidget { + static String tag = 'home-page'; + headHomePage(); + @override + _headHomePageState createState() => _headHomePageState(); +} + +class _headHomePageState extends State { + bool _notificationsBool = false; + bool _newsBool = false; + bool _announcementsBool = false; + bool _homeBool = true; + + bool _loading = true; + late String name; + late String studentType; + // Stream Controller for API + late StreamController _dashboardController; + late DashboardService dashboardService; + late DashboardData data; + late StreamController _profileController; + late ProfileService profileService; + late ProfileData data2; + late List designationsArray; + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + bool isStudent = false; + + final appBarServices _appBarServices = appBarServices(); + @override + void initState() { + super.initState(); + _dashboardController = StreamController(); + dashboardService = DashboardService(); + _profileController = StreamController(); + profileService = ProfileService(); + getData(); + } + + getData() async { + try { + print("gfsgsgd"); + Response response = await dashboardService.getDashboard(); + print("1"); + Response response2 = await profileService.getProfile(); + print("2"); + print(response); + print(response2); + + setState(() { + data = DashboardData.fromJson(jsonDecode(response.body)); + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + print(data2.user!); + print( + '-----------------------------------=---------------------------------------'); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; + studentType = data2.profile!['department']!['name']; + + if (data2.profile!['user_type'] == 'student') { + isStudent = true; + } + } catch (e) { + print(e); + } + } + + loadData() async { + getData().then((res) { + _dashboardController.add(res); + _profileController.add(res); + }); + } + + fetchDesignations() async { + try { + designationsArray = await _appBarServices.getDesignations(); + } catch (e) { + print("Error fetching designations: $e"); + return null; + } + } + + final GlobalKey scaffoldKey = new GlobalKey(); + showSnack() { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text('New Content Loaded'), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + curr_desig: curr_desig, + headerTitle: "P & S", + onDesignationChanged: (newValue) { + setState(() { + curr_desig = newValue; + }); + + }, + ), // This is default app bar used in all modules + drawer: SideDrawer(curr_desig: curr_desig), + bottomNavigationBar: MyBottomNavigationBar(), // This is sideDrawer used in all modules + body: Column( + children: [ + Expanded( + child: _loading == true + ? Center(child: CircularProgressIndicator()) + : ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + // Display user information + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 30.0), + color: Colors.white, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 170.0, + height: 190.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/profile_pic.png'), + fit: BoxFit.cover, + ), + ), + ), + SizedBox(height: 10.0), + Text( + name, //Display name of User + style: TextStyle( + fontSize: 20.0, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10.0), + Text( + studentType + " " + curr_desig, // Display Type of User + style: TextStyle( + fontSize: 17.0, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10.0), + ], + ), + ), + + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/new_request', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'New Request', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/approved', + arguments: data, + );; + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Approved Request', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/pending', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Pending', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/rejected', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Rejected Request', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + + + // Display Administrative Profile section if not a student and not HOD + + ], + ), + ), + // Place the BottomNavigationBar here + ], + ), + ); + } + + @override + void dispose() { + _dashboardController.close(); + super.dispose(); + } +} diff --git a/lib/screens/PurchaseStore/inbox.dart b/lib/screens/PurchaseStore/inbox.dart new file mode 100644 index 00000000..a660fe6c --- /dev/null +++ b/lib/screens/PurchaseStore/inbox.dart @@ -0,0 +1,150 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class Inbox extends StatefulWidget { + @override + _InboxPageState createState() => _InboxPageState(); +} + +class _InboxPageState extends State { + + List drawingFiles = [ + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19'), + DrawingFileInfo(fileId: 2, idententItem: 'Item 2', date: '2024-02-18'), + DrawingFileInfo(fileId: 3, idententItem: 'Item 3', date: '2024-02-17'), + // Add more DrawingFileInfo objects as needed + ]; + BoxDecoration myBoxDecoration() { + return BoxDecoration( + border: Border.all( + color: Colors.deepOrangeAccent, + width: 2.0, + style: BorderStyle.solid, + ), + borderRadius: BorderRadius.all(Radius.circular(15.0)), + ); + } + + Text myText(String text) { + return Text( + text, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), + ); + } + + Padding myContainer(String text) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: myText(text), + ), + decoration: myBoxDecoration(), + ), + ); + } + + @override + Widget build(BuildContext context) { + final data = ''; + return Scaffold( + appBar: AppBar( + title: Text('Inbox'), + backgroundColor: Colors.deepOrangeAccent, + ), + body: ListView.builder( + itemCount: drawingFiles.length, + itemBuilder: (context, index) { + final drawingFile = drawingFiles[index]; + return DrawingFile( + fileId: drawingFile.fileId, + idententItem: drawingFile.idententItem, + date: drawingFile.date, + index: index, + ); + }, + ), + ); + } +} + + +class DrawingFile extends StatelessWidget { + final int fileId; + final String idententItem; + final String date; + final int index; + + DrawingFile({ + required this.fileId, + required this.idententItem, + required this.date, + required this.index, + }); + + @override + Widget build(BuildContext context) { + final data=""; + // Determine background color based on index + Color backgroundColor = index.isOdd ? Colors.grey[200]! : Colors.white; + + return Container( + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + padding: EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: backgroundColor, + border: Border.all(width: 1.0, color: Colors.grey), + borderRadius: BorderRadius.circular(8.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'File Id: $fileId', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Identent Item: $idententItem', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Date: $date', + style: TextStyle(fontWeight: FontWeight.bold), + ), + ElevatedButton( + onPressed: () { + // Add your onPressed callback here + Navigator.pushNamed( + context, + '/purchase_store/indent_view', + arguments: data, + ); + }, + child: Text('View'), + ), + ], + ), + ); + } +} + +class DrawingFileInfo { + final int fileId; + final String idententItem; + final String date; + + DrawingFileInfo({ + required this.fileId, + required this.idententItem, + required this.date, + }); +} + +void main() { + runApp(MaterialApp( + title: ' Inbox App', + home: Inbox(), + )); +} diff --git a/lib/screens/PurchaseStore/indent_form.dart b/lib/screens/PurchaseStore/indent_form.dart new file mode 100644 index 00000000..d57ab17a --- /dev/null +++ b/lib/screens/PurchaseStore/indent_form.dart @@ -0,0 +1,225 @@ +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; + + +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'package:image_picker/image_picker.dart'; + +class IndentForm extends StatefulWidget { + const IndentForm({Key? key}) : super(key: key); + + @override + State createState() => _IndentFormState(); +} + +class _IndentFormState extends State { + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + + TextEditingController nameController = TextEditingController(); + TextEditingController designationController = TextEditingController(); + TextEditingController mobileController = TextEditingController(); + TextEditingController itemNameController = TextEditingController(); + TextEditingController quantityController = TextEditingController(); + TextEditingController presentStockController = TextEditingController(); + TextEditingController estimatedCostController = TextEditingController(); + TextEditingController purchaseJustificationController = TextEditingController(); + TextEditingController itemTypeController = TextEditingController(); + TextEditingController replaceDetailsController = TextEditingController(); + TextEditingController budgetaryHeadController = TextEditingController(); + TextEditingController expectedDeliveryController = TextEditingController(); + TextEditingController sourceOfSupplyController = TextEditingController(); + TextEditingController forwardToController = TextEditingController(); + TextEditingController receiverDesignationController = TextEditingController(); + _IndentFormState() { + designationController.text = curr_desig; + } + + File? attachment; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrangeAccent, + title: Text( + "Indent Form", + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold, + ), + ), + leading: IconButton( + icon: Icon(Icons.arrow_back), + onPressed: () { + Navigator.pop(context); + }, + ), + ), + body: Padding( + padding: const EdgeInsets.all(20), + child: ListView( + shrinkWrap: true, + children: [ + buildTextField("Name of the indenter", nameController), + SizedBox(height: 10), + buildTextField("Item Name", itemNameController), + SizedBox(height: 10), + TextField( + controller: designationController, + enabled: false, // Disable editing + decoration: InputDecoration( + border: OutlineInputBorder(), + hintText: curr_desig, + ), + ), + SizedBox(height: 10), + + + buildTextField("Quantity", quantityController), + SizedBox(height: 10), + buildTextField("Present Stock", presentStockController), + SizedBox(height: 10), + buildTextField("Estimated Cost", estimatedCostController), + SizedBox(height: 10), + buildTextField("Purchase & Justification", purchaseJustificationController), + SizedBox(height: 10), + buildTextField("Item Type", itemTypeController), + SizedBox(height: 10), + buildTextField("If Replace(give details)", replaceDetailsController), + SizedBox(height: 10), + buildTextField("Budgetary Head", budgetaryHeadController), + SizedBox(height: 10), + buildTextField("Expected Delivery", expectedDeliveryController), + SizedBox(height: 10), + buildTextField("Source of Supply", sourceOfSupplyController), + SizedBox(height: 10), + ElevatedButton( + onPressed: () { + pickAttachment(); + }, + child: Text( + 'Attach File', + style: TextStyle( + fontSize: 20, + ), + ), + ), + ElevatedButton( + onPressed: () { + submitForm(); + }, + child: Text( + 'Submit', + style: TextStyle( + fontSize: 30, + ), + ), + ), + buildTextField("Forward To", forwardToController), + SizedBox(height: 10), + buildTextField("Receiver Designation", receiverDesignationController), + SizedBox(height: 10), + ElevatedButton( + onPressed: () { + submitForm(); + }, + child: Text( + 'Submit', + style: TextStyle( + fontSize: 30, + ), + ), + ), + SizedBox(height: 20), + + attachment != null + ? Text( + 'Attachment: ${attachment!.path}', + style: TextStyle(fontSize: 16), + ) + : SizedBox(), + ], + ), + ), + ); + } + + Widget buildTextField(String label, TextEditingController controller) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + label, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 5), + TextField( + controller: controller, + decoration: InputDecoration( + border: OutlineInputBorder(), + hintText: '', + ), + ), + ], + ); + } + + void pickAttachment() async { + final picker = ImagePicker(); + final pickedFile = await picker.pickImage(source: ImageSource.gallery); + + setState(() { + if (pickedFile != null) { + attachment = File(pickedFile.path); + } + }); + } + + void submitForm() async { + var formData = { + 'name': nameController.text, + 'designation': designationController.text, + 'itemName': itemNameController.text, + 'quantity': quantityController.text, + 'presentStock': presentStockController.text, + 'estimatedCost': estimatedCostController.text, + 'purchaseJustification': purchaseJustificationController.text, + 'itemType': itemTypeController.text, + 'replaceDetails': replaceDetailsController.text, + 'budgetaryHead': budgetaryHeadController.text, + 'expectedDelivery': expectedDeliveryController.text, + 'sourceOfSupply': sourceOfSupplyController.text, + 'forwardTo': forwardToController.text, + 'receiverDesignation': receiverDesignationController.text, + }; + + if (attachment != null) { + // formData['attachment'] = await http.MultipartFile.fromPath('attachment', attachment!.path); + } + + var response = await http.post( + Uri.parse('YOUR_API_ENDPOINT_HERE'), + body: formData, + ); + + if (response.statusCode == 200) { + // Form submitted successfully + // Handle success scenario + } else { + // Form submission failed + // Handle error scenario + } + } +} + diff --git a/lib/screens/PurchaseStore/new_request.dart b/lib/screens/PurchaseStore/new_request.dart new file mode 100644 index 00000000..902a6813 --- /dev/null +++ b/lib/screens/PurchaseStore/new_request.dart @@ -0,0 +1,168 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class NewRequest extends StatefulWidget { + @override + _NewRequestPageState createState() => _NewRequestPageState(); +} + +class _NewRequestPageState extends State { + List drawingFiles = [ + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan'), + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan'), + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan') + // Add more DrawingFileInfo objects as needed + ]; + BoxDecoration myBoxDecoration() { + return BoxDecoration( + border: Border.all( + color: Colors.deepOrangeAccent, + width: 2.0, + style: BorderStyle.solid, + ), + borderRadius: BorderRadius.all(Radius.circular(15.0)), + ); + } + + Text myText(String text) { + return Text( + text, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), + ); + } + + Padding myContainer(String text) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: myText(text), + ), + decoration: myBoxDecoration(), + ), + ); + } + + @override + Widget build(BuildContext context) { + final data = ''; + return Scaffold( + appBar:AppBar( + title: Text('New Request'), // Add your title here + // You can customize other properties of the AppBar as needed + backgroundColor: Colors.deepOrangeAccent, + // Add other properties like actions, leading, etc. if needed + ), + + body: ListView.builder( + itemCount: drawingFiles.length, + itemBuilder: (context, index) { + final drawingFile = drawingFiles[index]; + return DrawingFile( + fileId: drawingFile.fileId, + idententItem: drawingFile.idententItem, + date: drawingFile.date, + index: index, + subject:drawingFile.subject, + from: drawingFile.from, + + ); + }, + ), + ); + } +} +class DrawingFile extends StatelessWidget { + final int fileId; + final String idententItem; + final String date; + final int index; + final String subject; + final String from; + + + DrawingFile({ + required this.fileId, + required this.idententItem, + required this.date, + required this.index, + required this.subject, + required this.from + }); + + @override + Widget build(BuildContext context) { + final data=''; + // Determine background color based on index + Color backgroundColor = index.isOdd ? Colors.grey[200]! : Colors.white; + + return Container( + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + padding: EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: backgroundColor, + border: Border.all(width: 1.0, color: Colors.grey), + borderRadius: BorderRadius.circular(8.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '$subject', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'from: $from', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Date: $date', + style: TextStyle(fontWeight: FontWeight.bold), + ), + ElevatedButton( + onPressed: () { + Navigator.pushNamed( + context, + '/purchase_store/indent_view', + arguments: data, + ); + print('Open form'); + }, + child: Text( + 'Open Form', + style: TextStyle(color: Colors.white), + ), + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Color(0xFFF36C35)), + ), + ) + ], + ), + ); + } +} + +class DrawingFileInfo { + final int fileId; + final String idententItem; + final String date; + final String subject; + final String from; + + DrawingFileInfo({ + required this.fileId, + required this.idententItem, + required this.date, + this.subject = '', // Provide a default value for subject + this.from = '', // Provide a default value for from + }); +} + +void main() { + runApp(MaterialApp( + title: 'NewRequest', + home: NewRequest(), + )); +} diff --git a/lib/screens/PurchaseStore/pending.dart b/lib/screens/PurchaseStore/pending.dart new file mode 100644 index 00000000..c418691d --- /dev/null +++ b/lib/screens/PurchaseStore/pending.dart @@ -0,0 +1,169 @@ +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class Pending extends StatefulWidget { + @override + _PendingPageState createState() => _PendingPageState(); +} + +class _PendingPageState extends State { + List drawingFiles = [ + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan'), + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan'), + DrawingFileInfo(fileId: 1, idententItem: 'Item 1', date: '2024-02-19',subject :'Order for a new Computer',from:'Hritik Ranjan') + // Add more DrawingFileInfo objects as needed + ]; + BoxDecoration myBoxDecoration() { + return BoxDecoration( + border: Border.all( + color: Colors.deepOrangeAccent, + width: 2.0, + style: BorderStyle.solid, + ), + borderRadius: BorderRadius.all(Radius.circular(15.0)), + ); + } + + Text myText(String text) { + return Text( + text, + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), + ); + } + + Padding myContainer(String text) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: myText(text), + ), + decoration: myBoxDecoration(), + ), + ); + } + + @override + Widget build(BuildContext context) { + final data = ''; + return Scaffold( + appBar: AppBar( + title: Text('Pending Request'), // Add your title here + // You can customize other properties of the AppBar as needed + backgroundColor: Colors.deepOrangeAccent, + // Add other properties like actions, leading, etc. if needed + ), + + body: ListView.builder( + itemCount: drawingFiles.length, + itemBuilder: (context, index) { + final drawingFile = drawingFiles[index]; + return DrawingFile( + fileId: drawingFile.fileId, + idententItem: drawingFile.idententItem, + date: drawingFile.date, + index: index, + subject:drawingFile.subject, + from: drawingFile.from, + + ); + }, + ), + ); + } +} +class DrawingFile extends StatelessWidget { + final int fileId; + final String idententItem; + final String date; + final int index; + final String subject; + final String from; + + + DrawingFile({ + required this.fileId, + required this.idententItem, + required this.date, + required this.index, + required this.subject, + required this.from + }); + + @override + Widget build(BuildContext context) { + final data=''; + // Determine background color based on index + Color backgroundColor = index.isOdd ? Colors.grey[200]! : Colors.white; + + return Container( + margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + padding: EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: backgroundColor, + border: Border.all(width: 1.0, color: Colors.grey), + borderRadius: BorderRadius.circular(8.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '$subject', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'from: $from', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Text( + 'Date: $date', + style: TextStyle(fontWeight: FontWeight.bold), + ), + ElevatedButton( + onPressed: () { + Navigator.pushNamed( + context, + '/purchase_store/indent_view', + arguments: data, + ); + print('Open form'); + }, + child: Text( + 'Open Form', + style: TextStyle(color: Colors.white), + ), + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Color(0xFFF36C35)), + ), + ) + ], + ), + ); + } +} + +class DrawingFileInfo { + final int fileId; + final String idententItem; + final String date; + final String subject; + final String from; + + DrawingFileInfo({ + required this.fileId, + required this.idententItem, + required this.date, + this.subject = '', // Provide a default value for subject + this.from = '', // Provide a default value for from + }); +} + +void main() { + runApp(MaterialApp( + title: 'Pending', + home: Pending(), + )); +} + diff --git a/lib/screens/PurchaseStore/ps_admin.dart b/lib/screens/PurchaseStore/ps_admin.dart new file mode 100644 index 00000000..e8d5589f --- /dev/null +++ b/lib/screens/PurchaseStore/ps_admin.dart @@ -0,0 +1,374 @@ + + +import 'dart:async'; +import 'dart:convert'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; +import 'package:fusion/models/dashboard.dart'; +import 'package:fusion/screens/LoginandDashboard/DashboardComponents/cardItems.dart'; +import 'package:fusion/services/dashboard_service.dart'; +import 'package:http/http.dart'; +import 'package:fusion/services/appBar_services.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; + +class psadminPage extends StatefulWidget { + static String tag = 'home-page'; + psadminPage(); + @override + _psadminPageState createState() => _psadminPageState(); +} + +class _psadminPageState extends State< psadminPage> { + bool _notificationsBool = false; + bool _newsBool = false; + bool _announcementsBool = false; + bool _homeBool = true; + + bool _loading = true; + late String name; + late String studentType; + // Stream Controller for API + late StreamController _dashboardController; + late DashboardService dashboardService; + late DashboardData data; + late StreamController _profileController; + late ProfileService profileService; + late ProfileData data2; + late List designationsArray; + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + bool isStudent = false; + + final appBarServices _appBarServices = appBarServices(); + @override + void initState() { + super.initState(); + _dashboardController = StreamController(); + dashboardService = DashboardService(); + _profileController = StreamController(); + profileService = ProfileService(); + getData(); + } + + getData() async { + try { + print("gfsgsgd"); + Response response = await dashboardService.getDashboard(); + print("1"); + Response response2 = await profileService.getProfile(); + print("2"); + print(response); + print(response2); + + setState(() { + data = DashboardData.fromJson(jsonDecode(response.body)); + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + print(data2.user!); + print( + '-----------------------------------=---------------------------------------'); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; + studentType = data2.profile!['department']!['name']; + + if (data2.profile!['user_type'] == 'student') { + isStudent = true; + } + } catch (e) { + print(e); + } + } + + loadData() async { + getData().then((res) { + _dashboardController.add(res); + _profileController.add(res); + }); + } + + fetchDesignations() async { + try { + designationsArray = await _appBarServices.getDesignations(); + } catch (e) { + print("Error fetching designations: $e"); + return null; + } + } + + final GlobalKey scaffoldKey = new GlobalKey(); + showSnack() { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text('New Content Loaded'), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + curr_desig: curr_desig, + headerTitle: "P & S", + onDesignationChanged: (newValue) { + setState(() { + curr_desig = newValue; + }); + + }, + ), // This is default app bar used in all modules + drawer: SideDrawer(curr_desig: curr_desig), + bottomNavigationBar: MyBottomNavigationBar(), // This is sideDrawer used in all modules + body: Column( + children: [ + Expanded( + child: _loading == true + ? Center(child: CircularProgressIndicator()) + : ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + // Display user information + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 30.0), + color: Colors.white, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 170.0, + height: 190.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/profile_pic.png'), + fit: BoxFit.cover, + ), + ), + ), + SizedBox(height: 10.0), + Text( + name, //Display name of User + style: TextStyle( + fontSize: 20.0, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10.0), + Text( + studentType + " " + curr_desig, // Display Type of User + style: TextStyle( + fontSize: 17.0, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10.0), + ], + ), + ), + + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/stock', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'View Stock', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/stock', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Generate Report', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/filed_indent', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Add Stock', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/transfer', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Perform Transfer', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/saved_indent', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Transfer History', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + + // Display Administrative Profile section if not a student and not HOD + + ], + ), + ), + // Place the BottomNavigationBar here + ], + ), + ); + } + + @override + void dispose() { + _dashboardController.close(); + super.dispose(); + } +} \ No newline at end of file diff --git a/lib/screens/PurchaseStore/purchase_store_homepage.dart b/lib/screens/PurchaseStore/purchase_store_homepage.dart new file mode 100644 index 00000000..2268c13a --- /dev/null +++ b/lib/screens/PurchaseStore/purchase_store_homepage.dart @@ -0,0 +1,467 @@ +// import 'package:flutter/material.dart'; +// import 'package:fusion/Components/appBar2.dart'; +// import 'package:fusion/Components/side_drawer2.dart'; +// import 'package:fusion/services/service_locator.dart'; +// import 'package:fusion/services/storage_service.dart'; +// import 'package:fusion/Components/bottom_navigation_bar.dart'; +// +// +// class PurchaseStoreHomePage extends StatefulWidget { +// @override +// _PurchaseStoreHomePageState createState() => _PurchaseStoreHomePageState(); +// } +// +// class _PurchaseStoreHomePageState extends State { +// var service = locator(); +// late String curr_desig = service.getFromDisk("Current_designation"); +// +// BoxDecoration myBoxDecoration() { +// return BoxDecoration( +// border: Border.all( +// color: Colors.deepOrangeAccent, +// width: 2.0, +// style: BorderStyle.solid, +// ), +// borderRadius: BorderRadius.all(Radius.circular(15.0)), +// ); +// } +// +// Text myText(String text) { +// return Text( +// text, +// style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), +// ); +// } +// +// Padding myContainer(String text) { +// return Padding( +// padding: const EdgeInsets.all(8.0), +// child: Container( +// child: Padding( +// padding: const EdgeInsets.all(8.0), +// child: myText(text), +// ), +// decoration: myBoxDecoration(), +// ), +// ); +// } +// +// @override +// Widget build(BuildContext context) { +// final data = ''; +// return Scaffold( +// appBar: CustomAppBar( +// curr_desig: curr_desig, +// headerTitle: "Purchase And Store", +// onDesignationChanged: (newValue) { +// setState(() { +// curr_desig = newValue; +// }); +// +// }, +// ), // This is default app bar used in all modules +// drawer: SideDrawer(curr_desig: curr_desig), +// bottomNavigationBar: +// MyBottomNavigationBar(), +// +// body: ListView( +// shrinkWrap: true, +// physics: ClampingScrollPhysics(), +// children: [ +// +// +// Card( +// elevation: 2.0, +// margin: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), +// shadowColor: Colors.black, +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.stretch, +// children: [ +// +// +// InkWell( +// child: myContainer("Indent Form"), +// onTap: () { +// Navigator.pushNamed( +// context, +// '/purchase_store/indent_form', +// arguments: data, +// ); +// }, +// ), +// InkWell( +// child: myContainer("Inbox"), +// onTap: () { +// Navigator.pushNamed( +// context, +// '/purchase_store/inbox', +// arguments: data, +// ); +// }, +// ), +// InkWell( +// child: myContainer("Saved Indent"), +// onTap: () { +// Navigator.pushNamed( +// context, +// '/purchase_store/saved_indent', +// arguments: data, +// ); +// }, +// ), +// InkWell( +// child: myContainer("Filed Indent"), +// onTap: () { +// Navigator.pushNamed( +// context, +// '/purchase_store/filed_indent', +// arguments: data, +// ); +// }, +// ), +// ], +// ), +// ), +// ], +// ), +// ); +// } +// } + + +import 'dart:async'; +import 'dart:convert'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar2.dart'; +import 'package:fusion/Components/side_drawer2.dart'; +import 'package:fusion/models/dashboard.dart'; +import 'package:fusion/screens/LoginandDashboard/DashboardComponents/cardItems.dart'; +import 'package:fusion/services/dashboard_service.dart'; +import 'package:http/http.dart'; +import 'package:fusion/services/appBar_services.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/Components/bottom_navigation_bar.dart'; + +class PurchaseStoreHomePage extends StatefulWidget { + static String tag = 'home-page'; + PurchaseStoreHomePage(); + @override + _PurchaseStoreHomePageState createState() => _PurchaseStoreHomePageState(); +} + +class _PurchaseStoreHomePageState extends State { + bool _notificationsBool = false; + bool _newsBool = false; + bool _announcementsBool = false; + bool _homeBool = true; + + bool _loading = true; + late String name; + late String studentType; + // Stream Controller for API + late StreamController _dashboardController; + late DashboardService dashboardService; + late DashboardData data; + late StreamController _profileController; + late ProfileService profileService; + late ProfileData data2; + late List designationsArray; + var service = locator(); + late String curr_desig = service.getFromDisk("Current_designation"); + bool isStudent = false; + + final appBarServices _appBarServices = appBarServices(); + @override + void initState() { + super.initState(); + _dashboardController = StreamController(); + dashboardService = DashboardService(); + _profileController = StreamController(); + profileService = ProfileService(); + getData(); + } + + getData() async { + try { + print("gfsgsgd"); + Response response = await dashboardService.getDashboard(); + print("1"); + Response response2 = await profileService.getProfile(); + print("2"); + print(response); + print(response2); + + setState(() { + data = DashboardData.fromJson(jsonDecode(response.body)); + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + print(data2.user!); + print( + '-----------------------------------=---------------------------------------'); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; + studentType = data2.profile!['department']!['name']; + + if (data2.profile!['user_type'] == 'student') { + isStudent = true; + } + } catch (e) { + print(e); + } + } + + loadData() async { + getData().then((res) { + _dashboardController.add(res); + _profileController.add(res); + }); + } + + fetchDesignations() async { + try { + designationsArray = await _appBarServices.getDesignations(); + } catch (e) { + print("Error fetching designations: $e"); + return null; + } + } + + final GlobalKey scaffoldKey = new GlobalKey(); + showSnack() { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text('New Content Loaded'), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + curr_desig: curr_desig, + headerTitle: "P & S", + onDesignationChanged: (newValue) { + setState(() { + curr_desig = newValue; + }); + + }, + ), // This is default app bar used in all modules + drawer: SideDrawer(curr_desig: curr_desig), + bottomNavigationBar: MyBottomNavigationBar(), // This is sideDrawer used in all modules + body: Column( + children: [ + Expanded( + child: _loading == true + ? Center(child: CircularProgressIndicator()) + : ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + // Display user information + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 30.0), + color: Colors.white, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 170.0, + height: 190.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/profile_pic.png'), + fit: BoxFit.cover, + ), + ), + ), + SizedBox(height: 10.0), + Text( + name, //Display name of User + style: TextStyle( + fontSize: 20.0, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10.0), + Text( + studentType + " " + curr_desig, // Display Type of User + style: TextStyle( + fontSize: 17.0, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10.0), + ], + ), + ), + + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/indent_form', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Indent Form', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/inbox', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Inbox', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/filed_indent', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'All Filed Indent', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + Card( + margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + color: Colors.deepOrangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0, left: 13.0, right: 10.0), + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + '/purchase_store/saved_indent', + arguments: data, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + + SizedBox(width: 40.0), + Text( + 'Saved Indent', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(width: 40.0), + + ], + ), + ), + ), + ), + + // Display Administrative Profile section if not a student and not HOD + + ], + ), + ), + // Place the BottomNavigationBar here + ], + ), + ); + } + + @override + void dispose() { + _dashboardController.close(); + super.dispose(); + } +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 49030f0b..ca3be226 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,6 +39,7 @@ dependencies: path_provider: ^2.0.8 open_file: ^3.2.1 flutter_html: ^2.2.1 + image_picker: ^0.8.4+4