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-14 12:28:39 +00:00
commit 47b3333bad
6 changed files with 262 additions and 26 deletions

View File

@ -10,7 +10,7 @@
<mat-progress-bar [mode]="'indeterminate'"></mat-progress-bar> <mat-progress-bar [mode]="'indeterminate'"></mat-progress-bar>
</div> </div>
<!-- Title --> <!-- Title -->
<div class="text-4xl font-extrabold tracking-tight">전체목록</div> <div class="text-4xl font-extrabold tracking-tight">{{ title }}</div>
<!-- Actions --> <!-- Actions -->
<div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4"> <div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4">
<!-- Search --> <!-- Search -->
@ -196,7 +196,7 @@
[color]="'primary'" [color]="'primary'"
(click)="__onClickRegist($event, partner)" (click)="__onClickRegist($event, partner)"
> >
대본등록 {{ btnTitle }}
</button> </button>
</div> </div>
</div> </div>

View File

@ -100,9 +100,13 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
searchInputControl = new FormControl(); searchInputControl = new FormControl();
selectedPartner?: Partner; selectedPartner?: Partner;
pagination?: PartnerPagination; pagination?: PartnerPagination;
sites!: Site[];
__members: MemberModel[] = []; __members: MemberModel[] = [];
title: string = '';
btnTitle: string = '';
memberClassId = '';
private _unsubscribeAll: Subject<any> = new Subject<any>(); private _unsubscribeAll: Subject<any> = new Subject<any>();
/** /**
@ -115,10 +119,46 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
private _activatedRoute: ActivatedRoute, private _activatedRoute: ActivatedRoute,
private _partnerService: PartnerService, private _partnerService: PartnerService,
private __memberService: MemberService, private __memberService: MemberService,
private _siteService: SiteService,
private router: Router, private router: Router,
private _matDialog: MatDialog private _matDialog: MatDialog
) {} ) {
switch (this.router.url) {
case '/member/partner/all':
this.title = '전체목록';
this.btnTitle = '대본등록';
this.memberClassId = 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb';
break;
case '/member/partner/main-office':
this.title = '본사목록';
this.btnTitle = '대본등록';
this.memberClassId = 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb';
break;
case '/member/partner/branch':
this.title = '대본목록';
this.btnTitle = '부본등록';
this.memberClassId = 'f25a17e9-5c5f-4e9c-bf80-92a9cedf829c';
break;
case '/member/partner/division':
this.title = '부본목록';
this.btnTitle = '총판등록';
this.memberClassId = 'cac7b897-2549-4f04-8415-8868f1dcb1da';
break;
case '/member/partner/office':
this.title = '총판목록';
this.btnTitle = '매장등록';
this.memberClassId = 'e11cac11-3825-4f4e-9cd5-39367f23f973';
break;
case '/member/partner/store':
this.title = '매장목록';
this.btnTitle = '회원등록';
this.memberClassId = '4598f07a-86d1-42a4-b038-25706683a7cd';
break;
default:
console.log(this.router.url);
break;
}
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks // @ Lifecycle hooks
@ -139,12 +179,6 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
this._changeDetectorRef.markForCheck(); this._changeDetectorRef.markForCheck();
}); });
this._siteService
.listSites()
.then((result) => {
this.sites = result.getSitesList();
})
.catch((reson) => console.log(reson));
// Get the products // Get the products
this._activatedRoute.data.subscribe((data) => { this._activatedRoute.data.subscribe((data) => {
@ -257,7 +291,11 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
__onClickRegist(event: MouseEvent, partner: MemberModel): void { __onClickRegist(event: MouseEvent, partner: MemberModel): void {
const dialogRef = this._matDialog.open(RegistComposeComponent, { const dialogRef = this._matDialog.open(RegistComposeComponent, {
data: { title: '대본 등록', parent: partner, sites: this.sites }, data: {
title: this.btnTitle,
parent: partner,
classId: this.memberClassId,
},
}); });
dialogRef dialogRef

View File

@ -48,7 +48,7 @@
<mat-label>사이트명</mat-label> <mat-label>사이트명</mat-label>
<mat-select [formControlName]="'siteName'" placeholder="사이트 선택"> <mat-select [formControlName]="'siteName'" placeholder="사이트 선택">
<mat-option *ngFor="let site of data.sites" [value]="site.getId()"> <mat-option *ngFor="let site of sites" [value]="site.getId()">
{{ site.getUrl() }} {{ site.getUrl() }}
</mat-option> </mat-option>
</mat-select> </mat-select>
@ -140,10 +140,10 @@
<mat-label>은행명</mat-label> <mat-label>은행명</mat-label>
<mat-select [formControlName]="'bankName'" placeholder="은행 선택"> <mat-select [formControlName]="'bankName'" placeholder="은행 선택">
<mat-option *ngFor="let bank of data.banks" [value]="bank.getId()"> <mat-option *ngFor="let bank of banks" [value]="bank.getId()">
{{ bank.getName() }} {{ bank.getName() }}
</mat-option> </mat-option>
<mat-option [value]="'0'"> 국민은행 </mat-option> <!-- <mat-option [value]="'0'"> 국민은행 </mat-option> -->
</mat-select> </mat-select>
<mat-error *ngIf="composeForm.get('bankName')?.hasError('required')"> <mat-error *ngIf="composeForm.get('bankName')?.hasError('required')">
은행명은 필수 입력입니다. 은행명은 필수 입력입니다.

View File

@ -19,12 +19,12 @@ import { Bank } from 'app/modules/proto/models/bank_pb';
import { Site } from 'app/modules/proto/models/site_pb'; import { Site } from 'app/modules/proto/models/site_pb';
import { MemberModel } from 'app/modules/proto/models/member_pb'; import { MemberModel } from 'app/modules/proto/models/member_pb';
import { fuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { BankService } from 'app/modules/polyglot/bank/services/bank.service';
export interface RegistComposeData { export interface RegistComposeData {
title: string; title: string;
parent: MemberModel; parent: MemberModel;
sites: Site[]; classId: string;
banks: Bank[];
} }
export interface RegistComposeResult { export interface RegistComposeResult {
choice: boolean; choice: boolean;
@ -38,6 +38,8 @@ export interface RegistComposeResult {
}) })
export class RegistComposeComponent implements OnInit { export class RegistComposeComponent implements OnInit {
composeForm!: FormGroup; composeForm!: FormGroup;
sites!: Site[];
banks!: Bank[];
alert: { type: FuseAlertType; message: string } = { alert: { type: FuseAlertType; message: string } = {
type: 'success', type: 'success',
@ -50,12 +52,14 @@ export class RegistComposeComponent implements OnInit {
* Constructor * Constructor
*/ */
constructor( constructor(
private _changeDetectorRef: ChangeDetectorRef,
public matDialogRef: MatDialogRef<RegistComposeComponent>, public matDialogRef: MatDialogRef<RegistComposeComponent>,
@Inject(MAT_DIALOG_DATA) public data: RegistComposeData, @Inject(MAT_DIALOG_DATA) public data: RegistComposeData,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
private _identityService: IdentityService, private _identityService: IdentityService,
private _memberService: MemberService, private _memberService: MemberService,
private _changeDetectorRef: ChangeDetectorRef private _siteService: SiteService,
private _bankService: BankService
) {} ) {}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -71,7 +75,7 @@ export class RegistComposeComponent implements OnInit {
partnerId: [{ value: this.data.parent.getUsername(), disabled: true }], partnerId: [{ value: this.data.parent.getUsername(), disabled: true }],
siteName: ['', [Validators.required]], siteName: ['', [Validators.required]],
signinId: ['', [Validators.required]], signinId: ['', [Validators.required]],
password: ['', [Validators.required]], password: ['beteran', [Validators.required]],
exchangePw: ['', [Validators.required]], exchangePw: ['', [Validators.required]],
nickname: ['', [Validators.required]], nickname: ['', [Validators.required]],
calculateType: ['', [Validators.required]], calculateType: ['', [Validators.required]],
@ -80,6 +84,20 @@ export class RegistComposeComponent implements OnInit {
accountNumber: ['', [Validators.required]], accountNumber: ['', [Validators.required]],
accountHolder: ['', [Validators.required]], accountHolder: ['', [Validators.required]],
}); });
this._siteService
.listSites()
.then((result) => {
this.sites = result.getSitesList();
})
.catch((reson) => console.log(reson));
this._bankService
.listBanks()
.then((result) => {
this.banks = result.getBanksList();
})
.catch((reson) => console.log(reson));
} }
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -140,7 +158,7 @@ export class RegistComposeComponent implements OnInit {
member.setSiteId(siteName); member.setSiteId(siteName);
member.setUsername(signinId); member.setUsername(signinId);
member.setPassword('beteran'); member.setPassword('beteran');
member.setMemberClassId('ae9b874e-5d0e-4c4d-8432-f45f02691ceb'); member.setMemberClassId(this.data.classId);
member.setMemberLevelId('c56231ac-2120-4a81-a30a-5d41fafb6c57'); member.setMemberLevelId('c56231ac-2120-4a81-a30a-5d41fafb6c57');
member.setReferrerMemberUsername(this.data.parent.getUsername()); member.setReferrerMemberUsername(this.data.parent.getUsername());
member.setNickname(nickname); member.setNickname(nickname);
@ -156,7 +174,7 @@ export class RegistComposeComponent implements OnInit {
this.showAlert = true; this.showAlert = true;
this.alert = { type: 'error', message: '등록에 실패하였습니다.' }; this.alert = { type: 'error', message: '등록에 실패하였습니다.' };
}) })
.finally(() => (this.showAlert = false)); .finally(() => setTimeout(() => this.close(), 5000));
} }
private close(): void { private close(): void {

View File

@ -3,6 +3,11 @@ import { Route } from '@angular/router';
import { ListComponent } from './components/list.component'; import { ListComponent } from './components/list.component';
import { import {
PartnerListForBranchResolver,
PartnerListForDivisionResolver,
PartnerListForMainOfficeResolver,
PartnerListForOfficeResolver,
PartnerListForStoreResolver,
PartnerListResolver, PartnerListResolver,
PartnersResolver, PartnersResolver,
} from './resolvers/partner.resolver'; } from './resolvers/partner.resolver';
@ -24,35 +29,35 @@ export const partnerRoutes: Route[] = [
path: 'main-office', path: 'main-office',
component: ListComponent, component: ListComponent,
resolve: { resolve: {
Partners: PartnersResolver, listPartner: PartnerListForMainOfficeResolver,
}, },
}, },
{ {
path: 'branch', path: 'branch',
component: ListComponent, component: ListComponent,
resolve: { resolve: {
Partners: PartnersResolver, listPartner: PartnerListForBranchResolver,
}, },
}, },
{ {
path: 'division', path: 'division',
component: ListComponent, component: ListComponent,
resolve: { resolve: {
Partners: PartnersResolver, listPartner: PartnerListForDivisionResolver,
}, },
}, },
{ {
path: 'office', path: 'office',
component: ListComponent, component: ListComponent,
resolve: { resolve: {
Partners: PartnersResolver, listPartner: PartnerListForOfficeResolver,
}, },
}, },
{ {
path: 'store', path: 'store',
component: ListComponent, component: ListComponent,
resolve: { resolve: {
Partners: PartnersResolver, listPartner: PartnerListForStoreResolver,
}, },
}, },
]; ];

