Merge branch 'feature/BETERAN-BACKEND-APP-BROWSER-init' of https://gitlab.loafle.net/bet/beteran-backend-app-browser into feature/BETERAN-BACKEND-APP-BROWSER-init

This commit is contained in:
이담 정 2022-08-19 10:16:17 +00:00
commit f0cf02bf47
10 changed files with 64 additions and 541 deletions

View File

@ -52,7 +52,7 @@
<th mat-header-cell *matHeaderCellDef>상위</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">
{{ __getRefererMember(info) }}
{{ __getParentUserName("") }}
</span>
</td>
</ng-container>
@ -209,7 +209,7 @@
<th mat-header-cell *matHeaderCellDef>상위</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">
{{ __getRefererMember(info) }}
{{ __getParentUserName("") }}
</span>
</td>
</ng-container>
@ -219,14 +219,14 @@
<th mat-header-cell *matHeaderCellDef>등급</th>
<td mat-cell *matCellDef="let info">
{{ info.getMemberClass()?.getName() }}
{{ __getMemberClassName(info) }}
</td>
</ng-container>
<ng-container matColumnDef="username">
<th mat-header-cell *matHeaderCellDef>아이디</th>
<td mat-cell *matCellDef="let info">
{{ info.getUsername() }}
{{ info.getMember()?.getUsername() }}
</td>
</ng-container>
@ -234,14 +234,16 @@
<ng-container matColumnDef="nickname">
<th mat-header-cell *matHeaderCellDef>닉네임</th>
<td mat-cell *matCellDef="let info">
{{ info.getNickname() }}
{{ info.getMember()?.getNickname() }}
</td>
</ng-container>
<!-- Expenses amount -->
<ng-container matColumnDef="isUse">
<th mat-header-cell *matHeaderCellDef>사용여부</th>
<td mat-cell *matCellDef="let info">Y</td>
<td mat-cell *matCellDef="let info">
{{ info.getCanUse() ? "Y" : "N" }}
</td>
</ng-container>
<!-- Expenses amount -->

View File

