bug fixes

enad-pre-live
Sultan Khan 4 years ago
parent 8fb4f3ee49
commit 1f958c4fa7

@ -117,6 +117,8 @@ import { FileOpener } from '@ionic-native/file-opener/ngx';
import { FilePath } from '@ionic-native/file-path/ngx';
import { FileChooser } from "@ionic-native/file-chooser/ngx";
import { IOSFilePicker } from '@ionic-native/file-picker/ngx';
import { SanitizeHtmlPipe } from '../itemforsale/services/domsafe';
@NgModule({
imports: [
CommonModule,
@ -135,6 +137,7 @@ import { IOSFilePicker } from '@ionic-native/file-picker/ngx';
],
declarations: [
FabButtonComponent,
SanitizeHtmlPipe,
WelcomeComponent,
NumberRangeComponent,
SSpacerComponent,
@ -273,7 +276,8 @@ import { IOSFilePicker } from '@ionic-native/file-picker/ngx';
GenericHeaderComponent,
AttendanceOptionsComponent,
CardCalendarComponent,
SubmitAddressModalComponent
SubmitAddressModalComponent,
SanitizeHtmlPipe
],
providers: [
AttendScanService,

@ -273,7 +273,7 @@ export class HomeComponent implements OnInit {
}
validate() {
if (!this.validateChar(this.itemInfo) || !this.itemDescription || !this.itemPrice || !this.itemCondition) {
if (!this.validateChar(this.itemInfo) || !this.itemDescription || !this.itemPrice || !this.itemCondition || this.addAttachRequest.length == 0) {
return false;
} else {
return true;

@ -14,7 +14,7 @@ export class ItemDetailsComponent implements OnInit {
itemDetails: any;
direction: any;
constructor(public ts: TranslatorService, public route: ActivatedRoute, public cs: CommonService, private sanitizer: DomSanitizer,) {
constructor(public ts: TranslatorService, public itemService: ItemForSaleService, public route: ActivatedRoute, public cs: CommonService, private sanitizer: DomSanitizer,) {
this.route
.params.subscribe(val => {
setTimeout(() => {
@ -37,4 +37,5 @@ export class ItemDetailsComponent implements OnInit {
getImgContent(imgFile): SafeUrl {
return this.sanitizer.bypassSecurityTrustUrl(imgFile);
}
}

@ -12,7 +12,6 @@ import { ItemDetailsComponent } from './item-details/item-details.component';
import { MyAdsComponent } from './my-ads/my-ads.component';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
import { ItemForSaleService } from './services/service.service';
import { SanitizeHtmlPipe } from './services/domsafe';
import { FilterComponent } from './filter/filter.component';
const routes: Routes = [
@ -52,8 +51,8 @@ const routes: Routes = [
HmgCommonModule,
RouterModule.forChild(routes)
],
declarations: [ItemforsalePage, HomeComponent, ItemsComponent, ItemDetailsComponent, MyAdsComponent, SanitizeHtmlPipe, FilterComponent],
declarations: [ItemforsalePage, HomeComponent, ItemsComponent, ItemDetailsComponent, MyAdsComponent, FilterComponent],
providers: [ItemForSaleService],
exports: [SanitizeHtmlPipe]
})
export class ItemforsalePageModule { }

@ -38,6 +38,9 @@ export class ItemForSaleService {
return this.con.postNoLoad(ItemForSaleService.getCategories, request, onError, errorLabel);
}
parser(response: any) {
try {
var result = JSON.parse(response.Mohemm_ITG_ResponseItem);

@ -18,7 +18,7 @@
{{key.categoryName_ar}}
</ion-label>
<ion-thumbnail slot="start">
<div class="top-filter" [innerHTML]="key.content"></div>
<div class="top-filter" [innerHTML]="key.content | sanitizeHTMLPipe "></div>
</ion-thumbnail>
</ion-item>

@ -33,7 +33,7 @@
<div class="container-icon" *ngIf="categories.length>0">
<div class="box-icon" *ngFor="let key of categories">
<div class="sale-icon" (click)="filterOffers(key)" [ngClass]="{'active':activeClass==key.categoryName_en }">
<div class="top" [innerHTML]="key.content">
<div class="top" [innerHTML]="key.content | sanitizeHTMLPipe">
<!-- <ion-icon name="images"></ion-icon> -->
<!-- <span [innerHTML]="key.content"></span> -->
<!-- <img [src]="key.content" /> -->

@ -5,7 +5,7 @@ import { CommonService } from 'src/app/hmg-common/services/common/common.service
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { OfferDiscountService } from '../services/service';
import { IonInfiniteScroll } from '@ionic/angular';
import { DomSanitizer} from '@angular/platform-browser';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
@ -26,14 +26,20 @@ export class HomeComponent implements AfterViewInit {
itemCounter = 1;
itemType: any;
isData = true;
// categories:any = [];
allCategory: any = {
categoryID: 0,
content: '<svg xmlns="http://www.w3.org/2000/svg" width="33.925" height="25.841" viewBox="0 0 33.925 25.841"><g id="More_Select" data-name="More Select"><path d="m30 1h-24a1 1 0 0 0 -1 1v1h21a3 3 0 0 1 3 3v21h1a1 1 0 0 0 1-1v-24a1 1 0 0 0 -1-1z"/><path d="m26 5h-24a1 1 0 0 0 -1 1v24a1 1 0 0 0 1 1h24a1 1 0 0 0 1-1v-24a1 1 0 0 0 -1-1zm-4.747 9.344-8.728 8.726a1 1 0 0 1 -1.414 0l-4.364-4.363a1 1 0 0 1 1.414-1.414l3.657 3.656 8.021-8.019a1 1 0 0 1 1.414 1.414z"/></g></svg>',
isActive: true,
categoryName_en: "All",
categoryName_ar: "الجميع",
}
constructor(
public ts: TranslatorService,
public modalController: ModalController,
public cs: CommonService,
public offersService: OfferDiscountService,
public ts: TranslatorService,
public modalController: ModalController,
public cs: CommonService,
public offersService: OfferDiscountService,
public route: ActivatedRoute,
private sanitizer: DomSanitizer) {
) {
this.route
.params.subscribe(val => {
@ -62,9 +68,11 @@ export class HomeComponent implements AfterViewInit {
getCategories() {
this.offersService.getCategories({}).subscribe((result) => {
this.categories = JSON.parse(result.Mohemm_ITG_ResponseItem).result.data; //result.result.data;
for (let i = 0; i < this.categories.length; i++) {
this.categories[i].content = this.sanitizer.bypassSecurityTrustHtml(this.categories[i].content);
}
//this.allCategory.content = this.sanitizer.bypassSecurityTrustHtml();
this.categories.unshift(this.allCategory);
// for (let i = 0; i < this.categories.length; i++) {
// this.categories[i].content = this.sanitizer.bypassSecurityTrustHtml(this.categories[i].content);
// }
this.cs.sharedService.setSharedData(this.categories, OfferDiscountService.categories);
});
}
@ -80,13 +88,13 @@ export class HomeComponent implements AfterViewInit {
getOfferDiscount(pageNo?, categoryId?) {
this.cs.startLoading();
if (categoryId) {
this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry'),pageNo, categoryId).subscribe((res) => {
this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry'), pageNo, categoryId).subscribe((res) => {
var data = JSON.parse(res['Mohemm_ITG_ResponseItem']);
this.cs.stopLoading();
if (data['result']) {
this.displayOffers(data['result']);
this.isData = true;
}else{
} else {
this.isData = false;
}
});
@ -94,10 +102,10 @@ export class HomeComponent implements AfterViewInit {
this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry')).subscribe((res) => {
var data = JSON.parse(res['Mohemm_ITG_ResponseItem']);
this.cs.stopLoading();
if (data['result']){
if (data['result']) {
this.displayOffers(data['result']);
this.isData = true;
} else{this.isData = false;}
} else { this.isData = false; }
});
}
@ -113,13 +121,13 @@ export class HomeComponent implements AfterViewInit {
}
filterOffers(key) {
if(this.direction === 'ltr') {
if (this.direction === 'ltr') {
this.activeClass = key.categoryName_en;
}else {
} else {
this.activeClass = key.categoryName_ar
}
this.itemType = key.id;
this.getOfferDiscount(1,this.itemType)
this.getOfferDiscount(1, this.itemType)
}
checkDate(date) {
@ -142,9 +150,9 @@ export class HomeComponent implements AfterViewInit {
search(t) {
console.log(this.tempSearch);
if(t === ''){
if (t === '') {
this.offersData = this.tempSearch;
} else{
} else {
this.offersData = this.tempSearch.filter((post) => {
return (post.Title.toLowerCase().indexOf(t.toLowerCase()) > -1);
});
@ -172,7 +180,7 @@ export class HomeComponent implements AfterViewInit {
console.log(this.itemCounter);
this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry'), this.itemCounter, this.itemType).subscribe((res) => {
const data = JSON.parse(res['Mohemm_ITG_ResponseItem']);
if (data['result']){
if (data['result']) {
const allItem = JSON.parse(data.result['data']);
if (allItem) {
allItem.forEach(element => {
@ -189,7 +197,7 @@ export class HomeComponent implements AfterViewInit {
console.log(this.itemCounter);
this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry'), this.itemCounter).subscribe((res) => {
const data = JSON.parse(res['Mohemm_ITG_ResponseItem']);
if (data['result']){
if (data['result']) {
const allItem = JSON.parse(data.result['data']);
if (allItem) {
allItem.forEach(element => {

@ -0,0 +1,7 @@
<app-generic-header showImage="false" showBack="true" [headerText]="'itemforsale,offersdiscount' | translate">
</app-generic-header>
<ion-content>
<div #map id="map">
</div>
</ion-content>

@ -0,0 +1,4 @@
#map {
width: 100%;
height: 100%;
}

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LocationComponent } from './location.component';
describe('LocationComponent', () => {
let component: LocationComponent;
let fixture: ComponentFixture<LocationComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LocationComponent ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LocationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,79 @@
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { HMGUtils } from 'src/app/hmg-common/hmg_utils';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { OfferDiscountService } from '../services/service';
declare var google;
@Component({
selector: 'app-location',
templateUrl: './location.component.html',
styleUrls: ['./location.component.scss'],
})
export class LocationComponent implements OnInit {
@ViewChild('map') mapContainer: ElementRef;
locations: any = [];
map: any;
offerDetails: any;
constructor(public hmgUtils: HMGUtils, public route: ActivatedRoute, public cs: CommonService) {
this.route
.params.subscribe(val => {
setTimeout(() => {
this.ionEnter();
}, 100);
});
}
ionEnter() {
this.locations = this.cs.sharedService.getSharedData(OfferDiscountService.selected_offers, false);
this.offerDetails = this.cs.sharedService.getSharedData(OfferDiscountService.selected_offers, false);
this.displayMap();
}
ngOnInit() {
}
displayMap() {
const map = new google.maps.Map(
document.getElementById("map") as HTMLElement,
{
zoom: 10,
center: { lat: 24.7136, lng: 46.6753 },
}
);
this.setMarkers(map);
}
setMarkers(map) {
for (let i = 0; i < this.locations.length; i++) {
const loc = this.locations[i];
const infoWindow = new google.maps.InfoWindow();
var marker = new google.maps.Marker({
position: { lat: loc.latitude, lng: loc.longitude },
map,
// icon: image,
// shape: shape,
title: this.offerDetails.Title,
});
marker.addListener("click", () => {
this.cs.openLocation(loc.latitude, loc.longitude)
});
}
this.hmgUtils.getCurrentLocation((resp) => {
console.log(resp);
if (resp) {
const latLng = new google.maps.LatLng(resp.latitude, resp.longitude);
const mapOptions = {
center: latLng,
zoom: 17,
mapTypeId: google.maps.MapTypeId.ROADMAP,
myLocation: true
};
this.map = new google.maps.Map(this.mapContainer.nativeElement, mapOptions);
};
})
}
}

@ -44,6 +44,12 @@
</div>
</ion-col>
</ion-row>
<ion-row *ngIf="details.IsHasLocation" (click)="getLocation()">
<ion-col size="1">
<ion-icon name="map"></ion-icon>
</ion-col>
<ion-col><p class="location-text">{{ts.trPK('itemforsale','location')}}</p></ion-col>
</ion-row>
</div>
@ -84,7 +90,7 @@
<img src="assets/imgs/itemsforsale/arrow.svg">
</ion-col>
</ion-row>
</ion-card-content>
</ion-card>
</ion-col>

@ -144,4 +144,9 @@ ion-card{
margin: 2px 0px 5px -3px;
font-size: 14px;
font-weight: bold;
}
.location-text{
font-weight: bold;
font-size: 14px;
text-decoration: underline;
}

@ -38,9 +38,9 @@ export class OfferDetailsComponent implements OnInit {
console.log(this.details);
const offerMessage = this.direction === 'ltr' ? this.details.Description : this.details.Description_AR;
const offerSubject = this.direction === 'ltr' ? this.details.Title : this.details.Title_AR;
const options = {
message: this.stripHtml(offerMessage),
message: this.stripHtml(offerMessage),
subject: this.stripHtml(offerSubject),
files: [this.details.Banner_Image]
}
@ -56,4 +56,14 @@ export class OfferDetailsComponent implements OnInit {
}, 200);
}
openLocation() {
this.cs.navigateForward('/offersdiscount/location');
}
getLocation() {
this.offersService.getOfferLocation({ OfferId: this.details.rowID }, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => {
result = JSON.parse(result.Mohemm_ITG_ResponseItem).result.data;
this.cs.sharedService.setSharedData(result, OfferDiscountService.selected_offers);
this.openLocation();
})
}
}

@ -11,6 +11,8 @@ import { OfferDetailsComponent } from './offer-details/offer-details.component';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
import { OfferDiscountService } from './services/service';
import { FilterComponent } from './filter/filter.component';
import { LocationComponent } from './location/location.component';
const routes: Routes = [
@ -30,6 +32,10 @@ const routes: Routes = [
path: 'filter-page',
component: FilterComponent
},
{
path: 'location',
component: LocationComponent
},
],
}
];
@ -44,8 +50,9 @@ const routes: Routes = [
HmgCommonModule,
RouterModule.forChild(routes)
],
declarations: [OffersdiscountPage, HomeComponent, OfferDetailsComponent, FilterComponent],
declarations: [OffersdiscountPage, HomeComponent, OfferDetailsComponent, FilterComponent, LocationComponent],
entryComponents: [FilterComponent],
providers: [OfferDiscountService, SocialSharing]
providers: [OfferDiscountService, SocialSharing],
})
export class OffersdiscountPageModule { }

@ -15,8 +15,9 @@ export class OfferDiscountService {
public static related_offers = 'related-offers';
public static selected_filters = 'selected-filters';
public static categories = 'categories';
public static offer_location = 'offer_location';
public static getCategories = 'Services/COCWS.svc/REST/Mohemm_ITG_GetCategories';
public static offerLocation = 'Services/COCWS.svc/REST/Mohemm_ITG_OffersLocation';
constructor(
public con: ConnectorService,
private authService: AuthenticationService,
@ -39,7 +40,7 @@ export class OfferDiscountService {
return this.con.postNoLoad(OfferDiscountService.offersDiscountData, request, onError, errorLabel);
}
getCategories(request: any, onError?: any, errorLabel?: string): Observable<any> {
getCategories(request: any, onError?: any, errorLabel?: string): Observable<any> {
this.authService.authenticateRequest(request);
request['EmployeeNumber'] = request.UserName;
request['ItgChannelId'] = 3;
@ -56,4 +57,10 @@ export class OfferDiscountService {
errorLabel
);
}
public getOfferLocation(request: any, onError?: any, errorLabel?: string) {
this.authService.authenticateRequest(request);
request.EmployeeNumber = request.UserName;
return this.con.postNoLoad(OfferDiscountService.offerLocation, request, onError, errorLabel);
}
}

@ -10,10 +10,10 @@
<div class="main-container">
<ion-item>
<ion-label>{{ 'worklist,template-name' | translate}}</ion-label>
<ion-select [(ngModel)]="template" (ionChange)="selectTemplates()" [placeholder]="'general,select' | translate"
[okText]="'general,ok' | translate" [cancelText]="'general,cancel' | translate" class="large-ion-select">
<ion-select [(ngModel)]="template" (ionChange)="selectTemplates()" [placeholder]="'general,select' | translate"
[okText]="'general,ok' | translate" [cancelText]="'general,cancel' | translate" class="concorrent-select large-ion-select">
<ion-select-option *ngFor="let program of programList" [value]="program">
{{ program.CONCURRENT_PROGRAM_NAME}}</ion-select-option></ion-select>
{{ program.USER_CONCURRENT_PROGRAM_NAME}}</ion-select-option></ion-select>
</ion-item>
<div class="divider"></div>

@ -11,7 +11,7 @@
<div *ngIf="transactionList && transactionList.length>0" class="transaction-list">
<ion-card *ngFor="let transaction of transactionList">
<div class="date">{{getDate(transaction.REQUEST_DATE)}}</div>
<div [ngClass]="direction =='rtl' ? 'date_ar' :'date'" >{{getDate(transaction.REQUEST_DATE)}}</div>
<ion-label class="ion-text-wrap">
<ion-text color="primary">
<div>

@ -1,6 +1,6 @@
.display-created{
display: inline-block;
margin:2px;
color:#000;
}
#containerDiv{
@ -25,6 +25,14 @@
width: 100px;
color:#969696;
}
.date_ar{
position: absolute;
font-size: 14px;
padding: 10px;
left:0;
width: 100px;
color:#969696;
}
.transaction-list{
margin-top:20px;
}

@ -15,6 +15,7 @@ export class TransactionListComponent implements OnInit {
transactionList: any = [];
selectedMenu: any;
template: any;
direction: any;
constructor(public cs: CommonService, private elementRef: ElementRef, public reports: ReportServiceService, public ts: TranslatorService, private platform: Platform, private file: File, private opener: FileOpener,
) { }
@ -22,6 +23,7 @@ export class TransactionListComponent implements OnInit {
this.selectedMenu = this.cs.sharedService.getSharedData(MenuResponse.SELECTED_MENU, false);
this.transactionList = this.cs.sharedService.getSharedData(ReportServiceService.TRANSACTION_LIST, false);
this.template = this.cs.sharedService.getSharedData(ReportServiceService.TEMPLATE, false);
this.direction = TranslatorService.getCurrentDirection();
}
getDate(date) {
return this.cs.evaluteDate(date);

@ -3320,6 +3320,10 @@
"offersdiscount": {
"en": "Offers & Discount",
"ar": "العروض والخصومات"
},
"location": {
"en": "Offer Location",
"ar": "عرض الموقع"
}
},
"attendance-tracking": {
@ -3459,16 +3463,17 @@
"en": "Please give us a comments",
"ar": "من فضلك اعطنا تعليقات"
},
"survey-success":{
"en":"Your survey has been submitted successfully",
"ar":"تم تقديم الاستبيان الخاص بك بنجاح"
"survey-success": {
"en": "Your survey has been submitted successfully",
"ar": "تم تقديم الاستبيان الخاص بك بنجاح"
},
"erm-failed": {
"en": "Something went wrong please try again",
"ar": "حدث خطأ ما. أعد المحاولة من فضلك"
},
"erm-failed":{
"en":"Something went wrong please try again",
"ar":"حدث خطأ ما. أعد المحاولة من فضلك"
},"viedo-success":{
"en":"Thank you for watching this video",
"ar":"شكرا لك على مشاهدة هذا الفيديو"
"viedo-success": {
"en": "Thank you for watching this video",
"ar": "شكرا لك على مشاهدة هذا الفيديو"
}
},
"transaction": {

@ -11,6 +11,8 @@
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8" async
defer></script>
<link rel="icon" type="image/png" href="assets/icon/favicon.png" />
<script src="assets/js/sms.js"></script>
<!-- add to homescreen for ios -->

@ -1635,4 +1635,8 @@ ion-segment-button {
.filterClass input{
box-shadow: none !important;
-webkit-box-shadow: none !important;
}
.concorrent-select .alert-radio-label{
padding: 0 28px 0 28px;
font-size: 12px;
}
Loading…
Cancel
Save