Skip to content

Commit

Permalink
work with Pharmacy add pharmacy-dials.page
Browse files Browse the repository at this point in the history
  • Loading branch information
Tayeb-Ali authored and Tayeb-Ali committed Mar 31, 2020
1 parent f337c70 commit c9caa2a
Show file tree
Hide file tree
Showing 17 changed files with 204 additions and 114 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
- show requests.
- accept request.
- users history.

> work on:
- auth.
- ice .
- wallet.

> work on:
- bok payment.

![alt text](https://i.ibb.co/S5fkPfV/localhost-8100-requests-i-Phone-6-7-8.png)
4 changes: 2 additions & 2 deletions capacitor.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"appId": "io.ionic.starter",
"appName": "vitel-user",
"appId": "com.detatech.vitaluser",
"appName": "Vital user",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "www",
Expand Down
2 changes: 1 addition & 1 deletion src/app/Pages/Blog-pages/blog/blog.page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-header>
<ion-toolbar>
<ion-title>Blog</ion-title>
<ion-title class="ion-text-center">Blog</ion-title>
</ion-toolbar>
</ion-header>

Expand Down
4 changes: 2 additions & 2 deletions src/app/Pages/Dashboard/home/home.page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-header>
<ion-toolbar>
<ion-title>Dashboard</ion-title>
<ion-title class="ion-text-center">Dashboard</ion-title>
</ion-toolbar>
</ion-header>

Expand Down Expand Up @@ -75,4 +75,4 @@
</ion-row>

</ion-grid>
</ion-content>
</ion-content>
5 changes: 2 additions & 3 deletions src/app/Pages/Dashboard/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class HomePage implements OnInit {
const actionSheet = await this.actionSheetController.create({
header: 'pharmacy Services',
buttons: [{
text: 'find pharmacy',
text: 'Find pharmacy',
icon: 'assets/icon/pharmacy.svg',
handler: () => {
this.router.navigate(['/find-pharmacy']);
Expand All @@ -143,8 +143,7 @@ export class HomePage implements OnInit {
text: 'Request history',
icon: 'list-circle-outline',
handler: () => {
// this.router.navigate(['/emergency-pages-history']);
alert('available soon');
this.router.navigate(['/pharmacy']);
}
}, {
text: 'Cancel',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export class AmbulanceDetailsPage implements OnInit {
params: any;
requestId: number;
request: any;
private acceptRes: any;
private userInfo: any;
acceptRes: any;
userInfo: any;

constructor(
private route: ActivatedRoute,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-header>
<ion-toolbar>
<ion-title>find-pharmacy</ion-title>
<ion-title class="ion-text-center">Find pharmacy</ion-title>
</ion-toolbar>
</ion-header>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { PharmacyDetailsPage } from './pharmacy-details.page';

const routes: Routes = [
{
path: '',
component: PharmacyDetailsPage
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class PharmacyDetailsPageRoutingModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { IonicModule } from '@ionic/angular';

import { PharmacyDetailsPageRoutingModule } from './pharmacy-details-routing.module';

import { PharmacyDetailsPage } from './pharmacy-details.page';

@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PharmacyDetailsPageRoutingModule
],
declarations: [PharmacyDetailsPage]
})
export class PharmacyDetailsPageModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<ion-header>
<ion-toolbar>
<ion-title>pharmacy-details</ion-title>
</ion-toolbar>
</ion-header>

<ion-content>

</ion-content>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-pharmacy-details',
templateUrl: './pharmacy-details.page.html',
styleUrls: ['./pharmacy-details.page.scss'],
})
export class PharmacyDetailsPage implements OnInit {

constructor() { }

ngOnInit() {
}

}
56 changes: 24 additions & 32 deletions src/app/Pages/pharmacy-pages/pharmacy/pharmacy.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@
<ion-title class="ion-text-center">Pharmacy</ion-title>
</ion-toolbar>
</ion-header>

<ion-content *ngIf="!pharmacyData">
<div class="ion-padding custom-skeleton">
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
<ion-skeleton-text animated></ion-skeleton-text>
<ion-skeleton-text animated style="width: 88%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 70%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</div>
<ion-content *ngIf="!pharmacyData" class="ion-padding custom-skeleton">
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
<ion-skeleton-text animated></ion-skeleton-text>
<ion-skeleton-text animated style="width: 88%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 70%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</ion-content>


<ion-content *ngIf="pharmacyData">
<ion-searchbar (ionCancel)="clearSearch()" (ionChange)="searchRequests()" animated
showCancelButton="focus"></ion-searchbar>
<ion-refresher (ionRefresh)="doRefresh($event)" slot="fixed">
<ion-refresher-content
pullingIcon="arrow-down-outline"
Expand All @@ -28,33 +26,27 @@
refreshingText="Refreshing...">
</ion-refresher-content>
</ion-refresher>
<ion-grid>
<ion-row>
<ion-col class="text-amber ion-text-center">Title</ion-col>
<ion-col class="text-amber ion-text-center">available</ion-col>
<ion-col class="text-amber ion-text-center">Date</ion-col>
</ion-row>
<ion-row *ngFor="let item of pharmacyData">
<ion-col class="text-blue ion-text-center"
routerLink="/emergency-pages-history/{{item?.id}}">{{item?.type}}</ion-col>

<ion-col class="text-amber ion-text-center">
{{item.available}}
</ion-col>


<ion-col class="text-blue-grey ion-text-center"
routerLink="/emergency-pages-history/{{item.id}}">{{item?.created_at| date: 'y-MM-d'}}</ion-col>
</ion-row>
</ion-grid>


<ion-list>
<ion-item *ngFor="let item of pharmacyData" routerLink="/request-details/{{item.id}}">
<!-- <ion-avatar slot="start">-->
<!-- <img src="assets/images/1.jpg">-->
<!-- </ion-avatar>-->
<ion-label>
<p>id: {{item?.id}}</p>
<h2>Name: {{item?.name}}</h2>
<h3>Type: {{item?.type}}</h3>
<h3>dose: {{item?.dose}} m/g</h3>
<p>Address: {{item?.address}}</p>
<p>Type: {{item?.type}}</p>
<p>data: {{item?.created_at|date: 'YYYY, MMMM, dd '}}</p>
</ion-label>
</ion-item>
</ion-list>
<ion-infinite-scroll (ionInfinite)="loadData($event)" threshold="100px">
<ion-infinite-scroll-content
loadingSpinner="bubbles"
loadingText="Loading more data...">
</ion-infinite-scroll-content>
</ion-infinite-scroll>

</ion-content>

130 changes: 76 additions & 54 deletions src/app/Pages/pharmacy-pages/pharmacy/pharmacy.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,93 @@ import {Component, OnInit} from '@angular/core';
import {EmergencyService} from '../../../Service/emergency.service';

@Component({
selector: 'app-pharmacy',
templateUrl: './pharmacy.page.html',
styleUrls: ['./pharmacy.page.scss'],
selector: 'app-pharmacy',
templateUrl: './pharmacy.page.html',
styleUrls: ['./pharmacy.page.scss'],
})
export class PharmacyPage implements OnInit {
pharmacyData: any;
page: number;
perPage = 0;
totalData: number;
totalPage: number;
private errorMessage: any;
private result: any;
pharmacyData: any;
page: number;
perPage = 0;
totalData: number;
totalPage: number;
errorMessage: any;
result: any;
search: any;

constructor(
private pharmacyServ: EmergencyService
) {
}
constructor(
private pharmacyServ: EmergencyService
) {
}

ngOnInit() {
}
ngOnInit() {
this.requestData();
}

doRefresh(event) {
this.requestData();
doRefresh(event) {
this.requestData();

setTimeout(() => {
event.target.complete();
}, 2000);
}
setTimeout(() => {
event.target.complete();
}, 2000);
}

requestData() {
this.pharmacyServ.getPharmcyRequest()
.subscribe(res => {
this.result = res;
this.perPage = this.result.per_page;
this.page = this.result.current_page;
this.totalData = this.result.total;
this.totalPage = this.result.total_pages;
this.pharmacyData = this.result.data.data;
requestData() {
this.pharmacyServ.getPharmcyRequest()
.subscribe(res => {
this.result = res;
this.perPage = this.result.per_page;
this.page = this.result.current_page;
this.totalData = this.result.total;
this.totalPage = this.result.total_pages;
this.pharmacyData = this.result.data;
console.log('rsp: ', res);

},
error =>
console.log('server: ', this.errorMessage = error)
);
}

},
error =>
console.log('server: ', this.errorMessage = error)
);
}

loadData(event) {
this.page = this.page + 1;
setTimeout(() => {
this.pharmacyServ.getPharmcyRequest(this.page)
.subscribe(
res => {
this.result = res;
this.perPage = this.result.per_page;
this.totalData = this.result.total;
this.totalPage = this.result.total_pages;
const length = this.result.data.length;
for (let i = 0; i < length; i++) {
this.pharmacyData.push(this.result.data[i]);
}
}),
event.target.complete();
}, 1000);

loadData(event) {
this.page = this.page + 1;
setTimeout(() => {
this.pharmacyServ.getPharmcyRequest(this.page)
.subscribe(
res => {
this.result = res;
// this.historyData = this.result.data;
this.perPage = this.result.per_page;
this.totalData = this.result.total;
this.totalPage = this.result.total_pages;
const length = this.result.data.length;
for (let i = 0; i < length; i++) {
this.pharmacyData.push(this.result.data[i]);
}

searchRequests() {
this.pharmacyServ.search(this.search).subscribe(
resp => {
if (resp.count > 0) {
this.pharmacyData = resp.results;
} else {
this.pharmacyData = [];
}
}),
event.target.complete();
}, 1000);
console.log('Search Result', resp);
},
err => {
console.log(err);
}
);
}

}
clearSearch() {
this.requestData();
}

}
Loading

0 comments on commit c9caa2a

Please sign in to comment.