diff --git a/AstronoteSpecification.md b/AstronoteSpecification.md index a9db7af..d58ab40 100644 --- a/AstronoteSpecification.md +++ b/AstronoteSpecification.md @@ -39,8 +39,7 @@ Sessions are cookie-based [ ] ==**DASHBOARD**== -Dashboard ensures draft and unvalidated expense reports management, sorted by year and company -Within each year sorted in decending order, expense reports are sorted by month in ascending order +Dashboard ensures draft and unvalidated expense reports management Every expense report in the dashboard features the following parameters: - Expense status (validated, unvalidated or draft) - Expense data (date, charge incl. and excl. taxes, VAT, distance) @@ -57,17 +56,20 @@ Baseline scenario: [ ] ==**MANAGE EXPENSE REPORT**== +Expenses are divided into two sections : costs related to a company (Costs) and the costs related to a customer (Purchases) +Expenses include : +- date, type, description, charge incl. and excl. taxes, VAT +- for mileage expense : date, type, provision, origin, destination, distance + +Only expenses report related to a company will be developed in this step + Expense report dashboard allows user to keep track of: - Expense report status - Supporting document (or lack thereof) - Saved comments (including writer name, writing date and comment content) - Business expenses -Expenses are divided into two sections : costs related to a company (Costs) and the costs related to a customer (Purchases) -Expenses include : -- date, type, description, charge incl. and excl. taxes, VAT -- for mileage expense : date, type, provision, origin, destination, distance - + Baseline scenario: 1. Active user goes to HCI and picks specific expence report 2. All expense report details are displayed @@ -88,7 +90,7 @@ Newly created expense reports are automatically saved as drafts [ ] ==**ADD BUSINESS-RELATED EXPENSE (company)**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to add to. User is redirected to specific expense report HCI, selects "Costs" category and clicks add button +1. Active user goes to HCI and selects expense report to add to. User is redirected to specific expense report HCI and clicks add button 2. User can complete overhead form with appropriate data 3. User can complete line charge form with appropriate data 4. User confirms or cancels expense addition @@ -106,7 +108,7 @@ Expense can only be added if expense report is already saved as draft [ ] ==**EDIT BUSINESS-RELATED EXPENSE (company)**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to edit from. User is redirected to specific expense report HCI, selects "Costs" category and clicks specific edit button +1. Active user goes to HCI and selects expense report to edit from. User is redirected to specific expense report HCI and clicks specific edit button 2. User can complete overhead form with appropriate data (fields have current values as default values) 3. User can complete line charge form with appropriate data (fields have current values as default values) 4. User confirms or cancels expense edition @@ -124,7 +126,7 @@ Expense can only be added if expense report is already saved as draft [ ] ==**ADD BUSINESS-RELATED TRAVEL EXPENSE (company)**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to add to. User is redirected to specific expense report HCI, selects "Costs" category and clicks add button +1. Active user goes to HCI and selects expense report to add to. User is redirected to specific expense report HCI and clicks add button 2. User completes form with appropriate data 3. User confirms or cancels expense addition @@ -138,7 +140,7 @@ Expense can only be added if expense report is already saved as draft. [ ] ==**EDIT BUSINESS-RELATED TRAVEL EXPENSE (company)**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to edit from. User is redirected to specific expense report HCI, selects "Costs" category and clicks specific edit button +1. Active user goes to HCI and selects expense report to edit from. User is redirected to specific expense report HCI and clicks specific edit button 2. User completes form with appropriate data (fields have current values as default values) 3. User confirms or cancels expense addition @@ -152,7 +154,7 @@ Expense can only be added if expense report is already saved as draft. [ ] ==**DELETE EXPENSE**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to delete expense from. User is redirected to specific expense report HCI, selects "Costs" or "Purchases" category and clicks specific delete button +1. Active user goes to HCI and selects expense report to delete expense from. User is redirected to specific expense report HCI and clicks specific delete button 2. User is prompted for deletion confirmation as safety measure 3. User confirms or cancels deletion @@ -162,7 +164,7 @@ An expense can only be delete if expense report is already saved as draft. [ ] ==**SAVE EXPENSE REPORT**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to save. User is redirected to specific expense and clicks save button +1. Active user goes to HCI and selects expense report to save. User is redirected to specific expense and clicks save button 2. User completes form with appropriate data (comments that are optional) 3. User confirms or cancels @@ -173,7 +175,7 @@ Comments will be displayed in dashboard HCI from then on [ ] ==**DELETE EXPENSE REPORT**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to delete. User is redirected to specific expense report HCI and clicks delete button +1. Active user goes to HCI and selects expense report to delete. User is redirected to specific expense report HCI and clicks delete button 2. User is prompted for deletion confirmation as safety measure 3. User confirms or cancels @@ -184,7 +186,7 @@ If deleted expense report was awaiting validation, it is returned to draft statu [ ] ==**SUBMIT EXPENSE REPORT FOR VALIDATION**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to submit for validation. User is redirected to specific expense report HCI and clicks validate button +1. Active user goes to HCI and selects expense report to submit for validation. User is redirected to specific expense report HCI and clicks validate button 2. User completes form with appropriate data (comment that is optional) 3. User confirms or cancels @@ -197,7 +199,7 @@ Expense reports might have another status but those are not accessible on the us [ ] ==**ATTACH SUPPORTING DOCUMENT TO EXPENSE**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to attach a document in. User is redirected to specific expense report HCI and clicks attach button +1. Active user goes to HCI and selects expense report to attach a document in. User is redirected to specific expense report HCI, browses supporting document files and clicks attach button 2. User completes form with appropriate data 3. User confirms or cancels attachment @@ -212,7 +214,7 @@ Supporting documents can be joined regardless of expense report status [ ] ==**DELETE SUPPORTING DOCUMENT FROM EXPENSE**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to delete a document in. User is redirected to specific expense report HCI, browses supporting document files and clicks file link +1. Active user goes to HCI and selects expense report to delete a document in. User is redirected to specific expense report HCI, browses supporting document files and clicks file link 2. File information is displayed on click (description, file name, file size, upload date, last edit date) 3. User clicks delete button 4. User is prompted for deletion confirmation as safety measure @@ -224,7 +226,7 @@ Supporting documents can be deleted regardless of expense report status [ ] ==**EDIT SUPPORTING DOCUMENT FROM EXPENSE**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to edit a document in. User is redirected to specific expense report HCI, browses supporting document files and clicks file link +1. Active user goes to HCI and selects expense report to edit a document in. User is redirected to specific expense report HCI, browses supporting document files and clicks file link 2. File information is displayed 3. User clicks edit button 4. User completes form with appropriate data (fields have current values as default values, including file) @@ -241,7 +243,7 @@ Supporting documents can be edited regardless of expense report status [ ] ==**GENERATE EXPENSE WITH OCR**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to generate expense in. User is redirected to specific expense report HCI, selects "Costs" or "Purchases" category and clicks generate button +1. Active user goes to HCI and selects expense report to generate expense in. User is redirected to specific expense report HCI and clicks generate button 2. User selects snapshot from gallery or takes snapshot on the spot 3. OCR system parses data from snapshot and automatically compute rates 4. Form loads with parsed data as default value in appropriate fields @@ -251,7 +253,7 @@ Baseline scenario: [ ] ==**ADD CUSTOMER INTERACTION-RELATED EXPENSE**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to add to. User is redirected to specific expense report HCI, selects "Purchases" category and clicks add button +1. Active user goes to HCI and selects and expense report to add to. User is redirected to specific expense report HCI and clicks add button 2. User can complete overhead form with appropriate data 3. User can complete line charge form with appropriate data 4. User confirms or cancels expense addition @@ -269,7 +271,7 @@ Expense can only be added if expense report is already saved as draft [ ] ==**EDIT CUSTOMER INTERACTION-RELATED EXPENSE**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to edit from. User is redirected to specific expense report HCI, selects "Purchases" category and clicks specific edit button +1. Active user goes to HCI and selects expense report to edit from. User is redirected to specific expense report HCI and clicks specific edit button 2. User can complete overhead form with appropriate data (fields have current values as default values) 3. User can complete line charge form with appropriate data (fields have current values as default values) 4. User confirms or cancels expense edition @@ -287,7 +289,7 @@ Expense can only be added if expense report is already saved as draft [ ] ==**ADD CUSTOMER INTERACTION-RELATED TRAVEL EXPENSE**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to add to. User is redirected to specific expense report HCI, selects "Purchases" category and clicks add button +1. Active user goes to HCI and selects expense report to add to. User is redirected to specific expense report HCI and clicks add button 2. User completes form with appropriate data 3. User confirms or cancels expense addition @@ -301,7 +303,7 @@ Expense can only be added if expense report is already saved as draft [ ] ==**EDIT CUSTOMER INTERACTION-RELATED TRAVEL EXPENSE**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to edit from. User is redirected to specific expense report HCI, selects "Purchases" category and clicks specific edit button +1. Active user goes to HCI and selects expense report to edit from. User is redirected to specific expense report HCI and clicks specific edit button 2. User completes form with appropriate data (fields have current values as default values) 3. User confirms or cancels expense edition @@ -315,7 +317,7 @@ Expense can only be added if expense report is already saved as draft [ ] ==**COPY EXPENSE**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to copy expense from. User is redirected to specific expense report HCI, selects "Costs" or "Purchases" category and clicks specific copy button +1. Active user goes to HCI and selects expense report to copy expense from. User is redirected to specific expense report HCI and clicks specific copy button 2. User specifies to which expense report the expense needs to be copied. Only expense reports already saved as drafts can be selected. Default value is current expense report 3. User confirms or cancels copy @@ -326,7 +328,7 @@ An expense can only be copied if expense report is already saved as draft [ ] ==**COPY EXPENSE REPORT**== Baseline scenario: -1. Active user goes to HCI and selects year and expense report to copy. User is redirected to specific expense report HCI and clicks copy button +1. Active user goes to HCI and selects expense report to copy. User is redirected to specific expense report HCI and clicks copy button 2. User specifies month and year 3. User confirms or cancels diff --git a/assets/astrolabe_logo.jpg b/assets/astrolabe_logo.jpg new file mode 100644 index 0000000..5474e27 Binary files /dev/null and b/assets/astrolabe_logo.jpg differ diff --git a/fonts/VarelaRound-Regular.ttf b/fonts/VarelaRound-Regular.ttf new file mode 100644 index 0000000..bd68d51 Binary files /dev/null and b/fonts/VarelaRound-Regular.ttf differ diff --git a/lib/main.dart b/lib/main.dart index 11655b6..3f53b7b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,117 +1,17 @@ import 'package:flutter/material.dart'; +import 'views/HomeLog.dart'; -void main() { - runApp(MyApp()); -} +void main() => runApp(MyApp()); class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - // This is the theme of your application. - // - // Try running your application with "flutter run". You'll see the - // application has a blue toolbar. Then, without quitting the app, try - // changing the primarySwatch below to Colors.green and then invoke - // "hot reload" (press "r" in the console where you ran "flutter run", - // or simply save your changes to "hot reload" in a Flutter IDE). - // Notice that the counter didn't reset back to zero; the application - // is not restarted. - primarySwatch: Colors.blue, - // This makes the visual density adapt to the platform that you run - // the app on. For desktop platforms, the controls will be smaller and - // closer together (more dense) than on mobile platforms. - visualDensity: VisualDensity.adaptivePlatformDensity, - ), - home: MyHomePage(title: 'Flutter Demo Home Page'), + home: HomeLog(), + debugShowCheckedModeBanner: false, ); } } -class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); - // This widget is the home page of your application. It is stateful, meaning - // that it has a State object (defined below) that contains fields that affect - // how it looks. - - // This class is the configuration for the state. It holds the values (in this - // case the title) provided by the parent (in this case the App widget) and - // used by the build method of the State. Fields in a Widget subclass are - // always marked "final". - - final String title; - - @override - _MyHomePageState createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; - }); - } - - @override - Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. - return Scaffold( - appBar: AppBar( - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. - title: Text(widget.title), - ), - body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - child: Column( - // Column is also a layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Invoke "debug painting" (press "p" in the console, choose the - // "Toggle Debug Paint" action from the Flutter Inspector in Android - // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) - // to see the wireframe for each widget. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headline4, - ), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. - ); - } -} diff --git a/lib/views/HomeLog.dart b/lib/views/HomeLog.dart new file mode 100644 index 0000000..d3bc8c9 --- /dev/null +++ b/lib/views/HomeLog.dart @@ -0,0 +1,158 @@ +import 'package:provider/provider.dart'; +import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class HomeLog extends StatefulWidget { + @override + _HomeLogState createState() => _HomeLogState(); +} + +class _HomeLogState extends State { + TextStyle style = TextStyle(fontFamily: 'Varela Round', fontSize: 20.0); + final GlobalKey _globalKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + return Scaffold( + key: _globalKey, + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height, + color: Colors.white, + child: Padding( + padding: EdgeInsets.all(50), + child: Column( + children: [ + SizedBox(height: 40), + _logoApp(), + _titleApp(), + SizedBox(height: 90), + _emailField(), + SizedBox(height: 30), + _passwordField(), + SizedBox(height: 50), + _logButton(), + SizedBox(height: 70), + _enDIUrl(), + SizedBox(height: 10), + _astrolabeUrl() + ], + ), + ), + ), + ), + ); + } + Widget _logoApp() { + return SizedBox( + height: 100.0, + child: Image.asset( + "assets/astrolabe_logo.jpg", + ), + ); + } + + Widget _titleApp() { + return Text( + "AstroNotes", + style: style.copyWith(color: Colors.black, fontSize: 40), + ); + } + + Widget _emailField() { + return TextField( + style: style, + keyboardType: TextInputType.emailAddress, + decoration: InputDecoration( + contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0), + labelText: "E-mail", + border: + OutlineInputBorder(borderRadius: BorderRadius.circular(32.0))), + ); + } + + Widget _passwordField() { + return TextField( + style: style, + obscureText: true, + decoration: InputDecoration( + contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0), + labelText: "Mot de passe", + border: + OutlineInputBorder(borderRadius: BorderRadius.circular(32.0))), + ); + } + + Widget _logButton() { + return Material( + elevation: 5.0, + borderRadius: BorderRadius.circular(30.0), + color: Color(0xFF4A148C), + child: MaterialButton( +// minWidth: MediaQuery.of(context).size.width, + padding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0), + onPressed: () {}, + child: Text("Connexion", + textAlign: TextAlign.center, + style: style.copyWith( + color: Colors.white, fontWeight: FontWeight.bold)), + )); + } + + void _launchLinkEnDI() async { + const url = "https://endi.coop"; + + if (await canLaunch(url)) { + await launch(url); + } else { + final snack = SnackBar( + content: Text("Impossible de lancer le lien"), + duration: Duration(seconds: 4), + backgroundColor: Colors.red[300], + ); + _globalKey.currentState.showSnackBar(snack); + } + } + + void _launchLinkAstrolabe() async { + const url = "https://astrolabe.coop"; + + if (await canLaunch(url)) { + await launch(url); + } else { + final snack = SnackBar( + content: Text("Impossible de lancer le lien"), + duration: Duration(seconds: 4), + backgroundColor: Colors.red[300], + ); + _globalKey.currentState.showSnackBar(snack); + } + } + + Widget _enDIUrl() { + return InkWell( + onTap: _launchLinkEnDI, + child: Text( + "En collaboration avec enDI", + style: style.copyWith( + color: Colors.black, + fontSize: 15, + decoration: TextDecoration.underline), + ), + ); + } + + Widget _astrolabeUrl() { + return InkWell( + onTap: _launchLinkAstrolabe, + child: Text( + "Développé par Astrolabe", + style: style.copyWith( + color: Colors.black, + fontSize: 15, + decoration: TextDecoration.underline), + ), + ); + } + +} diff --git a/pubspec.lock b/pubspec.lock index b6489c5..2c689ae 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -64,6 +64,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.3" + email_validator: + dependency: "direct main" + description: + name: email_validator + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" flutter: dependency: "direct main" description: flutter @@ -74,6 +81,11 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" image: dependency: transitive description: @@ -95,6 +107,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.8" + nested: + dependency: transitive + description: + name: nested + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4" path: dependency: transitive description: @@ -109,6 +128,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.4.0" + platform_detect: + dependency: transitive + description: + name: platform_detect + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + provider: + dependency: "direct main" + description: + name: provider + url: "https://pub.dartlang.org" + source: hosted + version: "4.3.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.4" quiver: dependency: transitive description: @@ -170,6 +217,41 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.6" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "5.5.0" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+7" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.7" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" vector_math: dependency: transitive description: @@ -186,3 +268,4 @@ packages: version: "3.6.1" sdks: dart: ">=2.7.0 <3.0.0" + flutter: ">=1.16.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 13a268e..2218d8e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -23,7 +23,9 @@ environment: dependencies: flutter: sdk: flutter - + provider: ^4.3.1 + email_validator: '^1.0.0' + url_launcher: ^5.5.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. @@ -45,9 +47,8 @@ flutter: uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg + assets: + - assets/astrolabe_logo.jpg # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. @@ -60,12 +61,10 @@ flutter: # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic + fonts: + - family: Varela Round + fonts: + - asset: fonts/VarelaRound-Regular.ttf # - family: Trajan Pro # fonts: # - asset: fonts/TrajanPro.ttf