Ignore:
Timestamp:
11/25/21 22:08:24 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
8d391a1
Parents:
59329aa
Message:

primeNG components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/src/app/planner/planner.component.ts

    r59329aa re29cc2e  
    22import { Planner } from '../_models/planner';
    33import { PlannerService } from '../_services/planner.service';
    4 import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
    54import { CreateInitialPlannerComponent } from '../create-initial-planner/create-initial-planner.component';
    65import { Router } from '@angular/router';
    76import { PlannerDto } from '../_models/dto/plannerDto';
    87import { FormBuilder, FormGroup, Validators } from '@angular/forms';
     8import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
     9import { PrimeNGConfig } from 'primeng/api';
    910
    1011
     
    1920  plannerDto: PlannerDto;
    2021  editForm: FormGroup;
     22  ref: DynamicDialogRef;
    2123
    2224
    23 
    24   constructor(private plannerService: PlannerService, private dialog: MatDialog, private router: Router,
    25     private fb : FormBuilder) {
     25  constructor(private plannerService: PlannerService, private router: Router,
     26    private fb: FormBuilder, private dialogService: DialogService, private primengConfig: PrimeNGConfig) {
    2627    this.planners = [];
    2728    this.plannerDto = new PlannerDto();
    2829    this.editForm = fb.group({
    2930      title: fb.control('initial value', Validators.required)
    30   });
    31   };
    32  
    33   openDialog(): void {
    34     const dialogRef = this.dialog.open(CreateInitialPlannerComponent, {
    35       width: '250px',
    36       data: {}
    3731    });
     32    this.ref = new DynamicDialogRef;   
    3833  }
    39  
     34
    4035  ngOnInit(): void {
     36
     37    this.primengConfig.ripple = true;
     38
    4139    this.plannerService.getAllPlanners().subscribe(
    4240      data => {
     
    4543    );
    4644  }
    47  
    48   onClickEditPlannerGet(id: number){
     45
     46  onClickEditPlannerGet(id: number) {
    4947    console.log(id);
    50         this.plannerService.getPlannerById(id).subscribe(
    51             data => {         
    52               this.router.navigate(['edit/planner/', id]);
    53             }
    54      );
    55    
     48    this.plannerService.getPlannerById(id).subscribe(
     49      data => {
     50        this.router.navigate(['edit/planner/', id]);
     51      }
     52    );
     53
    5654  }
    57 
    58  
     55  show() {
     56    this.ref = this.dialogService.open(CreateInitialPlannerComponent, {
     57      header: 'Create initial planner',
     58      width: '70%',
     59      contentStyle: { "max-height": "500px", "overflow": "auto" },
     60      baseZIndex: 10000
     61    });
     62  }
    5963}
Note: See TracChangeset for help on using the changeset viewer.