Add contact portal links
This commit is contained in:
parent
5b12bed0e4
commit
17f8b42caf
|
|
@ -704,6 +704,7 @@ abstract class ContactEntity extends Object
|
||||||
createdAt: 0,
|
createdAt: 0,
|
||||||
assignedUserId: '',
|
assignedUserId: '',
|
||||||
createdUserId: '',
|
createdUserId: '',
|
||||||
|
link: '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -749,6 +750,9 @@ abstract class ContactEntity extends Object
|
||||||
@BuiltValueField(wireName: 'last_login')
|
@BuiltValueField(wireName: 'last_login')
|
||||||
int get lastLogin;
|
int get lastLogin;
|
||||||
|
|
||||||
|
@nullable // TODO remove nullable
|
||||||
|
String get link;
|
||||||
|
|
||||||
String get fullName {
|
String get fullName {
|
||||||
return (firstName + ' ' + lastName).trim();
|
return (firstName + ' ' + lastName).trim();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -564,6 +564,12 @@ class _$ContactEntitySerializer implements StructuredSerializer<ContactEntity> {
|
||||||
'id',
|
'id',
|
||||||
serializers.serialize(object.id, specifiedType: const FullType(String)),
|
serializers.serialize(object.id, specifiedType: const FullType(String)),
|
||||||
];
|
];
|
||||||
|
if (object.link != null) {
|
||||||
|
result
|
||||||
|
..add('link')
|
||||||
|
..add(serializers.serialize(object.link,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
if (object.isChanged != null) {
|
if (object.isChanged != null) {
|
||||||
result
|
result
|
||||||
..add('isChanged')
|
..add('isChanged')
|
||||||
|
|
@ -655,6 +661,10 @@ class _$ContactEntitySerializer implements StructuredSerializer<ContactEntity> {
|
||||||
result.lastLogin = serializers.deserialize(value,
|
result.lastLogin = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(int)) as int;
|
specifiedType: const FullType(int)) as int;
|
||||||
break;
|
break;
|
||||||
|
case 'link':
|
||||||
|
result.link = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
break;
|
||||||
case 'isChanged':
|
case 'isChanged':
|
||||||
result.isChanged = serializers.deserialize(value,
|
result.isChanged = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(bool)) as bool;
|
specifiedType: const FullType(bool)) as bool;
|
||||||
|
|
@ -1720,6 +1730,8 @@ class _$ContactEntity extends ContactEntity {
|
||||||
@override
|
@override
|
||||||
final int lastLogin;
|
final int lastLogin;
|
||||||
@override
|
@override
|
||||||
|
final String link;
|
||||||
|
@override
|
||||||
final bool isChanged;
|
final bool isChanged;
|
||||||
@override
|
@override
|
||||||
final int createdAt;
|
final int createdAt;
|
||||||
|
|
@ -1753,6 +1765,7 @@ class _$ContactEntity extends ContactEntity {
|
||||||
this.customValue3,
|
this.customValue3,
|
||||||
this.customValue4,
|
this.customValue4,
|
||||||
this.lastLogin,
|
this.lastLogin,
|
||||||
|
this.link,
|
||||||
this.isChanged,
|
this.isChanged,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
|
|
@ -1839,6 +1852,7 @@ class _$ContactEntity extends ContactEntity {
|
||||||
customValue3 == other.customValue3 &&
|
customValue3 == other.customValue3 &&
|
||||||
customValue4 == other.customValue4 &&
|
customValue4 == other.customValue4 &&
|
||||||
lastLogin == other.lastLogin &&
|
lastLogin == other.lastLogin &&
|
||||||
|
link == other.link &&
|
||||||
isChanged == other.isChanged &&
|
isChanged == other.isChanged &&
|
||||||
createdAt == other.createdAt &&
|
createdAt == other.createdAt &&
|
||||||
updatedAt == other.updatedAt &&
|
updatedAt == other.updatedAt &&
|
||||||
|
|
@ -1870,18 +1884,18 @@ class _$ContactEntity extends ContactEntity {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc($jc($jc(0, firstName.hashCode), lastName.hashCode),
|
$jc($jc($jc($jc(0, firstName.hashCode), lastName.hashCode), email.hashCode),
|
||||||
email.hashCode),
|
password.hashCode),
|
||||||
password.hashCode),
|
phone.hashCode),
|
||||||
phone.hashCode),
|
contactKey.hashCode),
|
||||||
contactKey.hashCode),
|
isPrimary.hashCode),
|
||||||
isPrimary.hashCode),
|
sendEmail.hashCode),
|
||||||
sendEmail.hashCode),
|
customValue1.hashCode),
|
||||||
customValue1.hashCode),
|
customValue2.hashCode),
|
||||||
customValue2.hashCode),
|
customValue3.hashCode),
|
||||||
customValue3.hashCode),
|
customValue4.hashCode),
|
||||||
customValue4.hashCode),
|
lastLogin.hashCode),
|
||||||
lastLogin.hashCode),
|
link.hashCode),
|
||||||
isChanged.hashCode),
|
isChanged.hashCode),
|
||||||
createdAt.hashCode),
|
createdAt.hashCode),
|
||||||
updatedAt.hashCode),
|
updatedAt.hashCode),
|
||||||
|
|
@ -1908,6 +1922,7 @@ class _$ContactEntity extends ContactEntity {
|
||||||
..add('customValue3', customValue3)
|
..add('customValue3', customValue3)
|
||||||
..add('customValue4', customValue4)
|
..add('customValue4', customValue4)
|
||||||
..add('lastLogin', lastLogin)
|
..add('lastLogin', lastLogin)
|
||||||
|
..add('link', link)
|
||||||
..add('isChanged', isChanged)
|
..add('isChanged', isChanged)
|
||||||
..add('createdAt', createdAt)
|
..add('createdAt', createdAt)
|
||||||
..add('updatedAt', updatedAt)
|
..add('updatedAt', updatedAt)
|
||||||
|
|
@ -1976,6 +1991,10 @@ class ContactEntityBuilder
|
||||||
int get lastLogin => _$this._lastLogin;
|
int get lastLogin => _$this._lastLogin;
|
||||||
set lastLogin(int lastLogin) => _$this._lastLogin = lastLogin;
|
set lastLogin(int lastLogin) => _$this._lastLogin = lastLogin;
|
||||||
|
|
||||||
|
String _link;
|
||||||
|
String get link => _$this._link;
|
||||||
|
set link(String link) => _$this._link = link;
|
||||||
|
|
||||||
bool _isChanged;
|
bool _isChanged;
|
||||||
bool get isChanged => _$this._isChanged;
|
bool get isChanged => _$this._isChanged;
|
||||||
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
|
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
|
||||||
|
|
@ -2027,6 +2046,7 @@ class ContactEntityBuilder
|
||||||
_customValue3 = _$v.customValue3;
|
_customValue3 = _$v.customValue3;
|
||||||
_customValue4 = _$v.customValue4;
|
_customValue4 = _$v.customValue4;
|
||||||
_lastLogin = _$v.lastLogin;
|
_lastLogin = _$v.lastLogin;
|
||||||
|
_link = _$v.link;
|
||||||
_isChanged = _$v.isChanged;
|
_isChanged = _$v.isChanged;
|
||||||
_createdAt = _$v.createdAt;
|
_createdAt = _$v.createdAt;
|
||||||
_updatedAt = _$v.updatedAt;
|
_updatedAt = _$v.updatedAt;
|
||||||
|
|
@ -2070,6 +2090,7 @@ class ContactEntityBuilder
|
||||||
customValue3: customValue3,
|
customValue3: customValue3,
|
||||||
customValue4: customValue4,
|
customValue4: customValue4,
|
||||||
lastLogin: lastLogin,
|
lastLogin: lastLogin,
|
||||||
|
link: link,
|
||||||
isChanged: isChanged,
|
isChanged: isChanged,
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
updatedAt: updatedAt,
|
updatedAt: updatedAt,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ class AppListTile extends StatelessWidget {
|
||||||
this.dense = false,
|
this.dense = false,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.copyValue,
|
this.copyValue,
|
||||||
|
this.buttons,
|
||||||
});
|
});
|
||||||
|
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
|
|
@ -18,6 +19,7 @@ class AppListTile extends StatelessWidget {
|
||||||
final bool dense;
|
final bool dense;
|
||||||
final Function onTap;
|
final Function onTap;
|
||||||
final String copyValue;
|
final String copyValue;
|
||||||
|
final List<Widget> buttons;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -27,7 +29,11 @@ class AppListTile extends StatelessWidget {
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 25, vertical: 10),
|
contentPadding: EdgeInsets.symmetric(horizontal: 25, vertical: 10),
|
||||||
leading: Icon(icon),
|
leading: Icon(icon),
|
||||||
title: Text(title),
|
title: Text(title),
|
||||||
subtitle: subtitle == null ? Container() : Text(subtitle),
|
subtitle: buttons != null
|
||||||
|
? Row(
|
||||||
|
children: buttons,
|
||||||
|
)
|
||||||
|
: (subtitle == null ? Container() : Text(subtitle)),
|
||||||
dense: dense,
|
dense: dense,
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/lists/app_list_tile.dart';
|
import 'package:invoiceninja_flutter/ui/app/lists/app_list_tile.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||||
|
|
@ -50,10 +52,34 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
||||||
contacts.forEach((contact) {
|
contacts.forEach((contact) {
|
||||||
if ((contact.email ?? '').isNotEmpty) {
|
if ((contact.email ?? '').isNotEmpty) {
|
||||||
listTiles.add(AppListTile(
|
listTiles.add(AppListTile(
|
||||||
|
buttons: [
|
||||||
|
Expanded(
|
||||||
|
child: OutlineButton(
|
||||||
|
child: Text(localization.viewPortal.toUpperCase()),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5)),
|
||||||
|
onPressed: () {
|
||||||
|
launch('${contact.link}&client_hash=${client.clientHash}',
|
||||||
|
forceWebView: false, forceSafariVC: false);
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
SizedBox(width: kTableColumnGap),
|
||||||
|
Expanded(
|
||||||
|
child: OutlineButton(
|
||||||
|
child: Text(localization.copyLink.toUpperCase()),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5)),
|
||||||
|
onPressed: () {
|
||||||
|
Clipboard.setData(ClipboardData(text: contact.link));
|
||||||
|
Scaffold.of(context).showSnackBar(SnackBar(
|
||||||
|
content: Text(localization.copiedToClipboard
|
||||||
|
.replaceFirst(':value ', ''))));
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
],
|
||||||
icon: Icons.email,
|
icon: Icons.email,
|
||||||
title: contact.fullName + '\n' + contact.email,
|
title: contact.fullName + '\n' + contact.email,
|
||||||
copyValue: contact.email,
|
copyValue: contact.email,
|
||||||
subtitle: localization.email,
|
|
||||||
onTap: () => setState(() {
|
onTap: () => setState(() {
|
||||||
_launched = _launchURL(context, 'mailto:' + contact.email);
|
_launched = _launchURL(context, 'mailto:' + contact.email);
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue