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-12 08:15:32 +00:00
commit aaf9664eed
10 changed files with 225 additions and 38 deletions

View File

@ -90,7 +90,9 @@
관리
</div>
<mat-menu #menu="matMenu">
<button mat-menu-item>보유금지급/회수</button>
<button mat-menu-item (click)="__onClickCash($event)">
보유금지급/회수
</button>
<button mat-menu-item>수수료설정</button>
<button mat-menu-item>콤프지급/회수</button>
<button mat-menu-item>쿠폰머니지급/회수</button>
@ -167,7 +169,7 @@
mat-flat-button
class="bet-mat-small-8"
[color]="'primary'"
(click)="__onClickRegist($event)"
(click)="__onClickRegist($event, partner)"
>
대본등록
</button>

View File

@ -14,13 +14,16 @@ import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import {
debounceTime,
delay,
map,
merge,
Observable,
of,
startWith,
Subject,
switchMap,
takeUntil,
timer,
} from 'rxjs';
import { fuseAnimations } from '@fuse/animations';
import { FuseConfirmationService } from '@fuse/services/confirmation';
@ -30,6 +33,7 @@ import { PartnerPagination } from '../models/partner-pagination';
import { PartnerService } from '../services/partner.service';
import { ActivatedRoute, Router } from '@angular/router';
import { RegistComposeComponent } from '../compose/regist-compose.component';
import { CashComposeComponent } from '../compose/cash-compose.component';
import { MatDialog } from '@angular/material/dialog';
import { SiteService } from 'app/modules/polyglot/domain/services/site.service';
@ -158,7 +162,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
});
// Mark for check
this._changeDetectorRef.markForCheck();
this._changeDetectorRef.detectChanges();
// If the partner changes the sort order...
this._sort.sortChange
@ -234,9 +238,18 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
return item.id || index;
}
__onClickRegist(event: MouseEvent): void {
__onClickRegist(event: MouseEvent, partner: MemberModel): void {
const dialogRef = this._matDialog.open(RegistComposeComponent, {
data: { title: '대본', parentId: 'kgon2', sites: this.sites },
data: { title: '대본 등록하기', parent: partner, sites: this.sites },
});
dialogRef.afterClosed().subscribe((result) => {
console.log('Compose dialog was closed!');
});
}
__onClickCash(event: MouseEvent): void {
const dialogRef = this._matDialog.open(CashComposeComponent, {
data: { price: '', memo: '' },
});
dialogRef.afterClosed().subscribe((result) => {

View File

@ -0,0 +1,88 @@
<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>
<mat-radio-group
class="flex flex-col w-1/3 pr-2"
[color]="'primary'"
[value]="'cash'"
>
<mat-radio-button class="mb-2" [value]="'cash'">
캐쉬
</mat-radio-button>
</mat-radio-group>
</div>
<div>
<span class="font-semibold mb-2">추가/삭제</span>
<mat-radio-group
class="flex flex-col w-1/3 pr-2"
[color]="'primary'"
[value]="'give'"
>
<mat-radio-button class="mb-2" [value]="'give'">
지급
</mat-radio-button>
<mat-radio-button class="mb-2" [value]="'take'">
회수
</mat-radio-button>
</mat-radio-group>
</div>
<!-- To -->
<mat-form-field>
<mat-label>입력금액</mat-label>
<input matInput [formControlName]="'price'" />
</mat-form-field>
<!-- <div *ngFor="let f of sites">{{ f.getUrl() }}</div> -->
<!-- Cc -->
<mat-form-field>
<mat-label>메모</mat-label>
<input matInput [formControlName]="'memo'" />
</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">
<!-- Send -->
<button
class="order-first sm:order-last"
mat-flat-button
[color]="'primary'"
(click)="send()"
>
캐쉬충환전
</button>
<!-- Save as draft -->
<button class="sm:mx-3" mat-stroked-button (click)="saveAsDraft()">
<span>닫기</span>
</button>
</div>
</div>
</form>
</div>

View File

@ -0,0 +1,94 @@
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/domain/services/site.service';
import { IdentityService } from 'app/modules/polyglot/member/services/identity.service';
import { Site } from 'app/modules/protobuf/models/domain/site_pb';
export interface CashComposeData {
price: string;
memo: string;
}
export interface CashComposeResult {
price: string;
memo: string;
}
@Component({
selector: 'app-cash-compose',
templateUrl: './cash-compose.component.html',
encapsulation: ViewEncapsulation.None,
})
export class CashComposeComponent implements OnInit {
composeForm!: FormGroup;
sites: any[] = [];
// quillModules: any = {
// toolbar: [
// ['bold', 'italic', 'underline'],
// [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
// ['clean'],
// ],
// };
/**
* Constructor
*/
constructor(
public matDialogRef: MatDialogRef<CashComposeComponent>,
@Inject(MAT_DIALOG_DATA) public data: CashComposeData,
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,3 +1,4 @@
import { RegistComposeComponent } from './regist-compose.component';
import { CashComposeComponent } from './cash-compose.component';
export const COMPOSE = [RegistComposeComponent];
export const COMPOSE = [RegistComposeComponent, CashComposeComponent];

View File

@ -25,25 +25,26 @@
<!-- <div *ngFor="let f of sites">{{ f.getUrl() }}</div> -->
<!-- Cc -->
<mat-form-field>
<!-- <mat-form-field>
<mat-label>사이트명</mat-label>
<input matInput [formControlName]="'siteName'" />
<mat-error *ngIf="composeForm.get('siteName')?.hasError('required')">
사이트명은 필수 입력입니다.
</mat-error>
</mat-form-field>
</mat-form-field> -->
<!-- <mat-form-field>
<mat-form-field>
<mat-label>사이트명</mat-label>
<mat-select [formControlName]="'siteName'" placeholder="사이트 선택">
<mat-option *ngFor="let site of sites" [value]="site.getId()">
<mat-option *ngFor="let site of data.sites" [value]="site.getId()">
{{ site.getUrl() }}
</mat-option>
</mat-select>
<mat-error *ngIf="composeForm.get('siteName')?.hasError('required')">
사이트명은 필수 입력입니다.
</mat-error>
</mat-form-field> -->
</mat-form-field>
<!-- Bcc -->
<mat-form-field>

View File

@ -10,10 +10,11 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { SiteService } from 'app/modules/polyglot/domain/services/site.service';
import { IdentityService } from 'app/modules/polyglot/member/services/identity.service';
import { Site } from 'app/modules/protobuf/models/domain/site_pb';
import { MemberModel } from 'app/modules/protobuf/models/member/member_pb';
export interface RegistComposeData {
title: string;
parentId: string;
parent: MemberModel;
sites: Site[];
}
export interface RegistComposeResult {
@ -56,10 +57,7 @@ export class RegistComposeComponent implements OnInit {
private _identityService: IdentityService,
private _changeDetectorRef: ChangeDetectorRef
) {
this.data.sites.map((v) => {
const a = v.toObject();
this.sites.push(a);
});
this.data.sites.forEach((v) => console.log(v.getUrl()));
}
// -----------------------------------------------------------------------------------------------------
@ -72,7 +70,7 @@ export class RegistComposeComponent implements OnInit {
ngOnInit(): void {
// Create the form
this.composeForm = this._formBuilder.group({
partnerId: [{ value: this.data.parentId, disabled: true }],
partnerId: [{ value: this.data.parent.getUsername(), disabled: true }],
siteName: ['', [Validators.required]],
signinId: ['', [Validators.required]],
password: ['', [Validators.required]],
@ -114,7 +112,9 @@ export class RegistComposeComponent implements OnInit {
/**
* Send the message
*/
send(): void {}
send(): void {
console.log(this.composeForm.value);
}
__checkSigninId(event: FocusEvent): void {
const signinId = this.composeForm.get('signinId')?.value;
@ -127,7 +127,7 @@ export class RegistComposeComponent implements OnInit {
.get('signinId')
?.setErrors({ signinIdDuplicate: true });
}
this._changeDetectorRef.markForCheck();
// this._changeDetectorRef.markForCheck();
});
}
@ -142,23 +142,7 @@ export class RegistComposeComponent implements OnInit {
.get('nickname')
?.setErrors({ nicknameDuplicate: true });
}
this._changeDetectorRef.markForCheck();
// this._changeDetectorRef.markForCheck();
});
}
// checkSameName(): ValidatorFn {
// return (control: AbstractControl): { [key: string]: any } | null => {
// if (
// !control ||
// !control.value ||
// !this.groupList ||
// 0 === this.groupList.length
// ) {
// return null;
// }
// const v = (control.value as string).trim();
// const ban = -1 < this.groupList.findIndex((g) => g.name === v);
// return ban ? { groupNameSamed: { value: control.value } } : null;
// };
// }
}

View File

@ -15,6 +15,7 @@ import { MatSelectModule } from '@angular/material/select';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatGridListModule } from '@angular/material/grid-list';
import { MatMenuModule } from '@angular/material/menu';
import { MatRadioModule } from '@angular/material/radio';
import { TranslocoModule } from '@ngneat/transloco';
@ -24,6 +25,7 @@ import { COMPONENTS } from './components';
import { COMPOSE } from './compose';
import { partnerRoutes } from './partner.routing';
import { MatDialogModule } from '@angular/material/dialog';
@NgModule({
declarations: [COMPONENTS, COMPOSE],
@ -35,6 +37,7 @@ import { partnerRoutes } from './partner.routing';
ReactiveFormsModule,
FormsModule,
MatDialogModule,
MatButtonModule,
MatFormFieldModule,
MatIconModule,
@ -47,6 +50,7 @@ import { partnerRoutes } from './partner.routing';
MatTooltipModule,
MatGridListModule,
MatMenuModule,
MatRadioModule,
],
})
export class PartnerModule {}

View File

@ -4,7 +4,7 @@ export const environment: Environment = {
production: true,
nats: {
connectionOptions: {
servers: ['ws://192.168.50.200:8088'],
servers: ['ws://192.168.50.208:8088'],
},
},
};

View File

@ -8,7 +8,7 @@ export const environment: Environment = {
production: false,
nats: {
connectionOptions: {
servers: ['ws://192.168.50.200:8088'],
servers: ['ws://192.168.50.208:8088'],
},
},
};