Changeset e29cc2e for trip-planner-front/src/app/planner
- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- Location:
- trip-planner-front/src/app/planner
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/planner/edit-planner/edit-planner.component.html
r59329aa re29cc2e 42 42 </div> 43 43 </div> 44 <button mat-raised-button color="primary">45 <mat-icon>edit</mat-icon> Save46 </button> 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 47 </form> 48 48 49 -
trip-planner-front/src/app/planner/edit-planner/edit-planner.component.ts
r59329aa re29cc2e 77 77 } 78 78 79 onClickBack(){ 80 console.log("promena"); 81 this.router.navigate(['planners']); 82 } 79 83 } -
trip-planner-front/src/app/planner/planner.component.html
r59329aa re29cc2e 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 <button mat-raised-button (click)="openDialog()">Create initial planner</button>4 3 5 <mat-grid-list cols="4" > 6 <mat-grid-tile *ngFor="let planner of planners"> 7 <mat-card class="d-flex flex-column"> 8 <mat-card-title>{{planner.name}}</mat-card-title> 9 <mat-card-content> 10 {{planner.description}} 11 </mat-card-content> 12 <mat-card-actions class="mt-auto"> 13 <button mat-raised-button color="primary" (click)="onClickEditPlannerGet(planner.id)"> 14 <mat-icon>edit</mat-icon> Edit 15 </button> 16 <button mat-raised-button color="accent"> 17 <mat-icon>remove_red_eye</mat-icon>Details 18 </button> 19 </mat-card-actions> 20 </mat-card> 21 </mat-grid-tile> 22 </mat-grid-list> 4 <button pButton pRipple type="button" label="Create initial planner" class="p-button-help " (click)="show()"></button> 5 <br> 6 <br> 7 <p-table [value]="planners" [paginator]="true" [rows]="3" [responsive]="true"> 8 9 <ng-template pTemplate="body" let-planner> 10 <td > 11 <p-card header="{{planner.name}}" subheader="Card Subheader" [style]="{width: '360px'}" styleClass="p-card-shadow"> 12 <ng-template pTemplate="header"> 13 </ng-template> 14 <p>{{planner.description}}</p> 15 <ng-template pTemplate="footer"> 16 <button pButton pRipple type="button" label="Edit" class="p-button-outlined p-button-rounded p-button-help" (click)="onClickEditPlannerGet(planner.id)"></button> 17 <button pButton pRipple type="button" icon="pi pi-times" class="p-button-rounded p-button-danger p-button-outlined" label="Delete" [style]="{'margin-left': '.5em'}"></button> 18 </ng-template> 19 </p-card> 20 </td> 21 </ng-template> 22 </p-table> 23 24 -
trip-planner-front/src/app/planner/planner.component.ts
r59329aa re29cc2e 2 2 import { Planner } from '../_models/planner'; 3 3 import { PlannerService } from '../_services/planner.service'; 4 import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';5 4 import { CreateInitialPlannerComponent } from '../create-initial-planner/create-initial-planner.component'; 6 5 import { Router } from '@angular/router'; 7 6 import { PlannerDto } from '../_models/dto/plannerDto'; 8 7 import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 8 import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; 9 import { PrimeNGConfig } from 'primeng/api'; 9 10 10 11 … … 19 20 plannerDto: PlannerDto; 20 21 editForm: FormGroup; 22 ref: DynamicDialogRef; 21 23 22 24 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) { 26 27 this.planners = []; 27 28 this.plannerDto = new PlannerDto(); 28 29 this.editForm = fb.group({ 29 30 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: {}37 31 }); 32 this.ref = new DynamicDialogRef; 38 33 } 39 34 40 35 ngOnInit(): void { 36 37 this.primengConfig.ripple = true; 38 41 39 this.plannerService.getAllPlanners().subscribe( 42 40 data => { … … 45 43 ); 46 44 } 47 48 onClickEditPlannerGet(id: number) {45 46 onClickEditPlannerGet(id: number) { 49 47 console.log(id); 50 51 data => {52 53 54 55 48 this.plannerService.getPlannerById(id).subscribe( 49 data => { 50 this.router.navigate(['edit/planner/', id]); 51 } 52 ); 53 56 54 } 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 } 59 63 }
Note:
See TracChangeset
for help on using the changeset viewer.