#14 Add messages in the color list
This commit is contained in:
parent
951f9fcb87
commit
73bb2c3bce
|
@ -20,9 +20,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="recipes.size === 0" class="alert alert-warning w-50 m-auto text-center">
|
<div *ngIf="!loading">
|
||||||
<p>Il n'y a actuellement aucune recette enregistrée dans le système.</p>
|
<cre-warning-alert *ngIf="companies.length === 0">
|
||||||
<p *ngIf="hasEditPermission">Vous pouvez en créer une <b><a routerLink="/color/add">ici</a></b>.</p>
|
<p>Il n'y a actuellement aucune bannière enregistrée dans le système.</p>
|
||||||
|
<p *ngIf="hasCompanyEditPermission">Vous pouvez en créer une <b><a routerLink="/catalog/company/add">ici</a></b>.</p>
|
||||||
|
</cre-warning-alert>
|
||||||
|
<cre-warning-alert *ngIf="recipes.size === 0">
|
||||||
|
<p>Il n'y a actuellement aucune recette enregistrée dans le système.</p>
|
||||||
|
<p *ngIf="hasEditPermission">Vous pouvez en créer une <b><a routerLink="/color/add">ici</a></b>.</p>
|
||||||
|
</cre-warning-alert>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mat-expansion-panel
|
<mat-expansion-panel
|
||||||
|
|
|
@ -53,8 +53,8 @@ export class ListComponent extends ErrorHandlingComponent {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
this.fetchCompanies()
|
//this.fetchCompanies()
|
||||||
// this.fetchRecipes()
|
this.fetchRecipes()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fetchCompanies() {
|
private fetchCompanies() {
|
||||||
|
@ -98,6 +98,10 @@ export class ListComponent extends ErrorHandlingComponent {
|
||||||
return this.accountService.hasPermission(Permission.EDIT_RECIPES)
|
return this.accountService.hasPermission(Permission.EDIT_RECIPES)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get hasCompanyEditPermission(): boolean {
|
||||||
|
return this.accountService.hasPermission(Permission.EDIT_COMPANIES)
|
||||||
|
}
|
||||||
|
|
||||||
private recipeMatchesSearchQuery(recipe: Recipe) {
|
private recipeMatchesSearchQuery(recipe: Recipe) {
|
||||||
const matches = this.searchString(recipe.company.name) ||
|
const matches = this.searchString(recipe.company.name) ||
|
||||||
this.searchString(recipe.name) ||
|
this.searchString(recipe.name) ||
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="alert alert-warning w-50 m-auto text-center">
|
||||||
|
<ng-content></ng-content>
|
||||||
|
</div>
|
|
@ -0,0 +1,14 @@
|
||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {WarningAlert} from './alerts';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
WarningAlert
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
WarningAlert
|
||||||
|
],
|
||||||
|
imports: []
|
||||||
|
})
|
||||||
|
export class CreAlertsModule {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
import {Component} from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'cre-warning-alert',
|
||||||
|
templateUrl: 'alerts.html'
|
||||||
|
})
|
||||||
|
export class WarningAlert {
|
||||||
|
|
||||||
|
}
|
|
@ -11,6 +11,8 @@ export abstract class SubscribingComponent implements OnInit, OnDestroy {
|
||||||
protected subscribers$ = []
|
protected subscribers$ = []
|
||||||
protected destroy$ = new Subject<boolean>()
|
protected destroy$ = new Subject<boolean>()
|
||||||
|
|
||||||
|
loading = false
|
||||||
|
|
||||||
protected constructor(
|
protected constructor(
|
||||||
protected errorService: ErrorService,
|
protected errorService: ErrorService,
|
||||||
protected activatedRoute: ActivatedRoute,
|
protected activatedRoute: ActivatedRoute,
|
||||||
|
@ -74,12 +76,14 @@ export abstract class SubscribingComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
protected showLoadingWheel(shouldShowWheel) {
|
protected showLoadingWheel(shouldShowWheel) {
|
||||||
if (shouldShowWheel) {
|
if (shouldShowWheel) {
|
||||||
|
this.loading = true
|
||||||
globalLoadingWheel.show()
|
globalLoadingWheel.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected hideLoadingWheel(shouldShowWheel) {
|
protected hideLoadingWheel(shouldShowWheel) {
|
||||||
if (shouldShowWheel) {
|
if (shouldShowWheel) {
|
||||||
|
this.loading = false
|
||||||
globalLoadingWheel.hide()
|
globalLoadingWheel.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ import {CreFormsModule} from './components/forms/forms.module'
|
||||||
import {VarDirective} from './directives/var.directive'
|
import {VarDirective} from './directives/var.directive'
|
||||||
import {CreColorPreview} from './components/color-preview/color-preview'
|
import {CreColorPreview} from './components/color-preview/color-preview'
|
||||||
import {CreDialogsModule} from './components/dialogs/dialogs.module'
|
import {CreDialogsModule} from './components/dialogs/dialogs.module'
|
||||||
|
import {CreAlertsModule} from './components/alerts/alerts.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [VarDirective, HeaderComponent, UserMenuComponent, LabeledIconComponent, ConfirmBoxComponent, PermissionsListComponent, PermissionsFieldComponent, NavComponent, EntityListComponent, EntityAddComponent, EntityEditComponent, FileButtonComponent, GlobalAlertHandlerComponent, SliderFieldComponent, LoadingWheelComponent, CreColorPreview],
|
declarations: [VarDirective, HeaderComponent, UserMenuComponent, LabeledIconComponent, ConfirmBoxComponent, PermissionsListComponent, PermissionsFieldComponent, NavComponent, EntityListComponent, EntityAddComponent, EntityEditComponent, FileButtonComponent, GlobalAlertHandlerComponent, SliderFieldComponent, LoadingWheelComponent, CreColorPreview],
|
||||||
|
@ -73,7 +74,8 @@ import {CreDialogsModule} from './components/dialogs/dialogs.module'
|
||||||
CreFormsModule,
|
CreFormsModule,
|
||||||
VarDirective,
|
VarDirective,
|
||||||
CreColorPreview,
|
CreColorPreview,
|
||||||
CreDialogsModule
|
CreDialogsModule,
|
||||||
|
CreAlertsModule
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
|
|
Loading…
Reference in New Issue