Subsciber-invite: Remove longView. Fix conditions

This commit is contained in:
Konstantinos Triantafyllou 2022-07-06 12:31:55 +03:00
parent db5c95fe24
commit ad15aaae31
1 changed files with 9 additions and 13 deletions

View File

@ -16,7 +16,7 @@ declare var UIkit;
@Component({
selector: 'subscriber-invite',
template: `
<div *ngIf="longView" class="uk-grid uk-child-width-1-1" uk-grid [formGroup]="inviteForm">
<div *ngIf="body" class="uk-grid uk-child-width-1-1" uk-grid [formGroup]="inviteForm">
<div input [formInput]="inviteForm.get('name')" placeholder="From"></div>
<div input [formInput]="inviteForm.get('recipients')" type="chips"
placeholder="Recipients" hint="Add a recipient"
@ -49,17 +49,12 @@ declare var UIkit;
</div>
</div>
</div>
<div *ngIf="!longView">
<div input [formInput]="inviteForm.get('recipients')" type="chips" placeholder="Recipients" [addExtraChips]="true" [validators]="validators"></div>
</div>
`,
styleUrls: ['subscriber-invite.component.css']
})
export class SubscriberInviteComponent implements OnInit, OnDestroy {
@Input()
public user: User;
@Input()
public longView: boolean = true;
public community: CommunityInfo;
public inviteForm: FormGroup;
public email: Email;
@ -74,7 +69,6 @@ export class SubscriberInviteComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.loading = this.longView;
this.reset();
}
@ -99,12 +93,14 @@ export class SubscriberInviteComponent implements OnInit, OnDestroy {
});
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
this.community = community;
this.inviteForm.get('name').enable();
this.inviteForm.get('name').setValue(this.user.fullname);
this.inviteForm.get('name').disable();
this.body = Composer.initializeInvitationsBody(community.communityId, community.title, this.user.fullname);
this.email = Composer.initializeInvitationsEmail(community.title);
this.inviteForm.get('message').setValue(this.body.paragraphs);
if(this.community) {
this.inviteForm.get('name').enable();
this.inviteForm.get('name').setValue(this.user.fullname);
this.inviteForm.get('name').disable();
this.body = Composer.initializeInvitationsBody(community.communityId, community.title, this.user.fullname);
this.email = Composer.initializeInvitationsEmail(community.title);
this.inviteForm.get('message').setValue(this.body.paragraphs);
}
}));
if(!this.isManager) {
this.loading = false;