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oDAAA,EAAAA,iDAAA,EAAAA,qDAAA,EACZtH,+DAAmB,EAAA0H,wDAAA,EAAAA,uEAAA,EACnBzH,wGAAuB,EACvBC,wGAAuB,EACvBE,uDAAW,EAAAyH,gEAAA,EAAAA,2DAAA,EAAAA,mDAAA;MAAE;MACbxH,+EAAiB;MAAA4H,MAAA;IAAA;EAAA","sources":["./src/app/components/pages/blogs-list/blogs-list.component.ts","./src/app/components/pages/blogs-list/blogs-list.component.html"],"sourcesContent":["import { Component, Injector, OnInit } from '@angular/core';\r\nimport { GetAllBlogsRequest } from 'src/app/models/request-models/blog-request';\r\nimport { BaseGridResponse } from 'src/app/models/response-model/base-grid-response';\r\nimport { GetAllBlogsResponse } from 'src/app/models/response-model/blog-response';\r\nimport { SnappstayBaseComponent } from '../../base-component/base.component';\r\nimport { RouterLinkWithHref } from '@angular/router';\r\nimport { CommonModule } from '@angular/common';\r\nimport { NgxPaginationModule } from 'ngx-pagination';\r\nimport { NavbarStyleTwoComponent } from '../../common/navbar-style-two/navbar-style-two.component';\r\nimport { FooterStyleTwoComponent } from '../../common/footer-style-two/footer-style-two.component'; // Import NgxPaginationModule\r\nimport { SetBlogList } from 'src/app/state/snappstay.action';\r\nimport { FormsModule } from '@angular/forms'; // Import FormsModule for ngModel\r\nimport { FontAwesomeModule } from '@fortawesome/angular-fontawesome';\r\n\r\n@Component({\r\n selector: 'app-blogs-list',\r\n standalone: true,\r\n imports: [\r\n RouterLinkWithHref,\r\n CommonModule,\r\n NgxPaginationModule,\r\n NavbarStyleTwoComponent,\r\n FooterStyleTwoComponent,\r\n FormsModule, // Add FormsModule for ngModel binding\r\n FontAwesomeModule,\r\n ],\r\n templateUrl: './blogs-list.component.html',\r\n styleUrls: ['./blogs-list.component.scss'],\r\n})\r\nexport class BlogsListComponent\r\n extends SnappstayBaseComponent\r\n implements OnInit\r\n{\r\n totalRecords = 0; // Total number of blogs\r\n pageSize = 10; // Number of blogs per page\r\n currentPage = 1; // Current page number\r\n filteredBlogs: GetAllBlogsResponse[] = []; // Blogs to display\r\n searchQuery: string = ''; // Search query\r\n isSearched = false;\r\n loading = false;\r\n backupBlogs: GetAllBlogsResponse[] = [];\r\n\r\n constructor(inject: Injector) {\r\n super(inject);\r\n }\r\n\r\n ngOnInit(): void {\r\n // Check if the 'id' parameter is present\r\n const id = this.activatedRoute.snapshot.paramMap.get('id');\r\n if (id) {\r\n this.currentPage = Number(id) || 1; // Use the 'id' as the page number if it's valid\r\n }\r\n this.getAllBlogs();\r\n }\r\n\r\n // Method to get all blogs with optional search query\r\n getAllBlogs() {\r\n const filter: GetAllBlogsRequest = {\r\n pageNumber: this.currentPage,\r\n pageSize: this.pageSize,\r\n sortColumn: 'Id',\r\n sortOrder: 'asc',\r\n search: this.searchQuery, // Pass search query to the API\r\n };\r\n this.loading = true;\r\n\r\n this.blogApiService.getAllBlogsData(filter).subscribe({\r\n next: (response: BaseGridResponse) => {\r\n this.loading = false;\r\n\r\n if (response.result) {\r\n this.store.dispatch(new SetBlogList(response.result));\r\n }\r\n if (response.successful) {\r\n this.filteredBlogs = response.result || [];\r\n if (!this.searchQuery) {\r\n this.backupBlogs = this.filteredBlogs;\r\n }\r\n this.totalRecords = response.totalRecords || 0;\r\n } else {\r\n this.toastr.error(response.message, 'Error fetching blogs', {\r\n timeOut: 3000,\r\n positionClass: 'toast-bottom-right',\r\n });\r\n }\r\n },\r\n error: (error) => {\r\n this.loading = false;\r\n\r\n this.toastr.error('Something went wrong', 'Error', {\r\n timeOut: 3000,\r\n positionClass: 'toast-bottom-right',\r\n });\r\n },\r\n });\r\n }\r\n\r\n onPageChange(page: number) {\r\n this.currentPage = page;\r\n this.router.navigate(['/blogs-list', page]);\r\n this.getAllBlogs();\r\n }\r\n\r\n // Method triggered on search\r\n onSearch() {\r\n if (this.searchQuery) {\r\n this.isSearched = true;\r\n this.currentPage = 1; // Reset to first page on new search\r\n this.getAllBlogs();\r\n } else {\r\n this.filteredBlogs = this.backupBlogs;\r\n this.isSearched = false;\r\n }\r\n }\r\n\r\n clearSearch() {\r\n this.isSearched = false;\r\n this.searchQuery = ''; // Clear the search query\r\n this.getAllBlogs(); // Fetch all blogs without a search filter\r\n }\r\n}\r\n","\r\n
\r\n
\r\n

