쿠폰발행머니로그 page 수정

This commit is contained in:
이담 정 2022-07-20 08:06:46 +00:00
parent fc5141c709
commit e590aaa6f2
16 changed files with 174 additions and 174 deletions

View File

@ -228,11 +228,11 @@ export const appRoutes: Route[] = [
),
},
{
path: 'coupon-moneylog',
path: 'coupon-money-log',
loadChildren: () =>
import(
'app/modules/admin/member/coupon-moneylog/coupon-moneylog.module'
).then((m: any) => m.CouponMoneylogModule),
'app/modules/admin/member/coupon-money-log/coupon-money-log.module'
).then((m: any) => m.CouponMoneyLogModule),
},
{
path: 'coupon-log',

View File

@ -1,13 +1,13 @@
import { Injectable } from '@angular/core';
import { assign, cloneDeep } from 'lodash-es';
import { FuseMockApiService, FuseMockApiUtils } from '@fuse/lib/mock-api';
import { couponMoneylogs as couponMoneylogsData } from './data';
import { couponMoneyLogs as couponMoneyLogsData } from './data';
@Injectable({
providedIn: 'root',
})
export class MemberCouponMoneylogMockApi {
private _couponMoneylogs: any[] = couponMoneylogsData;
export class MemberCouponMoneyLogMockApi {
private _couponMoneyLogs: any[] = couponMoneyLogsData;
/**
* Constructor
@ -26,10 +26,10 @@ export class MemberCouponMoneylogMockApi {
*/
registerHandlers(): void {
// -----------------------------------------------------------------------------------------------------
// @ CouponMoneylogs - GET
// @ CouponMoneyLogs - GET
// -----------------------------------------------------------------------------------------------------
this._fuseMockApiService
.onGet('api/apps/member/coupon-moneylog/coupon-moneylogs', 300)
.onGet('api/apps/member/coupon-money-log/coupon-money-logs', 300)
.reply(({ request }) => {
// Get available queries
const search = request.params.get('search');
@ -38,12 +38,12 @@ export class MemberCouponMoneylogMockApi {
const page = parseInt(request.params.get('page') ?? '1', 10);
const size = parseInt(request.params.get('size') ?? '10', 10);
// Clone the couponMoneylogs
let couponMoneylogs: any[] | null = cloneDeep(this._couponMoneylogs);
// Clone the couponMoneyLogs
let couponMoneyLogs: any[] | null = cloneDeep(this._couponMoneyLogs);
// Sort the couponMoneylogs
// Sort the couponMoneyLogs
if (sort === 'sku' || sort === 'name' || sort === 'active') {
couponMoneylogs.sort((a, b) => {
couponMoneyLogs.sort((a, b) => {
const fieldA = a[sort].toString().toUpperCase();
const fieldB = b[sort].toString().toUpperCase();
return order === 'asc'
@ -51,15 +51,15 @@ export class MemberCouponMoneylogMockApi {
: fieldB.localeCompare(fieldA);
});
} else {
couponMoneylogs.sort((a, b) =>
couponMoneyLogs.sort((a, b) =>
order === 'asc' ? a[sort] - b[sort] : b[sort] - a[sort]
);
}
// If search exists...
if (search) {
// Filter the couponMoneylogs
couponMoneylogs = couponMoneylogs.filter(
// Filter the couponMoneyLogs
couponMoneyLogs = couponMoneyLogs.filter(
(contact: any) =>
contact.name &&
contact.name.toLowerCase().includes(search.toLowerCase())
@ -67,32 +67,32 @@ export class MemberCouponMoneylogMockApi {
}
// Paginate - Start
const couponMoneylogsLength = couponMoneylogs.length;
const couponMoneyLogsLength = couponMoneyLogs.length;
// Calculate pagination details
const begin = page * size;
const end = Math.min(size * (page + 1), couponMoneylogsLength);
const lastPage = Math.max(Math.ceil(couponMoneylogsLength / size), 1);
const end = Math.min(size * (page + 1), couponMoneyLogsLength);
const lastPage = Math.max(Math.ceil(couponMoneyLogsLength / size), 1);
// Prepare the pagination object
let pagination = {};
// If the requested page number is bigger than
// the last possible page number, return null for
// couponMoneylogs but also send the last possible page so
// couponMoneyLogs but also send the last possible page so
// the app can navigate to there
if (page > lastPage) {
couponMoneylogs = null;
couponMoneyLogs = null;
pagination = {
lastPage,
};
} else {
// Paginate the results by size
couponMoneylogs = couponMoneylogs.slice(begin, end);
couponMoneyLogs = couponMoneyLogs.slice(begin, end);
// Prepare the pagination mock-api
pagination = {
length: couponMoneylogsLength,
length: couponMoneyLogsLength,
size: size,
page: page,
lastPage: lastPage,
@ -105,41 +105,41 @@ export class MemberCouponMoneylogMockApi {
return [
200,
{
couponMoneylogs,
couponMoneyLogs,
pagination,
},
];
});
// -----------------------------------------------------------------------------------------------------
// @ CouponMoneylog - GET
// @ CouponMoneyLog - GET
// -----------------------------------------------------------------------------------------------------
this._fuseMockApiService
.onGet('api/apps/member/coupon-moneylog/coupon-moneylog')
.onGet('api/apps/member/coupon-money-log/coupon-money-log')
.reply(({ request }) => {
// Get the id from the params
const id = request.params.get('id');
// Clone the couponMoneylogs
const couponMoneylogs = cloneDeep(this._couponMoneylogs);
// Clone the couponMoneyLogs
const couponMoneyLogs = cloneDeep(this._couponMoneyLogs);
// Find the couponMoneylog
const couponMoneylog = couponMoneylogs.find(
// Find the couponMoneyLog
const couponMoneyLog = couponMoneyLogs.find(
(item: any) => item.id === id
);
// Return the response
return [200, couponMoneylog];
return [200, couponMoneyLog];
});
// -----------------------------------------------------------------------------------------------------
// @ CouponMoneylog - POST
// @ CouponMoneyLog - POST
// -----------------------------------------------------------------------------------------------------
this._fuseMockApiService
.onPost('api/apps/member/coupon-moneylog/coupon-moneylog')
.onPost('api/apps/member/coupon-money-log/coupon-money-log')
.reply(() => {
// Generate a new couponMoneylog
const newCouponMoneylog = {
// Generate a new couponMoneyLog
const newCouponMoneyLog = {
id: FuseMockApiUtils.guid(),
category: '',
name: 'A New User',
@ -161,58 +161,58 @@ export class MemberCouponMoneylogMockApi {
active: false,
};
// Unshift the new couponMoneylog
this._couponMoneylogs.unshift(newCouponMoneylog);
// Unshift the new couponMoneyLog
this._couponMoneyLogs.unshift(newCouponMoneyLog);
// Return the response
return [200, newCouponMoneylog];
return [200, newCouponMoneyLog];
});
// -----------------------------------------------------------------------------------------------------
// @ CouponMoneylog - PATCH
// @ CouponMoneyLog - PATCH
// -----------------------------------------------------------------------------------------------------
this._fuseMockApiService
.onPatch('api/apps/member/coupon-moneylog/coupon-moneylog')
.onPatch('api/apps/member/coupon-money-log/coupon-money-log')
.reply(({ request }) => {
// Get the id and couponMoneylog
// Get the id and couponMoneyLog
const id = request.body.id;
const couponMoneylog = cloneDeep(request.body.couponMoneylog);
const couponMoneyLog = cloneDeep(request.body.couponMoneyLog);
// Prepare the updated couponMoneylog
let updatedCouponMoneylog = null;
// Prepare the updated couponMoneyLog
let updatedCouponMoneyLog = null;
// Find the couponMoneylog and update it
this._couponMoneylogs.forEach((item, index, couponMoneylogs) => {
// Find the couponMoneyLog and update it
this._couponMoneyLogs.forEach((item, index, couponMoneyLogs) => {
if (item.id === id) {
// Update the couponMoneylog
couponMoneylogs[index] = assign(
// Update the couponMoneyLog
couponMoneyLogs[index] = assign(
{},
couponMoneylogs[index],
couponMoneylog
couponMoneyLogs[index],
couponMoneyLog
);
// Store the updated couponMoneylog
updatedCouponMoneylog = couponMoneylogs[index];
// Store the updated couponMoneyLog
updatedCouponMoneyLog = couponMoneyLogs[index];
}
});
// Return the response
return [200, updatedCouponMoneylog];
return [200, updatedCouponMoneyLog];
});
// -----------------------------------------------------------------------------------------------------
// @ CouponMoneylog - DELETE
// @ CouponMoneyLog - DELETE
// -----------------------------------------------------------------------------------------------------
this._fuseMockApiService
.onDelete('api/apps/member/coupon-moneylog/coupon-moneylog')
.onDelete('api/apps/member/coupon-money-log/coupon-money-log')
.reply(({ request }) => {
// Get the id
const id = request.params.get('id');
// Find the couponMoneylog and delete it
this._couponMoneylogs.forEach((item, index) => {
// Find the couponMoneyLog and delete it
this._couponMoneyLogs.forEach((item, index) => {
if (item.id === id) {
this._couponMoneylogs.splice(index, 1);
this._couponMoneyLogs.splice(index, 1);
}
});

View File

@ -1,6 +1,6 @@
/* eslint-disable */
export const couponMoneylogs = [
export const couponMoneyLogs = [
{
id: 'on00',
totalPartnerCount: '5',

View File

@ -133,11 +133,11 @@ export const defaultNavigation: FuseNavigationItem[] = [
link: '/member/coupon',
},
{
id: 'member.coupon-moneylog',
title: 'Coupon Moneylog',
id: 'member.coupon-money-log',
title: 'Coupon Money Log',
type: 'basic',
icon: 'heroicons_outline:academic-cap',
link: '/member/coupon-moneylog',
link: '/member/coupon-money-log',
},
{
id: 'member.coupon-log',

View File

@ -23,7 +23,7 @@ import { MemberPartnerOfficeMockApi } from './apps/member/partner-office/api';
import { MemberPartnerStoreMockApi } from './apps/member/partner-store/api';
import { MemberPartnerRecommendationMockApi } from './apps/member/partner-recommendation/api';
import { MemberCouponMockApi } from './apps/member/coupon/api';
import { MemberCouponMoneylogMockApi } from './apps/member/coupon-moneylog/api';
import { MemberCouponMoneyLogMockApi } from './apps/member/coupon-money-log/api';
import { MemberCouponLogMockApi } from './apps/member/coupon-log/api';
import { MessagesMockApi } from 'app/mock-api/common/messages/api';
import { NavigationMockApi } from 'app/mock-api/common/navigation/api';
@ -96,7 +96,7 @@ export const mockApiServices = [
MemberPartnerStoreMockApi,
MemberPartnerRecommendationMockApi,
MemberCouponMockApi,
MemberCouponMoneylogMockApi,
MemberCouponMoneyLogMockApi,
MemberCouponLogMockApi,
MessagesMockApi,
NavigationMockApi,

View File

@ -15,20 +15,20 @@
<div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4">
<!-- Memo -->
<!-- <mat-form-field>
<ng-container *ngIf="couponMoneylogs$ | async as couponMoneylogs">
<ng-container *ngIf="couponMoneyLogs$ | async as couponMoneyLogs">
<ng-container
*ngFor="let couponMoneylog of couponMoneylogs; trackBy: __trackByFn"
*ngFor="let couponMoneyLog of couponMoneyLogs; trackBy: __trackByFn"
>
<div
class="inventory-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
>
<fieldset>
총 파트너수:{{ couponMoneylog.totalPartnerCount }}
총 파트너수:{{ couponMoneyLog.totalPartnerCount }}
총 보유머니:{{
couponMoneylog.totalHoldingMoney
couponMoneyLog.totalHoldingMoney
}}
총 콤프:{{ couponMoneylog.totalComp }} 총 합계:{{
couponMoneylog.total
총 콤프:{{ couponMoneyLog.totalComp }} 총 합계:{{
couponMoneyLog.total
}}
</fieldset>
</div>
@ -152,8 +152,8 @@
<div
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto"
>
<ng-container *ngIf="couponMoneylogs$ | async as couponMoneylogs">
<ng-container *ngIf="couponMoneylogs.length > 0; else noCouponMoneylog">
<ng-container *ngIf="couponMoneyLogs$ | async as couponMoneyLogs">
<ng-container *ngIf="couponMoneyLogs.length > 0; else noCouponMoneyLog">
<div class="grid">
<!-- Header -->
<div
@ -183,10 +183,10 @@
<div class="hidden sm:block">비고</div>
</div>
<!-- Rows -->
<ng-container *ngIf="couponMoneylogs$ | async as couponMoneylogs">
<ng-container *ngIf="couponMoneyLogs$ | async as couponMoneyLogs">
<ng-container
*ngFor="
let couponMoneylog of couponMoneylogs;
let couponMoneyLog of couponMoneyLogs;
trackBy: __trackByFn
"
>
@ -232,22 +232,22 @@
<!-- 매장수 -->
<div class="hidden sm:block truncate">
<button mat-flat-button [color]="'primary'">
{{ couponMoneylog.branchCount }}
{{ couponMoneyLog.branchCount }}
</button>
<button mat-flat-button [color]="'primary'">
{{ couponMoneylog.divisionCount }}
{{ couponMoneyLog.divisionCount }}
</button>
<button mat-flat-button [color]="'primary'">
{{ couponMoneylog.officeCount }}
{{ couponMoneyLog.officeCount }}
</button>
<button mat-flat-button [color]="'primary'">
{{ couponMoneylog.storeCount }}
{{ couponMoneyLog.storeCount }}
</button>
</div>
<!-- 회원수 -->
<div class="hidden sm:block truncate">
<button mat-flat-button [color]="'primary'">
{{ couponMoneylog.memberCount }}
{{ couponMoneyLog.memberCount }}
</button>
</div>
<!-- id -->
@ -259,36 +259,36 @@
class="hidden sm:block truncate"
(click)="viewUserDetail(user.id!)"
>
{{ couponMoneylog.id }}
{{ couponMoneyLog.id }}
</div>
</ng-container>
</ng-container>
<!-- nickname -->
<div class="hidden sm:block truncate">
{{ couponMoneylog.nickname }}
{{ couponMoneyLog.nickname }}
</div>
<!-- accountHolder -->
<div class="hidden sm:block truncate">
{{ couponMoneylog.accountHolder }}
{{ couponMoneyLog.accountHolder }}
</div>
<!-- 연락처 -->
<div class="hidden sm:block truncate">
{{ couponMoneylog.phoneNumber }}
{{ couponMoneyLog.phoneNumber }}
</div>
<!-- 정산 -->
<div class="hidden sm:block truncate">
{{ couponMoneylog.calculateType }}
{{ couponMoneyLog.calculateType }}
</div>
<!-- 보유금 -->
<div class="hidden sm:block truncate">
캐쉬{{ couponMoneylog.ownCash }} 콤프{{
couponMoneylog.ownComp
캐쉬{{ couponMoneyLog.ownCash }} 콤프{{
couponMoneyLog.ownComp
}}
쿠폰{{ couponMoneylog.ownCoupon }}
쿠폰{{ couponMoneyLog.ownCoupon }}
</div>
<!-- gameMoney -->
<div class="hidden sm:block truncate">
{{ couponMoneylog.gameMoney }}
{{ couponMoneyLog.gameMoney }}
</div>
<!-- casinoCash -->
<div class="hidden sm:block truncate">
@ -301,34 +301,34 @@
</div>
<!-- todayComp -->
<div class="hidden sm:block truncate">
{{ couponMoneylog.todayComp }}P
{{ couponMoneyLog.todayComp }}P
</div>
<!-- 총입출 -->
<div class="hidden sm:block truncate">
입금{{ couponMoneylog.totalDeposit }} 출금{{
couponMoneylog.totalWithdraw
입금{{ couponMoneyLog.totalDeposit }} 출금{{
couponMoneyLog.totalWithdraw
}}
차익{{ couponMoneylog.balance }}
차익{{ couponMoneyLog.balance }}
</div>
<!-- log -->
<div class="hidden sm:block truncate">
가입{{ couponMoneylog.registDate }} 최종{{
couponMoneylog.finalSigninDate
가입{{ couponMoneyLog.registDate }} 최종{{
couponMoneyLog.finalSigninDate
}}
IP{{ couponMoneylog.ip }}
IP{{ couponMoneyLog.ip }}
</div>
<!-- state -->
<div class="hidden sm:block truncate">
{{ couponMoneylog.state }}
{{ couponMoneyLog.state }}
</div>
<!-- 회원수 -->
<div class="hidden sm:block truncate">
{{ couponMoneylog.memberCount }}
{{ couponMoneyLog.memberCount }}
</div>
<!-- 비고 -->
<div class="hidden sm:block truncate">
<button mat-flat-button [color]="'primary'">
{{ couponMoneylog.note }}
{{ couponMoneyLog.note }}
</button>
</div>
</div>
@ -348,7 +348,7 @@
</ng-container>
</ng-container>
<ng-template #noCouponMoneylog>
<ng-template #noCouponMoneyLog>
<div
class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
>

View File

@ -30,13 +30,13 @@ import { fuseAnimations } from '@fuse/animations';
import { FuseConfirmationService } from '@fuse/services/confirmation';
import { User } from '../../user/models/user';
import { CouponMoneylog } from '../models/coupon-moneylog';
import { CouponMoneylogPagination } from '../models/coupon-moneylog-pagination';
import { CouponMoneylogService } from '../services/coupon-moneylog.service';
import { CouponMoneyLog } from '../models/coupon-money-log';
import { CouponMoneyLogPagination } from '../models/coupon-money-log-pagination';
import { CouponMoneyLogService } from '../services/coupon-money-log.service';
import { Router } from '@angular/router';
@Component({
selector: 'coupon-moneylog-list',
selector: 'coupon-money-log-list',
templateUrl: './list.component.html',
styles: [
/* language=SCSS */
@ -66,13 +66,13 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
@ViewChild(MatSort) private _sort!: MatSort;
couponMoneylogs$!: Observable<CouponMoneylog[] | undefined>;
couponMoneyLogs$!: Observable<CouponMoneyLog[] | undefined>;
users$!: Observable<User[] | undefined>;
isLoading = false;
searchInputControl = new FormControl();
selectedCouponMoneylog?: CouponMoneylog;
pagination?: CouponMoneylogPagination;
selectedCouponMoneyLog?: CouponMoneyLog;
pagination?: CouponMoneyLogPagination;
private _unsubscribeAll: Subject<any> = new Subject<any>();
@ -83,7 +83,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
private _changeDetectorRef: ChangeDetectorRef,
private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder,
private _couponMoneylogService: CouponMoneylogService,
private _couponMoneyLogService: CouponMoneyLogService,
private router: Router
) {}
@ -96,9 +96,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
*/
ngOnInit(): void {
// Get the pagination
this._couponMoneylogService.pagination$
this._couponMoneyLogService.pagination$
.pipe(takeUntil(this._unsubscribeAll))
.subscribe((pagination: CouponMoneylogPagination | undefined) => {
.subscribe((pagination: CouponMoneyLogPagination | undefined) => {
// Update the pagination
this.pagination = pagination;
@ -107,7 +107,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
});
// Get the products
this.couponMoneylogs$ = this._couponMoneylogService.couponMoneylogs$;
this.couponMoneyLogs$ = this._couponMoneyLogService.couponMoneyLogs$;
}
/**
@ -125,7 +125,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
// Mark for check
this._changeDetectorRef.markForCheck();
// If the couponMoneylog changes the sort order...
// If the couponMoneyLog changes the sort order...
this._sort.sortChange
.pipe(takeUntil(this._unsubscribeAll))
.subscribe(() => {
@ -138,7 +138,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
.pipe(
switchMap(() => {
this.isLoading = true;
return this._couponMoneylogService.getCouponMoneylogs(
return this._couponMoneyLogService.getCouponMoneyLogs(
this._paginator.pageIndex,
this._paginator.pageSize,
this._sort.active,

View File

@ -22,14 +22,14 @@ import { SharedModule } from 'app/shared/shared.module';
import { COMPONENTS } from './components';
import { CouponMoneylogRoutes } from './coupon-moneylog.routing';
import { CouponMoneyLogRoutes } from './coupon-money-log.routing';
@NgModule({
declarations: [COMPONENTS],
imports: [
TranslocoModule,
SharedModule,
RouterModule.forChild(CouponMoneylogRoutes),
RouterModule.forChild(CouponMoneyLogRoutes),
MatButtonModule,
MatFormFieldModule,
@ -47,4 +47,4 @@ import { CouponMoneylogRoutes } from './coupon-moneylog.routing';
MatCheckboxModule,
],
})
export class CouponMoneylogModule {}
export class CouponMoneyLogModule {}

View File

@ -3,15 +3,15 @@ import { Route } from '@angular/router';
import { ListComponent } from './components/list.component';
import { ViewComponent } from '../user/components/view.component';
import { CouponMoneylogsResolver } from './resolvers/coupon-moneylog.resolver';
import { CouponMoneyLogsResolver } from './resolvers/coupon-money-log.resolver';
import { UserResolver } from '../user/resolvers/user.resolver';
export const CouponMoneylogRoutes: Route[] = [
export const CouponMoneyLogRoutes: Route[] = [
{
path: '',
component: ListComponent,
resolve: {
CouponMoneylogs: CouponMoneylogsResolver,
CouponMoneyLogs: CouponMoneyLogsResolver,
},
},
{

View File

@ -1,4 +1,4 @@
export interface CouponMoneylogPagination {
export interface CouponMoneyLogPagination {
length: number;
size: number;
page: number;

View File

@ -1,4 +1,4 @@
export interface CouponMoneylog {
export interface CouponMoneyLog {
id?: string;
totalPartnerCount?: number;
totalHoldingMoney?: number;

View File

@ -7,19 +7,19 @@ import {
} from '@angular/router';
import { catchError, Observable, throwError } from 'rxjs';
import { CouponMoneylog } from '../models/coupon-moneylog';
import { CouponMoneylogPagination } from '../models/coupon-moneylog-pagination';
import { CouponMoneylogService } from '../services/coupon-moneylog.service';
import { CouponMoneyLog } from '../models/coupon-money-log';
import { CouponMoneyLogPagination } from '../models/coupon-money-log-pagination';
import { CouponMoneyLogService } from '../services/coupon-money-log.service';
@Injectable({
providedIn: 'root',
})
export class CouponMoneylogResolver implements Resolve<any> {
export class CouponMoneyLogResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(
private _couponMoneylogService: CouponMoneylogService,
private _couponMoneyLogService: CouponMoneyLogService,
private _router: Router
) {}
@ -36,9 +36,9 @@ export class CouponMoneylogResolver implements Resolve<any> {
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<CouponMoneylog | undefined> {
return this._couponMoneylogService
.getCouponMoneylogById(route.paramMap.get('id'))
): Observable<CouponMoneyLog | undefined> {
return this._couponMoneyLogService
.getCouponMoneyLogById(route.paramMap.get('id'))
.pipe(
// Error here means the requested product is not available
catchError((error) => {
@ -61,11 +61,11 @@ export class CouponMoneylogResolver implements Resolve<any> {
@Injectable({
providedIn: 'root',
})
export class CouponMoneylogsResolver implements Resolve<any> {
export class CouponMoneyLogsResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private _couponMoneylogService: CouponMoneylogService) {}
constructor(private _couponMoneyLogService: CouponMoneyLogService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
@ -81,9 +81,9 @@ export class CouponMoneylogsResolver implements Resolve<any> {
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<{
pagination: CouponMoneylogPagination;
couponMoneylogs: CouponMoneylog[];
pagination: CouponMoneyLogPagination;
couponMoneyLogs: CouponMoneyLog[];
}> {
return this._couponMoneylogService.getCouponMoneylogs();
return this._couponMoneyLogService.getCouponMoneyLogs();
}
}

View File

@ -12,21 +12,21 @@ import {
throwError,
} from 'rxjs';
import { CouponMoneylog } from '../models/coupon-moneylog';
import { CouponMoneylogPagination } from '../models/coupon-moneylog-pagination';
import { CouponMoneyLog } from '../models/coupon-money-log';
import { CouponMoneyLogPagination } from '../models/coupon-money-log-pagination';
@Injectable({
providedIn: 'root',
})
export class CouponMoneylogService {
export class CouponMoneyLogService {
// Private
private __pagination = new BehaviorSubject<
CouponMoneylogPagination | undefined
CouponMoneyLogPagination | undefined
>(undefined);
private __couponMoneylog = new BehaviorSubject<CouponMoneylog | undefined>(
private __couponMoneyLog = new BehaviorSubject<CouponMoneyLog | undefined>(
undefined
);
private __couponMoneylogs = new BehaviorSubject<CouponMoneylog[] | undefined>(
private __couponMoneyLogs = new BehaviorSubject<CouponMoneyLog[] | undefined>(
undefined
);
@ -42,22 +42,22 @@ export class CouponMoneylogService {
/**
* Getter for pagination
*/
get pagination$(): Observable<CouponMoneylogPagination | undefined> {
get pagination$(): Observable<CouponMoneyLogPagination | undefined> {
return this.__pagination.asObservable();
}
/**
* Getter for couponMoneylog
* Getter for couponMoneyLog
*/
get couponMoneylog$(): Observable<CouponMoneylog | undefined> {
return this.__couponMoneylog.asObservable();
get couponMoneyLog$(): Observable<CouponMoneyLog | undefined> {
return this.__couponMoneyLog.asObservable();
}
/**
* Getter for couponMoneylogs
* Getter for couponMoneyLogs
*/
get couponMoneylogs$(): Observable<CouponMoneylog[] | undefined> {
return this.__couponMoneylogs.asObservable();
get couponMoneyLogs$(): Observable<CouponMoneyLog[] | undefined> {
return this.__couponMoneyLogs.asObservable();
}
// -----------------------------------------------------------------------------------------------------
@ -65,7 +65,7 @@ export class CouponMoneylogService {
// -----------------------------------------------------------------------------------------------------
/**
* Get couponMoneylogs
* Get couponMoneyLogs
*
*
* @param page
@ -74,21 +74,21 @@ export class CouponMoneylogService {
* @param order
* @param search
*/
getCouponMoneylogs(
getCouponMoneyLogs(
page: number = 0,
size: number = 10,
sort: string = 'name',
order: 'asc' | 'desc' | '' = 'asc',
search: string = ''
): Observable<{
pagination: CouponMoneylogPagination;
couponMoneylogs: CouponMoneylog[];
pagination: CouponMoneyLogPagination;
couponMoneyLogs: CouponMoneyLog[];
}> {
return this._httpClient
.get<{
pagination: CouponMoneylogPagination;
couponMoneylogs: CouponMoneylog[];
}>('api/apps/member/coupon-moneylog/coupon-moneylogs', {
pagination: CouponMoneyLogPagination;
couponMoneyLogs: CouponMoneyLog[];
}>('api/apps/member/coupon-money-log/coupon-money-logs', {
params: {
page: '' + page,
size: '' + size,
@ -100,7 +100,7 @@ export class CouponMoneylogService {
.pipe(
tap((response) => {
this.__pagination.next(response.pagination);
this.__couponMoneylogs.next(response.couponMoneylogs);
this.__couponMoneyLogs.next(response.couponMoneyLogs);
})
);
}
@ -108,19 +108,19 @@ export class CouponMoneylogService {
/**
* Get product by id
*/
getCouponMoneylogById(id: string | null): Observable<CouponMoneylog> {
return this.__couponMoneylogs.pipe(
getCouponMoneyLogById(id: string | null): Observable<CouponMoneyLog> {
return this.__couponMoneyLogs.pipe(
take(1),
map((couponMoneylogs) => {
map((couponMoneyLogs) => {
// Find the product
const couponMoneylog =
couponMoneylogs?.find((item) => item.id === id) || undefined;
const couponMoneyLog =
couponMoneyLogs?.find((item) => item.id === id) || undefined;
// Update the product
this.__couponMoneylog.next(couponMoneylog);
this.__couponMoneyLog.next(couponMoneyLog);
// Return the product
return couponMoneylog;
return couponMoneyLog;
}),
switchMap((product) => {
if (!product) {
@ -135,24 +135,24 @@ export class CouponMoneylogService {
/**
* Create product
*/
createCouponMoneylog(): Observable<CouponMoneylog> {
return this.couponMoneylogs$.pipe(
createCouponMoneyLog(): Observable<CouponMoneyLog> {
return this.couponMoneyLogs$.pipe(
take(1),
switchMap((couponMoneylogs) =>
switchMap((couponMoneyLogs) =>
this._httpClient
.post<CouponMoneylog>('api/apps/member/coupon-moneylog/product', {})
.post<CouponMoneyLog>('api/apps/member/coupon-money-log/product', {})
.pipe(
map((newCouponMoneylog) => {
// Update the couponMoneylogs with the new product
if (!!couponMoneylogs) {
this.__couponMoneylogs.next([
newCouponMoneylog,
...couponMoneylogs,
map((newCouponMoneyLog) => {
// Update the couponMoneyLogs with the new product
if (!!couponMoneyLogs) {
this.__couponMoneyLogs.next([
newCouponMoneyLog,
...couponMoneyLogs,
]);
}
// Return the new product
return newCouponMoneylog;
return newCouponMoneyLog;
})
)
)

View File

@ -14,7 +14,7 @@
"Partner Store": "Partner Store",
"Partner Recommendation": "Partner Recommendation",
"Coupon": "Coupon",
"Coupon Moneylog": "Coupon Moneylog",
"Coupon Money Log": "Coupon Money Log",
"Coupon Log": "Coupon Log",
"Analytics": "Analytics",
"Deposit": "Deposit",

View File

@ -15,7 +15,7 @@
"Partner Store": "매장",
"Partner Recommendation": "추천코드등록",
"Coupon": "쿠폰발행리스트",
"Coupon Moneylog": "쿠폰발행머니로그",
"Coupon Money Log": "쿠폰발행머니로그",
"Coupon Log": "쿠폰발행 로그",
"Analytics": "Analytics",
"Deposit": "입금관리",