수정 :: 새로운 대화 개설용 유저 선택 팝업 > 유저선택 처리

This commit is contained in:
leejh 2019-10-17 15:07:39 +09:00
parent 99d7440c25
commit d29ca388bf
3 changed files with 34 additions and 7 deletions

View File

@ -197,15 +197,39 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
); );
} }
onCheckGroup(params: { isChecked: boolean; group: GroupDetailData }) { onCheckGroup(params: {
this.logger.debug(params); isChecked: boolean;
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] };
}) {
if (params.isChecked) {
params.groupBuddyList.buddyList.forEach(item => {
if (
this.selectedUserList.filter(user => user.seq === item.seq).length ===
0
) {
this.selectedUserList.push(item);
}
});
} else {
this.selectedUserList = this.selectedUserList.filter(
item =>
params.groupBuddyList.buddyList.filter(del => del.seq === item.seq)
.length === 0
);
}
} }
onCheckUser(params: { onCheckUser(params: {
isChecked: boolean; isChecked: boolean;
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
}) { }) {
if (params.isChecked) { if (params.isChecked) {
this.selectedUserList.push(params.userInfo); if (
this.selectedUserList.filter(user => user.seq === params.userInfo.seq)
.length === 0
) {
this.selectedUserList.push(params.userInfo);
}
} else { } else {
this.selectedUserList = this.selectedUserList.filter( this.selectedUserList = this.selectedUserList.filter(
item => item.seq !== params.userInfo.seq item => item.seq !== params.userInfo.seq

View File

@ -28,7 +28,7 @@
(click)="onClickMore($event, groupBuddy.group)"> (click)="onClickMore($event, groupBuddy.group)">
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>
</button> </button>
<mat-checkbox *ngIf="checkable" #checkbox (change)="onChangeCheck(checkbox.checked, groupBuddy.group)" <mat-checkbox *ngIf="checkable" #checkbox (change)="onChangeCheck(checkbox.checked, groupBuddy)"
(click)="$event.stopPropagation()"></mat-checkbox> (click)="$event.stopPropagation()"></mat-checkbox>
</mat-panel-description> </mat-panel-description>
</mat-expansion-panel-header> </mat-expansion-panel-header>

View File

@ -40,7 +40,7 @@ export class ExpansionPanelComponent implements OnInit {
@Output() @Output()
checkGroup = new EventEmitter<{ checkGroup = new EventEmitter<{
isChecked: boolean; isChecked: boolean;
group: GroupDetailData; groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] };
}>(); }>();
@ContentChild(ExpansionPanelItemDirective, { @ContentChild(ExpansionPanelItemDirective, {
@ -67,10 +67,13 @@ export class ExpansionPanelComponent implements OnInit {
this.more.emit({ event, group }); this.more.emit({ event, group });
} }
onChangeCheck(value: boolean, group: GroupDetailData) { onChangeCheck(
value: boolean,
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }
) {
this.checkGroup.emit({ this.checkGroup.emit({
isChecked: value, isChecked: value,
group groupBuddyList
}); });
} }
} }