Snappstay News

\r\n
\r\n\r\n \r\n
\r\n \r\n \r\n \r\n
\r\n\r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n
\r\n
\r\n
\r\n \r\n \"Blog\r\n \r\n
\r\n
\r\n
    \r\n
  • \r\n {{ content.publishedDate | date }}\r\n
  • \r\n
\r\n

\r\n \r\n {{ content.title }}\r\n \r\n

\r\n\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n
\r\n
\r\n \"No\r\n
\r\n

No results found. Please try searching with different\r\n keywords.

\r\n \r\n \r\n
\r\n\r\n
\r\n\r\n \r\n
\r\n \r\n \r\n
\r\n
\r\n\r\n"],"names":["SnappstayBaseComponent","RouterLinkWithHref","CommonModule","NgxPaginationModule","NavbarStyleTwoComponent","FooterStyleTwoComponent","SetBlogList","FormsModule","FontAwesomeModule","i0","ɵɵelementStart","ɵɵlistener","BlogsListComponent_button_7_Template_button_click_0_listener","ɵɵrestoreView","_r1","ctx_r1","ɵɵnextContext","ɵɵresetView","onSearch","ɵɵelement","ɵɵelementEnd","BlogsListComponent_button_8_Template_button_click_0_listener","_r3","clearSearch","ɵɵelementContainerStart","ɵɵtemplate","BlogsListComponent_ng_container_10_div_1_Template","ɵɵadvance","ɵɵproperty","ɵɵpureFunction0","_c0","ɵɵtext","content_r4","id","coverImageUrl","ɵɵsanitizeUrl","ɵɵtextInterpolate1","ɵɵpipeBind1","publishedDate","title","BlogsListComponent_ng_container_11_div_1_Template","ɵɵpipeBind2","filteredBlogs","ɵɵpureFunction2","_c1","currentPage","totalRecords","BlogsListComponent_div_12_button_6_Template_button_click_0_listener","_r5","BlogsListComponent_div_12_button_7_Template_button_click_0_listener","_r6","BlogsListComponent_div_12_span_5_Template","BlogsListComponent_div_12_button_6_Template","BlogsListComponent_div_12_button_7_Template","searchQuery","BlogsListComponent_div_13_Template_pagination_controls_pageChange_1_listener","$event","_r7","onPageChange","BlogsListComponent","constructor","inject","pageSize","isSearched","loading","backupBlogs","ngOnInit","activatedRoute","snapshot","paramMap","get","Number","getAllBlogs","filter","pageNumber","sortColumn","sortOrder","search","blogApiService","getAllBlogsData","subscribe","next","response","result","store","dispatch","successful","toastr","error","message","timeOut","positionClass","page","router","navigate","ɵɵdirectiveInject","Injector","selectors","standalone","features","ɵɵInheritDefinitionFeature","ɵɵStandaloneFeature","decls","vars","consts","template","BlogsListComponent_Template","rf","ctx","ɵɵtwoWayListener","BlogsListComponent_Template_input_ngModelChange_6_listener","ɵɵtwoWayBindingSet","BlogsListComponent_Template_input_keyup_enter_6_listener","BlogsListComponent_button_7_Template","BlogsListComponent_button_8_Template","BlogsListComponent_ng_container_10_Template","BlogsListComponent_ng_container_11_Template","BlogsListComponent_div_12_Template","BlogsListComponent_div_13_Template","ɵɵtwoWayProperty","length","i1","NgForOf","NgIf","DatePipe","i2","PaginatePipe","PaginationControlsComponent","i3","DefaultValueAccessor","NgControlStatus","NgModel","styles"],"sourceRoot":"webpack:///","x_google_ignoreList":[]}