diff --git a/package.json b/package.json index a15ec42..f9ff045 100755 --- a/package.json +++ b/package.json @@ -44,13 +44,15 @@ "@angular/platform-browser-dynamic": "^8.2.4", "@angular/router": "^8.2.4", "@angular/service-worker": "^8.2.4", + "@ng-bootstrap/ng-bootstrap": "5.0.0", "@ngtools/webpack": "^8.3.2", "@ngx-lib/multiselect": "^1.0.3", - "@ng-bootstrap/ng-bootstrap": "5.0.0", + "@types/lodash": "^4.14.179", "bootstrap": "^4.3.1", "core-js": "^3.2.1", "custom-select-dropdown": "^1.0.11", "font-awesome": "^4.7.0", + "lodash": "^4.17.21", "moment": "^2.24.0", "rxjs": "^6.5.3", "zone.js": "~0.9.1" diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts index 9f70cb1..9ee4354 100755 --- a/src/app/app.routing.ts +++ b/src/app/app.routing.ts @@ -1,4 +1,4 @@ -import { Routes, RouterModule } from '@angular/router'; +import { RouterModule, Routes } from '@angular/router'; import { AuthenticationGuard, RoleGuard } from './core'; import { NgModule } from '@angular/core'; @@ -7,50 +7,61 @@ import { NotFoundComponent } from './pages/404'; const AppRoutes: Routes = [ { path: '', - data: {dashboard: true}, + data: { dashboard: true }, canActivate: [AuthenticationGuard], children: [ { path: 'volunteers', - loadChildren: './pages/volunteers/volunteers.module#VolunteersModule', + loadChildren: + './pages/volunteers/volunteers.module#VolunteersModule', canActivate: [RoleGuard], - data: {roles: ['DSU', 'NGO', 'INS']} + data: { roles: ['DSU', 'NGO', 'INS'] } }, { path: 'resources', - loadChildren: './pages/resources/resources.module#ResourcesModule', + loadChildren: + './pages/resources/resources.module#ResourcesModule', canActivate: [RoleGuard], - data: {roles: ['DSU', 'NGO']} + data: { roles: ['DSU', 'NGO'] } + }, + { + path: 'categories', + loadChildren: + './pages/categories/categories.module#CategoriesModule', + canActivate: [RoleGuard], + data: { roles: ['DSU'] } }, { path: 'organisations', - loadChildren: './pages/organisations/organisations.module#OrganisationsModule', + loadChildren: + './pages/organisations/organisations.module#OrganisationsModule', canActivate: [RoleGuard], - data: {roles: ['DSU', 'NGO']} + data: { roles: ['DSU', 'NGO'] } }, { path: 'map', loadChildren: './pages/map/map.module#MapModule', canActivate: [RoleGuard], - data: {roles: ['DSU']} + data: { roles: ['DSU'] } }, { path: 'info', loadChildren: './pages/info/info.module#InfoModule', canActivate: [RoleGuard], - data: {roles: ['DSU', 'NGO', 'INS']} + data: { roles: ['DSU', 'NGO', 'INS'] } }, { path: 'users', loadChildren: './pages/users/users.module#UsersModule', canActivate: [RoleGuard], - data: {roles: ['DSU', 'NGO', 'INS']} + data: { roles: ['DSU', 'NGO', 'INS'] } } ] }, { path: '', - loadChildren: './pages/authentication/authentication.module#AuthenticationModule' + loadChildren: + './pages/authentication/authentication.module#AuthenticationModule' }, { path: '404', @@ -58,6 +69,7 @@ const AppRoutes: Routes = [ }, { path: '**', redirectTo: '/404' } ]; + @NgModule({ imports: [RouterModule.forRoot(AppRoutes)], exports: [RouterModule] diff --git a/src/app/pages/categories/categories.module.ts b/src/app/pages/categories/categories.module.ts new file mode 100644 index 0000000..5e7a052 --- /dev/null +++ b/src/app/pages/categories/categories.module.ts @@ -0,0 +1,34 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { CategoriesComponent } from './categories/categories.component'; +import { CategoriesDashboardComponent } from './categories/components/categories-dashboard/categories-dashboard.component'; +import { CategoryAddComponent } from './categories/components/category-add/category-add.component'; +import { CategoryEditComponent } from './categories/components/category-edit/category-edit.component'; +import { CategoryDetailsComponent } from './categories/components/category-details/category-details.component'; +import { CategoriesRoutingModule } from '@app/pages/categories/categories.routing'; +import { NgxMultiselectModule } from '@ngx-lib/multiselect'; +import { SelectDropDownModule } from 'custom-select-dropdown'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { SharedModule } from '@app/shared'; + +@NgModule({ + declarations: [ + CategoriesComponent, + CategoryAddComponent, + CategoryEditComponent, + CategoryDetailsComponent, + CategoriesDashboardComponent + ], + imports: [ + NgxMultiselectModule, + SelectDropDownModule, + NgbModule, + CommonModule, + FormsModule, + ReactiveFormsModule, + SharedModule, + CategoriesRoutingModule + ] +}) +export class CategoriesModule {} diff --git a/src/app/pages/categories/categories.routing.ts b/src/app/pages/categories/categories.routing.ts new file mode 100644 index 0000000..5e885c8 --- /dev/null +++ b/src/app/pages/categories/categories.routing.ts @@ -0,0 +1,47 @@ +import { NgModule } from '@angular/core'; +import { RoleGuard } from '@app/core'; +import { RouterModule, Routes } from '@angular/router'; +import { CategoriesComponent } from './categories/categories.component'; +import { CategoriesDashboardComponent } from './categories/components/categories-dashboard/categories-dashboard.component'; +import { CategoryAddComponent } from './categories/components/category-add/category-add.component'; +import { CategoryEditComponent } from './categories/components/category-edit/category-edit.component'; +import { CategoryDetailsComponent } from './categories/components/category-details/category-details.component'; + +const routes: Routes = [ + { + path: '', + component: CategoriesComponent, + children: [ + { + path: '', + component: CategoriesDashboardComponent, + canActivate: [RoleGuard], + data: { roles: ['DSU'] } + }, + { + path: 'add', + component: CategoryAddComponent, + canActivate: [RoleGuard], + data: { roles: ['DSU'] } + }, + { + path: 'edit/:id', + component: CategoryEditComponent, + canActivate: [RoleGuard], + data: { roles: ['DSU'] } + }, + { + path: 'id/:id', + component: CategoryDetailsComponent, + canActivate: [RoleGuard], + data: { roles: ['DSU'] } + } + ] + } +]; + +@NgModule({ + exports: [RouterModule], + imports: [RouterModule.forChild(routes)] +}) +export class CategoriesRoutingModule {} diff --git a/src/app/pages/categories/categories.service.spec.ts b/src/app/pages/categories/categories.service.spec.ts new file mode 100644 index 0000000..c0f0bb2 --- /dev/null +++ b/src/app/pages/categories/categories.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { CategoriesService } from './categories.service'; + +describe('CategoriesService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: CategoriesService = TestBed.get(CategoriesService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/pages/categories/categories.service.ts b/src/app/pages/categories/categories.service.ts new file mode 100644 index 0000000..9694004 --- /dev/null +++ b/src/app/pages/categories/categories.service.ts @@ -0,0 +1,192 @@ +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs/internal/Observable'; +import { HttpClient } from '@angular/common/http'; +import { map, take } from 'rxjs/operators'; +import * as lodash from 'lodash'; + +export interface Category { + id: string; + slug: string; + name: string; + subCategories: SubCategory[]; +} + +export interface SubCategory { + id: string; + slug: string; + name: string; + parentCategory: Category; +} + +interface ApiCategory { + _id: string; + parent_id: string | undefined; + slug: string; + name: string; +} + +@Injectable({ + providedIn: 'root' +}) +export class CategoriesService { + constructor(private httpClient: HttpClient) {} + + /** + * pager for categories table + */ + pager: any = { + sort: 1, + method: 'ASC', + page: 1, + size: 15, + total: 0, + filters: {} + }; + + /** + * get the category pager + * @returns pager + */ + getPager() { + return { ...this.pager }; + } + + /** + * init pager with default values + */ + setPager() { + this.pager = { + sort: 1, + method: 'ASC', + page: 1, + size: 15, + total: 0, + filters: {} + }; + } + + getCategoriesBySlug(slug?: string): Observable { + const allCategories$: Observable = this.getAllCategories(); + if (slug && slug !== '') { + return allCategories$.pipe( + map((categories: Category[]) => + categories.filter((category: Category) => + category.slug.toLowerCase().includes(slug.toLowerCase()) + ) + ) + ); + } else { + return allCategories$; + } + } + + getCategoryById(id: string): Observable { + return this.getAllCategories().pipe( + map((categories: Category[]) => { + return categories.find(category => category.id === id); + }) + ); + } + + getAllCategories(): Observable { + return this.httpClient.get('/resources/categories').pipe( + take(1), + map((apiCategories: ApiCategory[]) => + this.groupSubCategoriesOnCategories(apiCategories) + ) + ); + } + + groupSubCategoriesOnCategories(apiCategories: ApiCategory[]): Category[] { + const partition: ApiCategory[][] = lodash.partition( + apiCategories, + category => + category.parent_id === undefined || category.parent_id === '0' + ); + const parentCategories = partition[0]; + const subCategories = partition[1]; + + return parentCategories.map(apiCategory => + this.convertToCategory( + apiCategory, + subCategories.filter( + (subCategory: ApiCategory) => + subCategory.parent_id === apiCategory._id + ) + ) + ); + } + + convertToCategory( + apiCategory: ApiCategory, + apiSubCategories: ApiCategory[] + ) { + const category: Category = { + id: apiCategory._id, + name: apiCategory.name, + slug: apiCategory.slug, + subCategories: apiSubCategories.map((apiSubCategory: ApiCategory) => + this.convertToSubCategory(apiSubCategory, category) + ) + }; + return category; + } + + convertToSubCategory( + apiSubCategory: ApiCategory, + parentCategory: Category + ): SubCategory { + return { + id: apiSubCategory._id, + name: apiSubCategory.name, + slug: apiSubCategory.slug, + parentCategory: parentCategory + }; + } + + getCategory(id: string, paginationObj?: any): Observable { + let params: any = {}; + + params = { ...params, ...paginationObj }; + if (params.filters) { + Object.keys(params.filters).forEach(key => { + if (params.filters[key]) { + params['filters[' + key + ']'] = params.filters[key]; + } + }); + delete params.filters; + } + + return this.httpClient.get(`/resources/categories/${id}`, { + params: params + }); + } + + /** + * post a new category to website, auto add Header + * @param {any} payload the org data to be added + * @returns observable with response + */ + addCategory(payload: any) { + return this.httpClient.post('/resources/categories', payload); + } + + /** + * delete category by id + * @param {string} id of the category to be deleted + * @returns observable with response + */ + deleteCategory(id: any) { + return this.httpClient.delete(`/resources/categories/${id}`); + } + + /** + * edit a category + * @param {any} payload the category data to be modified + * @param {string} id of the category to be modified + * @returns observable with response + */ + editCategory(id: string, payload: any) { + return this.httpClient.put(`/resources/categories/${id}`, payload); + } +} diff --git a/src/app/pages/categories/categories/categories.component.html b/src/app/pages/categories/categories/categories.component.html new file mode 100644 index 0000000..0680b43 --- /dev/null +++ b/src/app/pages/categories/categories/categories.component.html @@ -0,0 +1 @@ + diff --git a/src/app/pages/categories/categories/categories.component.scss b/src/app/pages/categories/categories/categories.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/categories/categories/categories.component.spec.ts b/src/app/pages/categories/categories/categories.component.spec.ts new file mode 100644 index 0000000..00ef24b --- /dev/null +++ b/src/app/pages/categories/categories/categories.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CategoriesComponent } from './categories.component'; + +describe('CategoriesComponent', () => { + let component: CategoriesComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [CategoriesComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CategoriesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/categories/categories/categories.component.ts b/src/app/pages/categories/categories/categories.component.ts new file mode 100644 index 0000000..98d6442 --- /dev/null +++ b/src/app/pages/categories/categories/categories.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-categories', + templateUrl: './categories.component.html', + styleUrls: ['./categories.component.scss'] +}) +export class CategoriesComponent { + /** + * wrapper for the categories pages. acts as frame + */ + constructor() {} +} diff --git a/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.html b/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.html new file mode 100644 index 0000000..b1bf6e2 --- /dev/null +++ b/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.html @@ -0,0 +1,68 @@ +
+ +
+ Total: {{pager.total}} +
+ + +
+ + + + + + + + + + + + + + + +
Nume CategorieSubcategorii
{{category.name}}{{category.subCategories.length}} + +
+
+
+
diff --git a/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.scss b/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.spec.ts b/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.spec.ts new file mode 100644 index 0000000..c6adcac --- /dev/null +++ b/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CategoriesDashboardComponent } from './categories-dashboard.component'; + +describe('CategoriesDashboardComponent', () => { + let component: CategoriesDashboardComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [CategoriesDashboardComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CategoriesDashboardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.ts b/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.ts new file mode 100644 index 0000000..1f47589 --- /dev/null +++ b/src/app/pages/categories/categories/components/categories-dashboard/categories-dashboard.component.ts @@ -0,0 +1,151 @@ +import { Component, OnInit } from '@angular/core'; +import { CategoriesService, Category } from '../../../categories.service'; + +import { AuthenticationService } from '@app/core'; +import { BreakpointObserver } from '@angular/cdk/layout'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'app-categories-dashboard', + templateUrl: './categories-dashboard.component.html', + styleUrls: ['./categories-dashboard.component.scss'] +}) +export class CategoriesDashboardComponent implements OnInit { + /** + * store the categories list + */ + categoriesData: Category[] = []; + /** + * pager for the categories table + */ + pager: any = {}; + /** + * flag for HTML to know how to display data + */ + displayBlock = false; + /** + *values to select from when filtering + */ + categoryFilterValues: any[] = []; + locationFilterValues: any[] = []; + /** + * selected filters array + */ + selected = new Array(2); + /** + * match the id with _id and display parent_id in order to indent the appropriate subcategories + */ + propertyMap = { + _id: 'id', + parent_id: 'parent_id' + }; + /** + * navigation extras will be sent to add category if user is ngo. + */ + navigationExtras: any; + + constructor( + private categoryService: CategoriesService, + public breakpointObserver: BreakpointObserver, + public authService: AuthenticationService, + private router: Router + ) {} + + ngOnInit() { + this.categoryService.setPager(); + this.pager = this.categoryService.getPager(); + + this.getData(); + /** + * observe screen change and switch to grid view if screen is too small + */ + this.breakpointObserver + .observe(['(max-width: 768px)']) + .subscribe(result => { + if (result.matches) { + this.switchToBlock(); + } + }); + } + + /** + * get data from server and store locally + + */ + getData() { + const slug: string = this.pager.filters['2']; + this.categoryService.getCategoriesBySlug(slug).subscribe(data => { + this.categoriesData = data; + this.pager.total = data.length; + }); + } + + /** + * send user to add category. if is NGO the ngo id is static. + */ + addCategory() { + if (this.authService.is('NGO')) { + const navigationExtras = { + state: { + ngo: { + // TO-DO: extragere informatiilor din contu utilizatorului + name: this.authService.user.organisation.name, + ngoid: this.authService.user.organisation._id + } + } + }; + this.router.navigateByUrl('/categories/add', navigationExtras); + } else { + this.router.navigate(['categories/add']); + } + } + + /** + * search callback. Filters added to pager and then a request is made + * @param {any} pager the pager with the search filer added + */ + searchChanged(pager: any) { + this.pager = pager; + this.getData(); + } + + /** + * filter callback. Filters added to pager and then a request is made + * @param {number} id the index in the pager filters and filters Selected array + */ + filterChanged(id?: number) { + console.log(this.selected); + this.pager.filters[id] = this.selected[id] + .map((elem: any) => elem.id) + .join(','); + this.getData(); + } + + /** + * view details about category by slug if DSU and by id if NGO + * @param {any} res the category to be viewed + */ + viewDetails(res: any) { + if (this.authService.is('DSU')) { + this.router.navigateByUrl(`/categories/name/${res.slug}`); + } else { + this.router.navigateByUrl( + `/categories/id/${res.categories[0]._id}` + ); + } + } + + /** + * set flag for HTML to list view + */ + switchToList() { + this.displayBlock = false; + } + + /** + * set flag for HTML to grid view + */ + switchToBlock() { + this.displayBlock = true; + } +} diff --git a/src/app/pages/categories/categories/components/category-add/category-add.component.html b/src/app/pages/categories/categories/components/category-add/category-add.component.html new file mode 100644 index 0000000..2c5f2b3 --- /dev/null +++ b/src/app/pages/categories/categories/components/category-add/category-add.component.html @@ -0,0 +1 @@ +

category-add works!

diff --git a/src/app/pages/categories/categories/components/category-add/category-add.component.scss b/src/app/pages/categories/categories/components/category-add/category-add.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/categories/categories/components/category-add/category-add.component.spec.ts b/src/app/pages/categories/categories/components/category-add/category-add.component.spec.ts new file mode 100644 index 0000000..69234a8 --- /dev/null +++ b/src/app/pages/categories/categories/components/category-add/category-add.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CategoryAddComponent } from './category-add.component'; + +describe('CategoryAddComponent', () => { + let component: CategoryAddComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [CategoryAddComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CategoryAddComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/categories/categories/components/category-add/category-add.component.ts b/src/app/pages/categories/categories/components/category-add/category-add.component.ts new file mode 100644 index 0000000..19fdf6f --- /dev/null +++ b/src/app/pages/categories/categories/components/category-add/category-add.component.ts @@ -0,0 +1,12 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-category-add', + templateUrl: './category-add.component.html', + styleUrls: ['./category-add.component.scss'] +}) +export class CategoryAddComponent implements OnInit { + constructor() {} + + ngOnInit() {} +} diff --git a/src/app/pages/categories/categories/components/category-details/category-details.component.html b/src/app/pages/categories/categories/components/category-details/category-details.component.html new file mode 100644 index 0000000..1860927 --- /dev/null +++ b/src/app/pages/categories/categories/components/category-details/category-details.component.html @@ -0,0 +1,27 @@ +
+ +
+

Nume categorie: {{category?.name}}

+
+

Subcategorii ({{category?.subCategories.length}}):

+
    +
  • + {{subCategory.name}} +
  • +
+ +
+
+
diff --git a/src/app/pages/categories/categories/components/category-details/category-details.component.scss b/src/app/pages/categories/categories/components/category-details/category-details.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/categories/categories/components/category-details/category-details.component.spec.ts b/src/app/pages/categories/categories/components/category-details/category-details.component.spec.ts new file mode 100644 index 0000000..19779bf --- /dev/null +++ b/src/app/pages/categories/categories/components/category-details/category-details.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CategoryDetailsComponent } from './category-details.component'; + +describe('CategoryDetailsComponent', () => { + let component: CategoryDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [CategoryDetailsComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CategoryDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/categories/categories/components/category-details/category-details.component.ts b/src/app/pages/categories/categories/components/category-details/category-details.component.ts new file mode 100644 index 0000000..5a6f2e1 --- /dev/null +++ b/src/app/pages/categories/categories/components/category-details/category-details.component.ts @@ -0,0 +1,79 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { AuthenticationService } from '@app/core'; +import { Location } from '@angular/common'; +import { CategoriesService, Category } from '../../../categories.service'; + +@Component({ + selector: 'app-category-details', + templateUrl: './category-details.component.html', + styleUrls: ['./category-details.component.scss'] +}) +export class CategoryDetailsComponent implements OnInit { + /** + * store category + */ + public category: Category; + /** + * flag for HTML to display edit button + */ + canEdit = true; + /** + * flag for HTML to display loading animation + */ + loading = false; + + constructor( + private categoriesService: CategoriesService, + private route: ActivatedRoute, + public authService: AuthenticationService, + private router: Router, + private location: Location + ) {} + + ngOnInit() { + this.getData(); + } + + /** + * edit this resource + */ + edit() { + this.router.navigateByUrl(`/categories/edit/${this.category.id}`); + } + + /** + * delete this resource + */ + deleteSelf() { + if ( + confirm( + 'Sunteți sigur că doriți să ștergeți această intrare? Odată ștearsă nu va mai putea fi recuperată.' + ) + ) { + this.loading = true; + this.categoriesService.deleteCategory(this.category.id).subscribe( + () => { + this.loading = false; + this.location.back(); + }, + () => { + this.loading = false; + } + ); + } + } + + /** + * get resource data from server + */ + + getData() { + this.categoriesService + .getCategoryById(this.route.snapshot.paramMap.get('id')) + .subscribe(category => { + this.category = category; + this.canEdit = this.authService.is('DSU'); + }); + } +} diff --git a/src/app/pages/categories/categories/components/category-edit/category-edit.component.html b/src/app/pages/categories/categories/components/category-edit/category-edit.component.html new file mode 100644 index 0000000..57816a5 --- /dev/null +++ b/src/app/pages/categories/categories/components/category-edit/category-edit.component.html @@ -0,0 +1 @@ +

category-edit works!

diff --git a/src/app/pages/categories/categories/components/category-edit/category-edit.component.scss b/src/app/pages/categories/categories/components/category-edit/category-edit.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/categories/categories/components/category-edit/category-edit.component.spec.ts b/src/app/pages/categories/categories/components/category-edit/category-edit.component.spec.ts new file mode 100644 index 0000000..c04d410 --- /dev/null +++ b/src/app/pages/categories/categories/components/category-edit/category-edit.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CategoryEditComponent } from './category-edit.component'; + +describe('CategoryEditComponent', () => { + let component: CategoryEditComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [CategoryEditComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CategoryEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/categories/categories/components/category-edit/category-edit.component.ts b/src/app/pages/categories/categories/components/category-edit/category-edit.component.ts new file mode 100644 index 0000000..ad72f51 --- /dev/null +++ b/src/app/pages/categories/categories/components/category-edit/category-edit.component.ts @@ -0,0 +1,12 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-category-edit', + templateUrl: './category-edit.component.html', + styleUrls: ['./category-edit.component.scss'] +}) +export class CategoryEditComponent implements OnInit { + constructor() {} + + ngOnInit() {} +} diff --git a/src/app/top-bar/top-bar.component.html b/src/app/top-bar/top-bar.component.html index 328e2bd..8129f52 100644 --- a/src/app/top-bar/top-bar.component.html +++ b/src/app/top-bar/top-bar.component.html @@ -15,6 +15,9 @@
  • Resurse
  • +
  • + Categorii +
  • Organizații
  • @@ -38,6 +41,7 @@ + diff --git a/src/app/top-bar/top-bar.component.scss b/src/app/top-bar/top-bar.component.scss index 292901a..af88e79 100644 --- a/src/app/top-bar/top-bar.component.scss +++ b/src/app/top-bar/top-bar.component.scss @@ -16,11 +16,12 @@ header { } .nav { - display: flex; - height: 60px; - flex-direction: row; - line-height: 60px; - white-space: nowrap; + display: flex; + height: 60px; + flex-direction: row; + flex-wrap: nowrap; + line-height: 60px; + white-space: nowrap; } .nav .nav__link { @@ -84,4 +85,4 @@ header { .active-link { background-color: #264998; color: #fff!important; -} \ No newline at end of file +}