show phone number(instead of card number) on user page if search was by phone

This commit is contained in:
Semyon Babushkin
2017-11-23 18:23:26 +03:00
parent c1bff19d1d
commit a0b62a541b
6 changed files with 15 additions and 15 deletions

View File

@@ -104,15 +104,15 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
} else if (call.method == 'findUserAndPurchase') {
var userResponse;
print(call.arguments[1]);
String cardPhone = call.arguments[0];
try {
switch (call.arguments[1]) {
case 'card':
userResponse = await getUserByCard(call.arguments[0],token);
userResponse = await getUserByCard(cardPhone,token);
break;
case 'phone':
userResponse = await getUserByPhone(call.arguments[0],token);
userResponse = await getUserByPhone(cardPhone,token);
break;
}
@@ -133,10 +133,10 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
if (users.length > 0) {
String userString = '${users[0]['first_name']} ${users[0]['last_name']}';
String card = users[0]['card'];
print(userString);
print(card);
pushRoute(context, new PurchaseScreen(helper, app, JSON.encode(users[0]), card));
print(cardPhone);
pushRoute(context, new PurchaseScreen(helper, app, JSON.encode(users[0]), cardPhone));
} else {
throw new FlutterError("Users not found");
}