Ignore:
Timestamp:
07/29/20 19:46:21 (4 years ago)
Author:
Mile Jankuloski <mile.jankuloski@…>
Branches:
master
Children:
4e72684
Parents:
e42f61a
Message:

Prepared and improved components for data flows

Location:
Farmatiko/ClientApp/src/app/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/ClientApp/src/app/admin/admin.component.html

    re42f61a rde18858  
    3131              </thead>
    3232              <tbody>
    33                 <tr *ngFor="">
    34                   <td>data1</td>
    35                   <td>data2</td>
    36                   <td>data3</td>
     33                <tr *ngFor="let head of heads">
     34                  <td>{{head.Name}} | {{head.Email}}</td>
     35                  <td>{{head.Pharmacy[0].name}}</td>
     36                  <td><a (click)="Approve()">Approve</a> | <a (click)="Reject()">Reject</a></td>
    3737                </tr>
    3838              </tbody>
    3939            </table>
    4040        </div>
     41        </div>
     42      </mat-tab>
    4143      <mat-tab label="Manage accounts">
    4244        <div class="wrapper">
     
    5052              </thead>
    5153              <tbody>
    52                 <tr *ngFor="">
    53                   <td>data1</td>
    54                   <td>data2</td>
     54                <tr *ngFor="let head of heads">
     55                  <td>{{head.Name}} | {{head.Email}}</td>
     56                  <td><a (click)="Del(head)">Delete</a> | <a (click)="ChangeDialog(head)">Change</a></td>
    5557                </tr>
    5658              </tbody>
    5759            </table>
     60          </div>
    5861        </div>
     62      </mat-tab>
    5963        <mat-tab label="Create new account">
    6064          <div class="createform">
    6165          <mat-form-field appearance="fill">
    6266            <mat-label>Name</mat-label>
    63             <input matInput>
     67            <input matInput [(ngModel)]="head.Name">
    6468          </mat-form-field><br>
    6569          <mat-form-field appearance="fill">
    6670            <mat-label>Email</mat-label>
    67             <input matInput>
     71            <input matInput [(ngModel)]="head.Email">
    6872          </mat-form-field><br>
    6973          <mat-form-field appearance="fill">
    7074            <mat-label>Password</mat-label>
    71             <input matInput>
     75            <input matInput [(ngModel)]="head.Passwd">
    7276          </mat-form-field><br>
    73             <button mat-raised-button color="primary">Create</button>
     77            <button onclick="createHead()" mat-raised-button color="primary">Create</button>
    7478          </div>
     79        </mat-tab>
     80</mat-tab-group>
     81
     82<div class="status">{{status}}</div>
  • Farmatiko/ClientApp/src/app/admin/admin.component.ts

    re42f61a rde18858  
    1 import { Component, OnInit } from '@angular/core';
     1import { Component, OnInit, Inject, Output, EventEmitter } from '@angular/core';
     2import { Pharmacy } from '../models/Pharmacy';
     3import { HttpClient } from '@angular/common/http';
     4import { MatDialog } from '@angular/material/dialog';
     5import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
     6import { Router, RouterModule } from '@angular/router';
     7import { PharmacyHead } from '../models/PharmacyHead';
    28import { FormControl } from '@angular/forms';
     9
    310
    411@Component({
     
    815})
    916export class AdminComponent implements OnInit {
     17  public heads: PharmacyHead[];
     18  public head: PharmacyHead;
     19  public status: string;
    1020
    11   constructor() { }
     21  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string, private dialog: MatDialog, private _snackBar: MatSnackBar, private router: Router) {
     22    http.get<PharmacyHead[]>(baseUrl + 'PharmacyHead/Get?').subscribe(result => {
     23      this.heads = result;
     24      console.log(this.heads);
     25    }, error => console.error(error));
     26  }
    1227
    1328  ngOnInit(): void {
     29    this.head = new PharmacyHead();
     30  }
     31
     32  createHead() {
     33    console.log(this.head);
     34    // post request vo prodolzenie
     35
     36    this.status="Status bar createHead";
     37    //window.location.reload();
     38  }
     39
     40  Del(head: PharmacyHead) {
     41    console.log(this.head);
     42    // post request vo prodolzenie
     43
     44    this.status="Status bar Del";
     45  }
     46
     47  ChangeDialog(head: PharmacyHead) {
     48    console.log(this.head);
     49
     50  }
     51
     52  Reject() {
     53    console.log('Rejected');
     54    // post request vo prodolzenie
     55
     56  }
     57
     58  Approve() {
     59    console.log('Approved');
     60    // post request vo prodolzenie
     61
    1462  }
    1563
Note: See TracChangeset for help on using the changeset viewer.