sliced the array

This commit is contained in:
CHIEFSOFT\ameye
2024-09-27 10:00:46 -04:00
parent dc26dde9d8
commit ff4cefb5b6
2 changed files with 20 additions and 7 deletions
@@ -1,4 +1,4 @@
<div *ngFor="let item of offerData">
<div *ngFor="let item of offerDataReduced">
<div class="offerBanner">
<div style="padding: 5px 0 5px 10px; color: red; font-weight: bolder; font-size: 16px;"> New Offer Expires : {{item.expire | date}}</div>
<div style="display: flex;">
@@ -13,6 +13,7 @@ import { BannersDataService } from "../../store/banners-data.service";
export class OffersReceivedComponent implements OnInit {
//@ViewChild('offerData') offerData: [];
offerData: [];
offerDataReduced: any;
constructor(
private navctrl: NavController,
private router: Router,
@@ -25,7 +26,8 @@ export class OffersReceivedComponent implements OnInit {
// this.getMyOffersData();
this.session_image_server = this.sessionDataProviderService.session_image_server;
setInterval(()=>{
this.offerData = this.bannersDataService.offerData;
this.reduceOfferData(); // = this.bannersDataService.offerData;
this.session_image_server = this.sessionDataProviderService.session_image_server;
}, 15000);
}
@@ -88,7 +90,7 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
role: "cancel",
handler: () => {
// this.getMyOffersData();
this.offerData = this.bannersDataService.offerData;
this.reduceOfferData(); // = this.bannersDataService.offerData;
},
},
{
@@ -96,7 +98,7 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
handler: () => {
this.sendOfferResponse(item, 100);
// this.getMyOffersData();
this.offerData = this.bannersDataService.offerData;
this.reduceOfferData(); // = this.bannersDataService.offerData;
},
},
],
@@ -114,7 +116,7 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
role: "cancel",
handler: () => {
//this.getMyOffersData();
this.offerData = this.bannersDataService.offerData;
this.reduceOfferData(); // = this.bannersDataService.offerData;
},
},
{
@@ -122,7 +124,7 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
handler: () => {
this.sendOfferResponse(item, 333);
//this.getMyOffersData();
this.offerData = this.bannersDataService.offerData;
this.reduceOfferData(); // = this.bannersDataService.offerData;
},
},
],
@@ -130,6 +132,16 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
await alert.present();
}
reduceOfferData(){
this.offerData = this.bannersDataService.offerData;
if( this.offerData.length >1){
this.offerDataReduced = this.offerData.slice(0,2);
}
else{
this.offerDataReduced = this.offerData;
}
}
responseData: {
action:number,
member_id: number,
@@ -162,7 +174,8 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){
this.offerRespData = offerRespData;
console.log("offerRespData RETURN->", this.offerRespData);
// this.getMyOffersData();
this.offerData = this.bannersDataService.offerData;
// this.offerData = this.bannersDataService.offerData;
this.reduceOfferData();
}
);
}