/* eslint-disable @typescript-eslint/no-explicit-any */ import { Component } from '@angular/core'; import { Router, RouterLink } from '@angular/router'; import { MatTabsModule } from '@angular/material/tabs'; import { CommonModule } from '@angular/common'; import { FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators, } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; import { MatPaginatorModule } from '@angular/material/paginator'; import { MatTableModule } from '@angular/material/table'; import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatSelectModule } from '@angular/material/select'; import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatDialogRef } from '@angular/material/dialog'; import { AuthService } from 'src/app/_helpers/services/auth.service'; import { DialogEtablissementComponent } from '../view-etablissement/dialog-etablissement/dialog-etablissement.component'; @Component({ selector: 'bgui-preferences', standalone: true, imports: [ CommonModule, MatButtonModule, MatIconModule, MatTabsModule, MatTableModule, MatInputModule, RouterLink, FormsModule, MatCardModule, MatPaginatorModule, ReactiveFormsModule, MatFormFieldModule, MatSelectModule, MatDatepickerModule, MatCheckboxModule, MatSlideToggleModule, ], templateUrl: './preferences.component.html', styleUrl: './preferences.component.scss', }) export class PreferencesComponent { copyLink() { const paymentLink = this.lienForm.get('paymentLink')!.value; if (paymentLink) { navigator.clipboard.writeText(paymentLink).then(() => { alert('Lien copié dans le presse-papiers'); }); } } shareLink() { const paymentLink = this.lienForm.get('paymentLink')!.value; if (paymentLink) { if (navigator.share) { navigator .share({ title: 'Lien de paiement', text: 'Voici le lien de paiement:', url: paymentLink, }) .catch(error => { console.error('Error sharing', error); }); } else { alert("Le partage n'est pas pris en charge par votre navigateur."); } } } onFileSelected($event: Event) { throw new Error('Method not implemented.'); } etablissement: string = 'Barnoin'; onSubmit() { throw new Error('Method not implemented.'); } onCancel() { throw new Error('Method not implemented.'); } etablishmentForm: FormGroup; lienForm: FormGroup; countries = [ { value: 'CI', viewValue: "Cote d'ivoire" }, { value: 'SN', viewValue: 'Senegal' }, { value: 'ML', viewValue: 'Mali' }, { value: 'GN', viewValue: 'Guinée' }, { value: 'BF', viewValue: 'Burkina Faso' }, { value: 'NE', viewValue: 'Niger' }, { value: 'TG', viewValue: 'Togo' }, { value: 'BJ', viewValue: 'Bénin' }, { value: 'CM', viewValue: 'Cameroun' }, { value: 'CD', viewValue: 'Congo RDC CDF' }, { value: 'KM', viewValue: 'Comores' }, { value: 'FR', viewValue: 'France' }, ]; business = [ { value: 'CI', viewValue: "Cote d'ivoire" }, { value: 'SN', viewValue: 'Senegal' }, { value: 'ML', viewValue: 'Mali' }, { value: 'GN', viewValue: 'Guinée' }, { value: 'BF', viewValue: 'Burkina Faso' }, { value: 'NE', viewValue: 'Niger' }, { value: 'TG', viewValue: 'Togo' }, { value: 'BJ', viewValue: 'Bénin' }, { value: 'CM', viewValue: 'Cameroun' }, { value: 'CD', viewValue: 'Congo RDC CDF' }, { value: 'KM', viewValue: 'Comores' }, { value: 'FR', viewValue: 'France' }, ]; hide = true; public myForm!: FormGroup; activites: any; fonctions: any; services: any; groupes: any; isChecked!: boolean; country: any; constructor( private fb: FormBuilder, private authservice: AuthService // private dialogRef: MatDialogRef, // private router: Router ) { this.etablishmentForm = this.fb.group({ name: ['', Validators.required], website: [''], logo: [''], phone: [''], country: ['', Validators.required], city: [''], address: ['', Validators.required], business: [false], businessSelect: [''], schoolLevels: this.fb.group({ maternelle: this.fb.array([]), primaire: this.fb.array([]), college: this.fb.array([]), lycee: this.fb.array([]), }), }); this.lienForm = this.fb.group({ paymentLink: ['', Validators.required], }); } }