|
1 |
| -<div style="min-height:82vh;"> |
2 |
| - <div class="container"> |
3 |
| - |
4 |
| - |
5 |
| - <div *ngIf="listing" class="my-5"> |
6 |
| - |
7 |
| - |
8 |
| - <div class="row"> |
9 |
| - <span class="fs-3 ">Your Stories |
10 |
| - <button class="btn btn-secondary float-end" (click)="openCreateForm()">Add |
11 |
| - New</button></span> |
12 |
| - </div> |
13 |
| - <div class="mx-5 py-3" *ngFor=" |
14 |
| - let story of stories | sortByDate |
| 1 | +<div style="min-height: 82vh"> |
| 2 | + <div class="container"> |
| 3 | + <div *ngIf="listing" class="my-5"> |
| 4 | + <div class="row"> |
| 5 | + <span class="fs-3" |
| 6 | + >Your Stories |
| 7 | + <button |
| 8 | + class="btn btn-secondary float-end" |
| 9 | + (click)="openCreateForm()" |
| 10 | + > |
| 11 | + Add New |
| 12 | + </button></span |
| 13 | + > |
| 14 | + </div> |
| 15 | + <div |
| 16 | + class="mx-5 py-3" |
| 17 | + *ngFor=" |
| 18 | + let story of stories |
| 19 | + | sortByDate |
15 | 20 | | paginate
|
16 |
| - : { |
17 |
| - itemsPerPage: tableSize, |
18 |
| - currentPage: page, |
19 |
| - totalItems: count |
20 |
| - }; |
21 |
| - let i = index |
22 |
| -
|
23 |
| - "> |
24 |
| - |
25 |
| - <div class="row pb-2"> |
26 |
| - <div> |
27 |
| - <span class="float-start fs-3"> {{story.title}}</span> |
28 |
| - <span class="float-end text-primary"> Date :- {{story.created_at | date:'mediumDate'}}</span> |
29 |
| - |
30 |
| - </div> |
31 |
| - </div> |
32 |
| - |
33 |
| - |
34 |
| - <div [innerHTML]="story.content | safeHtml" class="p-2"></div> |
35 |
| - |
36 |
| - <button class="btn btn-outline-secondary me-2" (click)="openEditForm(story.id)">Edit</button> |
37 |
| - <button class="btn btn-outline-danger" (click)="deleteStory(story.id)">Delete</button> |
38 |
| - </div> |
39 |
| - <div style="min-height: 60vh;" class="text-center m-auto" *ngIf="stories.length==0"> |
40 |
| - No story found |
41 |
| - </div> |
42 |
| - <div class="d-flex justify-content-center"> |
43 |
| - <pagination-controls previousLabel="Prev" nextLabel="Next" (pageChange)="onTableDataChange($event)"> |
44 |
| - </pagination-controls> |
45 |
| - </div> |
| 21 | + : { |
| 22 | + itemsPerPage: tableSize, |
| 23 | + currentPage: page, |
| 24 | + totalItems: count |
| 25 | + }; |
| 26 | + let i = index |
| 27 | + " |
| 28 | + > |
| 29 | + <div class="row pb-2"> |
| 30 | + <div> |
| 31 | + <span class="float-start fs-3"> {{ story.title }}</span> |
| 32 | + <span class="float-end text-primary"> |
| 33 | + Date :- {{ story.createdAt | date: "medium" }}</span |
| 34 | + > |
| 35 | + </div> |
46 | 36 | </div>
|
47 |
| - <div *ngIf="openForm" class="mx-5 my-4"> |
48 |
| - <p class="fs-3 text-center"> |
49 |
| - <button class="btn btn-warning float-start" (click)="listing=true;openForm=false;">Go Back</button> |
50 |
| - Add Your Story |
51 |
| - </p> |
52 | 37 |
|
53 |
| - <form [formGroup]="storyForm" (ngSubmit)="editButton==false?addStory():editStoryFun()"> |
54 |
| - <div class="mb-3"> |
55 |
| - <label class="form-label">Title</label> |
56 |
| - <input type="text" class="form-control" formControlName="title"> |
57 |
| - <p *ngIf="( |
58 |
| - storyForm.controls['title'].dirty || |
59 |
| - storyForm.controls['title'].touched || |
60 |
| - storyForm.controls['title'].pristine) && |
61 |
| - storyForm.controls['title'].errors |
62 |
| - " class="alert alert-danger">This Field is Required</p> |
63 |
| - </div> |
64 |
| - <div class="mb-3"> |
65 |
| - <label class="form-label">Content</label> |
66 |
| - <ckeditor #editor formControlName="content"> |
67 |
| - </ckeditor> |
68 |
| - <p *ngIf="( |
69 |
| - storyForm.controls['content'].dirty || |
70 |
| - storyForm.controls['content'].touched || |
71 |
| - storyForm.controls['content'].pristine) && |
72 |
| - storyForm.controls['content'].errors |
73 |
| - " class="alert alert-danger">This Field is Required</p> |
74 |
| - </div> |
75 |
| - <div class="mb-3"> |
76 |
| - <label class="form-label">Created At</label> |
77 |
| - <input type="datetime-local" class="form-control" |
78 |
| - formControlName="created_at"> |
79 |
| - <p *ngIf="( |
80 |
| - storyForm.controls['created_at'].dirty || |
81 |
| - storyForm.controls['created_at'].touched || |
82 |
| - storyForm.controls['created_at'].pristine) && |
83 |
| - storyForm.controls['created_at'].errors |
84 |
| - " class="alert alert-danger">This Field is Required</p> |
85 |
| - </div> |
| 38 | + <div [innerHTML]="story.content | safeHtml" class="p-2"></div> |
86 | 39 |
|
87 |
| - <button type="submit" class="btn btn-primary" [disabled]="!storyForm.valid">Submit |
88 |
| - </button> |
| 40 | + <button |
| 41 | + class="btn btn-outline-secondary me-2" |
| 42 | + (click)="openEditForm(story.id)" |
| 43 | + > |
| 44 | + Edit |
| 45 | + </button> |
| 46 | + <button class="btn btn-outline-danger" (click)="deleteStory(story.id)"> |
| 47 | + Delete |
| 48 | + </button> |
| 49 | + </div> |
| 50 | + <div |
| 51 | + style="min-height: 60vh" |
| 52 | + class="text-center m-auto" |
| 53 | + *ngIf="stories.length == 0" |
| 54 | + > |
| 55 | + No story found |
| 56 | + </div> |
| 57 | + <div class="d-flex justify-content-center"> |
| 58 | + <pagination-controls |
| 59 | + previousLabel="Prev" |
| 60 | + nextLabel="Next" |
| 61 | + (pageChange)="onTableDataChange($event)" |
| 62 | + > |
| 63 | + </pagination-controls> |
| 64 | + </div> |
| 65 | + </div> |
| 66 | + <div *ngIf="openForm" class="mx-5 my-4"> |
| 67 | + <p class="fs-3 text-center"> |
| 68 | + <button |
| 69 | + class="btn btn-warning float-start" |
| 70 | + (click)="listing = true; openForm = false" |
| 71 | + > |
| 72 | + Go Back |
| 73 | + </button> |
| 74 | + Add Your Story |
| 75 | + </p> |
89 | 76 |
|
90 |
| - </form> |
| 77 | + <form |
| 78 | + [formGroup]="storyForm" |
| 79 | + (ngSubmit)="editButton == false ? addStory() : editStoryFun()" |
| 80 | + > |
| 81 | + <div class="mb-3"> |
| 82 | + <label class="form-label">Title</label> |
| 83 | + <input type="text" class="form-control" formControlName="title" /> |
| 84 | + <p |
| 85 | + *ngIf=" |
| 86 | + (storyForm.controls['title'].dirty || |
| 87 | + storyForm.controls['title'].touched || |
| 88 | + storyForm.controls['title'].pristine) && |
| 89 | + storyForm.controls['title'].errors |
| 90 | + " |
| 91 | + class="alert alert-danger" |
| 92 | + > |
| 93 | + This Field is Required |
| 94 | + </p> |
| 95 | + </div> |
| 96 | + <div class="mb-3"> |
| 97 | + <label class="form-label">Content</label> |
| 98 | + <ckeditor #editor formControlName="content"> </ckeditor> |
| 99 | + <p |
| 100 | + *ngIf=" |
| 101 | + (storyForm.controls['content'].dirty || |
| 102 | + storyForm.controls['content'].touched || |
| 103 | + storyForm.controls['content'].pristine) && |
| 104 | + storyForm.controls['content'].errors |
| 105 | + " |
| 106 | + class="alert alert-danger" |
| 107 | + > |
| 108 | + This Field is Required |
| 109 | + </p> |
91 | 110 | </div>
|
92 | 111 |
|
| 112 | + <button |
| 113 | + type="submit" |
| 114 | + class="btn btn-primary" |
| 115 | + [disabled]="!storyForm.valid" |
| 116 | + > |
| 117 | + Submit |
| 118 | + </button> |
| 119 | + </form> |
93 | 120 | </div>
|
| 121 | + </div> |
94 | 122 | </div>
|
0 commit comments