Changeset 1ad8e64 for trip-planner-front/src/app
- Timestamp:
- 11/29/21 22:35:07 (3 years ago)
- Branches:
- master
- Children:
- 84d0fbb
- Parents:
- 8d391a1
- 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 45 45 import {PaginatorModule} from 'primeng/paginator'; 46 46 import {CardModule} from 'primeng/card'; 47 import { RegisterComponent } from './homepage/register/register.component'; 48 import { LoginComponent } from './homepage/login/login.component'; 47 49 48 50 @NgModule({ … … 57 59 AddLocationToPlannerPanelComponent, 58 60 HomepageComponent, 59 LocationDetailsComponent 61 LocationDetailsComponent, 62 RegisterComponent, 63 LoginComponent 60 64 ], 61 65 imports: [ -
trip-planner-front/src/app/create-initial-planner/create-initial-planner.component.html
r8d391a1 r1ad8e64 1 <form (ngSubmit)="onFormSubmitPlanner(f)" #f="ngForm" >2 1 <div mat-dialog-content> 3 2 <p>Planner name</p> … … 12 11 </div> 13 12 <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> 16 15 </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'; 1 import { Component, OnInit } from '@angular/core'; 2 import { DynamicDialogRef } from 'primeng/dynamicdialog'; 7 3 import { PlannerDto } from '../_models/dto/plannerDto'; 8 4 import { Planner } from '../_models/planner'; 9 import { PlannerService } from '../_services/planner.service';10 5 11 6 @Component({ … … 17 12 18 13 planner: Planner; 19 planners: Planner[];20 14 plannerDto: PlannerDto; 21 15 22 constructor(private dialogRef: MatDialogRef<CreateInitialPlannerComponent>, 23 private plannerService : PlannerService, private router : Router) { 16 constructor( private ref: DynamicDialogRef) { 24 17 this.planner = new Planner; 25 this.planners = [];26 18 this.plannerDto = new PlannerDto(); 27 19 } … … 32 24 } 33 25 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(); 48 29 } 49 30 -
trip-planner-front/src/app/homepage/homepage.component.html
r8d391a1 r1ad8e64 17 17 18 18 <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> 19 22 <li class="nav-item"> 20 23 <button class="btn btn-dark">Sign in</button> -
trip-planner-front/src/app/homepage/homepage.component.ts
r8d391a1 r1ad8e64 1 1 import { Component, OnInit } from '@angular/core'; 2 import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; 2 3 import { Location } from '../_models/location'; 3 4 import { LocationService } from '../_services/location.service'; 5 import { RegisterComponent } from './register/register.component'; 4 6 5 7 … … 16 18 locations: Location[]; 17 19 villages: Location[]; 20 ref: DynamicDialogRef; 18 21 19 constructor(private locationService: LocationService ) {22 constructor(private locationService: LocationService, private dialogService: DialogService) { 20 23 this.responsiveOptions = [ 21 24 { … … 37 40 this.locations = []; 38 41 this.villages = []; 42 this.ref = new DynamicDialogRef; 39 43 } 40 44 … … 52 56 ); 53 57 } 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 } 54 68 } -
trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.ts
r8d391a1 r1ad8e64 5 5 import { DynamicDialogRef } from 'primeng/dynamicdialog'; 6 6 import { 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 9 8 10 9 -
trip-planner-front/src/app/location/location.component.html
r8d391a1 r1ad8e64 1 1 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" 2 2 integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous"> 3 <p-toast></p-toast> 3 4 <p-toast></p-toast> 4 5 <h3>Here are all locations</h3> 5 6 <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 124 124 } 125 125 ); 126 127 128 126 }); 129 127 } -
trip-planner-front/src/app/planner/edit-planner/edit-planner.component.html
r8d391a1 r1ad8e64 43 43 </div> 44 44 <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 47 45 </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 78 78 79 79 onClickBack(){ 80 console.log("promena");81 80 this.router.navigate(['planners']); 82 81 } -
trip-planner-front/src/app/planner/planner.component.html
r8d391a1 r1ad8e64 1 1 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous"> 2 2 3 3 <p-toast></p-toast> 4 4 <button pButton pRipple type="button" label="Create initial planner" class="p-button-help " (click)="show()"></button> 5 5 <br> -
trip-planner-front/src/app/planner/planner.component.ts
r8d391a1 r1ad8e64 5 5 import { Router } from '@angular/router'; 6 6 import { PlannerDto } from '../_models/dto/plannerDto'; 7 import { FormBuilder, FormGroup, Validators } from '@angular/forms';8 7 import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; 9 import { PrimeNGConfig } from 'primeng/api';8 import { MessageService, PrimeNGConfig } from 'primeng/api'; 10 9 11 10 … … 13 12 selector: 'app-planner', 14 13 templateUrl: './planner.component.html', 15 styleUrls: ['./planner.component.css'] 14 styleUrls: ['./planner.component.css'], 15 providers: [DialogService, MessageService] 16 16 }) 17 17 export class PlannerComponent implements OnInit { … … 19 19 planners: Planner[]; 20 20 plannerDto: PlannerDto; 21 editForm: FormGroup;22 21 ref: DynamicDialogRef; 23 22 24 23 25 24 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) { 27 26 this.planners = []; 28 27 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; 33 29 } 34 30 … … 51 47 } 52 48 ); 49 } 53 50 54 }55 51 show() { 56 52 this.ref = this.dialogService.open(CreateInitialPlannerComponent, { … … 60 56 baseZIndex: 10000 61 57 }); 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 62 69 } 70 63 71 }
Note:
See TracChangeset
for help on using the changeset viewer.