Ignore:
Timestamp:
11/25/21 22:08:24 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
8d391a1
Parents:
59329aa
Message:

primeNG components

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  
    4242        </div>
    4343    </div>
    44     <button mat-raised-button color="primary" >
    45         <mat-icon>edit</mat-icon> Save
    46       </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
    4747</form>
    4848
    49    
  • trip-planner-front/src/app/planner/edit-planner/edit-planner.component.ts

    r59329aa re29cc2e  
    7777  }
    7878
     79  onClickBack(){
     80    console.log("promena");
     81    this.router.navigate(['planners']);
     82  }
    7983}
  • trip-planner-front/src/app/planner/planner.component.html

    r59329aa re29cc2e  
    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 <button mat-raised-button (click)="openDialog()">Create initial planner</button>
    43
    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  
    22import { Planner } from '../_models/planner';
    33import { PlannerService } from '../_services/planner.service';
    4 import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
    54import { CreateInitialPlannerComponent } from '../create-initial-planner/create-initial-planner.component';
    65import { Router } from '@angular/router';
    76import { PlannerDto } from '../_models/dto/plannerDto';
    87import { FormBuilder, FormGroup, Validators } from '@angular/forms';
     8import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
     9import { PrimeNGConfig } from 'primeng/api';
    910
    1011
     
    1920  plannerDto: PlannerDto;
    2021  editForm: FormGroup;
     22  ref: DynamicDialogRef;
    2123
    2224
    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) {
    2627    this.planners = [];
    2728    this.plannerDto = new PlannerDto();
    2829    this.editForm = fb.group({
    2930      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: {}
    3731    });
     32    this.ref = new DynamicDialogRef;   
    3833  }
    39  
     34
    4035  ngOnInit(): void {
     36
     37    this.primengConfig.ripple = true;
     38
    4139    this.plannerService.getAllPlanners().subscribe(
    4240      data => {
     
    4543    );
    4644  }
    47  
    48   onClickEditPlannerGet(id: number){
     45
     46  onClickEditPlannerGet(id: number) {
    4947    console.log(id);
    50         this.plannerService.getPlannerById(id).subscribe(
    51             data => {         
    52               this.router.navigate(['edit/planner/', id]);
    53             }
    54      );
    55    
     48    this.plannerService.getPlannerById(id).subscribe(
     49      data => {
     50        this.router.navigate(['edit/planner/', id]);
     51      }
     52    );
     53
    5654  }
    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  }
    5963}
Note: See TracChangeset for help on using the changeset viewer.