Ignore:
Timestamp:
11/02/21 22:14:57 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
6c1585f
Parents:
188ee53
Message:

create initial planner and routing with angular

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

Legend:

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

    r188ee53 r6a80231  
    1 .example-card {
    2    
    3   }
     1mat-card  {   
     2  width: 280px;   
     3  height: 160px;
     4
     5}
     6.example-card button {
     7  box-shadow:none !important;
     8  cursor:pointer;
     9}
  • trip-planner-front/src/app/planner/planner.component.html

    r188ee53 r6a80231  
     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">
    12
    23<button mat-raised-button (click)="openDialog()">Create initial planner</button>
    34
    4 <mat-grid-list cols="4" rowHeight="250px">
    5   <mat-grid-tile *ngFor="let planner of planners" >
    6       <mat-card class="example-card" >
     5<mat-grid-list cols="4" >
     6  <mat-grid-tile *ngFor="let planner of planners">
     7      <mat-card class="d-flex flex-column">
    78        <mat-card-title>{{planner.name}}</mat-card-title>
    89        <mat-card-content>
    910          {{planner.description}}
    1011        </mat-card-content>
    11         <mat-card-actions>
    12           <button mat-raised-button color="primary">
     12        <mat-card-actions class="mt-auto">
     13          <button mat-raised-button color="primary" (click)="onClickEditPlanner(planner.id)">
    1314            <mat-icon>edit</mat-icon> Edit
    1415          </button>
  • trip-planner-front/src/app/planner/planner.component.ts

    r188ee53 r6a80231  
    44import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
    55import { CreateInitialPlannerComponent } from '../create-initial-planner/create-initial-planner.component';
     6import { Router } from '@angular/router';
    67
    78
     
    1415
    1516  planners: Planner[];
    16   constructor(private plannerService: PlannerService, public dialog: MatDialog) {
     17  plannerId: number;
     18
     19  constructor(private plannerService: PlannerService, public dialog: MatDialog, private router: Router) {
    1720    this.planners = [];
     21    this.plannerId = 1;
    1822  };
    1923 
     
    3337  }
    3438 
     39  onClickEditPlanner(id: number){
     40    console.log(id);
     41   
     42         
     43          this.router.navigate(['edit/planner/', this.plannerId])
     44   
     45  }
    3546}
Note: See TracChangeset for help on using the changeset viewer.