WORKS!!!!!!!!

We did it boys, we uploaded a transaction
This commit is contained in:
Felix 2019-07-16 11:28:36 +01:00
parent 7dd00349a8
commit e3ca987aa8
No known key found for this signature in database
GPG key ID: 130EF6DC43E4DD07
12 changed files with 87 additions and 274 deletions

View file

@ -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;
}

View file

@ -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;
}