View File

@ -128,3 +128,178 @@ export class PartnerListResolver implements Resolve<any> {
return this.__memberService.listMembers(req); return this.__memberService.listMembers(req);
} }
} }
@Injectable({
providedIn: 'root',
})
export class PartnerListForMainOfficeResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private __memberService: MemberService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListMembersResponse.Result>
| Promise<ListMembersResponse.Result>
| ListMembersResponse.Result {
let req = new ListMembersRequest();
let search = new ListMembersRequest.Search();
search.setMemberClassId('4b014ef5-3bab-4413-aaf9-b0040a70ec77');
req.setSearch(search);
return this.__memberService.listMembers(req);
}
}
@Injectable({
providedIn: 'root',
})
export class PartnerListForBranchResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private __memberService: MemberService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListMembersResponse.Result>
| Promise<ListMembersResponse.Result>
| ListMembersResponse.Result {
let req = new ListMembersRequest();
let search = new ListMembersRequest.Search();
search.setMemberClassId('ae9b874e-5d0e-4c4d-8432-f45f02691ceb');
req.setSearch(search);
return this.__memberService.listMembers(req);
}
}
@Injectable({
providedIn: 'root',
})
export class PartnerListForDivisionResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private __memberService: MemberService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListMembersResponse.Result>
| Promise<ListMembersResponse.Result>
| ListMembersResponse.Result {
let req = new ListMembersRequest();
let search = new ListMembersRequest.Search();
search.setMemberClassId('f25a17e9-5c5f-4e9c-bf80-92a9cedf829c');
req.setSearch(search);
return this.__memberService.listMembers(req);
}
}
@Injectable({
providedIn: 'root',
})
export class PartnerListForOfficeResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private __memberService: MemberService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListMembersResponse.Result>
| Promise<ListMembersResponse.Result>
| ListMembersResponse.Result {
let req = new ListMembersRequest();
let search = new ListMembersRequest.Search();
search.setMemberClassId('cac7b897-2549-4f04-8415-8868f1dcb1da');
req.setSearch(search);
return this.__memberService.listMembers(req);
}
}
@Injectable({
providedIn: 'root',
})
export class PartnerListForStoreResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private __memberService: MemberService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListMembersResponse.Result>
| Promise<ListMembersResponse.Result>
| ListMembersResponse.Result {
let req = new ListMembersRequest();
let search = new ListMembersRequest.Search();
search.setMemberClassId('e11cac11-3825-4f4e-9cd5-39367f23f973');
req.setSearch(search);
return this.__memberService.listMembers(req);
}
}