diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index f2f0494..7fc2798 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -12,7 +12,7 @@ const routes: Routes = [ }, { path: '', - redirectTo: 'home', + redirectTo: 'cover', pathMatch: 'full' }, { diff --git a/src/app/services/tips.service.spec.ts b/src/app/services/tips.service.spec.ts new file mode 100644 index 0000000..d792025 --- /dev/null +++ b/src/app/services/tips.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { TipsService } from './tips.service'; + +describe('TipsService', () => { + let service: TipsService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(TipsService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/tips.service.ts b/src/app/services/tips.service.ts new file mode 100644 index 0000000..3b8a3e3 --- /dev/null +++ b/src/app/services/tips.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { environment } from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class TipsService { + + private apiUrl = `${environment.apiUrl}/trik`; + + constructor(private http: HttpClient) { } + + simpanPengukuran(data: any): Observable { + return this.http.post(this.apiUrl, data); + } + getAllTrik(): Observable { + const url = `${this.apiUrl}?take=30`; + return this.http.get(url); + } +} \ No newline at end of file diff --git a/src/app/tabel/tabel.page.ts b/src/app/tabel/tabel.page.ts index ac3cabf..be036a2 100644 --- a/src/app/tabel/tabel.page.ts +++ b/src/app/tabel/tabel.page.ts @@ -53,113 +53,20 @@ export class TabelPage implements OnInit { async ngOnInit() { await this.storage.create(); this.getPengukuranData(); - this.loadingIndicator = true; - this.dummy = [ - { - "id": 4, - "berat_badan": 1, - "tinggi_badan": 2, - "imt": 3, - "lingkar_perut": 16, - "tekanan_darah_diastole": 4, - "tekanan_darah_sistole": 5, - "frekuensi_nafas": 6, - "nadi": 7, - "kadar_gula_darah": 8, - "waktu_pengambilan_gula_darah": "pagi", - "kolesterol_total": 11, - "kolesterol_ldl": 10, - "kolesterol_hdl": 9, - "trigliserida": 15, - "kadar_hb": 12, - "kadar_asam_urat": 13, - "golongan_darah": "14", - "kondisi_umum": "kondisi", - "keluhan_perasaan": "keluhan", - "created_at": "2024-05-15T12:37:35Z", - "updated_at": "2024-05-15T12:37:35Z", - "deleted_at": null, - "identitas_id": 8 - }, - { - "id": 5, - "berat_badan": 3123, - "tinggi_badan": 123, - "imt": 412, - "lingkar_perut": 45, - "tekanan_darah_diastole": 244, - "tekanan_darah_sistole": 34, - "frekuensi_nafas": 234, - "nadi": 34, - "kadar_gula_darah": 42, - "waktu_pengambilan_gula_darah": "pagi", - "kolesterol_total": 2345, - "kolesterol_ldl": 23, - "kolesterol_hdl": 3424, - "trigliserida": 534, - "kadar_hb": 44, - "kadar_asam_urat": 53, - "golongan_darah": "45", - "kondisi_umum": "kondisi", - "keluhan_perasaan": "keluhan", - "created_at": "2024-05-15T12:39:11Z", - "updated_at": "2024-05-15T12:39:11Z", - "deleted_at": null, - "identitas_id": 8 - }, - { - "id": 6, - "berat_badan": 123, - "tinggi_badan": 412, - "imt": 312, - "lingkar_perut": 20, - "tekanan_darah_diastole": 23, - "tekanan_darah_sistole": 54, - "frekuensi_nafas": 34, - "nadi": 234, - "kadar_gula_darah": 234, - "waktu_pengambilan_gula_darah": "makan", - "kolesterol_total": 543, - "kolesterol_ldl": 523, - "kolesterol_hdl": 5234, - "trigliserida": 24, - "kadar_hb": 45, - "kadar_asam_urat": 35, - "golongan_darah": "2345", - "kondisi_umum": "aman terkendali", - "keluhan_perasaan": "perasaan", - "created_at": "2024-05-15T12:41:39Z", - "updated_at": "2024-05-15T12:41:39Z", - "deleted_at": null, - "identitas_id": 8 - } - ] - this.temp = [ - { id: 1, name: 'Austin', gender: 'Male', company: 'Swimlane' }, - { id: 2, name: 'Dany', gender: 'Male', company: 'KFC' }, - { id: 3, name: 'Molly', gender: 'Female', company: 'Burger King' }, - { id: 4, name: 'Austin', gender: 'Male', company: 'Swimlane' }, - { id: 5, name: 'Dany', gender: 'Male', company: 'KFC' }, - { id: 6, name: 'Molly', gender: 'Female', company: 'Burger King' }, - { id: 7, name: 'Austin', gender: 'Male', company: 'Swimlane' }, - { id: 8, name: 'Dany', gender: 'Male', company: 'KFC' }, - { id: 9, name: 'Molly', gender: 'Female', company: 'Burger King' }, - { id: 10, name: 'Austin', gender: 'Male', company: 'Swimlane' }, - { id: 11, name: 'Dany', gender: 'Male', company: 'KFC' }, - { id: 12, name: 'Molly', gender: 'Female', company: 'Burger King' }, - ]; - this.rows = [...this.dummy]; - this.loadingIndicator = false; + } async getPengukuranData() { + this.loadingIndicator = true; const idIdentitas = await this.storage.get('id_identitas'); this.pengukuranService.getPengukuranByIdentitasId(idIdentitas).subscribe( - (data: any) => { - console.log('Data Pengukuran:', data); + (res: any) => { + console.log('Data Pengukuran:', res); + this.rows = [...res.data]; }, (error: any) => { console.error('Error:', error); } ); - } + this.loadingIndicator = false; + } } \ No newline at end of file diff --git a/src/app/tips/tips.page.html b/src/app/tips/tips.page.html index 31bf389..76735c9 100644 --- a/src/app/tips/tips.page.html +++ b/src/app/tips/tips.page.html @@ -14,34 +14,14 @@ - + - TRIK AGAR SEHAT BUGAR SETIAP HARI + {{ tip.judul }} - - - -

- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum -

+
- - - - TRIK SEHAT BAGI PENDERITA DIABETES MELLITUS (DM) / KENCING MANIS - - - - - - -

- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum -

-
-
- \ No newline at end of file + diff --git a/src/app/tips/tips.page.ts b/src/app/tips/tips.page.ts index 2a06005..2150b66 100644 --- a/src/app/tips/tips.page.ts +++ b/src/app/tips/tips.page.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { TipsService } from '../services/tips.service'; @Component({ selector: 'app-tips', @@ -6,10 +7,25 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./tips.page.scss'], }) export class TipsPage implements OnInit { + resData: any; - constructor() { } + constructor( + private tipservice: TipsService + ) {} ngOnInit() { + this.getAllData(); } + async getAllData() { + this.tipservice.getAllTrik().subscribe( + (res: any) => { + this.resData = res.data; + console.log(res.data); + }, + (error: any) => { + console.error('Error:', error); + } + ); + } }