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

spring security

Location:
trip-planner-front/src/app
Files:
7 added
12 edited

Legend:

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

    r8d391a1 r1ad8e64  
    4545import {PaginatorModule} from 'primeng/paginator';
    4646import {CardModule} from 'primeng/card';
     47import { RegisterComponent } from './homepage/register/register.component';
     48import { LoginComponent } from './homepage/login/login.component';
    4749
    4850@NgModule({
     
    5759    AddLocationToPlannerPanelComponent,
    5860    HomepageComponent,
    59     LocationDetailsComponent
     61    LocationDetailsComponent,
     62    RegisterComponent,
     63    LoginComponent
    6064  ],
    6165  imports: [
  • trip-planner-front/src/app/create-initial-planner/create-initial-planner.component.html

    r8d391a1 r1ad8e64  
    1 <form (ngSubmit)="onFormSubmitPlanner(f)" #f="ngForm" >
    21  <div mat-dialog-content>
    32    <p>Planner name</p>
     
    1211  </div>
    1312  <div mat-dialog-actions>
    14     <button pButton pRipple type="button" label="Save" [disabled]="!f.form.valid"
    15       class="p-button-outlined p-button-rounded p-button-help"></button>
     13    <button pButton pRipple type="submit" label="Save"
     14      class="p-button-outlined p-button-rounded p-button-help" (click)="onFormSubmitPlanner(planner)"></button>
    1615  </div>
    17 </form>
  • trip-planner-front/src/app/create-initial-planner/create-initial-planner.component.ts

    r8d391a1 r1ad8e64  
    1 import { ResourceLoader } from '@angular/compiler';
    2 import { Route } from '@angular/compiler/src/core';
    3 import { Component, Inject, OnInit } from '@angular/core';
    4 import { NgForm } from '@angular/forms';
    5 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
    6 import { ActivatedRoute, Params, Router } from '@angular/router';
     1import { Component, OnInit } from '@angular/core';
     2import { DynamicDialogRef } from 'primeng/dynamicdialog';
    73import { PlannerDto } from '../_models/dto/plannerDto';
    84import { Planner } from '../_models/planner';
    9 import { PlannerService } from '../_services/planner.service';
    105
    116@Component({
     
    1712
    1813  planner: Planner;
    19   planners: Planner[];
    2014  plannerDto: PlannerDto;
    2115
    22   constructor(private dialogRef: MatDialogRef<CreateInitialPlannerComponent>,
    23               private plannerService : PlannerService, private router : Router) {
     16  constructor( private ref: DynamicDialogRef) {
    2417                this.planner = new Planner;
    25                 this.planners = [];
    2618                this.plannerDto = new PlannerDto();
    2719              }
     
    3224  }
    3325
    34   onCancelClick(): void {
    35     this.dialogRef.close();
    36   }
    37  
    38   onFormSubmitPlanner(form: NgForm){
    39    console.log(this.planner);
    40       this.plannerService.postInitialPlanner(this.planner).subscribe(
    41         data=>{
    42           console.log(data);
    43           this.router.navigate(['planner']);
    44         },
    45         error => console.log('oops', error)
    46      );
    47      window.location.reload();
     26  onFormSubmitPlanner(planner){
     27    this.ref.close(planner);
     28    window.location.reload();
    4829  }
    4930
  • trip-planner-front/src/app/homepage/homepage.component.html

    r8d391a1 r1ad8e64  
    1717
    1818      <ul class="navbar-nav ml-auto">
     19        <li class="nav-item">
     20          <button class="btn btn-dark" (click)="onClickSignUp()" type="button">Sign up</button>
     21        </li>
    1922        <li class="nav-item">
    2023          <button class="btn btn-dark">Sign in</button>
  • trip-planner-front/src/app/homepage/homepage.component.ts

    r8d391a1 r1ad8e64  
    11import { Component, OnInit } from '@angular/core';
     2import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
    23import { Location } from '../_models/location';
    34import { LocationService } from '../_services/location.service';
     5import { RegisterComponent } from './register/register.component';
    46
    57
     
    1618   locations: Location[];
    1719   villages: Location[];
     20   ref: DynamicDialogRef;
    1821
    19    constructor(private locationService: LocationService) {
     22   constructor(private locationService: LocationService, private dialogService: DialogService) {
    2023      this.responsiveOptions = [
    2124         {
     
    3740      this.locations = [];
    3841      this.villages = [];
     42      this.ref = new DynamicDialogRef;
    3943   }
    4044
     
    5256      );
    5357   }
     58
     59   onClickSignUp(){
     60      console.log("VLEGOV");
     61      this.ref = this.dialogService.open(RegisterComponent, {
     62         header: 'Register form',
     63         width: '70%',
     64         contentStyle: { "max-height": "500px", "overflow": "auto" },
     65         baseZIndex: 10000
     66       });
     67   }
    5468}
  • trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.ts

    r8d391a1 r1ad8e64  
    55import { DynamicDialogRef } from 'primeng/dynamicdialog';
    66import { LocationService } from 'src/app/_services/location.service';
    7 import { Location } from 'src/app/_models/location';
    8 import { PlannerLocationDto } from 'src/app/_models/dto/plannerLocationDto';
     7
    98
    109
  • trip-planner-front/src/app/location/location.component.html

    r8d391a1 r1ad8e64  
    11<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"
    22  integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
    3   <p-toast></p-toast>
     3
     4<p-toast></p-toast>
    45<h3>Here are all locations</h3>
    56<button pButton pRipple type="button" icon="pi pi-bell" class="p-button-rounded p-button-warning" label="Back to my Planners" (click)="onClickBackToMyPlanners()"></button>
  • trip-planner-front/src/app/location/location.component.ts

    r8d391a1 r1ad8e64  
    124124        }
    125125      );
    126 
    127 
    128126    });
    129127  }
  • trip-planner-front/src/app/planner/edit-planner/edit-planner.component.html

    r8d391a1 r1ad8e64  
    4343    </div>
    4444    <button pButton pRipplelabel label="Save" class="p-button-help"></button>
    45     <button pButton pRipple label="Back" class="p-button-info" (click)="onClickBack()" [style]="{'margin-left': '.5em'}"></button>
    46 
    4745</form>
    48 
     46<button pButton pRipple label="Back" class="p-button-info" (click)="onClickBack()" [style]="{'margin-left': '.11em'}"></button>
  • trip-planner-front/src/app/planner/edit-planner/edit-planner.component.ts

    r8d391a1 r1ad8e64  
    7878
    7979  onClickBack(){
    80     console.log("promena");
    8180    this.router.navigate(['planners']);
    8281  }
  • trip-planner-front/src/app/planner/planner.component.html

    r8d391a1 r1ad8e64  
    11<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
    22
    3 
     3<p-toast></p-toast>
    44<button pButton pRipple type="button" label="Create initial planner" class="p-button-help " (click)="show()"></button>
    55<br>
  • 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.