Added conditions to check role after connexion and changed guards
This commit is contained in:
@@ -10,15 +10,23 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="row-right">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="9">Logo</nz-form-label>
|
||||
<nz-form-control nzErrorTip="Ce champ est requis">
|
||||
<input #fileInputLogo nz-input type="file" placeholder="Déposer"
|
||||
(change)="onFileChange('logo', fileInputLogo.files)">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
@if (admin()){
|
||||
<div class="row-right">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="9">Logo</nz-form-label>
|
||||
<nz-form-control nzErrorTip="Ce champ est requis">
|
||||
<input #fileInputLogo nz-input type="file" placeholder="Déposer"
|
||||
(change)="onFileChange('logo', fileInputLogo.files)">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="row-right">
|
||||
<nz-form-item>
|
||||
<p class="text-red-600">Vous ne pouvez pas modifier le logo</p>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Signature -->
|
||||
@@ -31,14 +39,22 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="row-right">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="9">Signature</nz-form-label>
|
||||
<nz-form-control nzErrorTip="Ce champ est requis">
|
||||
<input #fileInputSignature nz-input type="file" placeholder="Déposer"
|
||||
(change)="onFileChange('electronicSignature', fileInputSignature.files)">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
@if (admin()) {
|
||||
<div class="row-right">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="9">Signature</nz-form-label>
|
||||
<nz-form-control nzErrorTip="Ce champ est requis">
|
||||
<input #fileInputSignature nz-input type="file" placeholder="Déposer"
|
||||
(change)="onFileChange('electronicSignature', fileInputSignature.files)">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="row-right">
|
||||
<nz-form-item>
|
||||
<p class="text-red-600">Vous ne pouvez pas modifier la signature</p>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -8,6 +8,7 @@ import {firstValueFrom} from "rxjs";
|
||||
import {GetSettingDto, SettingsService} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import imageCompression from "browser-image-compression";
|
||||
import {AuthService} from "../../services/auth.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-setting-form',
|
||||
@@ -27,8 +28,10 @@ import imageCompression from "browser-image-compression";
|
||||
export class SettingForm implements OnInit {
|
||||
private settingsService = inject(SettingsService);
|
||||
private notificationService = inject(NzNotificationService);
|
||||
private authService = inject(AuthService);
|
||||
|
||||
settings = signal<GetSettingDto>({});
|
||||
admin = signal<boolean>(false);
|
||||
|
||||
setting: SettingInfo = {
|
||||
logo: 'https://www.pyro-fetes.com/wp-content/themes/pcptheme/img/logo-pyro-fetes-OR-top.png',
|
||||
@@ -42,6 +45,7 @@ export class SettingForm implements OnInit {
|
||||
|
||||
async ngOnInit() {
|
||||
await this.fetchSettings();
|
||||
this.admin.set(this.authService.isAdmin());
|
||||
}
|
||||
|
||||
async fetchSettings() {
|
||||
|
||||
Reference in New Issue
Block a user