-
+ Email
+
+
{{contact.email}}
@@ -37,9 +39,9 @@
- Phone
-
-
+ Phone
+
+
{{contact.phone}}
@@ -47,9 +49,9 @@
- Job title
-
-
+ Job title
+
+
{{contact.jobTitle}}
@@ -57,9 +59,9 @@
- Company
-
-
+ Company
+
+
{{contact.company}}
@@ -68,15 +70,33 @@
-
- Buttons
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/main/content/apps/contacts/contact-list/contact-list.component.scss b/src/app/main/content/apps/contacts/contact-list/contact-list.component.scss
index f7e1316c..20a7e0c3 100644
--- a/src/app/main/content/apps/contacts/contact-list/contact-list.component.scss
+++ b/src/app/main/content/apps/contacts/contact-list/contact-list.component.scss
@@ -1,20 +1,30 @@
@import "src/app/core/scss/fuse";
:host {
+ flex: 1;
+
.mat-table {
background: transparent;
box-shadow: none;
+ .mat-column-checkbox {
+ flex: 0 1 64px;
+ }
+
+ .mat-column-avatar {
+ flex: 0 1 64px;
+ }
+
+ .mat-column-buttons {
+ flex: 0 1 80px;
+ }
+
.mat-row {
position: relative;
cursor: pointer;
.mat-cell {
-
- &.mat-column-icon {
- flex: 0 1 auto;
- padding: 0 24px 0 0;
- }
+ min-width: 0;
&.mat-column-detail-button {
flex: 0 1 auto;
diff --git a/src/app/main/content/apps/contacts/contact-list/contact-list.component.ts b/src/app/main/content/apps/contacts/contact-list/contact-list.component.ts
index c988fdd8..0399a062 100644
--- a/src/app/main/content/apps/contacts/contact-list/contact-list.component.ts
+++ b/src/app/main/content/apps/contacts/contact-list/contact-list.component.ts
@@ -11,28 +11,70 @@ import { Observable } from 'rxjs/Observable';
export class ContactListComponent implements OnInit
{
contacts: any;
+ user: any;
dataSource: FilesDataSource | null;
displayedColumns = ['checkbox', 'avatar', 'name', 'email', 'phone', 'jobTitle', 'buttons'];
- selected: any;
+ selectedContacts: any[];
+ checkboxes: {};
- constructor(private fileManagerService: ContactsService)
+ constructor(private contactsService: ContactsService)
{
- this.fileManagerService.onContactsChanged.subscribe(files => {
- this.contacts = files;
+ this.contactsService.onContactsChanged.subscribe(contacts => {
+
+ this.contacts = contacts;
+
+ this.checkboxes = {};
+ contacts.map(contact => {
+ this.checkboxes[contact.id] = false;
+ });
});
- this.fileManagerService.onContactSelected.subscribe(selected => {
- this.selected = selected;
+
+ this.contactsService.onSelectedContactsChanged.subscribe(selectedContacts => {
+ for ( const id in this.checkboxes )
+ {
+ this.checkboxes[id] = selectedContacts.includes(id);
+ }
+ this.selectedContacts = selectedContacts;
});
+
+ this.contactsService.onUserDataChanged.subscribe(user => {
+ this.user = user;
+ });
+
}
ngOnInit()
{
- this.dataSource = new FilesDataSource(this.fileManagerService);
+ this.dataSource = new FilesDataSource(this.contactsService);
}
onSelect(selected)
{
- this.fileManagerService.onContactSelected.next(selected);
+ // this.fileManagerService.onContactSelected.next(selected);
+ }
+
+ onSelectedChange(contactId)
+ {
+ this.contactsService.toggleSelectedContact(contactId);
+ }
+
+ toggleStar(contactId)
+ {
+ if ( this.user.starred.includes(contactId) )
+ {
+ this.user.starred.splice(this.user.starred.indexOf(contactId), 1);
+ }
+ else
+ {
+ this.user.starred.push(contactId);
+ }
+
+ this.contactsService.updateUserData(this.user);
+ }
+
+ removeContact(contactId)
+ {
+
}
}
diff --git a/src/app/main/content/apps/contacts/contact.model.ts b/src/app/main/content/apps/contacts/contact.model.ts
new file mode 100644
index 00000000..9cd2a8f4
--- /dev/null
+++ b/src/app/main/content/apps/contacts/contact.model.ts
@@ -0,0 +1,35 @@
+export class Contact
+{
+ id: string;
+ name: string;
+ lastName: string;
+ avatar: string;
+ nickname: string;
+ company: string;
+ jobTitle: string;
+ email: string;
+ phone: string;
+ address: string;
+ birthday: string;
+ notes: string;
+
+ constructor(contact)
+ {
+ {
+
+ this.id = contact.id;
+ this.name = contact.name;
+ this.lastName = contact.lastName;
+ this.avatar = contact.avatar;
+ this.nickname = contact.nickname;
+ this.company = contact.company;
+ this.jobTitle = contact.jobTitle;
+ this.email = contact.email;
+ this.phone = contact.phone;
+ this.address = contact.address;
+ this.birthday = contact.birhday;
+ this.notes = contact.notes;
+ }
+ }
+
+}
diff --git a/src/app/main/content/apps/contacts/contacts.component.html b/src/app/main/content/apps/contacts/contacts.component.html
index b7053db6..74134922 100644
--- a/src/app/main/content/apps/contacts/contacts.component.html
+++ b/src/app/main/content/apps/contacts/contacts.component.html
@@ -1,7 +1,7 @@
-