Offer page

This commit is contained in:
CHIEFSOFT\ameye
2024-09-28 17:33:32 -04:00
parent 5363d5444e
commit 4e327a6c64
4 changed files with 26 additions and 52 deletions
@@ -4,7 +4,6 @@ import {Router} from "@angular/router";
import {SessionDataProviderService} from "../../store/session-data-provider.service";
import {WrenchService} from "../../services/wrench.service";
import { BannersDataService } from "../../store/banners-data.service";
//import {input} from "@capacitor/assets/dist/colors";
@Component({
selector: 'app-offers-received',
@@ -12,13 +11,10 @@ import { BannersDataService } from "../../store/banners-data.service";
styleUrls: ['./offers-received.component.scss'],
})
export class OffersReceivedComponent implements OnInit {
//@ViewChild('offerData') offerData: [];
//@ViewChild('noLimit') noLimit: boolean;
@Input('noLimit') noLimit:boolean;
@Input('showCount') showCount: boolean;
total_offers:number = 0;
offerData: any;
//noLimit: boolean=false;
offerDataReduced: any;
constructor(
private navctrl: NavController,
@@ -30,18 +26,18 @@ export class OffersReceivedComponent implements OnInit {
public bannersDataService: BannersDataService
) {
addEventListener('app-banner-ready', (data:any) => {
console.log("BANNER DATA ", data);
// debugger;
console.log("BANNER REFRESH SEEN ********* OFFER RECIEVED");
this.reduceOfferData();
});
this.session_image_server = this.sessionDataProviderService.session_image_server;
setInterval(()=>{
this.reduceOfferData(); // = this.bannersDataService.offerData;
this.reduceOfferData();
this.session_image_server = this.sessionDataProviderService.session_image_server;
}, 15000);
}, 35000);
}
ngOnInit() {
@@ -50,46 +46,22 @@ export class OffersReceivedComponent implements OnInit {
session_image_server:string='';
curr_session:string='';
//
usrData: {
action:number, member_id: number, uid: string,
sessionid: string,
limit:20,
page:1, offset:number
};
// total_offers:number = 0;
// myOffersTotalData:any;
// myOffersData: [];
// getMyOffersData(){
// this.usrData = {action:15010,
// member_id: this.sessionDataProviderService.member_id,
// uid: this.sessionDataProviderService.member_uid,
// sessionid: this.sessionDataProviderService.session ,
// limit:20, page:1,offset: 0}
//
// this.curr_session = this.sessionDataProviderService.session;
// this.wrenchService.getMyOffers(this.usrData).subscribe(
// myOffersTotalData => {
// this.myOffersTotalData = myOffersTotalData;
// this.session_image_server = this.myOffersTotalData.session_image_server;
// console.log("myOffersTotalData RETURN->", this.myOffersTotalData);
// this.myOffersData = this.myOffersTotalData.result_list;
// console.log("myOffersData RETURN DATA->", this.myOffersData);
// this.total_offers = this.myOffersData?.length;
// }
// );
//
// }
currOpenOffer:string='';
currOpenOffer:string='';
openOfferDetail(item){
if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
this.currOpenOffer = ''
}else
{
this.currOpenOffer = item.offer_uid;
}
if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
this.currOpenOffer = ''
}else
{
this.currOpenOffer = item.offer_uid;
}
}
async requestStart(item) {
@@ -101,7 +73,6 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
text: "Cancel",
role: "cancel",
handler: () => {
// this.getMyOffersData();
this.reduceOfferData(); // = this.bannersDataService.offerData;
},
},
@@ -109,7 +80,6 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
text: "Start Now",
handler: () => {
this.sendOfferResponse(item, 100);
// this.getMyOffersData();
this.reduceOfferData(); // = this.bannersDataService.offerData;
},
},
@@ -127,7 +97,6 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
text: "Cancel",
role: "cancel",
handler: () => {
//this.getMyOffersData();
this.reduceOfferData(); // = this.bannersDataService.offerData;
},
},
@@ -135,7 +104,6 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
text: "Reject",
handler: () => {
this.sendOfferResponse(item, 333);
//this.getMyOffersData();
this.reduceOfferData(); // = this.bannersDataService.offerData;
},
},
@@ -166,7 +134,6 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
};
offerRespData:any;
// offferResponse(respData)
async sendOfferResponse(item, respType){
const loading = await this.loadingCtrl.create({
message: 'Processing',
@@ -186,11 +153,8 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
offerRespData => {
this.offerRespData = offerRespData;
console.log("offerRespData RETURN->", this.offerRespData);
// this.getMyOffersData();
// this.offerData = this.bannersDataService.offerData;
this.reduceOfferData();
}
);
}
}
+4 -1
View File
@@ -79,7 +79,10 @@
</div>
<ng-template #elseFulltag>
<!-- <app-offers-received [offerData]="offerData"></app-offers-received>-->
<app-offers-received [noLimit]="noLimit" ></app-offers-received>
<app-offers-received
[showCount]="false"
[noLimit]="noLimit">
</app-offers-received>
<div *ngIf="home_dash_type=='DEFAULT_HOME_DASH'; ">
<app-latest-market></app-latest-market>
<ion-card class="map-sec" *ngIf="enableTracking > 0">
+5 -1
View File
@@ -55,9 +55,13 @@ export class HomePage implements OnInit {
this.enableTracking = this.sessionDataProviderService.tracking;
this.etag = "" + Date.now();
console.log("BANNER REFRESH SEEN ********* BANNER LISNETER HOME ");
addEventListener('app-banner-ready', (data:any) => {
console.log("BANNER DATA ", data);
this.refreshBannersData();
this.bannerData = data.detail.banners;
this.offerBanner = data.detail.offers;
console.log("BANNER REFRESH SEEN ********* OFFER HOME PAGE");
this.refreshBannersData();
});
addEventListener("dash_tool_myjobs", () => {
+4 -1
View File
@@ -69,6 +69,7 @@ export class BannersDataService {
console.log("BANNERS RETURN->", this.bannerResult);
this.bannerData = this.bannerResult.result_list;
this.offerData = this.bannerResult.offers_list;
// debugger;
if (this.bannerResult?.home_dash_type != "") {
this.sessionDataProviderService.home_dash_type = this.bannerResult.home_dash_type;
// YOU NEED EVENT FOR EVERYBODY TO REFRESH IF SUBSCRIBED
@@ -76,10 +77,12 @@ export class BannersDataService {
}
this.homebannerCount = this.bannerData?.length;
// YOU NEED EVENT FOR EVERYBODY TO REFRESH IF SUBSCRIBED
const event = new CustomEvent("app-banner-ready", {detail: {
console.log("BANNER REFRESH FIRED ********* BANNER MODULE");
const event_banner = new CustomEvent("app-banner-ready", {detail: {
banners: this.bannerData,
offers: this.offerData
}});
dispatchEvent(event_banner);
});
}