made changes to submit receipt
This commit is contained in:
parent
c15fdf1382
commit
a784e2da9c
3 changed files with 11 additions and 7 deletions
|
@ -3,7 +3,7 @@ import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:local_spend/common/functions/save_current_login.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:local_spend/common/functions/show_dialog_single_button.dart';
|
import 'package:local_spend/common/functions/show_dialog_single_button.dart';
|
||||||
import 'package:local_spend/model/json/login_model.dart';
|
import 'package:local_spend/model/json/login_model.dart';
|
||||||
import 'package:local_spend/config.dart';
|
import 'package:local_spend/config.dart';
|
||||||
|
@ -13,11 +13,14 @@ import 'package:flutter/foundation.dart';
|
||||||
Future<LoginModel> submitReceiptAPI(
|
Future<LoginModel> submitReceiptAPI(
|
||||||
BuildContext context, String amount, String time) async {
|
BuildContext context, String amount, String time) async {
|
||||||
//var apiUrl = ConfigWrapper.of(context).apiKey;
|
//var apiUrl = ConfigWrapper.of(context).apiKey;
|
||||||
final url = "https://dev.peartrade.org/api/login";
|
final url = "https://dev.peartrade.org/api/upload";
|
||||||
|
|
||||||
|
SharedPreferences preferences = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
Map<String, String> body = {
|
Map<String, String> body = {
|
||||||
'transaction_value': amount,
|
'transaction_value': amount,
|
||||||
'purchase_time': time,
|
'purchase_time': time,
|
||||||
|
'session_key': preferences.get('LastToken'),
|
||||||
};
|
};
|
||||||
|
|
||||||
debugPrint('$body');
|
debugPrint('$body');
|
||||||
|
|
|
@ -104,6 +104,7 @@ class ReceiptPageState extends State<ReceiptPage> {
|
||||||
inputType: InputType.both,
|
inputType: InputType.both,
|
||||||
format: DateFormat("EEEE, MMMM d, yyyy 'at' h:mma"),
|
format: DateFormat("EEEE, MMMM d, yyyy 'at' h:mma"),
|
||||||
editable: true,
|
editable: true,
|
||||||
|
controller: _timeController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Date/Time of Transaction', hasFloatingPlaceholder: false),
|
labelText: 'Date/Time of Transaction', hasFloatingPlaceholder: false),
|
||||||
onChanged: (dt) => setState(() => date = dt),
|
onChanged: (dt) => setState(() => date = dt),
|
||||||
|
@ -144,7 +145,7 @@ class ReceiptPageState extends State<ReceiptPage> {
|
||||||
submitReceiptAPI(context, _amountController.text,
|
submitReceiptAPI(context, _amountController.text,
|
||||||
_timeController.text);
|
_timeController.text);
|
||||||
},
|
},
|
||||||
child: Text("LOGIN",
|
child: Text("SUBMIT",
|
||||||
style:
|
style:
|
||||||
TextStyle(color: Colors.white, fontSize: 22.0)),
|
TextStyle(color: Colors.white, fontSize: 22.0)),
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
|
|
|
@ -49,7 +49,7 @@ packages:
|
||||||
name: build_daemon
|
name: build_daemon
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.0"
|
version: "0.6.1"
|
||||||
build_resolvers:
|
build_resolvers:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -77,7 +77,7 @@ packages:
|
||||||
name: built_collection
|
name: built_collection
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.1"
|
version: "4.2.2"
|
||||||
built_value:
|
built_value:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -241,14 +241,14 @@ packages:
|
||||||
name: json_annotation
|
name: json_annotation
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.3.0"
|
||||||
json_serializable:
|
json_serializable:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: json_serializable
|
name: json_serializable
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.2"
|
version: "2.3.0"
|
||||||
kernel:
|
kernel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
Reference in a new issue