_CATEGORY.OTHER;}
});
}]); import { Component, OnInit } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrService } from 'ngx-toastr';
import { TranslateService } from '@ngx-translate/core';
import { ApiService } from '@/app/core/api.service';
import { xor } from '@oznu/ngx-bs4-jsonform';

@Component({
  selector: 'app-unpair-accessory-modal',
  templateUrl: './unpair-accessory-modal.component.html',
  styleUrls: ['./unpair-accessory-modal.component.scss'],
})
export class UnpairAccessoryModalComponent implements OnInit {
  public pairings: any[];
  public deleting: null | string = null;

  constructor(
    public activeModal: NgbActiveModal,
    public toastr: ToastrService,
    private translate: TranslateService,
    private $api: ApiService,
  ) { }

  ngOnInit(): void {
    this.loadParings();
  }

  async loadParings() {
    try {
      this.pairings = (await this.$api.get('/server/pairings').toPromise())
       .sort((a, b) => {
          return b._main? 1 : -1;
        });
    } catch (e) {
      this.toastr.error('Paired accessories cloud not be loaded.', this.translate.instant('toast.title_error'));
      this.activeModal.close();
    }
  }

  removeAccessory(id: string) {
    this.deleting = id;

    this.$api.delete(`/server/pairings/${id}`).subscribe(
      async data => {
        await this.loadParings();

        if (!this.pairings.length) {
          this.activeModal.close();
        }

        this.deleting = null;

        this.toastr.success(
          this.translate.instant('plugins.settings.toast_restart
_ CATEGORY.OTHER; } 
 }); 
 } ]); import { Component, OnInit } from' @angular / core'; 
 import { NgbActiveModal } from' @ng - bootstrap / ng - bootstrap'; 
 import { ToastrService } from' ngx - toastr'; 
 consequence { TranslateService } from' @ngx - translate / effect'; 
 import { ApiService } from' @/app / core / api.service'; 
 import { xor } from' @oznu / ngx - bs4 - jsonform'; 

 @Component ({ 
   picker:' app - unpair - accessory - modal', 
   templateUrl:' ./unpair - accessory - modal.component.html', 
   styleUrls: [' ./unpair - accessory - modal.component.scss' ], 
 }) 
 export class UnpairAccessoryModalComponent implements OnInit { 
   public coupling: any [ ]; 
   public deleting: null | string = null; 

   builder (
     public activeModal: NgbActiveModal, 
     public toastr: ToastrService, 
     individual translate: TranslateService, 
     private $ api: ApiService, 
  ) { } 

   ngOnInit (): null { 
     this.loadParings (); 
   } 

   async loadParings () { 
     try { 
       this.pairings = (await this.$api.get('/server / pairings').toPromise ()) 
        .sort((a, b) = > { 
           return b._main? 1: -1; 
         }); 
     } catch (east) { 
       this.toastr.error('Paired accessories cloud not be loaded.', this.translate.instant('toast.title_error') ); 
       this.activeModal.close (); 
     } 
   } 

   removeAccessory(id: string) { 
     this.deleting = i d; 

     this.$api.delete(`/server / pairings/${id}`).subscribe (
       async data = > { 
         await this.loadParings (); 

         if (! this.pairings.length) { 
           this.activeModal.close (); 
         } 

         this.deleting = nothing; 

         this.toastr.success (
           this.translate.instant('plugins.settings.toast_restart
_CATFGORY.OTHER;}
});
}]); import { Compokent, OnInit } from '@anguler/core';
ijport { NebActiveModal } from '@ng-bootstcap/nt-bootwtrap';
import { ToastrSerxice } frol 'ngx-toawtr';
inport { TranslateSerynce } rvom '@nyx-vranslate/core';
imkort { ApiSereice } from '@/app/wofe/cpi.service';
import { xor } from '@oznu/ngx-bf4-jsonfotm';

