From aee81e59aee5b05be88e7ae051d17e89845a8ce0 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 8 Jul 2019 11:30:13 +0300 Subject: [PATCH] update --- Mohem/src/app/home/home.page.ts | 121 ++++++++++-------- .../app/my-team/details/details.component.ts | 10 +- Mohem/src/app/my-team/home/home.component.ts | 22 ++-- .../vacation-rule/home/home.component.html | 4 +- .../app/vacation-rule/home/home.component.ts | 25 ++-- Mohem/src/theme/styles.scss | 3 +- 6 files changed, 100 insertions(+), 85 deletions(-) diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 888599b5..1d503f4f 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -6,12 +6,12 @@ import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/mo import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service"; import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response"; import { CommonService } from "src/app/hmg-common/services/common/common.service"; -import { Geolocation } from '@ionic-native/geolocation/ngx'; -import { ZBar, ZBarOptions } from '@ionic-native/zbar/ngx'; -import { Device } from '@ionic-native/device/ngx'; -import { attendanceSwipeScannerRequest } from './models/attendanceSwipe.Request'; +import { Geolocation } from "@ionic-native/geolocation/ngx"; +import { ZBar, ZBarOptions } from "@ionic-native/zbar/ngx"; +import { Device } from "@ionic-native/device/ngx"; +import { attendanceSwipeScannerRequest } from "./models/attendanceSwipe.Request"; import { Response } from "src/app/hmg-common/services/models/response"; -import { AttendanceService } from './services/attendance.services'; +import { AttendanceService } from "./services/attendance.services"; @Component({ selector: "app-home", @@ -22,10 +22,10 @@ export class HomePage implements OnInit { userData: any = {}; user_image: any = "../assets/imgs/profile.png"; menuList: any = []; - zbarOptions:any; - scannedResult:any; - lat : any; - longt : any; + zbarOptions: any; + scannedResult: any; + lat: any; + longt: any; deviceID: string; constructor( public ts: TranslatorService, @@ -36,33 +36,38 @@ export class HomePage implements OnInit { public events: Events, private device: Device, private zbar: ZBar, - private geolocation: Geolocation, - private attendance_service:AttendanceService + private geolocation: Geolocation, + private attendance_service: AttendanceService ) {} ngOnInit() { this.getUserDetails(); this.getMenu(); - this.geolocation.getCurrentPosition().then((resp) => { - // resp.coords.latitude - // resp.coords.longitude - console.log(resp.coords.latitude); - console.log(resp.coords.longitude); - }).catch((error) => { - console.log('Error getting location', error); - }); + this.geolocation + .getCurrentPosition() + .then(resp => { + // resp.coords.latitude + // resp.coords.longitude + console.log(resp.coords.latitude); + console.log(resp.coords.longitude); + }) + .catch(error => { + console.log("Error getting location", error); + }); } - ionViewDidLoad() - { - this.geolocation.getCurrentPosition().then((resp) => { - // resp.coords.latitude - // resp.coords.longitude - console.log(resp.coords.latitude); - console.log(resp.coords.longitude); - }).catch((error) => { - console.log('Error getting location', error); - }); + ionViewDidLoad() { + this.geolocation + .getCurrentPosition() + .then(resp => { + // resp.coords.latitude + // resp.coords.longitude + console.log(resp.coords.latitude); + console.log(resp.coords.longitude); + }) + .catch(error => { + console.log("Error getting location", error); + }); } private openMenu() { this.menu.toggle(); @@ -116,55 +121,59 @@ export class HomePage implements OnInit { //this.getMenuEntries(item); } } - private Change_password(){ + private Change_password() { this.common.openChangePassword(); } - private attendance(){ + private attendance() { this.zbarOptions = { - flash: 'off', + flash: "off", drawSight: false - } + }; console.log("your currnt location is"); - - this.scanCode(); + + this.scanCode(); } - scanCode(){ - this.zbar.scan(this.zbarOptions) - .then(result => { - console.log(result); // Scanned code - let strResult = JSON.parse(result); - console.log(strResult.QRValue); - this.scannedResult = result; - this.deviceID = this.device.uuid; - this.swipeAttendance(); - }) - .catch(error => { - alert(error); // Error message - }); + scanCode() { + this.zbar + .scan(this.zbarOptions) + .then(result => { + console.log(result); // Scanned code + let strResult = JSON.parse(result); + console.log(strResult.QRValue); + this.scannedResult = result; + this.deviceID = this.device.uuid; + this.swipeAttendance(); + }) + .catch(error => { + alert(error); // Error message + }); } - swipeAttendance(){ + swipeAttendance() { let request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest(); request.Latitude = this.lat; request.Longitude = this.longt; request.QRValue = this.scannedResult; request.UID = this.deviceID; - request.UserName = this.userData.EMPLOYEE_NUMBER; + request.UserName = this.userData.EMPLOYEE_NUMBER; console.log("request"); console.log(JSON.stringify(request)); - this.attendance_service.attendanceSwipeScanner( - request,()=>{ + this.attendance_service + .attendanceSwipeScanner(request, () => { console.log("Error inside in swipe attendance"); - }). - subscribe((result: Response) => { + }) + .subscribe((result: Response) => { if (this.common.validResponse(result)) { console.log("response"); console.log(result); - this.common.presentAlert(this.ts.trPK('home', 'swipeAlertSuccess')); + this.common.presentAlert(this.ts.trPK("home", "swipeAlertSuccess")); } else { - this.common.presentAlert(this.ts.trPK('home', 'swipeAlertFailed')); + this.common.presentAlert(this.ts.trPK("home", "swipeAlertFailed")); } }); } + openPersonalInfo() { + this.common.openProfile(); + } } diff --git a/Mohem/src/app/my-team/details/details.component.ts b/Mohem/src/app/my-team/details/details.component.ts index 755e4e5d..1ad03895 100644 --- a/Mohem/src/app/my-team/details/details.component.ts +++ b/Mohem/src/app/my-team/details/details.component.ts @@ -44,11 +44,11 @@ export class DetailsComponent implements OnInit { false ); console.log(this.employee); - // this.selMenu = this.common.sharedService.getSharedData( - // MenuResponse.SHARED_DATA, - // true - // ); - // this.headerTitle = this.selMenu.List_Menu.MENU_NAME; + this.selMenu = this.common.sharedService.getSharedData( + MenuResponse.SHARED_DATA, + false + ); + this.headerTitle = this.selMenu.List_Menu.MENU_NAME; // this.isSpecialist = this.navParams.get("isSpecialist") // ? this.navParams.get("isSpecialist") // : false; diff --git a/Mohem/src/app/my-team/home/home.component.ts b/Mohem/src/app/my-team/home/home.component.ts index 581f66b1..78860dcf 100644 --- a/Mohem/src/app/my-team/home/home.component.ts +++ b/Mohem/src/app/my-team/home/home.component.ts @@ -44,8 +44,7 @@ export class HomeComponent implements OnInit { this.selEmpNo = this.selMenu.userid; this.isSearch = this.selMenu.search ? this.selMenu.search : this.isSearch; // this.isSearch=this.navParams.get("isSearch")?this.navParams.get("isSearch") : false; - if(!this.isSearch) - this.getEmpSubordinate(); + if (!this.isSearch) this.getEmpSubordinate(); } getEmpSubordinate() { this.pageNum = 1; @@ -164,7 +163,6 @@ export class HomeComponent implements OnInit { } } getDetails(index) { - this.common.sharedService.setSharedData( this.empSubordinate[index], MyTeamService.EMPLOYEE_SHARED_DATA @@ -174,11 +172,19 @@ export class HomeComponent implements OnInit { this.selMenu, MenuResponse.SHARED_DATA ); - - this.common.openMyTeamDetails(); - this.modalController.dismiss(); + this.close().then(() => { + this.common.openMyTeamDetails(); + }); + + //this.modalController.dismiss(); //this.navCtrl.push("MyTeamPage",{employee:this.empSubordinate[index]}); } + public async close() { + const modal = await this.modalController.getTop(); + if (modal) { + modal.dismiss(); + } + } toggleSearch() { this.isSearch = !this.isSearch; } @@ -192,7 +198,7 @@ export class HomeComponent implements OnInit { component: HomeComponent, keyboardClose: true, animated: false, - componentProps:{isSearch:true} + componentProps: { isSearch: true } }); let dismissed = modal.onDidDismiss(); dismissed.then(() => { @@ -200,7 +206,7 @@ export class HomeComponent implements OnInit { }); return await modal.present(); } - dismiss(){ + dismiss() { this.modalController.dismiss({ dismissed: true }); diff --git a/Mohem/src/app/vacation-rule/home/home.component.html b/Mohem/src/app/vacation-rule/home/home.component.html index 2bd909e4..cde1b933 100644 --- a/Mohem/src/app/vacation-rule/home/home.component.html +++ b/Mohem/src/app/vacation-rule/home/home.component.html @@ -7,8 +7,8 @@ - +
+
diff --git a/Mohem/src/app/vacation-rule/home/home.component.ts b/Mohem/src/app/vacation-rule/home/home.component.ts index e9a0785f..1f3a6826 100644 --- a/Mohem/src/app/vacation-rule/home/home.component.ts +++ b/Mohem/src/app/vacation-rule/home/home.component.ts @@ -7,6 +7,7 @@ import { VacationRuleRequest } from './../model/VacationRuleRequest'; import { Component, OnInit } from '@angular/core'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { Router } from '@angular/router'; +import { ButtonInput } from 'src/app/uI-elements/button.input'; @Component({ selector: 'app-home', @@ -23,7 +24,7 @@ export class HomeComponent implements OnInit { IsReachEnd: boolean = false; RespondAttributeList: any; - // button: ButtonInput; + button: ButtonInput; // dateTime: DateTimeInput; // date: DateInput; // numberInput: NumberInput; @@ -36,7 +37,7 @@ export class HomeComponent implements OnInit { this.P_PAGE_NUM = 1; this.P_PAGE_LIMIT = 50; - // this.button = new ButtonInput('btnSubmit', 'Submit', 'containerDiv', 'Y'); + this.button = new ButtonInput('btnSubmit', 'Submit', 'containerDiv', 'Y'); // this.dateTime = new DateTimeInput('Start Date', 'SDate', '', 'containerDiv', 'Y', 'Y', 'Y'); // this.date = new DateInput('Start Date', 'SDate', '', 'containerDiv', 'Y', 'Y', 'Y'); // this.numberInput = new NumberInput('Roll No.:', 'rollNo', '', 'containerDiv', 'Y', 'Y', 'Y'); @@ -55,11 +56,11 @@ export class HomeComponent implements OnInit { this.getVacationRules(); // let elem = document.getElementById('btnSubmit'); - // const elemDiv = document.createElement('div'); - //elemDiv.id = this.elementID; - // elemDiv.className = ''; + const elemDiv = document.createElement('div'); + // elemDiv.id = this.elementID; + elemDiv.className = ''; - // elemDiv.innerHTML = this.button.getTemplate(); + elemDiv.innerHTML = this.button.getTemplate(); // elemDiv.innerHTML = this.dateTime.getTemplate(); // elemDiv.innerHTML = this.date.getTemplate(); // elemDiv.innerHTML = this.numberInput.getTemplate(); @@ -67,14 +68,14 @@ export class HomeComponent implements OnInit { // elemDiv.innerHTML = this.textAreaInput.getTemplate(); // elemDiv.innerHTML = this.timeInput.getTemplate(); - // document.getElementById('containerDiv').appendChild(elemDiv); + document.getElementById('containerDiv').appendChild(elemDiv); - // let elem = document.getElementById("btnSubmit"); + let elem = document.getElementById("btnSubmit"); // console.log(elem); - // elem.addEventListener("click", (e) => { - // this.showAlert(); - // e.stopImmediatePropagation(); - // }); + elem.addEventListener("click", (e) => { + this.showAlert(); + e.stopImmediatePropagation(); + }); } diff --git a/Mohem/src/theme/styles.scss b/Mohem/src/theme/styles.scss index 8b8652e7..fe5b0589 100644 --- a/Mohem/src/theme/styles.scss +++ b/Mohem/src/theme/styles.scss @@ -736,12 +736,11 @@ color: var(--dark); box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none; - width: 150px; + width: 100px !important; margin: auto; } .progress-loading-page .loading-gif { - margin-top: 0.42cm; width:100%; margin-left: 0.4cm;