This commit is contained in:
Hillel Coren 2019-10-17 15:45:39 +03:00
parent 263c053c86
commit 41beedaa7b
4 changed files with 6 additions and 6 deletions

View File

@ -50,6 +50,7 @@ abstract class CompanyGatewayEntity extends Object
return _$CompanyGatewayEntity._( return _$CompanyGatewayEntity._(
id: id ?? BaseEntity.nextId, id: id ?? BaseEntity.nextId,
isChanged: false, isChanged: false,
isDeleted: false,
gateway: GatewayEntity(), gateway: GatewayEntity(),
gatewayId: null, gatewayId: null,
showBillingAddress: true, showBillingAddress: true,

View File

@ -19,7 +19,7 @@ class CompanyGatewayRepository {
Future<CompanyGatewayEntity> loadItem( Future<CompanyGatewayEntity> loadItem(
Credentials credentials, String entityId) async { Credentials credentials, String entityId) async {
final dynamic response = await webClient.get( final dynamic response = await webClient.get(
'${credentials.url}/company_gateways/$entityId', credentials.token); '${credentials.url}/company_gateways/$entityId?include=gateway', credentials.token);
final CompanyGatewayItemResponse companyGatewayResponse = serializers final CompanyGatewayItemResponse companyGatewayResponse = serializers
.deserializeWith(CompanyGatewayItemResponse.serializer, response); .deserializeWith(CompanyGatewayItemResponse.serializer, response);
@ -29,7 +29,7 @@ class CompanyGatewayRepository {
Future<BuiltList<CompanyGatewayEntity>> loadList( Future<BuiltList<CompanyGatewayEntity>> loadList(
Credentials credentials, int updatedAt) async { Credentials credentials, int updatedAt) async {
String url = credentials.url + '/company_gateways?'; String url = credentials.url + '/company_gateways?include=gateway';
if (updatedAt > 0) { if (updatedAt > 0) {
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}'; url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
@ -52,11 +52,11 @@ class CompanyGatewayRepository {
if (companyGateway.isNew) { if (companyGateway.isNew) {
response = await webClient.post( response = await webClient.post(
credentials.url + '/company_gateways', credentials.token, credentials.url + '/company_gateways?include=gateway', credentials.token,
data: json.encode(data)); data: json.encode(data));
} else { } else {
var url = var url =
credentials.url + '/company_gateways/' + companyGateway.id.toString(); credentials.url + '/company_gateways/${companyGateway.id}?include=gateway';
if (action != null) { if (action != null) {
url += '?action=' + action.toString(); url += '?action=' + action.toString();
} }

View File

@ -1,5 +1,4 @@
import 'package:invoiceninja_flutter/data/models/company_gateway_model.dart'; import 'package:invoiceninja_flutter/data/models/company_gateway_model.dart';
import 'package:invoiceninja_flutter/redux/group/group_state.dart';
import 'package:redux/redux.dart'; import 'package:redux/redux.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart'; import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
import 'package:invoiceninja_flutter/redux/company/company_actions.dart'; import 'package:invoiceninja_flutter/redux/company/company_actions.dart';

View File

@ -31,7 +31,7 @@ class _CompanyGatewayViewState extends State<CompanyGatewayView> {
actions: [ actions: [
userCompany.canEditEntity(companyGateway) userCompany.canEditEntity(companyGateway)
? EditIconButton( ? EditIconButton(
isVisible: !companyGateway.isDeleted, isVisible: !(companyGateway.isDeleted ?? false),
onPressed: () => viewModel.onEditPressed(context), onPressed: () => viewModel.onEditPressed(context),
) )
: Container(), : Container(),