|
|
|
@@ -8,13 +8,17 @@ import {MatPaginator, MatPaginatorIntl, MatPaginatorModule, PageEvent} from "@an |
|
|
|
import {OrderFilter} from "@app/_models/orderFilter"; |
|
|
|
import {ApiConverter} from "@app/_helpers/api.converter"; |
|
|
|
import {NgIf} from "@angular/common"; |
|
|
|
import {ModalComponent} from "@app/_components/modal/modal.component"; |
|
|
|
import {NgbModal} from "@ng-bootstrap/ng-bootstrap"; |
|
|
|
import {NewPartnerComponent} from "@app/partners/new-partner/new-partner.component"; |
|
|
|
import {TranslateModule, TranslateService} from "@ngx-translate/core"; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'app-partners', |
|
|
|
templateUrl: './partners.component.html', |
|
|
|
styleUrl: './partners.component.scss', |
|
|
|
standalone: true, |
|
|
|
imports: [MatTableModule, MatSortModule, MatPaginatorModule, RouterLink, RouterLinkActive, NgIf], |
|
|
|
imports: [MatTableModule, MatSortModule, MatPaginatorModule, RouterLink, RouterLinkActive, NgIf, TranslateModule], |
|
|
|
}) |
|
|
|
export class PartnersComponent implements OnInit, AfterViewInit { |
|
|
|
@ViewChild(MatSort) sort; |
|
|
|
@@ -28,6 +32,8 @@ export class PartnersComponent implements OnInit, AfterViewInit { |
|
|
|
protected websiteOrderAsc: OrderFilter; |
|
|
|
|
|
|
|
protected dataType!: string; |
|
|
|
protected partnerName: string; |
|
|
|
protected partnerNameOne: string; |
|
|
|
protected displayedColumns: string[]; |
|
|
|
|
|
|
|
protected dataSource; |
|
|
|
@@ -39,7 +45,9 @@ export class PartnersComponent implements OnInit, AfterViewInit { |
|
|
|
constructor( |
|
|
|
private route: ActivatedRoute, |
|
|
|
private partnerService: PartnerService, |
|
|
|
private router: Router |
|
|
|
private router: Router, |
|
|
|
private modalService: NgbModal, |
|
|
|
private translateService: TranslateService |
|
|
|
) { |
|
|
|
this.sort = new MatSort(); |
|
|
|
this.paginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype); |
|
|
|
@@ -57,10 +65,20 @@ export class PartnersComponent implements OnInit, AfterViewInit { |
|
|
|
this.pageEvent = new PageEvent(); |
|
|
|
this.pageSize = 10; |
|
|
|
this.pageIndex = 0; |
|
|
|
|
|
|
|
this.partnerName = ""; |
|
|
|
this.partnerNameOne = ""; |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
this.dataType = this.route.snapshot.data['dataType']; |
|
|
|
// this.translateService.use(this.translateService.getDefaultLang()); |
|
|
|
this.translateService.get('basic.' + this.dataType).subscribe((translation: string) => { |
|
|
|
this.partnerName = translation; |
|
|
|
}); |
|
|
|
this.translateService.get('basic.' + this.dataType + 'One').subscribe((translation: string) => { |
|
|
|
this.partnerNameOne = translation; |
|
|
|
}); |
|
|
|
this.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -133,4 +151,9 @@ export class PartnersComponent implements OnInit, AfterViewInit { |
|
|
|
console.log(ApiConverter.extractId(partner.id)); |
|
|
|
this.router.navigate(['/' + partner.type, ApiConverter.extractId(partner.id)]); |
|
|
|
} |
|
|
|
|
|
|
|
openModalNewPartner() { |
|
|
|
const modalRef = this.modalService.open(ModalComponent); |
|
|
|
modalRef.componentInstance.dynamicComponent = NewPartnerComponent; |
|
|
|
} |
|
|
|
} |