Ignore:
Timestamp:
11/29/21 22:35:07 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
84d0fbb
Parents:
8d391a1
Message:

spring security

File:
1 edited

Legend:

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

    r8d391a1 r1ad8e64  
    55import { Router } from '@angular/router';
    66import { PlannerDto } from '../_models/dto/plannerDto';
    7 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
    87import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
    9 import { PrimeNGConfig } from 'primeng/api';
     8import { MessageService, PrimeNGConfig } from 'primeng/api';
    109
    1110
     
    1312  selector: 'app-planner',
    1413  templateUrl: './planner.component.html',
    15   styleUrls: ['./planner.component.css']
     14  styleUrls: ['./planner.component.css'],
     15  providers: [DialogService, MessageService]
    1616})
    1717export class PlannerComponent implements OnInit {
     
    1919  planners: Planner[];
    2020  plannerDto: PlannerDto;
    21   editForm: FormGroup;
    2221  ref: DynamicDialogRef;
    2322
    2423
    2524  constructor(private plannerService: PlannerService, private router: Router,
    26     private fb: FormBuilder, private dialogService: DialogService, private primengConfig: PrimeNGConfig) {
     25    private dialogService: DialogService, private primengConfig: PrimeNGConfig, private messageService: MessageService) {
    2726    this.planners = [];
    2827    this.plannerDto = new PlannerDto();
    29     this.editForm = fb.group({
    30       title: fb.control('initial value', Validators.required)
    31     });
    32     this.ref = new DynamicDialogRef;   
     28    this.ref = new DynamicDialogRef;
    3329  }
    3430
     
    5147      }
    5248    );
     49  }
    5350
    54   }
    5551  show() {
    5652    this.ref = this.dialogService.open(CreateInitialPlannerComponent, {
     
    6056      baseZIndex: 10000
    6157    });
     58    this.ref.onClose.subscribe((planner: Planner) => {
     59      console.log("NOVOKREIRANIOT NAME NA PLANNER: " + planner.name);
     60      this.plannerService.postInitialPlanner(planner).subscribe(
     61        data=>{
     62          console.log(data);
     63        },
     64        error => console.log('oops', error)
     65     );
     66      this.messageService.add({ severity: 'success', summary: 'The planner: ' + planner.name + ' has been created.' });
     67    });
     68   
    6269  }
     70
    6371}
Note: See TracChangeset for help on using the changeset viewer.