-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaaaaaaaas itest it , wait sec it't work bi**c hhh
- Loading branch information
Tayeb-Ali
authored and
Tayeb-Ali
committed
Apr 1, 2020
1 parent
c9caa2a
commit 191da80
Showing
13 changed files
with
401 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 85 additions & 4 deletions
89
src/app/Pages/pharmacy-pages/pharmacy-details/pharmacy-details.page.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,90 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>pharmacy-details</ion-title> | ||
</ion-toolbar> | ||
<ion-toolbar> | ||
<ion-buttons slot="start"> | ||
<ion-back-button color="light"> | ||
</ion-back-button> | ||
</ion-buttons> | ||
<ion-title class="ion-text-center">details</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content> | ||
|
||
<ion-content *ngIf="!pharmacy"> | ||
<div class="ion-padding ion-color-success"> | ||
<ion-skeleton-text animated class="ion-color-success" style="width: 60%"></ion-skeleton-text> | ||
<ion-skeleton-text animated class="ion-color-success"></ion-skeleton-text> | ||
<ion-skeleton-text animated class="ion-color-success" 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> | ||
<div class="ion-padding ion-color-success"> | ||
<ion-skeleton-text animated class="ion-color-success" style="width: 80%"></ion-skeleton-text> | ||
<ion-skeleton-text animated class="ion-color-success"></ion-skeleton-text> | ||
<ion-skeleton-text animated class="ion-color-success" style="width: 50%"></ion-skeleton-text> | ||
<ion-skeleton-text animated style="width: 40%"></ion-skeleton-text> | ||
<ion-skeleton-text animated style="width: 100%"></ion-skeleton-text> | ||
</div> | ||
</ion-content> | ||
|
||
<ion-content *ngIf="pharmacy" class="ion-no-padding"> | ||
<ion-card> | ||
<ion-item> | ||
<ion-avatar slot="start"> | ||
<img src="{{pharmacy?.user?.image}}"/> | ||
</ion-avatar> | ||
<ion-label> | ||
<h3>Create by: DR. {{pharmacy?.user?.name}}</h3> | ||
</ion-label> | ||
</ion-item> | ||
|
||
<ion-card-content> | ||
<ion-label> | ||
<p>#: {{pharmacy?.id}}</p> | ||
<h2>Name: {{pharmacy?.name}}</h2> | ||
<h3>Type: {{pharmacy?.type}}</h3> | ||
<h3>dose: {{pharmacy?.dose}} m/g</h3> | ||
<p>Location: {{pharmacy?.address}}</p> | ||
<p>Type: {{pharmacy?.type}}</p> | ||
<p>Created at: {{pharmacy?.created_at|date: 'yyyy-MMMM-dd '}}</p> | ||
</ion-label> | ||
</ion-card-content> | ||
<ion-row> | ||
<ion-col class="ion-no-padding" size="6"> | ||
<ion-button color="primary" fill="outline" size="small"> | ||
Order #:{{pharmacy?.id}} | ||
</ion-button> | ||
</ion-col> | ||
<ion-col class="ion-no-padding" size="6"> | ||
<ion-button fill="outline" size="small"> | ||
Available: {{pharmacy?.available}} | ||
</ion-button> | ||
</ion-col> | ||
</ion-row> | ||
</ion-card> | ||
<ion-card> | ||
<div *ngIf="!formCard" class="ion-text-center ion-align-items-center"> | ||
<ion-button (click)="pharmacyConfirm()" disabled="{{formCard}}" expand="block"> | ||
<ion-icon name="thumbs-up"></ion-icon> | ||
<div>Accept</div> | ||
</ion-button> | ||
</div> | ||
<!-- <div *ngIf="pharmacy.status == 2">--> | ||
<ion-button (click)="requestCancel()" color="danger" disabled="" expand="block"> | ||
<div>Cancel</div> | ||
</ion-button> | ||
<!-- </div>--> | ||
|
||
</ion-card> | ||
|
||
<ion-list *ngIf="formCard"> | ||
<ion-item> | ||
<ion-label>Price:</ion-label> | ||
<ion-input [(ngModel)]="formData.price" type="number"></ion-input> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>Location:</ion-label> | ||
<ion-input [(ngModel)]="formData.address" type="text"></ion-input> | ||
</ion-item> | ||
<ion-button (click)="emergencyConfirm(formData)" shape="round" type="full">Send</ion-button> | ||
</ion-list> | ||
</ion-content> |
117 changes: 115 additions & 2 deletions
117
src/app/Pages/pharmacy-pages/pharmacy-details/pharmacy-details.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,128 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import {Component, OnInit} from '@angular/core'; | ||
import {ActivatedRoute, Router} from '@angular/router'; | ||
import {AlertController, LoadingController, ToastController} from '@ionic/angular'; | ||
import {EmergencyService} from '../../../Service/emergency.service'; | ||
|
||
@Component({ | ||
selector: 'app-pharmacy-details', | ||
templateUrl: './pharmacy-details.page.html', | ||
styleUrls: ['./pharmacy-details.page.scss'], | ||
}) | ||
export class PharmacyDetailsPage implements OnInit { | ||
requestId: number; | ||
result: any; | ||
pharmacy: any; | ||
acceptRes: any; | ||
pharmacyData: any; | ||
formCard = false; | ||
formData = {price: null, address: ''}; | ||
|
||
constructor() { } | ||
constructor( | ||
public tostMessage: ToastController, | ||
private activeRoute: ActivatedRoute, | ||
private presentAlertConfirm: AlertController, | ||
private loadingController: LoadingController, | ||
public router: Router, | ||
private pharmacyServe: EmergencyService | ||
) { | ||
this.activeRoute.params.subscribe( | ||
params => { | ||
this.requestId = params.id; | ||
} | ||
); | ||
} | ||
|
||
ngOnInit() { | ||
this.requestData(); | ||
} | ||
|
||
|
||
async requestData() { | ||
const loading = await this.loadingController.create({ | ||
message: 'Loading...' | ||
}); | ||
await loading.present(); | ||
await this.pharmacyServe.getPharmcyRequestbyID(this.requestId) | ||
.subscribe(result => { | ||
this.result = result; | ||
this.pharmacy = this.result.data; | ||
loading.dismiss(); | ||
}, err => { | ||
console.log(err); | ||
loading.dismiss(); | ||
}); | ||
} | ||
|
||
acceptRequest(data) { | ||
this.pharmacyServe.updatePharmcyRequest(this.requestId, data) | ||
.subscribe(response => { | ||
console.log(this.acceptRes = response); | ||
if (this.acceptRes.success) { | ||
this.succseMessage(this.acceptRes.message) | ||
this.router.navigateByUrl('/'); | ||
} else { | ||
this.faildMessage(); | ||
} | ||
|
||
}, | ||
error => { | ||
this.acceptRes = error; | ||
alert('try later'); | ||
console.log(this.acceptRes); | ||
} | ||
); | ||
} | ||
|
||
async emergencyConfirm(data) { | ||
const alert = await this.presentAlertConfirm.create({ | ||
header: 'Confirm!', | ||
message: 'Message <strong>Do you want to follow up and agree to the request?</strong>!!!', | ||
buttons: [ | ||
{ | ||
text: 'Cancel', | ||
role: 'cancel', | ||
cssClass: 'secondary', | ||
handler: (blah) => { | ||
} | ||
}, { | ||
text: 'Okay', | ||
handler: () => { | ||
console.log('Confirm Okay'); | ||
this.acceptRequest(data); | ||
} | ||
} | ||
] | ||
}); | ||
|
||
await alert.present(); | ||
} | ||
|
||
pharmacyConfirm() { | ||
this.formCard = true; | ||
} | ||
|
||
requestCancel() { | ||
this.formCard = false; | ||
|
||
} | ||
|
||
async succseMessage(messge) { | ||
const toast = await this.tostMessage.create({ | ||
message: messge, | ||
duration: 3000, | ||
color: 'primary', | ||
position: 'middle' | ||
}); | ||
toast.present(); | ||
} | ||
|
||
async faildMessage() { | ||
const toast = await this.tostMessage.create({ | ||
message: 'try again with veiled data', | ||
duration: 3000, | ||
color: 'danger', | ||
position: 'middle' | ||
}); | ||
toast.present(); | ||
} | ||
} |
Oops, something went wrong.