@ -8,46 +8,23 @@ import {
ViewChild,
ViewEncapsulation,
} from '@angular/core';
import {
FormBuilder,
FormControl,
FormGroup,
Validators,
} from '@angular/forms';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import {
debounceTime,
map,
merge,
Observable,
Subject,
switchMap,
takeUntil,
} from 'rxjs';
import { Subject } from 'rxjs';
import { fuseAnimations } from '@fuse/animations';
import { FuseConfirmationService } from '@fuse/services/confirmation';
import { PartnerRecommendation as PartnerRecommendation } from '../models/partner-recommendation';
import { PartnerRecommendationPagination as PartnerRecommendationPagination } from '../models/partner-recommendation-pagination';
import { PartnerRecommendationService as PartnerRecommendationService } from '../services/partner-recommendation.service';
import { ActivatedRoute, Router } from '@angular/router';
import { MatDialog } from '@angular/material/dialog';
import { RegistComposeComponent } from '../compose/regist-compose.component';
import { MatTableDataSource } from '@angular/material/table';
import { MemberModel } from 'app/modules/proto/models/member_pb';
import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb';
import { SelectionModel } from '@angular/cdk/collections';
import {
AddComposeComponent,
AddComposeResult,
} from '../compose/add-compose.component';
import { DeleteComposeComponent } from '../compose/delete-compose.component';
import { MemberService } from 'app/modules/polyglot/member/services/member.service';
import { MemberReferrerService } from 'app/modules/polyglot/member_referrer/services/member_referrer.service';
import { MemberReferrerModel } from 'app/modules/proto/models/member_referrer_pb';
@Component({
selector: 'partner-recommendation-list',
templateUrl: './list.component.html',
@ -85,7 +62,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
registPartnerStoreDataSource: MatTableDataSource<MemberModel> =
new MatTableDataSource();
removePartnerStoreDataSource: MatTableDataSource<MemberModel> =
removePartnerStoreDataSource: MatTableDataSource<MemberReferrerModel> =
new MatTableDataSource();
registPartnerStoreTableColumns: string[] = [
@ -117,14 +94,12 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
isLoading = false;
searchInputControl = new FormControl();
selectedPartnerRecommendation?: PartnerRecommendation;
pagination?: PartnerRecommendationPagination;
registSelection = new SelectionModel<MemberModel>(true, []);
removeSelection = new SelectionModel<MemberModel>(true, []);
removeSelection = new SelectionModel<MemberReferrerModel>(true, []);
addBtnConfigForm!: FormGroup;
removeBtnConfigForm!: FormGroup;
registConfigForm!: FormGroup;
removeConfigForm!: FormGroup;
private _unsubscribeAll: Subject<any> = new Subject<any>();
@ -136,10 +111,6 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
private _activatedRoute: ActivatedRoute,
private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder,
private _partnerRecommendationService: PartnerRecommendationService,
private router: Router,
private _matDialog: MatDialog,
private _memberService: MemberService,
private _memberReffererService: MemberReferrerService
) {}
@ -151,6 +122,24 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
* On init
*/
ngOnInit(): void {
this.__addBtnConfirmConfig();
this.__removeBtnConfirmConfig();
this._memberReffererService.listMemberReferrers().then((result) => {
const list = result.getMemberReferrersList();
this.removePartnerStoreDataSource.data = result.getMemberReferrersList();
/* this.registPartnerStoreDataSource.data */
const partnerStores = this.listMembers.filter(
(m) =>
m.getMemberClass()?.getId() === 'e11cac11-3825-4f4e-9cd5-39367f23f973'
);
this.registPartnerStoreDataSource.data = partnerStores;
// Mark for check
this._changeDetectorRef.markForCheck();
});
// Get the products
this._activatedRoute.data.subscribe((data) => {
let listMemberResult: ListMembersResponse.Result =
@ -158,12 +147,12 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
this.listMembers = listMemberResult.getMembersList();
this.registPartnerStoreDataSource.data = listMemberResult
/* this.registPartnerStoreDataSource.data = listMemberResult
.getMembersList()
.filter(
(v: MemberModel) =>
v.getMemberClass()?.getId() ===
'e11cac11-3825-4f4e-9cd5-39367f23f973'
'e11cac11-3825-4f4e-9cd5-39367f23f973' &&
);
this.removePartnerStoreDataSource.data = listMemberResult
.getMembersList()
@ -171,7 +160,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
(v: MemberModel) =>
v.getMemberClass()?.getId() ===
'e11cac11-3825-4f4e-9cd5-39367f23f973'
);
); */
/* console.log('dddd', listMemberResult.getMembersList()); */
@ -267,7 +256,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
}
return `${
this.registSelection.isSelected(row) ? 'deselect' : 'select'
} row ${row.getUsername()}`;
} row ${row.getId()}`;
}
__removeToggleAllRows() {
@ -286,13 +275,13 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
}
/** The label for the checkbox on the passed row */
__removeCheckboxLabel(row?: MemberModel): string {
__removeCheckboxLabel(row?: MemberReferrerModel): string {
if (!row) {
return `${this.__removeIsAllSelected() ? 'deselect' : 'select'} all`;
}
return `${
this.removeSelection.isSelected(row) ? 'deselect' : 'select'
} row ${row.getUsername()}`;
} row ${row.getId()}`;
}
/**
@ -328,16 +317,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
return item.id || index;
}
__onClickRegist(event: MouseEvent): void {
const dialogRef = this._matDialog.open(RegistComposeComponent);
dialogRef.afterClosed().subscribe((result) => {
console.log('Compose dialog was closed!');
});
}
__addBtnConfirmConfig(): void {
this.addBtnConfigForm = this._formBuilder.group({
this.registConfigForm = this._formBuilder.group({
title: '알림',
message: '정말 추천인으로 추가하시겠습니까?',
icon: this._formBuilder.group({
@ -360,7 +341,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
});
}
__removeBtnConfirmConfig(): void {
this.removeBtnConfigForm = this._formBuilder.group({
this.removeConfigForm = this._formBuilder.group({
title: '알림',
message: '정말 삭제하시겠습니까?',
icon: this._formBuilder.group({
@ -384,11 +365,14 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
}
__onClickAddBtn(event: MouseEvent): void {
// Open the dialog and save the reference of it
const dialogRef = this._fuseConfirmationService.open();
const dialogRef = this._fuseConfirmationService.open(
this.registConfigForm.value
);
dialogRef.afterClosed().subscribe((result: AddComposeResult) => {
console.log('Compose dialog was closed!');
if (!!result.choice) {
/* const dialogRef = this._matDialog.open(AddComposeComponent); */
dialogRef.afterClosed().subscribe((result) => {
if (result === 'confirmed') {
if (!!this.registSelection.hasValue()) {
this.registSelection.selected.forEach((m: MemberModel) => {
this._memberReffererService.createMemberReferrer(m.getId());
@ -399,18 +383,27 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
}
__onClickRemoveBtn(event: MouseEvent): void {
// Open the dialog and save the reference of it
const dialogRef = this._fuseConfirmationService.open();
const dialogRef = this._fuseConfirmationService.open(
this.removeConfigForm.value
);
// Subscribe to afterClosed from the dialog reference
dialogRef.afterClosed().subscribe((result) => {
console.log(result);
if (result === 'confirmed') {
}
});
}
__getRefererMember(member: MemberModel): string {
__getParentUserName(parentId: string): string {
/* console.log(member.getReferrerMember()?.getUsername());
const name = member.getReferrerMember()?.getUsername(); */
return '없음';
const find = this.listMembers.find((m) => m.getId() === parentId);
return !!find ? find.getUsername() : '없음';
}
__getMemberClassName(info: MemberReferrerModel): string {
console.log(info.getMember()?.getUsername());
return '매장';
}
}

View File

@ -1,46 +0,0 @@
<div class="flex flex-col max-w-240 md:min-w-160 max-h-screen -m-6">
<!-- Header -->
<div
class="flex flex-0 items-center justify-between h-16 pr-3 sm:pr-5 pl-6 sm:pl-8 bg-primary text-on-primary"
>
<div class="text-lg font-medium">알림</div>
<button mat-icon-button (click)="selectAndClose(false)" [tabIndex]="-1">
<mat-icon
class="text-current"
[svgIcon]="'heroicons_outline:x'"
></mat-icon>
</button>
</div>
<!-- Compose form -->
<form
class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto"
[formGroup]="composeForm"
>
<div>
<span class="font-semibold mb-2">추천인으로 추가하시겠습니까?</span>
</div>
<div
class="flex flex-col sm:flex-row sm:items-center justify-between mt-4 sm:mt-6"
>
<div class="flex items-center mt-4 sm:mt-0">
<!-- Save as draft -->
<button
class="sm:mx-3"
mat-stroked-button
(click)="selectAndClose(true)"
>
<span>등록</span>
</button>
<!-- Save as draft -->
<button
class="sm:mx-3"
mat-stroked-button
(click)="selectAndClose(false)"
>
<span>취소</span>
</button>
</div>
</div>
</form>
</div>

View File

@ -1,73 +0,0 @@
import {
ChangeDetectorRef,
Component,
Inject,
OnInit,
ViewEncapsulation,
} from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { SiteService } from 'app/modules/polyglot/site/services/site.service';
import { IdentityService } from 'app/modules/polyglot/identity/services/identity.service';
import { Site } from 'app/modules/proto/models/site_pb';
export interface AddComposeData {
price: string;
memo: string;
}
export interface AddComposeResult {
choice: boolean;
}
@Component({
selector: 'app-add-compose',
templateUrl: './add-compose.component.html',
encapsulation: ViewEncapsulation.None,
})
export class AddComposeComponent implements OnInit {
composeForm!: FormGroup;
sites: any[] = [];
// quillModules: any = {
// toolbar: [
// ['bold', 'italic', 'underline'],
// [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
// ['clean'],
// ],
// };
/**
* Constructor
*/
constructor(
public matDialogRef: MatDialogRef<AddComposeComponent>,
@Inject(MAT_DIALOG_DATA) public data: AddComposeData,
private _formBuilder: FormBuilder,
private _identityService: IdentityService,
private _changeDetectorRef: ChangeDetectorRef
) {}
// -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks
// -----------------------------------------------------------------------------------------------------
/**
* On init
*/
ngOnInit(): void {
// Create the form
this.composeForm = this._formBuilder.group({
price: ['', [Validators.required]],
memo: ['', [Validators.required]],
});
}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
selectAndClose(choice: boolean): void {
this.matDialogRef.close({
choice,
});
}
}

View File

@ -1,38 +0,0 @@
<div class="flex flex-col max-w-240 md:min-w-160 max-h-screen -m-6">
<!-- Header -->
<div
class="flex flex-0 items-center justify-between h-16 pr-3 sm:pr-5 pl-6 sm:pl-8 bg-primary text-on-primary"
>
<div class="text-lg font-medium">알림</div>
<button mat-icon-button (click)="saveAndClose()" [tabIndex]="-1">
<mat-icon
class="text-current"
[svgIcon]="'heroicons_outline:x'"
></mat-icon>
</button>
</div>
<!-- Compose form -->
<form
class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto"
[formGroup]="composeForm"
>
<div>
<span class="font-semibold mb-2">삭제하시겠습니까?</span>
</div>
<div
class="flex flex-col sm:flex-row sm:items-center justify-between mt-4 sm:mt-6"
>
<div class="flex items-center mt-4 sm:mt-0">
<!-- Save as draft -->
<button class="sm:mx-3" mat-stroked-button (click)="saveAsDraft()">
<span>OK</span>
</button>
<!-- Save as draft -->
<button class="sm:mx-3" mat-stroked-button (click)="saveAsDraft()">
<span>CANCEL</span>
</button>
</div>
</div>
</form>
</div>

View File

@ -1,94 +0,0 @@
import {
ChangeDetectorRef,
Component,
Inject,
OnInit,
ViewEncapsulation,
} from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { SiteService } from 'app/modules/polyglot/site/services/site.service';
import { IdentityService } from 'app/modules/polyglot/identity/services/identity.service';
import { Site } from 'app/modules/proto/models/site_pb';
export interface DeleteComposeData {
price: string;
memo: string;
}
export interface DeleteComposeResult {
price: string;
memo: string;
}
@Component({
selector: 'app-delete-compose',
templateUrl: './delete-compose.component.html',
encapsulation: ViewEncapsulation.None,
})
export class DeleteComposeComponent implements OnInit {
composeForm!: FormGroup;
sites: any[] = [];
// quillModules: any = {
// toolbar: [
// ['bold', 'italic', 'underline'],
// [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
// ['clean'],
// ],
// };
/**
* Constructor
*/
constructor(
public matDialogRef: MatDialogRef<DeleteComposeComponent>,
@Inject(MAT_DIALOG_DATA) public data: DeleteComposeData,
private _formBuilder: FormBuilder,
private _identityService: IdentityService,
private _changeDetectorRef: ChangeDetectorRef
) {}
// -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks
// -----------------------------------------------------------------------------------------------------
/**
* On init
*/
ngOnInit(): void {
// Create the form
this.composeForm = this._formBuilder.group({
price: ['', [Validators.required]],
memo: ['', [Validators.required]],
});
}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Save and close
*/
saveAndClose(): void {
// Save the message as a draft
this.saveAsDraft();
// Close the dialog
this.matDialogRef.close();
}
/**
* Discard the message
*/
discard(): void {}
/**
* Save the message as a draft
*/
saveAsDraft(): void {}
/**
* Send the message
*/
send(): void {}
}

View File

@ -1,9 +0,0 @@
import { RegistComposeComponent } from './regist-compose.component';
import { AddComposeComponent } from './add-compose.component';
import { DeleteComposeComponent } from './delete-compose.component';
export const COMPOSE = [
RegistComposeComponent,
AddComposeComponent,
DeleteComposeComponent,
];

View File

@ -1,111 +0,0 @@
<div class="flex flex-col max-w-240 md:min-w-160 max-h-screen -m-6">
<!-- Header -->
<div
class="flex flex-0 items-center justify-between h-16 pr-3 sm:pr-5 pl-6 sm:pl-8 bg-primary text-on-primary"
>
<div class="text-lg font-medium">대본사 생성</div>
<button mat-icon-button (click)="saveAndClose()" [tabIndex]="-1">
<mat-icon
class="text-current"
[svgIcon]="'heroicons_outline:x'"
></mat-icon>
</button>
</div>
<!-- Compose form -->
<form
class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto"
[formGroup]="composeForm"
>
<!-- To -->
<mat-form-field>
<mat-label>파트너아이디</mat-label>
<input matInput [formControlName]="'partnerId'" />
</mat-form-field>
<!-- Cc -->
<mat-form-field>
<mat-label>사이트명</mat-label>
<input matInput [formControlName]="'siteName'" />
</mat-form-field>
<!-- Bcc -->
<mat-form-field>
<mat-label>회원 아이디</mat-label>
<input matInput [formControlName]="'signinId'" />
</mat-form-field>
<!-- Subject -->
<mat-form-field>
<mat-label>비밀번호</mat-label>
<input matInput [formControlName]="'password'" />
</mat-form-field>
<mat-form-field>
<mat-label>환전 비밀번호</mat-label>
<input matInput [formControlName]="'exchangePw'" />
</mat-form-field>
<mat-form-field>
<mat-label>닉네임</mat-label>
<input matInput [formControlName]="'nickname'" />
</mat-form-field>
<mat-form-field>
<mat-label>정산종류</mat-label>
<input matInput [formControlName]="'calculateType'" />
</mat-form-field>
<mat-form-field>
<mat-label>휴대폰번호</mat-label>
<input matInput [formControlName]="'phoneNumber'" />
</mat-form-field>
<mat-form-field>
<mat-label>은행명</mat-label>
<input matInput [formControlName]="'bankName'" />
</mat-form-field>
<mat-form-field>
<mat-label>계좌번호</mat-label>
<input matInput [formControlName]="'accountNumber'" />
</mat-form-field>
<mat-form-field>
<mat-label>예금주</mat-label>
<input matInput [formControlName]="'accountHolder'" />
</mat-form-field>
<!-- Body -->
<!-- <quill-editor
class="mt-2"
[formControlName]="'body'"
[modules]="quillModules"
></quill-editor> -->
<!-- Actions -->
<div
class="flex flex-col sm:flex-row sm:items-center justify-between mt-4 sm:mt-6"
>
<div class="flex items-center mt-4 sm:mt-0">
<!-- Discard -->
<button class="ml-auto sm:ml-0" mat-stroked-button (click)="discard()">
Discard
</button>
<!-- Save as draft -->
<button class="sm:mx-3" mat-stroked-button (click)="saveAsDraft()">
<span>Save as draft</span>
</button>
<!-- Send -->
<button
class="order-first sm:order-last"
mat-flat-button
[color]="'primary'"
(click)="send()"
>
Send
</button>
</div>
</div>
</form>
</div>

View File

@ -1,100 +0,0 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef } from '@angular/material/dialog';
@Component({
selector: 'app-regist-compose',
templateUrl: './regist-compose.component.html',
encapsulation: ViewEncapsulation.None,
})
export class RegistComposeComponent implements OnInit {
composeForm!: FormGroup;
copyFields: { cc: boolean; bcc: boolean } = {
cc: false,
bcc: false,
};
// quillModules: any = {
// toolbar: [
// ['bold', 'italic', 'underline'],
// [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
// ['clean'],
// ],
// };
/**
* Constructor
*/
constructor(
public matDialogRef: MatDialogRef<RegistComposeComponent>,
private _formBuilder: FormBuilder
) {}
// -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks
// -----------------------------------------------------------------------------------------------------
/**
* On init
*/
ngOnInit(): void {
// Create the form
this.composeForm = this._formBuilder.group({
partnerId: [{ value: 'kgon4', disabled: true }],
siteName: [''],
signinId: [''],
password: [''],
exchangePw: [''],
nickname: [''],
calculateType: [''],
phoneNumber: [''],
bankName: [''],
accountNumber: [''],
accountHolder: [''],
});
}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Show the copy field with the given field name
*
* @param name
*/
showCopyField(name: string): void {
// Return if the name is not one of the available names
if (name !== 'cc' && name !== 'bcc') {
return;
}
// Show the field
this.copyFields[name] = true;
}
/**
* Save and close
*/
saveAndClose(): void {
// Save the message as a draft
this.saveAsDraft();
// Close the dialog
this.matDialogRef.close();
}
/**
* Discard the message
*/
discard(): void {}
/**
* Save the message as a draft
*/
saveAsDraft(): void {}
/**
* Send the message
*/
send(): void {}
}

View File

@ -21,12 +21,11 @@ import { TranslocoModule } from '@ngneat/transloco';
import { SharedModule } from 'app/shared/shared.module';
import { COMPONENTS } from './components';
import { COMPOSE } from './compose';
import { partnerRecommendationRoutes } from './partner-recommendation.routing';
@NgModule({
declarations: [COMPONENTS, COMPOSE],
declarations: [COMPONENTS],
imports: [
TranslocoModule,
SharedModule,