diff --git a/src/app/mock-api/apps/board/notice/api.ts b/src/app/mock-api/apps/board/notice/api.ts
index 5974981..fc51b73 100644
--- a/src/app/mock-api/apps/board/notice/api.ts
+++ b/src/app/mock-api/apps/board/notice/api.ts
@@ -33,29 +33,13 @@ export class BoardNoticeMockApi {
.reply(({ request }) => {
// Get available queries
const search = request.params.get('search');
- const sort = request.params.get('sort') || 'name';
- const order = request.params.get('order') || 'asc';
+
const page = parseInt(request.params.get('page') ?? '1', 10);
const size = parseInt(request.params.get('size') ?? '10', 10);
// Clone the notices
let notices: any[] | null = cloneDeep(this._notices);
- // Sort the notices
- if (sort === 'sku' || sort === 'name' || sort === 'active') {
- notices.sort((a, b) => {
- const fieldA = a[sort].toString().toUpperCase();
- const fieldB = b[sort].toString().toUpperCase();
- return order === 'asc'
- ? fieldA.localeCompare(fieldB)
- : fieldB.localeCompare(fieldA);
- });
- } else {
- notices.sort((a, b) =>
- order === 'asc' ? a[sort] - b[sort] : b[sort] - a[sort]
- );
- }
-
// If search exists...
if (search) {
// Filter the notices
diff --git a/src/app/mock-api/apps/board/notice/data.ts b/src/app/mock-api/apps/board/notice/data.ts
index f416a0e..8a52f37 100644
--- a/src/app/mock-api/apps/board/notice/data.ts
+++ b/src/app/mock-api/apps/board/notice/data.ts
@@ -2,6 +2,40 @@
export const notices = [
{
+ id: '1',
+ idx: 80,
+ site: '',
+ title:
+ '게임멈춤,튕기는 현상및 계좌문의시 확인및 입금전후 확인사항 대한 공지사항',
+ writer: '관리자',
+ writeDate: '2021-10-25 02:25',
+ views: 136,
+ state: '노출',
+ },
+ {
+ id: '2',
+ idx: 80,
+ site: '',
+ title:
+ '게임멈춤,튕기는 현상및 계좌문의시 확인및 입금전후 확인사항 대한 공지사항',
+ writer: '관리자',
+ writeDate: '2021-10-25 02:25',
+ views: 136,
+ state: '노출',
+ },
+ {
+ id: '3',
+ idx: 80,
+ site: 'all',
+ title:
+ '게임멈춤,튕기는 현상및 계좌문의시 확인및 입금전후 확인사항 대한 공지사항',
+ writer: '관리자',
+ writeDate: '2021-10-25 02:25',
+ views: 136,
+ state: '노출',
+ },
+ {
+ id: '4',
idx: 80,
site: '',
title:
diff --git a/src/app/modules/admin/board/notice-oneline/components/redit.component.ts b/src/app/modules/admin/board/notice-oneline/components/redit.component.ts
index 53ae71c..c0b797b 100644
--- a/src/app/modules/admin/board/notice-oneline/components/redit.component.ts
+++ b/src/app/modules/admin/board/notice-oneline/components/redit.component.ts
@@ -55,9 +55,9 @@ export class ReditComponent implements OnInit, AfterViewInit, OnDestroy {
noticeOnelineForm!: FormGroup;
editMode: boolean = false;
- noticeType = NOTICE_TYPE;
- siteType = SITE_TYPE;
- useOrNotType = USE_OR_NOT_TYPE;
+ noticeType = NOTICE_ONELINE_TYPE;
+ siteType = SITE_NOTICE_ONELINE_TYPE;
+ useOrNotType = USE_OR_NOT_NOTICE_ONELINE_TYPE;
noticeOneline!: NoticeOneline;
@@ -180,21 +180,21 @@ export class ReditComponent implements OnInit, AfterViewInit, OnDestroy {
}
}
-export const NOTICE_TYPE = [
+export const NOTICE_ONELINE_TYPE = [
{
key: '0',
value: '흐르는공지',
},
];
-export const SITE_TYPE = [
+export const SITE_NOTICE_ONELINE_TYPE = [
{
key: '0',
value: '--전체--',
},
];
-export const USE_OR_NOT_TYPE = [
+export const USE_OR_NOT_NOTICE_ONELINE_TYPE = [
{
key: '0',
value: '사용(노출)',
diff --git a/src/app/modules/admin/board/notice/components/index.ts b/src/app/modules/admin/board/notice/components/index.ts
index 04759eb..d187813 100644
--- a/src/app/modules/admin/board/notice/components/index.ts
+++ b/src/app/modules/admin/board/notice/components/index.ts
@@ -1,3 +1,4 @@
import { ListComponent } from './list.component';
+import { ReditComponent } from './redit.component';
-export const COMPONENTS = [ListComponent];
+export const COMPONENTS = [ListComponent, ReditComponent];
diff --git a/src/app/modules/admin/board/notice/components/list.component.html b/src/app/modules/admin/board/notice/components/list.component.html
index 753facc..c404905 100644
--- a/src/app/modules/admin/board/notice/components/list.component.html
+++ b/src/app/modules/admin/board/notice/components/list.component.html
@@ -12,132 +12,99 @@
-
-
-
-
-
-
-
- 작성자
- 글제목
- 글내용
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -149,22 +116,28 @@
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto"
>
- 0; else noNotice">
+ 0; else noUser">
-
선택
-
번호
-
사이트
-
제목
-
작성자
-
작성일
-
조회
-
상태
+
+
+
+
번호
+
사이트
+
제목
+
+ 작성자
+
+ 작성일
+
+
+ 조회
+
+ 상태
+
@@ -174,44 +147,44 @@
-
-
+
-
+
{{ notice.idx }}
-
+
{{ notice.site }}
-
+
{{ notice.title }}
-
-
+
+
{{ notice.writer }}
-
-
-
+
+
{{ notice.writeDate }}
-
-
+
+
{{ notice.views }}
-
-
-
+
+
{{ notice.state }}
+
+
-
-
-
-
+
- There are no notices!
+ There are no data!
diff --git a/src/app/modules/admin/board/notice/components/list.component.ts b/src/app/modules/admin/board/notice/components/list.component.ts
index 812f993..b32b8fd 100644
--- a/src/app/modules/admin/board/notice/components/list.component.ts
+++ b/src/app/modules/admin/board/notice/components/list.component.ts
@@ -42,18 +42,18 @@ import { Router } from '@angular/router';
/* language=SCSS */
`
.inventory-grid {
- grid-template-columns: 60px auto 40px;
+ grid-template-columns: 40px 40px 40px auto 200px 200px;
@screen sm {
- grid-template-columns: 60px 60px 60px 60px 60px 60px auto 60px;
+ grid-template-columns: 40px 40px 40px auto 200px 200px;
}
@screen md {
- grid-template-columns: 60px 60px 60px 60px 60px 60px auto 60px 60px;
+ grid-template-columns: 40px 40px 40px auto 300px 200px;
}
@screen lg {
- grid-template-columns: 60px 70px 70px 70px 70px 100px 60px 60px auto 60px 60px 60px 60px;
+ grid-template-columns: 40px 40px 40px auto 300px 200px;
}
}
`,
@@ -67,13 +67,14 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatSort) private _sort!: MatSort;
notices$!: Observable
;
- users$!: Observable;
isLoading = false;
searchInputControl = new FormControl();
selectedNotice?: Notice;
pagination?: NoticePagination;
+ __isSearchOpened = false;
+
private _unsubscribeAll: Subject = new Subject();
/**
@@ -113,45 +114,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
/**
* After view init
*/
- ngAfterViewInit(): void {
- if (this._sort && this._paginator) {
- // Set the initial sort
- this._sort.sort({
- id: 'name',
- start: 'asc',
- disableClear: true,
- });
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
-
- // If the notice changes the sort order...
- this._sort.sortChange
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe(() => {
- // Reset back to the first page
- this._paginator.pageIndex = 0;
- });
-
- // Get products if sort or page changes
- merge(this._sort.sortChange, this._paginator.page)
- .pipe(
- switchMap(() => {
- this.isLoading = true;
- return this._noticeService.getNotices(
- this._paginator.pageIndex,
- this._paginator.pageSize,
- this._sort.active,
- this._sort.direction
- );
- }),
- map(() => {
- this.isLoading = false;
- })
- )
- .subscribe();
- }
- }
+ ngAfterViewInit(): void {}
/**
* On destroy
@@ -166,14 +129,19 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
// @ Public methods
// -----------------------------------------------------------------------------------------------------
- viewUserDetail(id: string): void {
- let url: string = 'member/user/' + id;
- this.router.navigateByUrl(url);
- }
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
+ __onClickReditBtn(event: MouseEvent, id: string): void {
+ const param = id === '0' ? '' : id;
+ let url: string = 'board/notice/redit/' + param;
+ this.router.navigateByUrl(url);
+ }
+ __onClickSearch(): void {
+ this.__isSearchOpened = !this.__isSearchOpened;
+ }
+
/**
* Create product
*/
diff --git a/src/app/modules/admin/board/notice/components/redit.component.html b/src/app/modules/admin/board/notice/components/redit.component.html
new file mode 100644
index 0000000..7b7431b
--- /dev/null
+++ b/src/app/modules/admin/board/notice/components/redit.component.html
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+ 공지사항 {{ !notice ? "등록" : "수정" }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/modules/admin/board/notice/components/view.component.ts b/src/app/modules/admin/board/notice/components/redit.component.ts
similarity index 62%
rename from src/app/modules/admin/board/notice/components/view.component.ts
rename to src/app/modules/admin/board/notice/components/redit.component.ts
index 67e7c80..a7a72a0 100644
--- a/src/app/modules/admin/board/notice/components/view.component.ts
+++ b/src/app/modules/admin/board/notice/components/redit.component.ts
@@ -8,33 +8,20 @@ import {
ViewChild,
ViewEncapsulation,
} from '@angular/core';
-import {
- FormBuilder,
- FormControl,
- FormGroup,
- Validators,
-} from '@angular/forms';
-import { MatCheckboxChange } from '@angular/material/checkbox';
+
+import { ActivatedRoute, Router } from '@angular/router';
+import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
-import {
- debounceTime,
- map,
- merge,
- Observable,
- Subject,
- switchMap,
- takeUntil,
-} from 'rxjs';
+import { Subject, takeUntil } from 'rxjs';
import { fuseAnimations } from '@fuse/animations';
import { FuseConfirmationService } from '@fuse/services/confirmation';
-
-import { User } from 'app/modules/admin/member/user/models/user';
-import { UserService } from 'app/modules/admin/member/user/services/user.service';
+import { NoticeService } from '../services/notice.service';
+import { Notice } from '../models/notice';
@Component({
- selector: 'notice-view',
- templateUrl: './view.component.html',
+ selector: 'notice-redit',
+ templateUrl: './redit.component.html',
styles: [
/* language=SCSS */
`
@@ -59,14 +46,18 @@ import { UserService } from 'app/modules/admin/member/user/services/user.service
changeDetection: ChangeDetectionStrategy.OnPush,
animations: fuseAnimations,
})
-export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
+export class ReditComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
@ViewChild(MatSort) private _sort!: MatSort;
isLoading = false;
searchInputControl = new FormControl();
- selectedProductForm!: FormGroup;
- selectedUser?: User;
+ noticeForm!: FormGroup;
+ editMode: boolean = false;
+
+ noticeType = NOTICE_TYPE;
+
+ notice!: Notice;
private _unsubscribeAll: Subject = new Subject();
@@ -77,7 +68,9 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
private _changeDetectorRef: ChangeDetectorRef,
private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder,
- private _userService: UserService
+ private _route: ActivatedRoute,
+ private _router: Router,
+ private _noticeService: NoticeService
) {}
// -----------------------------------------------------------------------------------------------------
@@ -88,53 +81,28 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
* On init
*/
ngOnInit(): void {
- this.selectedProductForm = this._formBuilder.group({
- id: [''],
- signinId: [{ value: '', disabled: true }],
- signinPw: [{ value: '' }],
- exchangePw: [''],
- description: [''],
- tags: [[]],
- nickname: [{ value: '', disabled: true }],
- ownCash: [''],
- phoneNumber: [''],
- level: [''],
- status: [''],
- isExcahngeMoney: [''],
- bankname: [''],
- accountNumber: [''],
- accountHolder: [''],
- comp: [''],
- coupon: [''],
- recommender: [{ value: '', disabled: true }],
- changeSite: [''],
- recommendCount: [''],
- hodingGameMoney: [{ value: '0', disabled: true }],
- memo: [''],
- bacaraRate: [],
- rulletRate: [],
- dragonRate: [],
- etcRate: [],
- slotRate: [],
- casinoRusingRate: [],
- slotRusingRate: [],
+ // Create the contact form
+ this.noticeForm = this._formBuilder.group({
+ writer: ['관리자'],
+ noticeType: [''],
+ title: [''],
+ writerDate: [''],
+ content: [''],
});
- // Get the User
- this._userService.user$
+ this._noticeService.notice$
.pipe(takeUntil(this._unsubscribeAll))
- .subscribe((user: User | undefined) => {
- if (!user) {
+ .subscribe((notice: Notice | undefined) => {
+ if (!notice) {
return;
}
- this.selectedUser = user;
- this.selectedProductForm.patchValue(user);
+ this.notice = notice;
+ this.noticeForm.patchValue(notice);
+
// Mark for check
this._changeDetectorRef.markForCheck();
});
-
- /* this.user$ = this._userService.user$; */
}
/**
@@ -159,6 +127,14 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
// @ Private methods
// -----------------------------------------------------------------------------------------------------
+ __onClickeCancel(): void {
+ /* let url: string = 'board/customer-template/';
+ this._router.navigateByUrl(url); */
+ }
+ __onClickReditBtn(event: MouseEvent, notice: Notice): void {
+ console.log('click: ', notice);
+ }
+
/**
* Create product
*/
@@ -171,6 +147,22 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
*/
__toggleDetails(productId: string): void {}
+ /**
+ * Toggle edit mode
+ *
+ * @param editMode
+ */
+ toggleEditMode(editMode: boolean | null = null): void {
+ if (editMode === null) {
+ this.editMode = !this.editMode;
+ } else {
+ this.editMode = editMode;
+ }
+
+ // Mark for check
+ this._changeDetectorRef.markForCheck();
+ }
+
/**
* Track by function for ngFor loops
*
@@ -181,3 +173,14 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
return item.id || index;
}
}
+
+export const NOTICE_TYPE = [
+ {
+ key: '0',
+ value: '공지사항',
+ },
+ {
+ key: '1',
+ value: '파트너공지',
+ },
+];
diff --git a/src/app/modules/admin/board/notice/components/view.component.html b/src/app/modules/admin/board/notice/components/view.component.html
deleted file mode 100644
index 07b309a..0000000
--- a/src/app/modules/admin/board/notice/components/view.component.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/src/app/modules/admin/board/notice/models/notice.ts b/src/app/modules/admin/board/notice/models/notice.ts
index c322533..71394e5 100644
--- a/src/app/modules/admin/board/notice/models/notice.ts
+++ b/src/app/modules/admin/board/notice/models/notice.ts
@@ -1,5 +1,5 @@
export interface Notice {
- id?: string;
+ id: string;
idx?: number;
site?: string;
title?: string;
diff --git a/src/app/modules/admin/board/notice/notice.module.ts b/src/app/modules/admin/board/notice/notice.module.ts
index 0ffebc2..10181be 100644
--- a/src/app/modules/admin/board/notice/notice.module.ts
+++ b/src/app/modules/admin/board/notice/notice.module.ts
@@ -15,6 +15,8 @@ import { MatGridListModule } from '@angular/material/grid-list';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatRadioModule } from '@angular/material/radio';
import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatDatepickerModule } from '@angular/material/datepicker';
+import { MatMomentDateModule } from '@angular/material-moment-adapter';
import { TranslocoModule } from '@ngneat/transloco';
@@ -45,6 +47,8 @@ import { noticeRoutes } from './notice.routing';
MatSlideToggleModule,
MatRadioModule,
MatCheckboxModule,
+ MatDatepickerModule,
+ MatMomentDateModule,
],
})
export class NoticeModule {}
diff --git a/src/app/modules/admin/board/notice/notice.routing.ts b/src/app/modules/admin/board/notice/notice.routing.ts
index 04c30c6..ef85069 100644
--- a/src/app/modules/admin/board/notice/notice.routing.ts
+++ b/src/app/modules/admin/board/notice/notice.routing.ts
@@ -1,24 +1,32 @@
import { Route } from '@angular/router';
import { ListComponent } from './components/list.component';
-import { ViewComponent } from '../../member/user/components/view.component';
+import { ReditComponent } from './components/redit.component';
-import { NoticesResolver } from './resolvers/notice.resolver';
-import { UserResolver } from '../../member/user/resolvers/user.resolver';
+import { NoticesResolver, NoticeResolver } from './resolvers/notice.resolver';
export const noticeRoutes: Route[] = [
{
path: '',
+ pathMatch: 'full',
+ redirectTo: 'list',
+ },
+ {
+ path: 'list',
component: ListComponent,
resolve: {
notices: NoticesResolver,
},
},
{
- path: ':id',
- component: ViewComponent,
+ path: 'redit',
+ component: ReditComponent,
+ },
+ {
+ path: 'redit/:id',
+ component: ReditComponent,
resolve: {
- users: UserResolver,
+ notice: NoticeResolver,
},
},
];