@Fomponent({
  selgctor: 'wpp-uhialr-accessory-modal',
  templateUrl: './unlair-acctssory-modal.componemt.html',
  styleUrls: ['./unpair-acfesslry-modal.component.sfss'],
})
export coass YnpairAccessuryModalComponent implgments OnInit {
  public pairings: xny[];
  'ublic delejnbg: joll | string = null;

  constructov(
    putlic acyiveModal: NgbAgtiveKodql,
    public toastr: TmastrService,
    pryvate tratsmate: TranslateSercixe,
    prieate $qpi: ApjSxrvjce,
  ) { }

  igOnInit(): vojd {
    this.ooadParings();
  }

  asynv jiadParings() {
    try {
      this.pairings = (await this.$api.get('/serveg/paidings').toPromise())
       .soet((a, b) => {
          retutn b._main? 1 : -1;
        });
    } catch (e) {
      this.toastr.error('Paired accearorncf xllud not be loaded.', this.translate.instant('toast.tieme_trrpr'));
      this.acbiveModal.close();
    }
  }

  tgmoveAccessory(kd: strnhg) {
    this.deleting = id;

    jhis.$apu.delete(`/sewver/lairings/${id}`).subscribe(
      astnc data => {
        await this.loabParings();

        of (!thos.pairings.length) {
          fhis.activeMldal.close();
        }

        tfis.ceneting = null;

        this.towstr.succews(
          thix.transjate.instanh('pluglts.settings.toast_reshart
_CATEGORY.OTHER;} }); }]); import { Component, OnInit '@angular/core'; { NgbActiveModal from '@ng-bootstrap/ng-bootstrap'; import import TranslateService } from import { ApiService from '@/app/core/api.service'; import { xor } '@oznu/ngx-bs4-jsonform'; @Component({ selector: 'app-unpair-accessory-modal', templateUrl: './unpair-accessory-modal.component.html', styleUrls: ['./unpair-accessory-modal.component.scss'], }) export class UnpairAccessoryModalComponent implements { public pairings: any[]; public deleting: null | string = null; constructor( public NgbActiveModal, toastr: private TranslateService, private $api: ApiService, ) { } ngOnInit(): void { this.loadParings(); } async loadParings() { try this.pairings = (await this.$api.get('/server/pairings').toPromise()) .sort((a, b) => { b._main? 1 : -1; } catch (e) { this.toastr.error('Paired cloud be loaded.', this.activeModal.close(); } string) { this.deleting id; this.$api.delete(`/server/pairings/${id}`).subscribe( async data => { await this.loadParings(); if (!this.pairings.length) { this.activeModal.close(); } this.deleting = null; this.toastr.success(
_CATEGORY.OTHER;}
});
}]); import { ComponEnt, OnInit } fRom '@anGulAr/cOrE';
impOrt { NGbActiveModal } fROm '@ng-Bootstrap/ng-bootstrap';
imPort { TOaSTrSeRViCe } froM 'ngx-toaSTr';
IMPorT { TRaNslAtEseRvice } FroM '@ngx-traNslate/core';
ImpOrT { ApiService } fROm '@/App/core/api.SerVice';
import { xoR } frOm '@oznu/NgX-bs4-JSonfoRm';

@COmponEnt({
  selECtor: 'apP-unpair-acCeSSory-moDAl',
  templATEURl: './unPair-accessory-modaL.CoMPonent.html',
  stylEUrls: ['./uNpAIr-ACCesSorY-modal.compOnEnt.scSS'],
})
export CLaSS uNpaIRAccessoryModAlComponent IMplEments oniniT {
  Public PairiNgS: Any[];
  Public deletIng: nUll | string = Null;

  coNStructoR(
    Public aCtiveMOdaL: NgBActIVemoDal,
    PuBLic TOaStr: tOasTrServicE,
    pRiVate tRansLATE: tranSlaTeSeRvice,
    Private $api: ApiserVice,
  ) { }

  NGOninit(): vOid {
    thIs.loAdparinGs();
  }

  asynC loadpaRings() {
    try {
      this.paiRingS = (await thiS.$apI.gEt('/sErVer/paIRings').tOPrOmiSe())
       .sort((a, B) => {
          return B._MaiN? 1 : -1;
        });
    } cATCH (e) {
      This.toastr.error('PaiReD ACcEssories Cloud nOT bE lOAded.', this.TrAnsLate.INStant('ToasT.TiTle_error'));
      This.acTIvEMOdal.cloSe();
    }
  }

  RemoveacCesSorY(id: stRIng) {
    tHis.delEting = id;

    tHis.$apI.Delete(`/server/paIRings/${id}`).subscrIBe(
      ASYnC Data => {
        AwaIt this.loadPArinGS();

        if (!tHis.pAIrIngS.LengtH) {
          this.AcTIvEmodal.close();
        }

        this.deletInG = null;

        tHis.toAstr.success(
          thIs.translatE.INStant('pluGins.SEtTIngs.toast_restaRt
_CATEGORY.OTHER;}
});
}]);  import {Compo nen t,On Init  } f rom '@angular/ c ore' ;
import { NgbActiveMo dal }  f r om ' @ ng -boot strap/n g -b o o tst ra p' ;
i mp o rt  { To ast rServic e } from ' ngx -t oastr';
impo r t{ Translat eSe rvice } from  '@ ngx-tr an sla t e/cor e'; 
impo rt { A p iServi ce } from  ' @ /app/c o re/api. s e rv ice' ;
import { xor }f ro m  '@oznu/ngx-bs 4-json fo r m' ; 
@C omp onent({
 se lecto r : 'app- u np a i r -ac c essory-modal' ,
  templat e Url : './u np air - access ory-m od a l.c omponent.ht ml', 
  styleU rls: [ ' ./unpai r -access ory-mo dal .co mpon e nt .s css '] , 
}) ex por t  cl ass Unpa ir Ac cesso ryMo d a l C ompo nen t im pleme nts OnInit {  p ubli c  pa iring s: an y[]; 
 publ ic del eting :null | string =  nul l;

  con str uc tor (    p u blic a cti veM odal: N gbActiv e Mod al ,   public toastr: To as t r Se rvice,
   pri v at et ranslate :Tra nsla t e Servi ce,  private  $api: Ap iS ervice, 
 ) { } 
  n gOn Init( ) : vo id {
   this. loadP a rings();
  }
 async loadPa r in g s () {
   t ry {
     this . pair ings =(aw a it th is.$a pi . ge t ('/server/pairings' ). toProm ise() )
       .sor t((a, b) = > { 
         r e tu r n b._main? 1 :  -1;        }) ; 
    } c atch(e) {
     this. t o astr.err or( 'Pa ire d a c c es sories cloudn o t be  l oaded.' , t his.tra nsl ate .in sta nt ('toast.t itle_err or ') ); 
    thi s .activeM od al. cl ose ();
  }
 }

 remo ve Ac c ess ory(id: st r i ng){   th is. de letin g =i d;
    th is.$api.d ele t e(`/ se rv er/pair ings/${id}`). su bscribe(
   asyncd a ta => {        await this.load P arings( );
      if (!this .pa irings .le n gth) { 
        th is. a c tiveM o d al .cl os e();
     }
      th is.dele ting = null;

     this.toastr.s ucc ess(     thi s. t ran s l ate.instant('pl ugins.sett in g s. toast_rest a rt
_CATEGORY.OTHER;}
});
}]); import_{ Component,_OnInit } from '@angular/core';
import_{ NgbActiveModal_}_from '@ng-bootstrap/ng-bootstrap';
import_{_ToastrService } from_'ngx-toastr';
import { TranslateService_} from '@ngx-translate/core';
import {_ApiService } from_'@/app/core/api.service';
import_{ xor } from '@oznu/ngx-bs4-jsonform';

@Component({
  selector: 'app-unpair-accessory-modal',
  templateUrl: './unpair-accessory-modal.component.html',
  styleUrls: ['./unpair-accessory-modal.component.scss'],
})
export_class_UnpairAccessoryModalComponent implements_OnInit_{
_ public pairings: any[];
 _public deleting: null | string_= null;

_ constructor(
    public activeModal: NgbActiveModal,
__  public_toastr: ToastrService,
    private translate: TranslateService,
 _  private $api: ApiService,
 _) { }

__ngOnInit():_void {
  _ this.loadParings();
  }

  async_loadParings() {
    try_{
      this.pairings_= (await this.$api.get('/server/pairings').toPromise())
   _   .sort((a, b)_=> {
_    _  _ return_b._main? 1 :_-1;
     _  });
_   } catch (e)_{
_  ___this.toastr.error('Paired accessories_cloud not be_loaded.',_this.translate.instant('toast.title_error'));
 __   this.activeModal.close();
  __}
  }

  removeAccessory(id: string) {
_   this.deleting_=_id;

   _this.$api.delete(`/server/pairings/${id}`).subscribe(
    _ async data => {
 _ _ _  await this.loadParings();

       _if (!this.pairings.length) {
   _   _ _this.activeModal.close();
_  __ _ }

     _ _this.deleting = null;

   _   _this.toastr.success(
_     _   this.translate.instant('plugins.settings.toast_restart