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: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/model/json/login_model.dart';
|
||||
import 'package:local_spend/config.dart';
|
||||
|
@ -13,11 +13,14 @@ import 'package:flutter/foundation.dart';
|
|||
Future<LoginModel> submitReceiptAPI(
|
||||
BuildContext context, String amount, String time) async {
|
||||
//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 = {
|
||||
'transaction_value': amount,
|
||||
'purchase_time': time,
|
||||
'session_key': preferences.get('LastToken'),
|
||||
};
|
||||
|
||||
debugPrint('$body');
|
||||
|
|
|
@ -104,6 +104,7 @@ class ReceiptPageState extends State<ReceiptPage> {
|
|||
inputType: InputType.both,
|
||||
format: DateFormat("EEEE, MMMM d, yyyy 'at' h:mma"),
|
||||
editable: true,
|
||||
controller: _timeController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Date/Time of Transaction', hasFloatingPlaceholder: false),
|
||||
onChanged: (dt) => setState(() => date = dt),
|
||||
|
@ -144,7 +145,7 @@ class ReceiptPageState extends State<ReceiptPage> {
|
|||
submitReceiptAPI(context, _amountController.text,
|
||||
_timeController.text);
|
||||
},
|
||||
child: Text("LOGIN",
|
||||
child: Text("SUBMIT",
|
||||
style:
|
||||
TextStyle(color: Colors.white, fontSize: 22.0)),
|
||||
color: Colors.blue,
|
||||
|
|
|
@ -49,7 +49,7 @@ packages:
|
|||
name: build_daemon
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.0"
|
||||
version: "0.6.1"
|
||||
build_resolvers:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -77,7 +77,7 @@ packages:
|
|||
name: built_collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.2.1"
|
||||
version: "4.2.2"
|
||||
built_value:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -241,14 +241,14 @@ packages:
|
|||
name: json_annotation
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "2.3.0"
|
||||
json_serializable:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: json_serializable
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.2"
|
||||
version: "2.3.0"
|
||||
kernel:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
Reference in a new issue