diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts
index 047c476..f259c06 100644
--- a/src/app/app.routing.ts
+++ b/src/app/app.routing.ts
@@ -214,11 +214,11 @@ export const appRoutes: Route[] = [
// ).then((m: any) => m.PartnerStoreModule),
// },
{
- path: 'recommendation',
+ path: 'partner-recommendation',
loadChildren: () =>
import(
- 'app/modules/admin/member/recommendation/recommendation.module'
- ).then((m: any) => m.RecommendationModule),
+ 'app/modules/admin/member/partner-recommendation/partner-recommendation.module'
+ ).then((m: any) => m.PartnerRecommendationModule),
},
{
path: 'coupon',
diff --git a/src/app/mock-api/apps/member/recommendation/api.ts b/src/app/mock-api/apps/member/partner-recommendation/api.ts
similarity index 59%
rename from src/app/mock-api/apps/member/recommendation/api.ts
rename to src/app/mock-api/apps/member/partner-recommendation/api.ts
index 6670b2b..3c6140c 100644
--- a/src/app/mock-api/apps/member/recommendation/api.ts
+++ b/src/app/mock-api/apps/member/partner-recommendation/api.ts
@@ -1,13 +1,13 @@
import { Injectable } from '@angular/core';
import { assign, cloneDeep } from 'lodash-es';
import { FuseMockApiService, FuseMockApiUtils } from '@fuse/lib/mock-api';
-import { recommendations as recommendationsData } from './data';
+import { partnerRecommendations as partnerRecommendationsData } from './data';
@Injectable({
providedIn: 'root',
})
-export class MemberRecommendationMockApi {
- private _recommendations: any[] = recommendationsData;
+export class MemberPartnerRecommendationMockApi {
+ private _partnerRecommendations: any[] = partnerRecommendationsData;
/**
* Constructor
@@ -26,10 +26,13 @@ export class MemberRecommendationMockApi {
*/
registerHandlers(): void {
// -----------------------------------------------------------------------------------------------------
- // @ Recommendations - GET
+ // @ PartnerRecommendations - GET
// -----------------------------------------------------------------------------------------------------
this._fuseMockApiService
- .onGet('api/apps/member/recommendation/recommendations', 300)
+ .onGet(
+ 'api/apps/member/partner-recommendation/partner-recommendations',
+ 300
+ )
.reply(({ request }) => {
// Get available queries
const search = request.params.get('search');
@@ -38,12 +41,14 @@ export class MemberRecommendationMockApi {
const page = parseInt(request.params.get('page') ?? '1', 10);
const size = parseInt(request.params.get('size') ?? '10', 10);
- // Clone the recommendations
- let recommendations: any[] | null = cloneDeep(this._recommendations);
+ // Clone the partnerRecommendations
+ let partnerRecommendations: any[] | null = cloneDeep(
+ this._partnerRecommendations
+ );
- // Sort the recommendations
+ // Sort the partnerRecommendations
if (sort === 'signinId' || sort === 'nickname' || sort === 'state') {
- recommendations.sort((a, b) => {
+ partnerRecommendations.sort((a, b) => {
const fieldA = a[sort].toString().toUpperCase();
const fieldB = b[sort].toString().toUpperCase();
return order === 'asc'
@@ -51,15 +56,15 @@ export class MemberRecommendationMockApi {
: fieldB.localeCompare(fieldA);
});
} else {
- recommendations.sort((a, b) =>
+ partnerRecommendations.sort((a, b) =>
order === 'asc' ? a[sort] - b[sort] : b[sort] - a[sort]
);
}
// If search exists...
if (search) {
- // Filter the recommendations
- recommendations = recommendations.filter(
+ // Filter the partnerRecommendations
+ partnerRecommendations = partnerRecommendations.filter(
(contact: any) =>
contact.name &&
contact.name.toLowerCase().includes(search.toLowerCase())
@@ -67,32 +72,35 @@ export class MemberRecommendationMockApi {
}
// Paginate - Start
- const recommendationsLength = recommendations.length;
+ const partnerRecommendationsLength = partnerRecommendations.length;
// Calculate pagination details
const begin = page * size;
- const end = Math.min(size * (page + 1), recommendationsLength);
- const lastPage = Math.max(Math.ceil(recommendationsLength / size), 1);
+ const end = Math.min(size * (page + 1), partnerRecommendationsLength);
+ const lastPage = Math.max(
+ Math.ceil(partnerRecommendationsLength / size),
+ 1
+ );
// Prepare the pagination object
let pagination = {};
// If the requested page number is bigger than
// the last possible page number, return null for
- // recommendations but also send the last possible page so
+ // partnerRecommendations but also send the last possible page so
// the app can navigate to there
if (page > lastPage) {
- recommendations = null;
+ partnerRecommendations = null;
pagination = {
lastPage,
};
} else {
// Paginate the results by size
- recommendations = recommendations.slice(begin, end);
+ partnerRecommendations = partnerRecommendations.slice(begin, end);
// Prepare the pagination mock-api
pagination = {
- length: recommendationsLength,
+ length: partnerRecommendationsLength,
size: size,
page: page,
lastPage: lastPage,
@@ -105,41 +113,41 @@ export class MemberRecommendationMockApi {
return [
200,
{
- recommendations,
+ partnerRecommendations,
pagination,
},
];
});
// -----------------------------------------------------------------------------------------------------
- // @ Recommendation - GET
+ // @ PartnerRecommendation - GET
// -----------------------------------------------------------------------------------------------------
this._fuseMockApiService
- .onGet('api/apps/member/recommendation/recommendation')
+ .onGet('api/apps/member/partner-recommendation/partner-recommendation')
.reply(({ request }) => {
// Get the id from the params
const id = request.params.get('id');
- // Clone the recommendations
- const recommendations = cloneDeep(this._recommendations);
+ // Clone the partnerRecommendations
+ const partnerRecommendations = cloneDeep(this._partnerRecommendations);
- // Find the recommendation
- const recommendation = recommendations.find(
+ // Find the partnerRecommendation
+ const partnerRecommendation = partnerRecommendations.find(
(item: any) => item.id === id
);
// Return the response
- return [200, recommendation];
+ return [200, partnerRecommendation];
});
// -----------------------------------------------------------------------------------------------------
- // @ Recommendation - POST
+ // @ PartnerRecommendation - POST
// -----------------------------------------------------------------------------------------------------
this._fuseMockApiService
- .onPost('api/apps/member/recommendation/recommendation')
+ .onPost('api/apps/member/partner-recommendation/partner-recommendation')
.reply(() => {
- // Generate a new recommendation
- const newRecommendation = {
+ // Generate a new partnerRecommendation
+ const newPartnerRecommendation = {
id: FuseMockApiUtils.guid(),
category: '',
name: 'A New User',
@@ -161,58 +169,62 @@ export class MemberRecommendationMockApi {
active: false,
};
- // Unshift the new recommendation
- this._recommendations.unshift(newRecommendation);
+ // Unshift the new partnerRecommendation
+ this._partnerRecommendations.unshift(newPartnerRecommendation);
// Return the response
- return [200, newRecommendation];
+ return [200, newPartnerRecommendation];
});
// -----------------------------------------------------------------------------------------------------
- // @ Recommendation - PATCH
+ // @ PartnerRecommendation - PATCH
// -----------------------------------------------------------------------------------------------------
this._fuseMockApiService
- .onPatch('api/apps/member/recommendation/recommendation')
+ .onPatch('api/apps/member/partner-recommendation/partner-recommendation')
.reply(({ request }) => {
- // Get the id and recommendation
+ // Get the id and partnerRecommendation
const id = request.body.id;
- const recommendation = cloneDeep(request.body.recommendation);
+ const partnerRecommendation = cloneDeep(
+ request.body.partnerRecommendation
+ );
- // Prepare the updated recommendation
- let updatedRecommendation = null;
+ // Prepare the updated partnerRecommendation
+ let updatedPartnerRecommendation = null;
- // Find the recommendation and update it
- this._recommendations.forEach((item, index, recommendations) => {
- if (item.id === id) {
- // Update the recommendation
- recommendations[index] = assign(
- {},
- recommendations[index],
- recommendation
- );
+ // Find the partnerRecommendation and update it
+ this._partnerRecommendations.forEach(
+ (item, index, partnerRecommendations) => {
+ if (item.id === id) {
+ // Update the partnerRecommendation
+ partnerRecommendations[index] = assign(
+ {},
+ partnerRecommendations[index],
+ partnerRecommendation
+ );
- // Store the updated recommendation
- updatedRecommendation = recommendations[index];
+ // Store the updated partnerRecommendation
+ updatedPartnerRecommendation = partnerRecommendations[index];
+ }
}
- });
+ );
// Return the response
- return [200, updatedRecommendation];
+ return [200, updatedPartnerRecommendation];
});
// -----------------------------------------------------------------------------------------------------
- // @ Recommendation - DELETE
+ // @ PartnerRecommendation - DELETE
// -----------------------------------------------------------------------------------------------------
this._fuseMockApiService
- .onDelete('api/apps/member/recommendation/recommendation')
+ .onDelete('api/apps/member/partner-recommendation/partner-recommendation')
.reply(({ request }) => {
// Get the id
const id = request.params.get('id');
- // Find the recommendation and delete it
- this._recommendations.forEach((item, index) => {
+ // Find the partnerRecommendation and delete it
+ this._partnerRecommendations.forEach((item, index) => {
if (item.id === id) {
- this._recommendations.splice(index, 1);
+ this._partnerRecommendations.splice(index, 1);
}
});
diff --git a/src/app/mock-api/apps/member/recommendation/data.ts b/src/app/mock-api/apps/member/partner-recommendation/data.ts
similarity index 89%
rename from src/app/mock-api/apps/member/recommendation/data.ts
rename to src/app/mock-api/apps/member/partner-recommendation/data.ts
index 5655c24..b79dab7 100644
--- a/src/app/mock-api/apps/member/recommendation/data.ts
+++ b/src/app/mock-api/apps/member/partner-recommendation/data.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
-export const recommendations = [
+export const partnerRecommendations = [
{
id: '7eb7c859-1347-4317-96b6-9476a7e2ba3c',
signinId: 'on04',
diff --git a/src/app/mock-api/common/navigation/data.ts b/src/app/mock-api/common/navigation/data.ts
index 48954f6..719f187 100644
--- a/src/app/mock-api/common/navigation/data.ts
+++ b/src/app/mock-api/common/navigation/data.ts
@@ -68,18 +68,61 @@ export const defaultNavigation: FuseNavigationItem[] = [
link: '/member/current-user',
},
{
- id: 'member.partner',
- title: 'Partner',
- type: 'basic',
- icon: 'heroicons_outline:academic-cap',
- link: '/member/partner',
- },
- {
- id: 'member.recommendation',
- title: 'Recommendation',
- type: 'basic',
- icon: 'heroicons_outline:academic-cap',
- link: '/member/recommendation',
+ id: 'apps.ecommerce',
+ title: 'partner-management',
+ type: 'collapsable',
+ icon: 'heroicons_outline:shopping-cart',
+ children: [
+ {
+ id: 'member.partner',
+ title: 'All Partner',
+ type: 'basic',
+ icon: 'heroicons_outline:academic-cap',
+ link: '/member/partner/all',
+ },
+ {
+ id: 'member.partner-mainoffice',
+ title: 'Partner Mainoffice',
+ type: 'basic',
+ icon: 'heroicons_outline:academic-cap',
+ link: '/member/partner/main-office',
+ },
+ {
+ id: 'member.partner-branch',
+ title: 'Partner Branch',
+ type: 'basic',
+ icon: 'heroicons_outline:academic-cap',
+ link: '/member/partner/branch',
+ },
+ {
+ id: 'member.partner-division',
+ title: 'Partner Division',
+ type: 'basic',
+ icon: 'heroicons_outline:academic-cap',
+ link: '/member/partner/division',
+ },
+ {
+ id: 'member.partner-office',
+ title: 'Partner Office',
+ type: 'basic',
+ icon: 'heroicons_outline:academic-cap',
+ link: '/member/partner/office',
+ },
+ {
+ id: 'member.partner-store',
+ title: 'Partner Store',
+ type: 'basic',
+ icon: 'heroicons_outline:academic-cap',
+ link: '/member/partner/store',
+ },
+ {
+ id: 'member.partner-recommendation',
+ title: 'Partner Recommendation',
+ type: 'basic',
+ icon: 'heroicons_outline:academic-cap',
+ link: '/member/partner/recommendation',
+ },
+ ],
},
{
diff --git a/src/app/mock-api/index.ts b/src/app/mock-api/index.ts
index 94da709..60ef8ad 100644
--- a/src/app/mock-api/index.ts
+++ b/src/app/mock-api/index.ts
@@ -21,7 +21,7 @@ import { MemberPartnerBranchMockApi } from './apps/member/partner-branch/api';
import { MemberPartnerDivisionMockApi } from './apps/member/partner-division/api';
import { MemberPartnerOfficeMockApi } from './apps/member/partner-office/api';
import { MemberPartnerStoreMockApi } from './apps/member/partner-store/api';
-import { MemberRecommendationMockApi } from './apps/member/recommendation/api';
+import { MemberPartnerRecommendationMockApi } from './apps/member/partner-recommendation/api';
import { MemberCouponMockApi } from './apps/member/coupon/api';
import { MemberCouponMoneyLogMockApi } from './apps/member/coupon-money-log/api';
import { MemberCouponLogMockApi } from './apps/member/coupon-log/api';
@@ -94,7 +94,7 @@ export const mockApiServices = [
MemberPartnerDivisionMockApi,
MemberPartnerOfficeMockApi,
MemberPartnerStoreMockApi,
- MemberRecommendationMockApi,
+ MemberPartnerRecommendationMockApi,
MemberCouponMockApi,
MemberCouponMoneyLogMockApi,
MemberCouponLogMockApi,
diff --git a/src/app/modules/admin/member/recommendation/components/index.ts b/src/app/modules/admin/member/partner-recommendation/components/index.ts
similarity index 100%
rename from src/app/modules/admin/member/recommendation/components/index.ts
rename to src/app/modules/admin/member/partner-recommendation/components/index.ts
diff --git a/src/app/modules/admin/member/recommendation/components/list.component.html b/src/app/modules/admin/member/partner-recommendation/components/list.component.html
similarity index 82%
rename from src/app/modules/admin/member/recommendation/components/list.component.html
rename to src/app/modules/admin/member/partner-recommendation/components/list.component.html
index 27cb53c..fc862a0 100644
--- a/src/app/modules/admin/member/recommendation/components/list.component.html
+++ b/src/app/modules/admin/member/partner-recommendation/components/list.component.html
@@ -70,8 +70,15 @@
-
- 0; else noRecommendation">
+
+ 0;
+ else noPartnerRecommendation
+ "
+ >
-
+
@@ -109,25 +118,25 @@
- {{ recommendation.highRank }}
+ {{ partnerRecommendation.highRank }}
- {{ recommendation.signinId }}
+ {{ partnerRecommendation.signinId }}
- {{ recommendation.nickname }}
+ {{ partnerRecommendation.nickname }}
- {{ recommendation.state }}
+ {{ partnerRecommendation.state }}
- {{ recommendation.rank }}
+ {{ partnerRecommendation.rank }}
- {{ recommendation.accountHolder }}
+ {{ partnerRecommendation.accountHolder }}
- {{ recommendation.holdingMoney }}
+ {{ partnerRecommendation.holdingMoney }}
- {{ recommendation.ownComp }}
+ {{ partnerRecommendation.ownComp }}
- {{ recommendation.siteAddress }}
+ {{ partnerRecommendation.siteAddress }}
@@ -151,7 +160,7 @@
-
+
@@ -214,8 +223,15 @@
-
- 0; else noRecommendation">
+
+ 0;
+ else noPartnerRecommendation
+ "
+ >
-
+
@@ -248,23 +266,23 @@
- {{ recommendation.highRank }}
+ {{ partnerRecommendation.highRank }}
- {{ recommendation.signinId }}
+ {{ partnerRecommendation.signinId }}
- {{ recommendation.nickname }}
+ {{ partnerRecommendation.nickname }}
- {{ recommendation.state }}
+ {{ partnerRecommendation.state }}
- {{ recommendation.rank }}
+ {{ partnerRecommendation.rank }}
- {{ recommendation.useOrNot }}
+ {{ partnerRecommendation.useOrNot }}
- {{ recommendation.memberCount }}
+ {{ partnerRecommendation.memberCount }}
- {{ recommendation.siteAddress }}
+ {{ partnerRecommendation.siteAddress }}
@@ -288,7 +306,7 @@
-
+
diff --git a/src/app/modules/admin/member/recommendation/components/list.component.ts b/src/app/modules/admin/member/partner-recommendation/components/list.component.ts
similarity index 84%
rename from src/app/modules/admin/member/recommendation/components/list.component.ts
rename to src/app/modules/admin/member/partner-recommendation/components/list.component.ts
index 9fed294..b62689d 100644
--- a/src/app/modules/admin/member/recommendation/components/list.component.ts
+++ b/src/app/modules/admin/member/partner-recommendation/components/list.component.ts
@@ -31,16 +31,16 @@ import { FuseConfirmationService } from '@fuse/services/confirmation';
import { User } from '../../user/models/user';
-import { Recommendation as Recommendation } from '../models/recommendation';
-import { RecommendationPagination as RecommendationPagination } from '../models/recommendation-pagination';
-import { RecommendationService as RecommendationService } from '../services/recommendation.service';
+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 { Router } from '@angular/router';
import { MatDialog } from '@angular/material/dialog';
import { RegistComposeComponent } from '../compose/regist-compose.component';
@Component({
- selector: 'recommendation-list',
+ selector: 'partner-recommendation-list',
templateUrl: './list.component.html',
styles: [
/* language=SCSS */
@@ -74,15 +74,15 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
@ViewChild(MatSort) private _sort!: MatSort;
- recommendations$!: Observable
;
+ partnerRecommendations$!: Observable;
users$!: Observable;
__isSearchOpened1 = false;
__isSearchOpened2 = false;
isLoading = false;
searchInputControl = new FormControl();
- selectedRecommendation?: Recommendation;
- pagination?: RecommendationPagination;
+ selectedPartnerRecommendation?: PartnerRecommendation;
+ pagination?: PartnerRecommendationPagination;
private _unsubscribeAll: Subject = new Subject();
@@ -93,7 +93,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
private _changeDetectorRef: ChangeDetectorRef,
private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder,
- private _recommendationService: RecommendationService,
+ private _partnerRecommendationService: PartnerRecommendationService,
private router: Router,
private _matDialog: MatDialog
) {}
@@ -107,9 +107,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
*/
ngOnInit(): void {
// Get the pagination
- this._recommendationService.pagination$
+ this._partnerRecommendationService.pagination$
.pipe(takeUntil(this._unsubscribeAll))
- .subscribe((pagination: RecommendationPagination | undefined) => {
+ .subscribe((pagination: PartnerRecommendationPagination | undefined) => {
// Update the pagination
this.pagination = pagination;
@@ -118,7 +118,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
});
// Get the products
- this.recommendations$ = this._recommendationService.recommendations$;
+ this.partnerRecommendations$ =
+ this._partnerRecommendationService.partnerRecommendations$;
}
/**
@@ -136,7 +137,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
// Mark for check
this._changeDetectorRef.markForCheck();
- // If the recommendation changes the sort order...
+ // If the partnerRecommendation changes the sort order...
this._sort.sortChange
.pipe(takeUntil(this._unsubscribeAll))
.subscribe(() => {
@@ -149,7 +150,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
.pipe(
switchMap(() => {
this.isLoading = true;
- return this._recommendationService.getRecommendations(
+ return this._partnerRecommendationService.getPartnerRecommendations(
this._paginator.pageIndex,
this._paginator.pageSize,
this._sort.active,
diff --git a/src/app/modules/admin/member/recommendation/compose/index.ts b/src/app/modules/admin/member/partner-recommendation/compose/index.ts
similarity index 100%
rename from src/app/modules/admin/member/recommendation/compose/index.ts
rename to src/app/modules/admin/member/partner-recommendation/compose/index.ts
diff --git a/src/app/modules/admin/member/recommendation/compose/regist-compose.component.html b/src/app/modules/admin/member/partner-recommendation/compose/regist-compose.component.html
similarity index 100%
rename from src/app/modules/admin/member/recommendation/compose/regist-compose.component.html
rename to src/app/modules/admin/member/partner-recommendation/compose/regist-compose.component.html
diff --git a/src/app/modules/admin/member/recommendation/compose/regist-compose.component.ts b/src/app/modules/admin/member/partner-recommendation/compose/regist-compose.component.ts
similarity index 100%
rename from src/app/modules/admin/member/recommendation/compose/regist-compose.component.ts
rename to src/app/modules/admin/member/partner-recommendation/compose/regist-compose.component.ts
diff --git a/src/app/modules/admin/member/recommendation/models/recommendation-pagination.ts b/src/app/modules/admin/member/partner-recommendation/models/partner-recommendation-pagination.ts
similarity index 69%
rename from src/app/modules/admin/member/recommendation/models/recommendation-pagination.ts
rename to src/app/modules/admin/member/partner-recommendation/models/partner-recommendation-pagination.ts
index 842c3bf..7b46ebd 100644
--- a/src/app/modules/admin/member/recommendation/models/recommendation-pagination.ts
+++ b/src/app/modules/admin/member/partner-recommendation/models/partner-recommendation-pagination.ts
@@ -1,4 +1,4 @@
-export interface RecommendationPagination {
+export interface PartnerRecommendationPagination {
length: number;
size: number;
page: number;
diff --git a/src/app/modules/admin/member/recommendation/models/recommendation.ts b/src/app/modules/admin/member/partner-recommendation/models/partner-recommendation.ts
similarity index 88%
rename from src/app/modules/admin/member/recommendation/models/recommendation.ts
rename to src/app/modules/admin/member/partner-recommendation/models/partner-recommendation.ts
index 184be2b..2057f59 100644
--- a/src/app/modules/admin/member/recommendation/models/recommendation.ts
+++ b/src/app/modules/admin/member/partner-recommendation/models/partner-recommendation.ts
@@ -1,6 +1,6 @@
import { NumberValueAccessor } from '@angular/forms';
-export interface Recommendation {
+export interface PartnerRecommendation {
id: string;
signinId?: string;
nickname?: string;
diff --git a/src/app/modules/admin/member/recommendation/recommendation.module.ts b/src/app/modules/admin/member/partner-recommendation/partner-recommendation.module.ts
similarity index 89%
rename from src/app/modules/admin/member/recommendation/recommendation.module.ts
rename to src/app/modules/admin/member/partner-recommendation/partner-recommendation.module.ts
index 4475008..3729997 100644
--- a/src/app/modules/admin/member/recommendation/recommendation.module.ts
+++ b/src/app/modules/admin/member/partner-recommendation/partner-recommendation.module.ts
@@ -23,14 +23,14 @@ import { SharedModule } from 'app/shared/shared.module';
import { COMPONENTS } from './components';
import { COMPOSE } from './compose';
-import { recommendationRoutes } from './recommendation.routing';
+import { partnerRecommendationRoutes } from './partner-recommendation.routing';
@NgModule({
declarations: [COMPONENTS, COMPOSE],
imports: [
TranslocoModule,
SharedModule,
- RouterModule.forChild(recommendationRoutes),
+ RouterModule.forChild(partnerRecommendationRoutes),
MatButtonModule,
MatFormFieldModule,
@@ -48,4 +48,4 @@ import { recommendationRoutes } from './recommendation.routing';
MatCheckboxModule,
],
})
-export class RecommendationModule {}
+export class PartnerRecommendationModule {}
diff --git a/src/app/modules/admin/member/recommendation/recommendation.routing.ts b/src/app/modules/admin/member/partner-recommendation/partner-recommendation.routing.ts
similarity index 55%
rename from src/app/modules/admin/member/recommendation/recommendation.routing.ts
rename to src/app/modules/admin/member/partner-recommendation/partner-recommendation.routing.ts
index 556d226..09265b7 100644
--- a/src/app/modules/admin/member/recommendation/recommendation.routing.ts
+++ b/src/app/modules/admin/member/partner-recommendation/partner-recommendation.routing.ts
@@ -2,9 +2,9 @@ import { Route } from '@angular/router';
import { ListComponent } from './components/list.component';
-import { RecommendationsResolver } from './resolvers/recommendation.resolver';
+import { PartnerRecommendationsResolver } from './resolvers/partner-recommendation.resolver';
-export const recommendationRoutes: Route[] = [
+export const partnerRecommendationRoutes: Route[] = [
// {
// path: '',
// pathMatch: 'full',
@@ -14,7 +14,7 @@ export const recommendationRoutes: Route[] = [
path: '',
component: ListComponent,
resolve: {
- Recommendations: RecommendationsResolver,
+ PartnerRecommendations: PartnerRecommendationsResolver,
},
},
];
diff --git a/src/app/modules/admin/member/recommendation/resolvers/recommendation.resolver.ts b/src/app/modules/admin/member/partner-recommendation/resolvers/partner-recommendation.resolver.ts
similarity index 64%
rename from src/app/modules/admin/member/recommendation/resolvers/recommendation.resolver.ts
rename to src/app/modules/admin/member/partner-recommendation/resolvers/partner-recommendation.resolver.ts
index bd52abf..7afce94 100644
--- a/src/app/modules/admin/member/recommendation/resolvers/recommendation.resolver.ts
+++ b/src/app/modules/admin/member/partner-recommendation/resolvers/partner-recommendation.resolver.ts
@@ -7,19 +7,19 @@ import {
} from '@angular/router';
import { catchError, Observable, throwError } from 'rxjs';
-import { Recommendation } from '../models/recommendation';
-import { RecommendationPagination } from '../models/recommendation-pagination';
-import { RecommendationService } from '../services/recommendation.service';
+import { PartnerRecommendation } from '../models/partner-recommendation';
+import { PartnerRecommendationPagination } from '../models/partner-recommendation-pagination';
+import { PartnerRecommendationService } from '../services/partner-recommendation.service';
@Injectable({
providedIn: 'root',
})
-export class RecommendationResolver implements Resolve {
+export class PartnerRecommendationResolver implements Resolve {
/**
* Constructor
*/
constructor(
- private _recommendationServiceService: RecommendationService,
+ private _partnerRecommendationServiceService: PartnerRecommendationService,
private _router: Router
) {}
@@ -36,9 +36,9 @@ export class RecommendationResolver implements Resolve {
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
- ): Observable {
- return this._recommendationServiceService
- .getRecommendationById(route.paramMap.get('id'))
+ ): Observable {
+ return this._partnerRecommendationServiceService
+ .getPartnerRecommendationById(route.paramMap.get('id'))
.pipe(
// Error here means the requested product is not available
catchError((error) => {
@@ -61,11 +61,13 @@ export class RecommendationResolver implements Resolve {
@Injectable({
providedIn: 'root',
})
-export class RecommendationsResolver implements Resolve {
+export class PartnerRecommendationsResolver implements Resolve {
/**
* Constructor
*/
- constructor(private _recommendationService: RecommendationService) {}
+ constructor(
+ private _partnerRecommendationService: PartnerRecommendationService
+ ) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
@@ -81,9 +83,9 @@ export class RecommendationsResolver implements Resolve {
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<{
- pagination: RecommendationPagination;
- recommendations: Recommendation[];
+ pagination: PartnerRecommendationPagination;
+ partnerRecommendations: PartnerRecommendation[];
}> {
- return this._recommendationService.getRecommendations();
+ return this._partnerRecommendationService.getPartnerRecommendations();
}
}
diff --git a/src/app/modules/admin/member/partner-recommendation/services/partner-recommendation.service.ts b/src/app/modules/admin/member/partner-recommendation/services/partner-recommendation.service.ts
new file mode 100644
index 0000000..9f06595
--- /dev/null
+++ b/src/app/modules/admin/member/partner-recommendation/services/partner-recommendation.service.ts
@@ -0,0 +1,168 @@
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import {
+ BehaviorSubject,
+ filter,
+ map,
+ Observable,
+ of,
+ switchMap,
+ take,
+ tap,
+ throwError,
+} from 'rxjs';
+
+import { PartnerRecommendation } from '../models/partner-recommendation';
+import { PartnerRecommendationPagination } from '../models/partner-recommendation-pagination';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class PartnerRecommendationService {
+ // Private
+ private __pagination = new BehaviorSubject<
+ PartnerRecommendationPagination | undefined
+ >(undefined);
+ private __partnerRecommendation = new BehaviorSubject<
+ PartnerRecommendation | undefined
+ >(undefined);
+ private __partnerRecommendations = new BehaviorSubject<
+ PartnerRecommendation[] | undefined
+ >(undefined);
+
+ /**
+ * Constructor
+ */
+ constructor(private _httpClient: HttpClient) {}
+
+ // -----------------------------------------------------------------------------------------------------
+ // @ Accessors
+ // -----------------------------------------------------------------------------------------------------
+
+ /**
+ * Getter for pagination
+ */
+ get pagination$(): Observable {
+ return this.__pagination.asObservable();
+ }
+
+ /**
+ * Getter for partnerRecommendation
+ */
+ get partnerRecommendation$(): Observable {
+ return this.__partnerRecommendation.asObservable();
+ }
+
+ /**
+ * Getter for partnerRecommendations
+ */
+ get partnerRecommendations$(): Observable<
+ PartnerRecommendation[] | undefined
+ > {
+ return this.__partnerRecommendations.asObservable();
+ }
+
+ // -----------------------------------------------------------------------------------------------------
+ // @ Public methods
+ // -----------------------------------------------------------------------------------------------------
+
+ /**
+ * Get partnerRecommendations
+ *
+ *
+ * @param page
+ * @param size
+ * @param sort
+ * @param order
+ * @param search
+ */
+ getPartnerRecommendations(
+ page: number = 0,
+ size: number = 10,
+ sort: string = 'name',
+ order: 'asc' | 'desc' | '' = 'asc',
+ search: string = ''
+ ): Observable<{
+ pagination: PartnerRecommendationPagination;
+ partnerRecommendations: PartnerRecommendation[];
+ }> {
+ return this._httpClient
+ .get<{
+ pagination: PartnerRecommendationPagination;
+ partnerRecommendations: PartnerRecommendation[];
+ }>('api/apps/member/partner-recommendation/partner-recommendations', {
+ params: {
+ page: '' + page,
+ size: '' + size,
+ sort,
+ order,
+ search,
+ },
+ })
+ .pipe(
+ tap((response) => {
+ this.__pagination.next(response.pagination);
+ this.__partnerRecommendations.next(response.partnerRecommendations);
+ })
+ );
+ }
+
+ /**
+ * Get product by id
+ */
+ getPartnerRecommendationById(
+ id: string | null
+ ): Observable {
+ return this.__partnerRecommendations.pipe(
+ take(1),
+ map((partnerRecommendations) => {
+ // Find the product
+ const partnerRecommendation =
+ partnerRecommendations?.find((item) => item.id === id) || undefined;
+
+ // Update the product
+ this.__partnerRecommendation.next(partnerRecommendation);
+
+ // Return the product
+ return partnerRecommendation;
+ }),
+ switchMap((product) => {
+ if (!product) {
+ return throwError('Could not found product with id of ' + id + '!');
+ }
+
+ return of(product);
+ })
+ );
+ }
+
+ /**
+ * Create product
+ */
+ createPartnerRecommendation(): Observable {
+ return this.partnerRecommendations$.pipe(
+ take(1),
+ switchMap((partnerRecommendations) =>
+ this._httpClient
+ .post(
+ 'api/apps/member/partner-recommendation/product',
+ {}
+ )
+ .pipe(
+ map((newPartnerRecommendation) => {
+ // Update the partnerRecommendations with the new product
+ if (!!partnerRecommendations) {
+ this.__partnerRecommendations.next([
+ newPartnerRecommendation,
+ ...partnerRecommendations,
+ ]);
+ }
+
+ // Return the new product
+ return newPartnerRecommendation;
+ })
+ )
+ )
+ );
+ }
+}
diff --git a/src/app/modules/admin/member/partner/partner.routing.ts b/src/app/modules/admin/member/partner/partner.routing.ts
index d80a846..aca5843 100644
--- a/src/app/modules/admin/member/partner/partner.routing.ts
+++ b/src/app/modules/admin/member/partner/partner.routing.ts
@@ -11,7 +11,7 @@ export const partnerRoutes: Route[] = [
// redirectTo: 'all',
// },
{
- path: '',
+ path: 'all',
component: ListComponent,
resolve: {
Partners: PartnersResolver,
diff --git a/src/app/modules/admin/member/recommendation/services/recommendation.service.ts b/src/app/modules/admin/member/recommendation/services/recommendation.service.ts
deleted file mode 100644
index 73eac28..0000000
--- a/src/app/modules/admin/member/recommendation/services/recommendation.service.ts
+++ /dev/null
@@ -1,161 +0,0 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import {
- BehaviorSubject,
- filter,
- map,
- Observable,
- of,
- switchMap,
- take,
- tap,
- throwError,
-} from 'rxjs';
-
-import { Recommendation } from '../models/recommendation';
-import { RecommendationPagination } from '../models/recommendation-pagination';
-
-@Injectable({
- providedIn: 'root',
-})
-export class RecommendationService {
- // Private
- private __pagination = new BehaviorSubject<
- RecommendationPagination | undefined
- >(undefined);
- private __recommendation = new BehaviorSubject(
- undefined
- );
- private __recommendations = new BehaviorSubject(
- undefined
- );
-
- /**
- * Constructor
- */
- constructor(private _httpClient: HttpClient) {}
-
- // -----------------------------------------------------------------------------------------------------
- // @ Accessors
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Getter for pagination
- */
- get pagination$(): Observable {
- return this.__pagination.asObservable();
- }
-
- /**
- * Getter for recommendation
- */
- get recommendation$(): Observable {
- return this.__recommendation.asObservable();
- }
-
- /**
- * Getter for recommendations
- */
- get recommendations$(): Observable {
- return this.__recommendations.asObservable();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Get recommendations
- *
- *
- * @param page
- * @param size
- * @param sort
- * @param order
- * @param search
- */
- getRecommendations(
- page: number = 0,
- size: number = 10,
- sort: string = 'name',
- order: 'asc' | 'desc' | '' = 'asc',
- search: string = ''
- ): Observable<{
- pagination: RecommendationPagination;
- recommendations: Recommendation[];
- }> {
- return this._httpClient
- .get<{
- pagination: RecommendationPagination;
- recommendations: Recommendation[];
- }>('api/apps/member/recommendation/recommendations', {
- params: {
- page: '' + page,
- size: '' + size,
- sort,
- order,
- search,
- },
- })
- .pipe(
- tap((response) => {
- this.__pagination.next(response.pagination);
- this.__recommendations.next(response.recommendations);
- })
- );
- }
-
- /**
- * Get product by id
- */
- getRecommendationById(id: string | null): Observable {
- return this.__recommendations.pipe(
- take(1),
- map((recommendations) => {
- // Find the product
- const recommendation =
- recommendations?.find((item) => item.id === id) || undefined;
-
- // Update the product
- this.__recommendation.next(recommendation);
-
- // Return the product
- return recommendation;
- }),
- switchMap((product) => {
- if (!product) {
- return throwError('Could not found product with id of ' + id + '!');
- }
-
- return of(product);
- })
- );
- }
-
- /**
- * Create product
- */
- createRecommendation(): Observable {
- return this.recommendations$.pipe(
- take(1),
- switchMap((recommendations) =>
- this._httpClient
- .post('api/apps/member/recommendation/product', {})
- .pipe(
- map((newRecommendation) => {
- // Update the recommendations with the new product
- if (!!recommendations) {
- this.__recommendations.next([
- newRecommendation,
- ...recommendations,
- ]);
- }
-
- // Return the new product
- return newRecommendation;
- })
- )
- )
- );
- }
-}
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index 93deb7c..20053d4 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -6,8 +6,14 @@
"Casino Money": "Casino Money",
"Unconnected": "Unconnected",
"Project": "Project",
- "Partner": "Partner",
- "Recommendation": "Recommendation",
+ "partner-management": "partner-management",
+ "All Partner": "All Partner",
+ "Partner Mainoffice": "Partner Mainoffice",
+ "Partner Branch": "Partner Branch",
+ "Partner Division": "Partner Division",
+ "Partner Office": "Partner Office",
+ "Partner Store": "Partner Store",
+ "Partner Recommendation": "Recommendation",
"Coupon": "Coupon",
"Coupon Money Log": "Coupon Money Log",
"Coupon Log": "Coupon Log",
diff --git a/src/assets/i18n/ko.json b/src/assets/i18n/ko.json
index 59bf5e3..7ccdaf3 100644
--- a/src/assets/i18n/ko.json
+++ b/src/assets/i18n/ko.json
@@ -7,8 +7,13 @@
"Unconnected": "장기미접속회원",
"Project": "프로젝트",
"partner-management": "파트너관리",
- "Partner": "파트너",
- "Recommendation": "추천코드등록",
+ "All Partner": "전체파트너",
+ "Partner Mainoffice": "본사",
+ "Partner Branch": "대본",
+ "Partner Division": "부본",
+ "Partner Office": "총판",
+ "Partner Store": "매장",
+ "Partner Recommendation": "추천코드등록",
"Coupon": "쿠폰발행리스트",
"Coupon Money Log": "쿠폰발행머니로그",
"Coupon Log": "쿠폰발행 로그",