Several updates #3

Merged
william merged 28 commits from 14-no-entity-message into develop 2021-12-02 15:00:53 -05:00
7 changed files with 48 additions and 6 deletions
Showing only changes of commit 73bb2c3bce - Show all commits

View File

@ -20,9 +20,15 @@
</div>
</div>
<div *ngIf="recipes.size === 0" class="alert alert-warning w-50 m-auto text-center">
<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>
<div *ngIf="!loading">
<cre-warning-alert *ngIf="companies.length === 0">
<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>
<mat-expansion-panel

View File

@ -53,8 +53,8 @@ export class ListComponent extends ErrorHandlingComponent {
}
)
this.fetchCompanies()
// this.fetchRecipes()
//this.fetchCompanies()
this.fetchRecipes()
}
private fetchCompanies() {
@ -98,6 +98,10 @@ export class ListComponent extends ErrorHandlingComponent {
return this.accountService.hasPermission(Permission.EDIT_RECIPES)
}
get hasCompanyEditPermission(): boolean {
return this.accountService.hasPermission(Permission.EDIT_COMPANIES)
}
private recipeMatchesSearchQuery(recipe: Recipe) {
const matches = this.searchString(recipe.company.name) ||
this.searchString(recipe.name) ||

View File

@ -0,0 +1,3 @@
<div class="alert alert-warning w-50 m-auto text-center">
<ng-content></ng-content>
</div>

View File

@ -0,0 +1,14 @@
import {NgModule} from '@angular/core';
import {WarningAlert} from './alerts';
@NgModule({
declarations: [
WarningAlert
],
exports: [
WarningAlert
],
imports: []
})
export class CreAlertsModule {
}

View File

@ -0,0 +1,9 @@
import {Component} from '@angular/core';
@Component({
selector: 'cre-warning-alert',
templateUrl: 'alerts.html'
})
export class WarningAlert {
}

View File

@ -11,6 +11,8 @@ export abstract class SubscribingComponent implements OnInit, OnDestroy {
protected subscribers$ = []
protected destroy$ = new Subject<boolean>()
loading = false
protected constructor(
protected errorService: ErrorService,
protected activatedRoute: ActivatedRoute,
@ -74,12 +76,14 @@ export abstract class SubscribingComponent implements OnInit, OnDestroy {
protected showLoadingWheel(shouldShowWheel) {
if (shouldShowWheel) {
this.loading = true
globalLoadingWheel.show()
}
}
protected hideLoadingWheel(shouldShowWheel) {
if (shouldShowWheel) {
this.loading = false
globalLoadingWheel.hide()
}
}

View File

@ -37,6 +37,7 @@ import {CreFormsModule} from './components/forms/forms.module'
import {VarDirective} from './directives/var.directive'
import {CreColorPreview} from './components/color-preview/color-preview'
import {CreDialogsModule} from './components/dialogs/dialogs.module'
import {CreAlertsModule} from './components/alerts/alerts.module';
@NgModule({
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,
VarDirective,
CreColorPreview,
CreDialogsModule
CreDialogsModule,
CreAlertsModule
],
imports: [
MatTabsModule,