diff --git a/src/app/Pages/Dashboard/home/home.page.html b/src/app/Pages/Dashboard/home/home.page.html
index 72120dc..0612fa8 100644
--- a/src/app/Pages/Dashboard/home/home.page.html
+++ b/src/app/Pages/Dashboard/home/home.page.html
@@ -75,4 +75,9 @@
+
+
+
Please complete the profile and upload the CV
+
upload cv
+
diff --git a/src/app/Pages/Dashboard/home/home.page.ts b/src/app/Pages/Dashboard/home/home.page.ts
index e34dbdf..8f6588e 100644
--- a/src/app/Pages/Dashboard/home/home.page.ts
+++ b/src/app/Pages/Dashboard/home/home.page.ts
@@ -3,6 +3,7 @@ import {Storage} from '@ionic/storage';
import {InAppBrowser} from '@ionic-native/in-app-browser/ngx';
import {ActionSheetController} from '@ionic/angular';
import {Router} from '@angular/router';
+import {AuthService} from '../../../Service/auth.service';
@Component({
selector: 'app-home',
@@ -11,14 +12,16 @@ import {Router} from '@angular/router';
})
export class HomePage implements OnInit {
userInfo: any;
+ response: any;
constructor(
private storage: Storage,
public router: Router,
private iab: InAppBrowser,
+ private userServ: AuthService,
public actionSheetController: ActionSheetController
) {
- // this.userInfo = JSON.parse(localStorage.getItem('userInfo'));
+ this.getDashboardData();
}
ngOnInit(): void {
@@ -29,16 +32,18 @@ export class HomePage implements OnInit {
.catch(err => {
console.log(err);
});
+ // this.updateFcmToken();
}
- openBrow() {
- const browser = this.iab.create('https://medical.detatech.xyz/profile/' + this.userInfo.id);
- // browser.executeScript('...');
- // browser.insertCSS(...);
- // browser.on('loadstop').subscribe(event => {
- // browser.insertCSS({code: 'body{color: red;'});
- // });
+ ionViewDidEnter() {
+ if (localStorage.getItem('fcm_registration_in')) {
+ this.updateFcmToken();
+ }
+ }
+
+ openCvUpdate() {
+ const browser = this.iab.create('https://medical.detatech.xyz/profile/' + this.userInfo.id);
browser.on('loadstop').subscribe(event => {
console.log('sus: ', event);
},
@@ -48,6 +53,37 @@ export class HomePage implements OnInit {
}
+ getDashboardData() {
+ this.userServ.checkUserService()
+ .subscribe(response => {
+ this.response = response;
+ if (this.response.status === true) {
+ console.log('check: ', this.response);
+ } else {
+ alert('filed');
+ }
+ }, error => {
+ console.log('server: ', error);
+ });
+ }
+
+ updateFcmToken() {
+ const data = {
+ fcm_registration_in: localStorage.getItem('fcm_registration_in')
+ };
+ this.userServ.updateFcmToken(data)
+ .subscribe(response => {
+ console.log('res: ', response);
+ // if (this.response.status === true) {
+ // } else {
+ // alert('filed');
+ // }
+ }, error => {
+ console.log('server: ', error);
+ });
+ }
+
+
async ambulanceActionSheet() {
const actionSheet = await this.actionSheetController.create({
header: 'Ambulances Services',
@@ -140,19 +176,34 @@ export class HomePage implements OnInit {
this.router.navigate(['/find-pharmacy']);
}
}, {
- text: 'Request history',
+ text: 'Last Request',
icon: 'list-circle-outline',
handler: () => {
this.router.navigate(['/pharmacy']);
}
}, {
- text: 'Cancel',
- icon: 'close',
- role: 'cancel',
+ text: 'Your Request history',
+ icon: 'list-circle-outline',
handler: () => {
- console.log('Cancel clicked');
+ // this.router.navigate(['/pharmacy']);
+ alert('soon');
}
- }]
+ },
+ {
+ text: 'Your Accept history',
+ icon: 'list-circle-outline',
+ handler: () => {
+ // this.router.navigate(['/pharmacy']);
+ alert('soon');
+ }
+ }, {
+ text: 'Cancel',
+ icon: 'close',
+ role: 'cancel',
+ handler: () => {
+ console.log('Cancel clicked');
+ }
+ }]
});
await actionSheet.present();
}
diff --git a/src/app/Pages/emergency-pages/emergency-details/emergency-details.page.ts b/src/app/Pages/emergency-pages/emergency-details/emergency-details.page.ts
index e6ae8fb..242c6b4 100644
--- a/src/app/Pages/emergency-pages/emergency-details/emergency-details.page.ts
+++ b/src/app/Pages/emergency-pages/emergency-details/emergency-details.page.ts
@@ -11,7 +11,6 @@ import {EmergencyService} from '../../../Service/emergency.service';
export class EmergencyDetailsPage implements OnInit {
result: any;
- params: any;
requestId: number;
emergency: any;
emergencyData: any;
diff --git a/src/app/Pages/pharmacy-pages/find-pharmacy/find-pharmacy.page.html b/src/app/Pages/pharmacy-pages/find-pharmacy/find-pharmacy.page.html
index 3547ee2..c1deed6 100644
--- a/src/app/Pages/pharmacy-pages/find-pharmacy/find-pharmacy.page.html
+++ b/src/app/Pages/pharmacy-pages/find-pharmacy/find-pharmacy.page.html
@@ -10,10 +10,10 @@
You are looking for:
-
- Your address:
-
-
+
+
+
+
Dose:
diff --git a/src/app/Pages/pharmacy-pages/pharmacy-details/pharmacy-details.page.html b/src/app/Pages/pharmacy-pages/pharmacy-details/pharmacy-details.page.html
index f377abb..239f1a2 100644
--- a/src/app/Pages/pharmacy-pages/pharmacy-details/pharmacy-details.page.html
+++ b/src/app/Pages/pharmacy-pages/pharmacy-details/pharmacy-details.page.html
@@ -1,9 +1,90 @@
-
- pharmacy-details
-
+
+
+
+
+
+ details
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create by: DR. {{pharmacy?.user?.name}}
+
+
+
+
+
+ #: {{pharmacy?.id}}
+ Name: {{pharmacy?.name}}
+ Type: {{pharmacy?.type}}
+ dose: {{pharmacy?.dose}} m/g
+ Location: {{pharmacy?.address}}
+ Type: {{pharmacy?.type}}
+ Created at: {{pharmacy?.created_at|date: 'yyyy-MMMM-dd '}}
+
+
+
+
+
+ Order #:{{pharmacy?.id}}
+
+
+
+
+ Available: {{pharmacy?.available}}
+
+
+
+
+
+
+
+
+ Cancel
+
+
+
+
+
+
+
+ Price:
+
+
+
+ Location:
+
+
+ Send
+
diff --git a/src/app/Pages/pharmacy-pages/pharmacy-details/pharmacy-details.page.ts b/src/app/Pages/pharmacy-pages/pharmacy-details/pharmacy-details.page.ts
index cb0a892..aa81dc3 100644
--- a/src/app/Pages/pharmacy-pages/pharmacy-details/pharmacy-details.page.ts
+++ b/src/app/Pages/pharmacy-pages/pharmacy-details/pharmacy-details.page.ts
@@ -1,4 +1,7 @@
-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',
@@ -6,10 +9,120 @@ import { Component, OnInit } from '@angular/core';
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 Do you want to follow up and agree to the request?!!!',
+ 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();
+ }
}
diff --git a/src/app/Pages/pharmacy-pages/pharmacy/pharmacy.page.html b/src/app/Pages/pharmacy-pages/pharmacy/pharmacy.page.html
index 83433cf..bb379e9 100644
--- a/src/app/Pages/pharmacy-pages/pharmacy/pharmacy.page.html
+++ b/src/app/Pages/pharmacy-pages/pharmacy/pharmacy.page.html
@@ -28,18 +28,19 @@
-
-
-
-
+
+
+
+ Dr- {{item?.user?.name}}
+
- id: {{item?.id}}
+ #: {{item?.id}}
Name: {{item?.name}}
Type: {{item?.type}}
dose: {{item?.dose}} m/g
- Address: {{item?.address}}
+ Location: {{item?.address}}
Type: {{item?.type}}
- data: {{item?.created_at|date: 'YYYY, MMMM, dd '}}
+ Created at: {{item?.created_at|date: 'yyyy-MMMM-dd '}}
diff --git a/src/app/Pages/request-specialists-pages/history/history.page.html b/src/app/Pages/request-specialists-pages/history/history.page.html
index 64e58bf..184ce8a 100644
--- a/src/app/Pages/request-specialists-pages/history/history.page.html
+++ b/src/app/Pages/request-specialists-pages/history/history.page.html
@@ -1,6 +1,10 @@
- history
+
+
+
+
+ History
diff --git a/src/app/Pages/user-pages/medical-board/medical-board.page.ts b/src/app/Pages/user-pages/medical-board/medical-board.page.ts
index d9413cf..4bcd2f8 100644
--- a/src/app/Pages/user-pages/medical-board/medical-board.page.ts
+++ b/src/app/Pages/user-pages/medical-board/medical-board.page.ts
@@ -3,6 +3,7 @@ import {MedicalBoard} from '../../../Models/medical-board';
import {LoadingController} from '@ionic/angular';
import {AuthService} from '../../../Service/auth.service';
import {formatDate} from '@angular/common';
+import {Router} from '@angular/router';
@Component({
selector: 'app-medical-board',
@@ -16,15 +17,16 @@ export class MedicalBoardPage implements OnInit {
address: '',
birth_of_date: '',
graduation_date: '',
- medical_field_id: 0,
+ medical_field_id: null,
medical_registration_number: '',
registration_date: '',
- years_of_experience: 0
+ years_of_experience: null
};
specialtiesList: any;
private dataResult: any;
constructor(
+ private router: Router,
private loadingController: LoadingController,
private medicalServ: AuthService
) {
@@ -51,6 +53,11 @@ export class MedicalBoardPage implements OnInit {
.then(async data => {
(await loading).dismiss();
this.dataResult = data;
+ if (this.dataResult.success) {
+ this.router.navigate(['/']);
+ } else {
+ alert('error try again');
+ }
})
.catch(async err => {
(await loading).dismiss();
diff --git a/src/app/Service/auth.service.ts b/src/app/Service/auth.service.ts
index dfd3a8a..80f653b 100644
--- a/src/app/Service/auth.service.ts
+++ b/src/app/Service/auth.service.ts
@@ -19,8 +19,8 @@ export class AuthService {
authenticationState = new BehaviorSubject(null);
- private myHeaders: any;
token2 = `Bearer ${localStorage.getItem('token')}`;
+ private myHeaders: any;
constructor(
private storage: Storage,
@@ -54,6 +54,7 @@ export class AuthService {
});
});
}
+
logout() {
this.http.post(`${this.url}logout`, localStorage.getItem('token'));
return this.storage.remove('userInfo').then(res => {
@@ -92,7 +93,7 @@ export class AuthService {
this.authenticationState.next(true);
});
this.storage.set('userInfo', this.user.user).then(r =>
- console.log('login:', r));
+ r.toString());
resolve(res);
}, (err) => {
reject(err);
@@ -115,7 +116,6 @@ export class AuthService {
}
medicalBoardService(boardData) {
- console.log(boardData);
return new Promise((resolve, reject) => {
this.http.post(this.url + 'employs', boardData, {
headers: new HttpHeaders().set('Content-Type', 'application/json')
diff --git a/src/app/Service/emergency.service.ts b/src/app/Service/emergency.service.ts
index 9fa8d5f..7f7f3f7 100644
--- a/src/app/Service/emergency.service.ts
+++ b/src/app/Service/emergency.service.ts
@@ -73,4 +73,9 @@ export class EmergencyService {
sendPharmcyRequest(data): Observable {
return this.http.post(`${this.Url}pharmacies`, data, this.myHeaders);
}
+
+ updatePharmcyRequest(id, data): Observable {
+ console.log(data);
+ return this.http.patch(`${this.Url}pharmacies/${id}`, data, this.myHeaders);
+ }
}
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 485f228..e23144c 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -1,93 +1,95 @@
-import {NgModule} from '@angular/core';
-import {PreloadAllModules, RouterModule, Routes} from '@angular/router';
-import {AuthGuard} from './guard/auth.guard';
-
-const routes: Routes = [
- {
- path: '',
- loadChildren: () => import('./Pages/tabs/tabs.module').then(m => m.TabsPageModule), canActivate: [AuthGuard]
- },
- {
- path: 'requests',
- loadChildren: () => import('./Pages/request-specialists-pages/requests/requests.module').then(m => m.RequestsPageModule)
- },
- {
- path: 'history',
- loadChildren: () => import('./Pages/request-specialists-pages/history/history.module').then(m => m.HistoryPageModule)
- },
- {
- path: 'request-details/:id',
- loadChildren: () => import('./Pages/request-specialists-pages/request-details/request-details.module')
- .then(m => m.RequestDetailsPageModule)
- },
- {
- path: 'login',
- loadChildren: () => import('./Pages/user-pages/login/login.module').then(m => m.LoginPageModule)
- },
- {
- path: 'register',
- loadChildren: () => import('./Pages/user-pages/register/register.module').then(m => m.RegisterPageModule)
- },
- {
- path: 'ambulance',
- loadChildren: () => import('./Pages/ambulance-pages/ambulance/ambulance.module').then(m => m.AmbulancePageModule)
- },
- {
- path: 'medical-board',
- loadChildren: () => import('./Pages/user-pages/medical-board/medical-board.module').then(m => m.MedicalBoardPageModule)
- },
- {
- path: 'emergency-pages-request',
- loadChildren: () => import('./Pages/emergency-pages/request/request.module').then(m => m.RequestPageModule)
- },
- {
- path: 'emergency-pages-history',
- loadChildren: () => import('./Pages/emergency-pages/history/history.module').then(m => m.HistoryPageModule)
- },
- {
- path: 'ambulance-history',
- loadChildren: () => import('./Pages/ambulance-pages/ambulance-history/ambulance-history.module')
- .then(m => m.AmbulanceHistoryPageModule)
- },
- {
- path: 'ambulance-details/:id',
- loadChildren: () => import('./Pages/ambulance-pages/ambulance-details/ambulance-details.module')
- .then(m => m.AmbulanceDetailsPageModule)
- },
- {
- path: 'emergency-details/:id',
- loadChildren: () => import('./Pages/emergency-pages/emergency-details/emergency-details.module')
- .then(m => m.EmergencyDetailsPageModule)
- },
- {
- path: 'blog',
- loadChildren: () => import('./Pages/Blog-pages/blog/blog.module').then(m => m.BlogPageModule)
- },
- {
- path: 'blog-details',
- loadChildren: () => import('./Pages/Blog-pages/blog-details/blog-details.module').then(m => m.BlogDetailsPageModule)
- },
- {
- path: 'find-pharmacy',
- loadChildren: () => import('./Pages/pharmacy-pages/find-pharmacy/find-pharmacy.module').then(m => m.FindPharmacyPageModule)
- },
- {
- path: 'pharmacy',
- loadChildren: () => import('./Pages/pharmacy-pages/pharmacy/pharmacy.module').then(m => m.PharmacyPageModule)
- },
{
- path: 'pharmacy-details',
- loadChildren: () => import('./Pages/pharmacy-pages/pharmacy-details/pharmacy-details.module').then( m => m.PharmacyDetailsPageModule)
+import {NgModule} from '@angular/core';
+import {PreloadAllModules, RouterModule, Routes} from '@angular/router';
+import {AuthGuard} from './guard/auth.guard';
+
+const routes: Routes = [
+ {
+ path: '',
+ loadChildren: () => import('./Pages/tabs/tabs.module').then(m => m.TabsPageModule), canActivate: [AuthGuard]
+ },
+ {
+ path: 'requests',
+ loadChildren: () => import('./Pages/request-specialists-pages/requests/requests.module').then(m => m.RequestsPageModule)
+ },
+ {
+ path: 'history',
+ loadChildren: () => import('./Pages/request-specialists-pages/history/history.module').then(m => m.HistoryPageModule)
+ },
+ {
+ path: 'request-details/:id',
+ loadChildren: () => import('./Pages/request-specialists-pages/request-details/request-details.module')
+ .then(m => m.RequestDetailsPageModule)
+ },
+ {
+ path: 'login',
+ loadChildren: () => import('./Pages/user-pages/login/login.module').then(m => m.LoginPageModule)
+ },
+ {
+ path: 'register',
+ loadChildren: () => import('./Pages/user-pages/register/register.module').then(m => m.RegisterPageModule)
+ },
+ {
+ path: 'ambulance',
+ loadChildren: () => import('./Pages/ambulance-pages/ambulance/ambulance.module').then(m => m.AmbulancePageModule)
+ },
+ {
+ path: 'medical-board',
+ loadChildren: () => import('./Pages/user-pages/medical-board/medical-board.module').then(m => m.MedicalBoardPageModule)
+ },
+ {
+ path: 'emergency-pages-request',
+ loadChildren: () => import('./Pages/emergency-pages/request/request.module').then(m => m.RequestPageModule)
+ },
+ {
+ path: 'emergency-pages-history',
+ loadChildren: () => import('./Pages/emergency-pages/history/history.module').then(m => m.HistoryPageModule)
+ },
+ {
+ path: 'ambulance-history',
+ loadChildren: () => import('./Pages/ambulance-pages/ambulance-history/ambulance-history.module')
+ .then(m => m.AmbulanceHistoryPageModule)
+ },
+ {
+ path: 'ambulance-details/:id',
+ loadChildren: () => import('./Pages/ambulance-pages/ambulance-details/ambulance-details.module')
+ .then(m => m.AmbulanceDetailsPageModule)
+ },
+ {
+ path: 'emergency-details/:id',
+ loadChildren: () => import('./Pages/emergency-pages/emergency-details/emergency-details.module')
+ .then(m => m.EmergencyDetailsPageModule)
+ },
+ {
+ path: 'blog',
+ loadChildren: () => import('./Pages/Blog-pages/blog/blog.module').then(m => m.BlogPageModule)
+ },
+ {
+ path: 'blog-details',
+ loadChildren: () => import('./Pages/Blog-pages/blog-details/blog-details.module').then(m => m.BlogDetailsPageModule)
+ },
+ {
+ path: 'find-pharmacy',
+ loadChildren: () => import('./Pages/pharmacy-pages/find-pharmacy/find-pharmacy.module').then(m => m.FindPharmacyPageModule)
+ },
+ {
+ path: 'pharmacy',
+ loadChildren: () => import('./Pages/pharmacy-pages/pharmacy/pharmacy.module').then(m => m.PharmacyPageModule)
+ },
+ {
+ path: 'pharmacy-details/:id',
+ loadChildren: () => import('./Pages/pharmacy-pages/pharmacy-details/pharmacy-details.module')
+ .then( m => m.PharmacyDetailsPageModule)
}
-
-
-];
-
-@NgModule({
- imports: [
- RouterModule.forRoot(routes, {preloadingStrategy: PreloadAllModules})
- ],
- exports: [RouterModule]
-})
-export class AppRoutingModule {
-}
+
+
+];
+
+@NgModule({
+ imports: [
+ RouterModule.forRoot(routes, {preloadingStrategy: PreloadAllModules})
+ ],
+ exports: [RouterModule]
+})
+export class AppRoutingModule {
+}
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 639350e..bf3bcba 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -6,6 +6,7 @@ import {StatusBar} from '@ionic-native/status-bar/ngx';
import {FCM} from 'capacitor-fcm';
import {Plugins, PushNotification} from '@capacitor/core';
+
const {PushNotifications} = Plugins;
const fcm = new FCM();
@@ -33,9 +34,9 @@ export class AppComponent {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
- // this.onLoade();
- // this.subscribeTo();
- // this.getToken();
+ this.onLoade();
+ this.subscribeTo();
+ this.getToken();
});
}