WORKS!!!!!!!!
We did it boys, we uploaded a transaction
This commit is contained in:
parent
7dd00349a8
commit
e3ca987aa8
12 changed files with 87 additions and 274 deletions
|
@ -1,6 +1,7 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:async';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:local_spend/common/functions/get_token.dart';
|
||||
|
||||
class Organisation {
|
||||
|
@ -24,7 +25,7 @@ List<Organisation> jsonToOrganisations(String json) {
|
|||
Map decoded = jsonDecode(json);
|
||||
// print(decoded);
|
||||
|
||||
List<dynamic> validated = decoded['unvalidated'];
|
||||
List<dynamic> validated = decoded['validated'];
|
||||
// Map organisation = validated[0];
|
||||
//
|
||||
// print("");
|
||||
|
@ -101,4 +102,8 @@ Future<List<Organisation>> findOrganisations(String search) async {
|
|||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class OrganizationController extends TextEditingController {
|
||||
Organisation organisation;
|
||||
}
|
|
@ -59,6 +59,14 @@ Future<LoginModel> submitReceiptAPI(
|
|||
if (response.statusCode == 200) {
|
||||
final responseJson = json.decode(response.body);
|
||||
|
||||
print(responseJson[0]);
|
||||
|
||||
showDialogSingleButton(
|
||||
context,
|
||||
responseJson[0] == "" ? responseJson[0] : "Upload Successful",
|
||||
"Transaction successfully submitted to server",
|
||||
"OK"
|
||||
);
|
||||
return LoginModel.fromJson(responseJson);
|
||||
} else {
|
||||
final responseJson = json.decode(response.body);
|
||||
|
@ -68,7 +76,7 @@ Future<LoginModel> submitReceiptAPI(
|
|||
context,
|
||||
"Unable to Submit Receipt",
|
||||
// "You may have supplied an invalid 'Email' / 'Password' combination. Please try again or email an administrator.",
|
||||
responseJson.toString(),
|
||||
"Message from server: " + responseJson[1],
|
||||
"OK");
|
||||
return null;
|
||||
}
|
||||
|
|
Reference in a new issue