Purchase orders
This commit is contained in:
parent
599aa190c1
commit
94944ae90c
|
|
@ -5,6 +5,7 @@ import 'dart:convert';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:built_value/built_value.dart';
|
import 'package:built_value/built_value.dart';
|
||||||
import 'package:built_value/serializer.dart';
|
import 'package:built_value/serializer.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
// Project imports:
|
// Project imports:
|
||||||
import 'package:invoiceninja_flutter/.env.dart';
|
import 'package:invoiceninja_flutter/.env.dart';
|
||||||
|
|
@ -579,11 +580,9 @@ abstract class CompanyEntity extends Object
|
||||||
);
|
);
|
||||||
|
|
||||||
bool isModuleEnabled(EntityType entityType) {
|
bool isModuleEnabled(EntityType entityType) {
|
||||||
/*
|
if (kReleaseMode && entityType == EntityType.purchaseOrder) {
|
||||||
if (entityType == EntityType.purchaseOrder) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
if ((entityType == EntityType.invoice ||
|
if ((entityType == EntityType.invoice ||
|
||||||
entityType == EntityType.payment) &&
|
entityType == EntityType.payment) &&
|
||||||
|
|
|
||||||
|
|
@ -225,9 +225,8 @@ class LoginVM {
|
||||||
try {
|
try {
|
||||||
WebUtils.microsoftLogin((idToken, accessToken) {
|
WebUtils.microsoftLogin((idToken, accessToken) {
|
||||||
print('## RESULT: acces: $accessToken id: $idToken');
|
print('## RESULT: acces: $accessToken id: $idToken');
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
store.dispatch(OAuthLoginRequest(
|
store.dispatch(OAuthLoginRequest(
|
||||||
completer: completer,
|
completer: completer,
|
||||||
idToken: idToken,
|
idToken: idToken,
|
||||||
|
|
@ -240,6 +239,9 @@ class LoginVM {
|
||||||
));
|
));
|
||||||
completer.future.then((_) => _handleLogin(context: context));
|
completer.future.then((_) => _handleLogin(context: context));
|
||||||
*/
|
*/
|
||||||
|
}, (dynamic error) {
|
||||||
|
completer.completeError(error);
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
completer.completeError(error);
|
completer.completeError(error);
|
||||||
print('## onMicrosoftLoginPressed: $error');
|
print('## onMicrosoftLoginPressed: $error');
|
||||||
|
|
@ -249,19 +251,17 @@ class LoginVM {
|
||||||
(BuildContext context, Completer<Null> completer) async {
|
(BuildContext context, Completer<Null> completer) async {
|
||||||
try {
|
try {
|
||||||
WebUtils.microsoftLogin((idToken, accessToken) {
|
WebUtils.microsoftLogin((idToken, accessToken) {
|
||||||
print('## RESULT: acces: $accessToken id: $idToken');
|
store.dispatch(OAuthSignUpRequest(
|
||||||
|
completer: completer,
|
||||||
|
idToken: idToken,
|
||||||
|
provider: UserEntity.OAUTH_PROVIDER_MICROSOFT,
|
||||||
|
accessToken: accessToken,
|
||||||
|
));
|
||||||
|
completer.future
|
||||||
|
.then((_) => _handleLogin(context: context, isSignUp: true));
|
||||||
|
}, (dynamic error) {
|
||||||
|
completer.completeError(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
store.dispatch(OAuthSignUpRequest(
|
|
||||||
completer: completer,
|
|
||||||
idToken: idToken,
|
|
||||||
provider: kOAuthProviderMicrosoft,
|
|
||||||
accessToken: accessToken,
|
|
||||||
));
|
|
||||||
completer.future
|
|
||||||
.then((_) => _handleLogin(context: context, isSignUp: true));
|
|
||||||
*/
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
completer.completeError(error);
|
completer.completeError(error);
|
||||||
print('## onMicrosoftSignUpPressed: $error');
|
print('## onMicrosoftSignUpPressed: $error');
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,8 @@ class UserDetailsVM {
|
||||||
completer: completer,
|
completer: completer,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}, (dynamic error) {
|
||||||
|
showErrorDialog(context: context, message: error);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
showErrorDialog(context: context, message: error);
|
showErrorDialog(context: context, message: error);
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,10 @@ class WebUtils {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void microsoftLogin(Function(String, String) callback) async {
|
static void microsoftLogin(
|
||||||
|
Function(String, String) succesCallback,
|
||||||
|
Function(dynamic) failureCallback,
|
||||||
|
) async {
|
||||||
final config = Configuration()
|
final config = Configuration()
|
||||||
..auth = (BrowserAuthOptions()
|
..auth = (BrowserAuthOptions()
|
||||||
//..redirectUri = 'https://invoicing.co/auth/microsoft'
|
//..redirectUri = 'https://invoicing.co/auth/microsoft'
|
||||||
|
|
@ -81,10 +84,11 @@ class WebUtils {
|
||||||
|
|
||||||
final loginRequest = PopupRequest()..scopes = ['user.read'];
|
final loginRequest = PopupRequest()..scopes = ['user.read'];
|
||||||
|
|
||||||
final AuthenticationResult result =
|
publicClientApp.loginPopup(loginRequest).then((result) {
|
||||||
await publicClientApp.loginPopup(loginRequest);
|
succesCallback(result?.idToken, result?.accessToken);
|
||||||
|
}).catchError((dynamic error) {
|
||||||
callback(result?.idToken, result?.accessToken);
|
failureCallback(error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,10 @@ class WebUtils {
|
||||||
|
|
||||||
static void warnChanges(Store<AppState> store) {}
|
static void warnChanges(Store<AppState> store) {}
|
||||||
|
|
||||||
static void microsoftLogin(Function(String, String) callback) async {}
|
static void microsoftLogin(
|
||||||
|
Function(String, String) successCallback,
|
||||||
|
Function(dynamic) failureCallback,
|
||||||
|
) async {}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static String loadToken() => null;
|
static String loadToken() => null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue