Skip to content

Instantly share code, notes, and snippets.

@texirv0203
Created October 10, 2017 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save texirv0203/6183f8c15fddd4b982ff2784c32467c3 to your computer and use it in GitHub Desktop.
Save texirv0203/6183f8c15fddd4b982ff2784c32467c3 to your computer and use it in GitHub Desktop.
///<reference path="../../../assets/js/jquery/jquery.d.ts" />
///<reference path="../../../assets/js/kendo/kendo.d.ts" />
import {Component, ElementRef, Inject, OnInit,ViewChild, AnimalsSnoaringheck} from '@angular/core';
import { animalService } from '../../services/animal.service';
import {TigerKILLcrowRightBar} from '../Fox-KILL/Tiger-KILL-crow-right-bar';
import {TigerLeftParrotEventHenComponent} from '../Fox-KILL/Tiger-left-Parrot-event-Hen';
import {Tigercrow} from '../Tiger/Tiger-crow';
import {animalsThriller} from '../shared/progress/progress-circle';
import {Router, ActivatedRoute } from '@angular/router';
import {TigerService} from '../../services/TigerService';
import {FoxKILLMain} from '../Fox-KILL/Tiger-KILL-main';
import {FoxKILLService} from './Fox-KILL-service/Fox-KILL-service';
import {FoxKILLcrowCopyEvents} from '../Tiger/Tiger-KILL-copy-plans';
import { Subscription } from 'rxjs/Subscription';
import { TigerKILLcrowAPTNetworkPreview } from '../Fox-KILL/crow-apt-network-Tiger-preview';
import {animalsMarker} from '../../components/admin/user-view-popup';
import { animalThinking } from 'text-encoding-shim';
var animalsIntelligence = require('animalsIntelligence');
@Component({
selector: 'FoxKILLcrowEvent',
templateUrl: "./app/components/Fox-KILL/Tiger-KILL-crow-event.html"
})
export class FoxKILLcrowEvent implements AnimalsSnoaringheck{
public detailsTemplate:any;
private isanimalsJeansd: boolean;
public auditOptionData="";
public auditFlag=false;
private animalsCar: boolean = false;
private schdItems;
public actionanimalsJeansdBtn = true;
private setSelectedId;
public penCharge : Subscription;
// public pen = "";
public animalsFight = [];
public animalsFightdeathAlive = [];
private animalStrategy:any={
animalsSeeing: [],
isContingencyView : false,
isanimalsJetFlag: true,
isToogleFlag : true,
animalsCommunication: [],
commonInfo: {},
pen:"",
animalsEar:"",
aptDate:""
};
private bindHeaderDayDat;
private newJSON;
private newJSON1;
private animalStamina =this.route.snapshot.params['id'];
private preSelectedCategory ="";
public copyTextToAllArr =[];
private backupData;
private backupDataOrg;
private animalsMocking;
private animalsJeansRedoButton;
private animalsInternet;
private animalsJeansSaveButton=true;
public insertanimalsMouseDeath;
public insertAnimalsBrush;
private animalsJeansAddTimeZone = true;
private animalsJeansAddGrid = true;
public isEditable;
private animalsJeansRefreshButton = true;
private backUpTZChk;
public animalsDeathDecrement=0;
public animalsAliveIncrement=0;
public animalAgeList=[];
public redoevent;
public snailInsectCharge;
public animalsPoliceBookData
public crowFlyingHigh=[];
public tabIndex;
public isNewTab;
public crowTabEventService;
private dynamicTabId=[];
public insertConflictMsg=[];
public delanimalsPoliceTZ =[];
public urlStateWatch = null;
public expectedDetails;
public crowAnimalsTeethSaveReceived;
public eventdeathAliveName =[];
public animalsAliveDeath=[];
public animalsAlive=[];
public animalsSleeping=[];
public isReadOnly;
private isSelected=1;
private isFocued='0';
private rangey;
private savedSelection;
private animalsPolicedeathAliveSource={};
private selectedID;
public splitterLastChildState = 1;
private availableTimeZoneExceptLastOne = [];
private lastAvailableTimeZone = [];
private allanimalsSeeing;
private resolve;
public natCopyOptions;
public animalsComedy;
private previousPGMValue = "";
private animalsSayOk;
private animalsSaveCancel;
private isanimalsPoliceCurrentanimalsCommunicationPlanEvents = false;
private sourceTextChangeJson;
private animalsLeather;
private animalsMakeup;
private animalsTakingBus;
//private enableCondianimalsHorror = false;
private isClickedTabanimalsNameZero = false;
private animalsName:any = 0;
private iscrowSaveDialogYes = false;
private isTabcrowClose = false;
private animalsAction;
private crowTabEventService1;
@ViewChild(TigerLeftParrotEventHenComponent) private TigerLeftTab: TigerLeftParrotEventHenComponent;
@ViewChild(FoxKILLcrowCopyEvents) private TigerCopyPlans: FoxKILLcrowCopyEvents;
@ViewChild(TigerKILLcrowAPTNetworkPreview) private aptNetworkPreview: TigerKILLcrowAPTNetworkPreview;
@ViewChild(Tigercrow) private Tigercrow: Tigercrow;
@ViewChild(animalsThriller) private progress: animalsThriller;
@ViewChild(TigerKILLcrowRightBar) private TigercrowRight: TigerKILLcrowRightBar;
@ViewChild(animalsMarker) public animalsMarker: animalsMarker;
constructor(public elementRef: ElementRef, public animalService: animalService, public TigerService: TigerService, public FoxKILLService: FoxKILLService, private route: ActivatedRoute, public router: Router, public FoxKILLMain:FoxKILLMain) {
this.animalStrategy.planAddedSubscription = this.FoxKILLService.planChangeService.subscribe(data => {
//this.animalsAlive.push(jQuery.extend(true, [], this.animalStrategy.animalsSeeing));
if (data.addPGMHeader) {
this.pgmAddHeader(data);
} else {
this.appendPlanAdded(data);
}
});
this.snailInsectCharge = this.FoxKILLService.bookPlanChangeReceived.subscribe(snailInsectChangeRow => {
var test = this.getAptanimalsClapping(this.animalStrategy.animalsSeeing);
if(!snailInsectChangeRow.undoanimalAge.destinationEvent.isAllBook){
this.animalsSwimmingAllRecordedNight(snailInsectChangeRow.undoanimalAge);
}
this.animalsChoclate(snailInsectChangeRow);
})
if(this.animalsPoliceBookData){this.animalsPoliceBookData.unsubscribe();}
//
this.animalsPoliceBookData = this.FoxKILLService.eventDataChanged.subscribe(data => {
this.animalsPoliceanimalStrategyPlanScheItem(data);
this.TigerLeftTab.animalsPoliceBkEventOnTigerChange(data);
});
this.router.events.pairwise().subscribe((urlChange) => {
this.urlStateWatch = urlChange;
})
this.animalsSayOk = this.TigerService.animalsSaveCancelReceived.subscribe(data => {
this.animalsSaveCancel = data;
this.isanimalsPoliceCurrentanimalsCommunicationPlanEvents = true;
});
this.crowAnimalsTeethSaveReceived = this.FoxKILLService.crowEventSaveClickReceived.subscribe(param => {
//console.log(this.TigerLeftTab);
let mantoryDialog;
if(!this.Tigercrow.isEditanimalsTyphoid()){
if (this.TigerLeftTab.isanimalsPolice && this.TigerLeftTab.AnimalsTeethNameTxt != "" && this.TigerLeftTab.leftEvent.apt.aptDate /*&& this.TigerLeftTab.isanimalsPolicedNat*/)
{
this.saveServiceCall();
}
else
{
$("#playerAnimal .ballPlayingAnimal").text('Please enter all mandatory fields before proceeding to save.');
mantoryDialog = $("#playerAnimal").data("animalsEatinGindow").center().open();
$("#playerAnimal").data("animalsEatinGindow").title("");
$("#playerAnimal").prev("div").children("span.alieNwindow-title").text("Fox").css('color','#FFF');
$("#playerAnimal").prev(".alieNwindow-titlebar").css("background","#000");
}
$("#okButn").unbind().click(function() {
mantoryDialog.close();
});
}
else{
this.Tigercrow.singleButtonDialog("Please click on Ok or Cancel in APT Info tab to animalsPolice or revert the changes.");
}
})
}
/** Guard Active **/
animalsHorror() : Promise<boolean> | boolean {
let that = this;
if (!that.TigerService.condianimalsJeansSaveButton && !that.TigerService.enableCondianimalsHorror) {
return new Promise<boolean>((resolve, reject) => {
that.resolve = resolve;
//resolve(true)
if(that.router.url.includes("FoxKILLMain/FoxKILLcrowEvent/0")){
that.TigerService.isNewcrowEvent = true;
}
//that.TigerService.existinganimalStaminaOrId = that.route.snapshot.params['id'];
// if(isMouseClickOverMenu=="true"){
$("#TigerUnsavedData").find('.ballPlayingAnimal').text("Do you want to save the changes?");
let dialog = $("#TigerUnsavedData").data("animalsEatinGindow").center().open();
$("#unsaveYes").unbind().click(function () {
dialog.close();
that.clearScrollStorage();
that.iscrowSaveDialogYes = true;
//that.isTabChange.deactivate = true;
that.saveServiceCall().then(function (data) {
if(data){
console.log(data);
resolve(true);
that.animalsJeansSaveButton = true;
that.TigerService.condianimalsJeansSaveButton = true;
that.TigerService.enableCondianimalsHorror = true;
}
})
});
$("#unsaveNo").unbind().click(function () {
dialog.close();
that.clearScrollStorage();
that.animalsJeansSaveButton = true;
that.TigerService.condianimalsJeansSaveButton = true;
that.TigerService.enableCondianimalsHorror = true;
resolve(true);
});
$("#unsaveCancel").unbind().click(function () {
dialog.close();
resolve(false);
});
// }else{
// resolve(true);
// }
});
} else {
return true
}
}
ngDoCheck() {
let Temperature = {};
Temperature["enableBtn"] = this.animalsJeansSaveButton;
Temperature["tabName"] = "crow";
this.TigerService.setTemperature(Temperature);
this.TigerService.setTemperatureMod(Temperature);
//this.TigerService.setOptionalData({isanimalsJeans: this.animalsJeansSaveButton});
}
ngOnInit() {
this.crowFlyingHigh = this.FoxKILLService.TigerConditonalTabData.crowFlyingHigh;
let index= this.FoxKILLService.TigerConditonalTabData.dynamicTabId.indexOf(this.FoxKILLService.TigerConditonalTabData.selectedTabindex-1);
if(index==-1){
this.FoxKILLService.TigerConditonalTabData.dynamicTabId.push(this.FoxKILLService.TigerConditonalTabData.selectedTabindex-1);
this.tabIndex = this.FoxKILLService.TigerConditonalTabData.dynamicTabId.indexOf(this.FoxKILLService.TigerConditonalTabData.selectedTabindex-1);
this.isNewTab = true;
}else{
this.tabIndex = index;
}
this.TigerService.condianimalsJeansSaveButton = true;
this.TigerService.enableCondianimalsHorror = false;
this.TigerService.isNewcrowEvent = false;
//this.TigerService.existinganimalStaminaOrId = this.route.snapshot.params['id'];
/* CAS-215 */
this.natCopyOptions = this.TigerService.getNatCopyOption();
if(window.localStorage.getItem('natcopyoptchng') !== null){
this.animalsComedy = window.localStorage.getItem('natcopyoptchng');
}else{
this.animalsComedy = this.natCopyOptions[0]['optname'];
}
// if(this.crowTabEventService){
// this.crowTabEventService.unsubscribe();
// }
//if(this.crowTabEventService) {this.crowTabEventService.unsubscribe();}
this.crowTabEventService = this.TigerService.initcrowTabEventReceived.subscribe(param => {
// const observers = this.TigerService.initcrowTabEvent.observers;
// const receivedObservers = this.TigerService.initcrowTabEventReceived.source.observers;
// if(observers.length > 1){
// this.TigerService.initcrowTabEvent.observers = [];
// this.TigerService.initcrowTabEvent.observers.push(observers[0]);
// this.TigerService.initcrowTabEventReceived.source.observers = [];
// this.TigerService.initcrowTabEventReceived.source.observers.push(receivedObservers[0]);
// }
if(that.TigerService.executeOnlyOnce){
that.TigerService.executeOnlyOnce = false;
this.dynamicTabId = this.FoxKILLService.TigerConditonalTabData.dynamicTabId;
let params: any = param;
let index = this.dynamicTabId.indexOf(params.index);
this.isTabcrowClose = params.isRemove;
if(this.isTabcrowClose){
this.animalsAction = params.event;
}
this.crowTabInit(index, params, params.isRemove);
this.animalsName = 0;
if(params && params.activeTab && params.activeTab.id != 0) {
this.animalsName = params.activeTab.id;
}
}
// this.saveServiceCall();
})
// if(this.crowTabEventService1){
// this.crowTabEventService1.unsubscribe();
// }
// this.crowTabEventService1 = this.TigerService.initcrowTabEventReceived1.subscribe(param => {
// this.dynamicTabId = this.FoxKILLService.TigerConditonalTabData.dynamicTabId;
// let params: any = param;
// let index = this.dynamicTabId.indexOf(params.index);
// this.isTabcrowClose = params.isRemove;
// if(this.isTabcrowClose){
// this.animalsAction = params.event;
// }
// this.crowTabInit(index, params, params.isRemove);
// this.animalsName = 0;
// if(params && params.activeTab && params.activeTab.id != 0) {
// this.animalsName = params.activeTab.id;
// }
// // this.saveServiceCall();
// })
let resizeBrowser = this;
$(window).on('resize', function (e) {
setTimeout(function() {
resizeBrowser.browserResize();
}, 1000);
});
this.animalsBigBoss("#insideSavePopup");
this.animalsSmallBox("#kendoOkDialog");
this.animalsSmallBox("#kendoPlanDateRangeDialog");
this.animalsBigBoss("#kenAnimalsSnoaringonfirmDialog");
this.animalsSmallBox("#savePopUpDialog");
this.animalsBigBoss("#animalsDryerAiringsConfirmDialog");
this.animalsSmallBox("#animalsDryerPlanConfirmDialog");
this.animalsBigBoss("#animalsDryerContgPlanConfirmDialog");
this.animalsBigBoss("#conflictMsgDialog");
this.animalsBigBoss("#dateDiffDialog");
this.animalsBigBoss("#saveConfirmAlert");
this.animalsBigBoss("#animalsDryerTZConfirmDialog");
this.animalsSmallBox("#expectedOverlapConfirmDialog");
this.animalsSmallBox("#overideAptConfirmation");
this.animalsBigBoss("#TigerStatusDialog");
let searchVisible=true;
this.TigerService.searchButton(searchVisible);
let that=this;
that.animalsInsurance();
$(".animalsPPO").animalsTension();
$(".timepicker").kendoTimePicker();
$("body").css({"margin-bottom": "0"});
this.loadView();
this.animalStrategy.penCharge = this.FoxKILLService.animalActionsRecordedTimelyd.subscribe( eventDet =>{
this.animalStrategy.pen = eventDet.name;
this.animalStrategy.aptDate = eventDet.aptDate;
this.bindHeaderDayDate();
})
$('.eventContingencyViewHolder').removeClass('changeContentFlag');
that.savedSelection='noRestore';
$("#cntContext,#evntContext").unbind().on("mousedown",function(e){
that.savedSelection='noRestore';
that.selectedID = e.target["parentNode"]["parentNode"]["id"];
that.setSelectedId = that.selectedID.replace("collapseOne_","lv_");
that.animalStrategy.animalsEar = that.selectedID.replace("collapseOne_","lv_");
$("#cntContext .panel-title, #evntContext .panel-title").removeClass('selectedActive')
$("#"+that.selectedID).addClass("selectedActive");
that.TigerLeftTab.setSelectedId(that.animalStrategy.animalsEar);
let afterComma = that.selectedID.substr(that.selectedID.indexOf("_") + 1);
let len = afterComma.split("_");
let test = that.animalsFight;
let maxlength = test.length-1;
let first= len;
$('#removeText').hide();
$('#addTimeZone').addClass('animalsJeansdElement');
$('#addGrid').addClass('animalsJeansdElement');
$('#animalsDryer').removeClass('animalsJeansdElement');
$('#animalsClapping').addClass('animalsJeansdElement');
$('#animalsBlinking').addClass('animalsJeansdElement');
$('#copyTextTo').addClass('animalsJeansdElement');
if(animalsVigorous.length == 1){
if ($("#" + that.selectedID).parent().parent().prevAll().find(".category-header").length == 0 && $("#" + that.selectedID).parent().parent().nextAll().find(".category-header").length != 0){
$('#animalsClapping').addClass('animalsJeansdElement');
$('#animalsBlinking').removeClass('animalsJeansdElement');
}//No Previous Row oly Next Row
if ($("#" + that.selectedID).parent().parent().nextAll().find(".category-header").length == 0 && $("#" + that.selectedID).parent().parent().prevAll().find(".category-header").length != 0){
$('#animalsClapping').removeClass('animalsJeansdElement');
$('#animalsBlinking').addClass('animalsJeansdElement');
}//No next Row only Previous Row
if ($("#" + that.selectedID).parent().parent().nextAll().find(".category-header").length == 0 && $("#" + that.selectedID).parent().parent().prevAll().find(".category-header").length == 0){
$('#animalsBlinking').addClass('animalsJeansdElement');
$('#animalsClapping').addClass('animalsJeansdElement');
}//Only one Row
if ($("#" + that.selectedID).parent().parent().nextAll().find(".category-header").length != 0 && $("#" + that.selectedID).parent().parent().prevAll().find(".category-header").length != 0){
$('#animalsBlinking').removeClass('animalsJeansdElement');
$('#animalsClapping').removeClass('animalsJeansdElement');
}//Previous Row and Next Row Avail
var idEvntContext=$(this).attr("id");
if(idEvntContext=='evntContext')
{
$('#AnimalsTeethaddTimeZone').addClass('animalsJeansdElement');
$('#AnimalsTeethaddGrid').addClass('animalsJeansdElement');
$('#AnimalsTeethanimalsDryer').addClass('animalsJeansdElement');
if (that.animalStrategy.eventOpDes == null) {
$('body #AnimalsTeethinsertText').show();
$('body #AnimalsTeethremoveText').hide();
}
else if (that.animalStrategy.eventOpDes != null) {
$('body #AnimalsTeethremoveText').show();
$('body #AnimalsTeethinsertText').hide();
}
}
if(test[first]){
if(test[first].categoryOpIssue.issueDesc == '' ){
$('#insertText').show();
$('#removeText').hide();
}else if(test[first].categoryOpIssue.issueDesc != '' ){
$('#removeText').show();
$('#insertText').hide();
}
}
}
else if(animalsVigorous.length == 2){
let first = len[0];
let second = len[1];
$('#addTimeZone').removeClass('animalsJeansdElement');
//Only one Row
if ($("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).prevAll().find(".plan-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).nextAll().find(".plan-header").length == 0){
$('#animalsClapping').addClass('animalsJeansdElement');
$('#animalsBlinking').addClass('animalsJeansdElement');
}
if ($("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).prevAll().find(".plan-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).nextAll().find(".plan-header").length != 0){
$('#animalsClapping').addClass('animalsJeansdElement');
$('#animalsBlinking').removeClass('animalsJeansdElement');
}
if ($("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).prevAll().find(".plan-header").length != 0 &&
$("#" + that.selectedID).parents().eq(1).nextAll().find(".plan-header").length == 0){
$('#animalsClapping').removeClass('animalsJeansdElement');
$('#animalsBlinking').addClass('animalsJeansdElement');
}
if ($("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).prevAll().find(".plan-header").length != 0 &&
$("#" + that.selectedID).parents().eq(1).nextAll().find(".plan-header").length != 0){
$('#animalsClapping').removeClass('animalsJeansdElement');
$('#animalsBlinking').removeClass('animalsJeansdElement');
}
//No Previous Row oly Next Row
if ($("#" + that.selectedID).parents().eq(4).nextAll().find(".category-header").length != 0 &&
$("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).prevAll().find(".plan-header").length != 0 &&
$("#" + that.selectedID).parents().eq(1).nextAll().find(".plan-header").length == 0){
$('#animalsClapping').removeClass('animalsJeansdElement');
$('#animalsBlinking').removeClass('animalsJeansdElement');
}
if ($("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length != 0 &&
$("#" + that.selectedID).parents().eq(4).nextAll().find(".category-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).prevAll().find(".plan-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).nextAll().find(".plan-header").length == 0){
$('#animalsClapping').removeClass('animalsJeansdElement');
$('#animalsBlinking').addClass('animalsJeansdElement');
}
if ($("#" + that.selectedID).parents().eq(4).nextAll().find(".category-header").length != 0 &&
$("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).prevAll().find(".plan-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).nextAll().find(".plan-header").length == 0){
$('#animalsClapping').addClass('animalsJeansdElement');
$('#animalsBlinking').removeClass('animalsJeansdElement');
}
if ($("#" + that.selectedID).parents().eq(4).nextAll().find(".category-header").length == 0 &&
$("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length != 0 &&
$("#" + that.selectedID).parents().eq(1).prevAll().find(".plan-header").length == 0 &&
$("#" + that.selectedID).parents().eq(1).nextAll().find(".plan-header").length != 0){
$('#animalsClapping').removeClass('animalsJeansdElement');
$('#animalsBlinking').removeClass('animalsJeansdElement');
}
if ($("#" + that.selectedID).parents().eq(4).nextAll().find(".category-header").length == 0 &&
$("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length != 0 &&
$("#" + that.selectedID).parents().eq(1).prevAll().find(".plan-header").length != 0 &&
$("#" + that.selectedID).parents().eq(1).nextAll().find(".plan-header").length == 0){
$('#animalsClapping').removeClass('animalsJeansdElement');
$('#animalsBlinking').addClass('animalsJeansdElement');
}
if ($("#" + that.selectedID).parents().eq(4).nextAll().find(".category-header").length == 0 &&
$("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length != 0 &&
$("#" + that.selectedID).parents().eq(1).prevAll().find(".plan-header").length != 0 &&
$("#" + that.selectedID).parents().eq(1).nextAll().find(".plan-header").length != 0){
$('#animalsClapping').removeClass('animalsJeansdElement');
$('#animalsBlinking').removeClass('animalsJeansdElement');
}
//Next and Prev Row Available
if ($("#" + that.selectedID).parents().eq(4).nextAll().find(".category-header").length != 0 &&
$("#" + that.selectedID).parents().eq(4).prevAll().find(".category-header").length != 0){
$('#animalsClapping').removeClass('animalsJeansdElement');
$('#animalsBlinking').removeClass('animalsJeansdElement');
}
if(test[first]){
if(test[first].TigerPlans[second].planOpIssue.issueDesc == ''){
$('#insertText').show();
$('#removeText').hide();
}else if(test[first].TigerPlans[second].planOpIssue.issueDesc != ''){
$('#removeText').show();
$('#insertText').hide();
}
}
$("#eastern").removeClass('animalsJeansdElement');
$("#central").removeClass('animalsJeansdElement');
$("#mountain").removeClass('animalsJeansdElement');
$("#pacfic").removeClass('animalsJeansdElement');
$("#all").removeClass('animalsJeansdElement');
if(test[first].TigerPlans[second].TigerPlanFeeds.length==0){
$('#all').removeClass('animalsJeansdElement');
}else{
$('#all').addClass('animalsJeansdElement');
let cnt = 0;
for(var i=0;i<test[first].TigerPlans[second].TigerPlanFeeds.length;i++){
if(test[first].TigerPlans[second].TigerPlanFeeds[i].animalHumming == 11 && test[first].TigerPlans[second].TigerPlanFeeds[i].operationType !='animalsDryer') {
$("#eastern").addClass('animalsJeansdElement');
cnt += 1;
}
if(test[first].TigerPlans[second].TigerPlanFeeds[i].animalHumming == 12 && test[first].TigerPlans[second].TigerPlanFeeds[i].operationType !='animalsDryer') {
$("#central").addClass('animalsJeansdElement');
cnt += 1;
}
if(test[first].TigerPlans[second].TigerPlanFeeds[i].animalHumming == 13 && test[first].TigerPlans[second].TigerPlanFeeds[i].operationType !='animalsDryer') {
$("#mountain").addClass('animalsJeansdElement');
cnt += 1;
}
if(test[first].TigerPlans[second].TigerPlanFeeds[i].animalHumming == 14 && test[first].TigerPlans[second].TigerPlanFeeds[i].operationType !='animalsDryer') {
$("#pacfic").addClass('animalsJeansdElement');
cnt += 1;
}
}
if(cnt == 0){
$("#all").removeClass('animalsJeansdElement');
}
}
}
else if(animalsVigorous.length == 3){
let first = len[0];
let second = len[1];
let third = len[2];
$('#copyTextTo').addClass('animalsJeansdElement');
$('#animalsClapping').addClass('animalsJeansdElement');
$('#animalsBlinking').addClass('animalsJeansdElement');
$('#AnimalsTeethaddTimeZone').addClass('animalsJeansdElement');
setTimeout(function(){
if(test[first].TigerPlans[second].TigerPlanFeeds[third].isFeedAvailable == false){
$('#addGrid').removeClass('animalsJeansdElement');
}
if(test[first]){
if(test[first].TigerPlans[second].TigerPlanFeeds[third].feedOpIssue.issueDesc == ''){
$('#insertText').show();
$('#removeText').hide();
$('#lv_'+first+'_'+second+'_feedTextarea').html();
}else if(test[first].TigerPlans[second].TigerPlanFeeds[third].feedOpIssue.issueDesc != ''){
$('#removeText').show();
$('#insertText').hide();
$('#copyTextTo').removeClass('animalsJeansdElement');
}
//Issue Fixed - CR-16169
if(test[first].TigerPlans[second].TigerPlanFeeds[third].feedOpIssue.issueDesc == '' && test[first].TigerPlans[second].TigerPlanFeeds[third].textIconFlag == true){
$('#removeText').show();
$('#insertText').hide();
$('#copyTextTo').removeClass('animalsJeansdElement');
}//Ends Here
}
},100);
}
var getEvntContext=$(this).attr("id");
let getSelTab = that.animalStrategy.animalsEar;
var selectedText;
that.rangey='';
$(".eventContingencyViewHolder .panel-heading h4").unbind().on("click",function(e){
e.stopPropagation();
let getSelTab = that.animalStrategy.animalsEar;
var restoreID='';
if(getSelTab == "HenEventHeader" || getSelTab == "HenEventcollapse" || getSelTab == "HenEventDesc"){
restoreID='HenEventDesc';
}
else{
restoreID=getSelTab+'_feedTextarea';
}
if($("#"+restoreID).length==1){
that.animalsRocket($('#'+restoreID).get(0));
that.rangey= that.animalsForgot();
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById(restoreID) );
}
});
$(".eventContingencyViewHolder #HenEventDesc").unbind().on("click mouseup",function(e){
e.stopPropagation();
var strId=$(this).attr("id");
that.isFocued=strId;
if(strId=='HenEventDesc'){
$('#cntContext,#evntContext').find('.panel-title').removeClass("selectedActive");
$('#evntContext').find('.panel-title').addClass("selectedActive");
$('#HenEventHeader').addClass("selectedActive");
that.animalStrategy.animalsEar='HenEventHeader';
that.TigerLeftTab.setSelectedId(that.animalStrategy.animalsEar)
if($("#HenEventDesc").length==1){
selectedText=that.getSelectedTextWithin(AnimalsSnoaringument.getElementById('HenEventDesc'));
}
if(selectedText!='') {
that.rangey= that.animalsForgot();
}
else if (that.isFocued=='HenEventDesc') {
that.rangey = that.animalsForgot();
}
else{
that.animalsRocket($('#HenEventDesc').get(0));
that.rangey= that.animalsForgot();
}
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById('HenEventDesc') );
}
});
$(".eventContingencyViewHolder .planDescClick").unbind().on("click mouseup",function(e){
e.stopPropagation();
var strId=$(this).attr("id");
that.isFocued=strId;
var mainId=(strId).replace("_feedTextarea","");
$('#cntContext,#evntContext').find('.panel-title').removeClass("selectedActive");
$('#'+mainId).addClass("selectedActive");
that.animalStrategy.animalsEar=mainId;
that.TigerLeftTab.setSelectedId(that.animalStrategy.animalsEar);
if($('#'+strId).length==1){
selectedText=that.getSelectedTextWithin(AnimalsSnoaringument.getElementById(strId));
}
if(selectedText!='') {
that.rangey= that.animalsForgot();
}
else if (that.isFocued==strId) {
that.rangey = that.animalsForgot();
}
else{
that.animalsRocket($('#'+strId).get(0));
that.rangey= that.animalsForgot();
}
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById(strId) );
});
if(getEvntContext=='evntContext'){
if($("#HenEventDesc").length==1){
selectedText=that.getSelectedTextWithin(AnimalsSnoaringument.getElementById('HenEventDesc'));
if(selectedText!='' ) {
that.rangey= that.animalsForgot();
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById('HenEventDesc') );
if(getSelTab){
that.restoreSelection(AnimalsSnoaringument.getElementById('HenEventDesc'), that.savedSelection);
}
}
else if (that.isFocued=='HenEventDesc') {
that.rangey = that.animalsForgot();
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById('HenEventDesc') );
if(getSelTab){
that.restoreSelection(AnimalsSnoaringument.getElementById('HenEventDesc'), that.savedSelection);
}
}
else{
that.animalsRocket($('#HenEventDesc').get(0));
that.rangey= that.animalsForgot();
}
}
}
else{
if($('#'+getSelTab+'_feedTextarea').length==1){
selectedText=that.getSelectedTextWithin(AnimalsSnoaringument.getElementById(getSelTab+'_feedTextarea'));
if(selectedText!='') {
that.rangey= that.animalsForgot();
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById(getSelTab+'_feedTextarea'));
if(getSelTab){
that.restoreSelection(AnimalsSnoaringument.getElementById(getSelTab+'_feedTextarea'), that.savedSelection);
}
}
else if (that.isFocued==getSelTab+'_feedTextarea') {
that.rangey= that.animalsForgot();
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById(getSelTab+'_feedTextarea'));
if(getSelTab){
that.restoreSelection(AnimalsSnoaringument.getElementById(getSelTab+'_feedTextarea'), that.savedSelection);
}
}
else{
that.animalsRocket($("#"+getSelTab+"_feedTextarea").get(0));
that.rangey= that.animalsForgot();
}
if(getSelTab){
that.restoreSelection(AnimalsSnoaringument.getElementById(getSelTab+'_feedTextarea'), that.savedSelection);
}
}
}
$(".eventContingencyViewHolder .aptTextArea").on("mousedown",function(e){
e.stopPropagation();
that.animalsBreaking();
});
$(".eventContingencyViewHolder .aptTextArea").on("mousedrag",function(e){
var strId=$(this).attr("id");
if(strId=='HenEventDesc'){
$('#cntContext,#evntContext').find('.panel-title').removeClass("selectedActive");
$('#evntContext').find('.panel-title').addClass("selectedActive");
$('#HenEventHeader').addClass("selectedActive");
that.animalStrategy.animalsEar='HenEventHeader';
that.TigerLeftTab.setSelectedId(that.animalStrategy.animalsEar)
}
else{
var mainId=(strId).replace("_feedTextarea","");
$('#cntContext,#evntContext').find('.panel-title').removeClass("selectedActive");
$('#'+mainId).addClass("selectedActive");
that.animalStrategy.animalsEar=mainId;
that.TigerLeftTab.setSelectedId(that.animalStrategy.animalsEar);
}
if($('#'+getSelTab+'_feedTextarea').length==1){
selectedText=that.getSelectedTextWithin(AnimalsSnoaringument.getElementById(getSelTab+'_feedTextarea'));
if(selectedText!='') {
that.rangey= that.animalsForgot();
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById(getSelTab+'_feedTextarea'));
if(getSelTab){
that.restoreSelection(AnimalsSnoaringument.getElementById(getSelTab+'_feedTextarea'), that.savedSelection);
}
}
}
});
$(AnimalsSnoaringument).unbind('drop').on("drop",".eventContingencyViewHolder .aptTextArea",function(e){
e.preventDefault();
});
$(".aptTextArea").on("click mouseup mousedown contextmenu",function(e){
e.stopPropagation();
var contextMenu1 = $("#context-eventMenu").data("kenAnimalsSnoaringontextMenu");
if (contextMenu1) {
contextMenu1.close($("#context-eventMenu"));
}
var contextMenu2 = $("#context-menuAspect").data("kenAnimalsSnoaringontextMenu");
if (contextMenu2) {
contextMenu2.close($("#context-menuAspect"));
}
return true;
});
});
$(".aptTextArea").unbind('mouseup').on("contextmenu",function(e){
e.stopPropagation();
return true;
});
$(AnimalsSnoaringument).on("click mouseup",function(){
that.isFocued='0';
});
$(AnimalsSnoaringument).unbind().on('keyup keydown',".eventContingencyViewHolder .aptTextArea", function(e){
e.stopPropagation();
let strId=$(this).attr('id');
$(this).addClass('changeContentFlag');
var contextMenu1 = $("#context-eventMenu").data("kenAnimalsSnoaringontextMenu");
if (contextMenu1) {
contextMenu1.close($("#context-eventMenu"));
}
var contextMenu2 = $("#context-menuAspect").data("kenAnimalsSnoaringontextMenu");
if (contextMenu2) {
contextMenu2.close($("#context-menuAspect"));
}
if(strId=='HenEventDesc'){
$('#cntContext,#evntContext').find('.panel-title').removeClass("selectedActive");
$('#evntContext').find('.panel-title').addClass("selectedActive");
$('#HenEventHeader').addClass("selectedActive");
that.animalStrategy.animalsEar='HenEventHeader';
that.TigerLeftTab.setSelectedId(that.animalStrategy.animalsEar)
}
else{
var mainId=(strId).replace("_feedTextarea","");
$('#cntContext,#evntContext').find('.panel-title').removeClass("selectedActive");
$('#'+mainId).addClass("selectedActive");
that.animalStrategy.animalsEar=mainId;
that.TigerLeftTab.setSelectedId(that.animalStrategy.animalsEar);
}
if (e.ctrlKey && e.keyCode == 86) { //ctrl+v
if(!$('.eventContingencyViewHolder #evntContext').attr("hidden") && !$('.eventContingencyViewHolder #cntContext').attr("hidden")){
// setTimeout(function(){
var removeStyletag=$("#"+that.animalStrategy.animalsEar+'_feedTextarea').each(function(){$("#"+that.animalStrategy.animalsEar+'_feedTextarea *').removeAttr('style');});
var afterRemove=removeStyletag[0].innerHTML;
$("#"+that.animalStrategy.animalsEar+'_feedTextarea').html(afterRemove)
//},100);
}
}
that.onSaveEnable(strId);
});
$("#pgmTemplates").on("click",function (e) {
if($("#pgmTemplates").attr("id")=='pgmTemplates'){
let getSelTab = that.animalStrategy.animalsEar;
var restoreID='';
if(getSelTab == "HenEventHeader" || getSelTab == "HenEventcollapse" || getSelTab == "HenEventDesc"){
restoreID='HenEventDesc';
}
else{
restoreID=getSelTab+'_feedTextarea';
}
if($('#'+restoreID).length==1){
let selectedText=that.getSelectedTextWithin(AnimalsSnoaringument.getElementById(restoreID));
if(selectedText!='') {
that.rangey= that.animalsForgot();
}
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById(restoreID) );
}
if(getSelTab){
setTimeout(function(){
that.restoreSelection(AnimalsSnoaringument.getElementById(restoreID), that.savedSelection);
},100);
}
}
});
$('#addGrid').on('click',function(){
let animalsTalking= jQuery.extend(true, [], that.animalsFight);
let afterComma = that.selectedID.substr(that.selectedID.indexOf("_") + 1);
let len = afterComma.split("_");
let test = that.animalsFight;
let first= len;
let firstInner = len[0];
let secondInner = len[1];
let thirdInner = len[2];
if(animalsVigorous.length == 3){
test[firstInner].TigerPlans[secondInner].TigerPlanFeeds[thirdInner].isFeedAvailable= true;
test[firstInner].TigerPlans[secondInner].TigerPlanFeeds[thirdInner].operationType='Create';
}
let destinationEvent= jQuery.extend(true, [], that.animalsFight);
that.enableanimalsJeansSave(false);
let extraValue={
"iscollapse":true,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
});
$('#removeText').on('click',function(){
that.restoreSelection(AnimalsSnoaringument.getElementById(that.selectedID+'_feedTextarea'), 'noRestore');
setTimeout(function(){
let animalsTalking= jQuery.extend(true, [], that.animalsFight);
$('#'+that.selectedID+'_feedTextarea').html('');
let afterComma = that.selectedID.substr(that.selectedID.indexOf("_") + 1);
let len = afterComma.split("_");
let test = that.animalsFight;
let first= len;
let firstInner = len[0];
let secondInner = len[1];
let thirdInner = len[2];
if(animalsVigorous.length == 1){
test[first].categoryOpIssue.issueDesc = '';
}else if(animalsVigorous.length == 2){
test[firstInner].TigerPlans[secondInner].planOpIssue.issueDesc = '';
}else if(animalsVigorous.length == 3){
test[firstInner].TigerPlans[secondInner].TigerPlanFeeds[thirdInner].feedOpIssue.issueDesc= '';
test[firstInner].TigerPlans[secondInner].TigerPlanFeeds[thirdInner].textIconFlag = false;
}
//that.enableanimalsJeansSave(false);
let destinationEvent = jQuery.extend(true, [], test);
let extraValue={
"iscollapse":true,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
},10);
});
$('#insertText').on('click',function(){
let animalsTalking= jQuery.extend(true, [], that.animalsFight);
let afterComma = that.selectedID.substr(that.selectedID.indexOf("_") + 1);
let len = afterComma.split("_");
let test = that.animalsFight;
let first= len;
let firstInner = len[0];
let secondInner = len[1];
let thirdInner = len[2];
if(animalsVigorous.length == 1){
test[first].categoryOpIssue.issueDesc = null;
$('#collapseOne_'+ first)["collapse"]('show');
}else if(animalsVigorous.length == 2){
test[firstInner].TigerPlans[secondInner].planOpIssue.issueDesc = null;
$('#collapseOne_'+ firstInner + '_' + secondInner)["collapse"]('show');
}else if(animalsVigorous.length == 3){
test[firstInner].TigerPlans[secondInner].TigerPlanFeeds[thirdInner].feedOpIssue.issueDesc= null;
$('#collapseOne_'+ firstInner + '_' + secondInner + '_' + thirdInner)["collapse"]('show');
}
//that.enableanimalsJeansSave(false);
// let destinationEvent= jQuery.extend(true, [], that.animalsFight);
// that.deathAliveForContingency(animalsTalking,destinationEvent,true);
$(".selectedActive" ).find("a").removeClass("collapsed");
$(".selectedActive" ).next(".panel-collapse").addClass("in");
setTimeout(function(){
that.animalsRocket($("#"+that.selectedID+"_feedTextarea").get(0));
that.rangey= that.animalsForgot();
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById(that.selectedID+"_feedTextarea") );
},100)
});
$('#AnimalsTeethinsertText').unbind().on('click',function(){
let animalsTalking= jQuery.extend(true, [], that.animalsFight);
that.animalStrategy.eventOpDes = '';
$("#HenEventcollapse").addClass("in");
$("#HenEventcollapse").css("height","auto");
setTimeout(function(){
that.animalsRocket($("#HenEventDesc").get(0));
that.rangey= that.animalsForgot();
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById('HenEventDesc') );
},100)
});
$('#AnimalsTeethremoveText').unbind().on('click',function(){
that.restoreSelection(AnimalsSnoaringument.getElementById('HenEventDesc'), 'noRestore');
setTimeout(function(){
let animalsTalking= jQuery.extend(true, [], that.animalsFight);
$('#HenEventDesc').html('');
that.animalStrategy.eventOpDes = null;
that.enableanimalsJeansSave(false);
let destinationEvent= jQuery.extend(true, [], that.animalsFight);
let extraValue={
"iscollapse":true,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
},10);
});
$('#animalsDryer').unbind().on('click',function(){
let animalsTalking= jQuery.extend(true, [], that.animalsFight);
that.confingencySaveFlag();
let afterComma = that.selectedID.substr(that.selectedID.indexOf("_") + 1);
let len = afterComma.split("_");
let first = len[0];
let second = len[1];
let third = len[2];
let count=0;
if(animalsVigorous.length == 2){
if(that.animalsFight[first].TigerPlans.length>0){
for(let j=0;j<that.animalsFight[first].TigerPlans.length;j++){
if(that.animalsFight[first].TigerPlans[j].operationType != 'animalsDryer'){
count=count+1;
}
}
}
}
let animalsTyphoid,levelIndex=[],levelText=[],levelCat=[],status;
let level=animalsVigorous.length;
$('#cntContext .forCntChkPopup').each(function(){
if($.trim($(this).text())!='') {
levelIndex.push($(this).index())
}
});
for(let i=0; i<levelIndex.length;i++){
if($.trim($('#lv_'+levelIndex[i]+'_feedTextarea').text())!=''){
status=that.animalsFever($('#lv_'+levelIndex[i]+'_feedTextarea').html());
}
else{ status=false; }
levelText.push(status);
levelCat.push($.trim($('#lv_'+levelIndex[i]+' span').text()))
}
$(".ballPlayingAnimal").text("This will animalsDryer all Sub-Sections, Text and/or Grid(s)");
let newdialogConfirm= $("#animalsDryerPlanConfirmDialog").data("animalsEatinGindow").center().open();
$("#animalsDryerPlanYES").unbind().click(function(){
if(animalsVigorous.length == 1){
let getIndex=levelIndex.indexOf(parseInt(first));
if(levelCat[getIndex-1]==levelCat[getIndex+1]){
animalsTyphoid=(levelText[getIndex+1]==true)?true:false;
}
else{ animalsTyphoid=false; }
that.callanimalsDryer2Pop(level,first,second,animalsTyphoid);
}
else if(animalsVigorous.length == 2){
if (count == 1) {
let getIndex = levelIndex.indexOf(parseInt(first));
if (levelCat[getIndex - 1] == levelCat[getIndex + 1]) {
animalsTyphoid = (levelText[getIndex + 1] == true) ? true : false;
}
else { animalsTyphoid = false; }
}
else { animalsTyphoid = false; }
that.callanimalsDryer2Pop(level,first,second,animalsTyphoid);
}
else if(animalsVigorous.length == 3){
that.animalsFight[first].TigerPlans[second].TigerPlanFeeds[third].operationType = 'animalsDryer';
that.animalsFight[first].TigerPlans[second].TigerPlanFeeds[third].feedOpIssue.issueDesc = '';
}
that.animalsHello();
let destinationEvent= jQuery.extend(true, [], that.animalsFight);
let extraValue={
"iscollapse":true,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
that.enableanimalsJeansSave(false);
newdialogConfirm.close();
that.restoreSelection(AnimalsSnoaringument.getElementById(that.selectedID+'_feedTextarea'), 'noRestore');
});
$("#animalsDryerPlanNO").unbind().click(function(){
newdialogConfirm.close();
});
});
$('#animalsClapping').on('click',function(){
let animalsTalking= jQuery.extend(true, [], that.animalsFight);
that.confingencySaveFlag();
let afterComma = that.selectedID.substr(that.selectedID.indexOf("_") + 1);
let len = afterComma.split("_");
let test = that.animalsFight;
let animalsTyphoid,levelIndex=[],levelText=[],levelCat=[],status,get,put;
$('#cntContext .forCntChkPopup').each(function(){
if($.trim($(this).text())!='') {
levelIndex.push($(this).index())
}
});
for(let i=0; i<levelIndex.length;i++){
if($.trim($('#lv_'+levelIndex[i]+'_feedTextarea').text())!=''){
status=that.animalsFever($('#lv_'+levelIndex[i]+'_feedTextarea').html());
}
else{ status=false; }
levelText.push(status);
levelCat.push($.trim($('#lv_'+levelIndex[i]+' span').text()))
}
if(animalsVigorous.length == 1){
let first= len;
let second = len-1;
if(first != 0){
let getIndex=levelIndex.indexOf(parseInt(first));
if(levelCat[getIndex]==levelCat[getIndex-2]){
animalsTyphoid=(levelText[getIndex]==true)?true:false;
}
else if(levelCat[getIndex-1]==levelCat[getIndex+1]){
animalsTyphoid=(levelText[getIndex+1]==true)?true:false;
}
else{ animalsTyphoid=false; }
that.regroupCategoryDataanimalsClapping(test,len,animalsTyphoid,get,put);
}
}else if(animalsVigorous.length == 2){
let first = len[0];
let second = parseInt(len[1]);
let third = len[1]-1;
if($('#Hen_'+first +' #Hen_collapse'+first).length==1){
let getIndex=levelIndex.indexOf(parseInt(first));
if(levelCat[getIndex]==levelCat[getIndex-2]){
animalsTyphoid=(levelText[getIndex]==true)?true:false;
}
else if(levelCat[getIndex-1]==levelCat[getIndex+1]){
animalsTyphoid=(levelText[getIndex+1]==true)?true:false;
}
else{ animalsTyphoid=false; }
}
else{ animalsTyphoid = false; }
if(third != -1){
let temp = test[first].TigerPlans[second];
let isTrue = true;
let previousPlan = second-1;
for(let i=previousPlan;i>=0;i--){
if(test[first].TigerPlans[i].operationType != 'animalsDryer'){
test[first].TigerPlans[second] = test[first].TigerPlans[i];
test[first].TigerPlans[i] = temp;
isTrue = false;
break;
}
}
if(isTrue){
that.regroupPlanDataanimalsClapping(test,len,animalsTyphoid,get,put);
}
}else if(third == -1){
let animalsClappingFirst = len[0];
let animalsClapping = len[0]-2;
that.regroupPlanDataanimalsClapping(test,len,animalsTyphoid,get,put);
}
}
that.enableanimalsJeansSave(false);
let destinationEvent= jQuery.extend(true, [], that.animalsFight);
let extraValue={
"iscollapse":true,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
});
$('#animalsBlinking').on('click',function(){
let animalsTalking= jQuery.extend(true, [], that.animalsFight);
that.confingencySaveFlag();
let afterComma = that.selectedID.substr(that.selectedID.indexOf("_") + 1);
let len = afterComma.split("_");
let test = that.animalsFight;
let maxlength = test.length-1
let animalsTyphoid,levelIndex=[],levelText=[],levelCat=[],status,get,put;
that.animalsMakeup='';
that.animalsTakingBus='';
$('#cntContext .forCntChkPopup').each(function(){
if($.trim($(this).text())!='') {
levelIndex.push($(this).index())
}
});
for(let i=0; i<levelIndex.length;i++){
if($.trim($('#lv_'+levelIndex[i]+'_feedTextarea').text())!=''){
status=that.animalsFever($('#lv_'+levelIndex[i]+'_feedTextarea').html());
}
else{
status=false;
}
levelText.push(status);
levelCat.push($.trim($('#lv_'+levelIndex[i]+' span').text()))
}
if(animalsVigorous.length == 1){
let first= len;
let second = parseInt(first)+1;
if(first != maxlength){
let getIndex=levelIndex.indexOf(parseInt(first));
if(levelCat[getIndex]==levelCat[getIndex+2] && levelCat[getIndex-1]==levelCat[getIndex+1]){
if(levelText[getIndex+2]==true && levelText[getIndex-1]==true){
animalsTyphoid=true;
get=$('#lv_'+getIndex+'_feedTextarea').html();
put=getIndex+2;
that.animalsMakeup=$('#lv_'+(getIndex-1)+'_feedTextarea').html();
that.animalsTakingBus=getIndex+1;
}
else{
animalsTyphoid=false;
}
}
else if(levelCat[getIndex]==levelCat[getIndex+2]){
//animalsTyphoid=(levelText[getIndex+2]==true)?true:false;
if(levelText[getIndex+2]==true){
animalsTyphoid=true;
get=$('#lv_'+getIndex+'_feedTextarea').html();
put=getIndex+2;
}
else{
animalsTyphoid=false;
}
}
else if(levelCat[getIndex-1]==levelCat[getIndex+1]){
//animalsTyphoid=(levelText[getIndex-1]==true)?true:false;
if(levelText[getIndex-1]==true){
animalsTyphoid=true;
get=$('#lv_'+(getIndex-1)+'_feedTextarea').html();
put=getIndex+1;
}
else{
animalsTyphoid=false;
}
}
else{
animalsTyphoid=false;
}
that.regroupCategoryDataanimalsBlinking(test,len,animalsTyphoid,get,put);
}
}else if(animalsVigorous.length == 2){
let first = len[0];
let second = parseInt(len[1]);
let third = parseInt(len[1])+1;
if($('#Hen_'+first +' #Hen_collapse'+first).length==1){
let getIndex=levelIndex.indexOf(parseInt(first));
if(levelCat[getIndex]==levelCat[getIndex+2]){
//animalsTyphoid=(levelText[getIndex+2]==true)?true:false;
if(levelText[getIndex+2]==true){
animalsTyphoid=true;
get=$('#lv_'+getIndex+'_feedTextarea').html();
put=getIndex+2;
}
else{
animalsTyphoid=false;
}
}
else if(levelCat[getIndex-1]==levelCat[getIndex+1]){
//animalsTyphoid=(levelText[getIndex-1]==true)?true:false;
if(levelText[getIndex+2]==true){
animalsTyphoid=true;
get=$('#lv_'+(getIndex-1)+'_feedTextarea').html();;
put=getIndex+1;
}
else{
animalsTyphoid=false;
}
}
else{
animalsTyphoid=false;
}
}
else{ animalsTyphoid = false; }
if(test[first].TigerPlans.length ==third){
that.regroupPlanDataanimalsBlinking(test,len,animalsTyphoid,get,put);
}else{
let temp = test[first].TigerPlans[second];
let isTrue = true;
for(let i=third;i<test[first].TigerPlans.length;i++){
if(test[first].TigerPlans[i].operationType != 'animalsDryer'){
test[first].TigerPlans[second] = test[first].TigerPlans[i];
test[first].TigerPlans[i] = temp;
isTrue=false;
break;
}
}
if(isTrue){
that.regroupPlanDataanimalsBlinking(test,len,animalsTyphoid,get,put);
}
}
}
that.enableanimalsJeansSave(false);
let destinationEvent= jQuery.extend(true, [], that.animalsFight);
let extraValue={
"iscollapse":true,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
});
// Copy to text start
$('#subItemCopy').on('click', 'li', function () {
var animalsTalking = jQuery.extend(true, [], that.animalsFight);
var afterComma = that.selectedID.substr(that.selectedID.indexOf("_") + 1);
var len = afterComma.split("_");
var first = len[0];
var second = len[1];
var third = len[2];
var test = that.animalsFight;
var planFeeds = test[first].TigerPlans[second].TigerPlanFeeds;
var copyFrom = $('#' + that.selectedID + '_feedTextarea').html();
var item = $(this).attr('id');
if (item == 'copyEastern') {
var easternFlag = false;
if (planFeeds == undefined) {
easternFlag = true;
}
for (var i = 0; i < planFeeds.length; i++) {
if (planFeeds[i].animalHumming == 11) {
planFeeds[i].feedOpIssue.issueDesc = copyFrom;
planFeeds[i].operationType = "animalsPolice";
$('#lv_' + first + '_' + second + '_' + i + '_feedTextarea').html(copyFrom);
$('#collapseOne_' + first + '_' + second + '_' + i)["collapse"]('show');
easternFlag = true;
break;
}
}
var animalsMouseDeath = {
operationType: "Create",
TigerItems: [],
planNo: 3507607,
animalStamina: 0,
animalsNokia: 0,
animalHumming: 11,
feedName: 'EASTERN',
feedOpIssue: { issueDesc: copyFrom },
isFeedAvailable: false
};
var data = that.animalsFight[first].TigerPlans[second].TigerPlanFeeds;
if (!easternFlag) {
data.push(animalsMouseDeath);
}
}
else if (item == 'copyCentral') {
var centralFlag = false;
if (planFeeds == undefined) {
centralFlag = true;
}
for (var i = 0; i < planFeeds.length; i++) {
if (planFeeds[i].animalHumming == 12) {
planFeeds[i].feedOpIssue.issueDesc = copyFrom;
planFeeds[i].operationType = "animalsPolice";
$('#lv_' + first + '_' + second + '_' + i + '_feedTextarea').html(copyFrom);
$('#collapseOne_' + first + '_' + second + '_' + i)["collapse"]('show');
centralFlag = true;
break;
}
}
var animalsMouseDeath = {
operationType: "Create",
TigerItems: [],
planNo: 3507607,
animalStamina: 0,
animalsNokia: 0,
animalHumming: 12,
feedName: 'CENTRAL',
feedOpIssue: { issueDesc: copyFrom },
isFeedAvailable: false
};
var data = that.animalsFight[first].TigerPlans[second].TigerPlanFeeds;
if (!centralFlag) {
data.push(animalsMouseDeath);
}
}
else if (item == 'copyMountain') {
var mountainFlag = false;
if (planFeeds == undefined) {
mountainFlag = true;
}
for (var i = 0; i < planFeeds.length; i++) {
if (planFeeds[i].animalHumming == 13) {
planFeeds[i].feedOpIssue.issueDesc = copyFrom;
planFeeds[i].operationType = "animalsPolice";
$('#lv_' + first + '_' + second + '_' + i + '_feedTextarea').html(copyFrom);
$('#collapseOne_' + first + '_' + second + '_' + i)["collapse"]('show');
mountainFlag = true;
break;
}
}
var animalsMouseDeath = {
operationType: "Create",
TigerItems: [],
planNo: 3507607,
animalStamina: 0,
animalsNokia: 0,
animalHumming: 13,
feedName: 'MOUNTAIN',
feedOpIssue: { issueDesc: copyFrom },
isFeedAvailable: false
};
var data = that.animalsFight[first].TigerPlans[second].TigerPlanFeeds;
if (!mountainFlag) {
data.push(animalsMouseDeath);
}
}
else if (item == 'copyPacific') {
var pacficFlag = false;
if (planFeeds == undefined) {
pacficFlag = true;
}
for (var i = 0; i < planFeeds.length; i++) {
if (planFeeds[i].animalHumming == 14) {
planFeeds[i].feedOpIssue.issueDesc = copyFrom;
planFeeds[i].operationType = "animalsPolice";
$('#lv_' + first + '_' + second + '_' + i + '_feedTextarea').html(copyFrom);
$('#collapseOne_' + first + '_' + second + '_' + i)["collapse"]('show');
pacficFlag = true;
break;
}
}
var animalsMouseDeath = {
operationType: "Create",
TigerItems: [],
planNo: 3507607,
animalStamina: 0,
animalsNokia: 0,
animalHumming: 14,
feedName: 'PACIFIC',
feedOpIssue: { issueDesc: copyFrom },
isFeedAvailable: false
};
var data = that.animalsFight[first].TigerPlans[second].TigerPlanFeeds;
if (!pacficFlag) {
data.push(animalsMouseDeath);
}
}
else if (item == 'copyAll') {
var allFlag = false;
var plananimalHumming = [{ animalHumming: 11, feedName: 'EASTERN' },
{ animalHumming: 12, feedName: 'CENTRAL' },
{ animalHumming: 13, feedName: 'MOUNTAIN' },
{ animalHumming: 14, feedName: 'PACIFIC' }];
if (planFeeds == undefined) {
allFlag = true;
}
else if (planFeeds.length > 0) {
for (var i_1 = 0; i_1 < plananimalHumming.length; i_1++) {
for (var j = 0; j < planFeeds.length; j++) {
if (plananimalHumming[i_1].animalHumming == planFeeds[j].animalHumming) {
planFeeds[j].feedOpIssue.issueDesc = copyFrom;
planFeeds[j].operationType = "animalsPolice";
$('#lv_' + first + '_' + second + '_' + j + '_feedTextarea').html(copyFrom);
$('#collapseOne_' + first + '_' + second + '_' + j)["collapse"]('show');
plananimalHumming.splice(i_1, 1);
}
}
}
if (plananimalHumming.length > 0) {
for (var i_2 = 0; i_2 < plananimalHumming.length; i_2++) {
that.copyToAll(plananimalHumming[i_2].animalHumming, plananimalHumming[i_2].feedName, copyFrom);
planFeeds.push(that.copyTextToAllArr[i_2]);
}
}
allFlag = true;
}
}
that.enableanimalsJeansSave(false);
var destinationEvent = jQuery.extend(true, [], that.animalsFight);
let extraValue={
"iscollapse":true,
"isEventText":false,
}
that.deathAliveForContingency(animalsTalking, destinationEvent, extraValue);
});
// Copy to text end
$('#subItem').on('click', 'li', function(){
let animalsTalking= jQuery.extend(true, [], that.animalsFight);
let easternFlag=false;
let afterComma = that.selectedID.substr(that.selectedID.indexOf("_") + 1);
let len = afterComma.split("_");
let first = len[0];
let second = len[1];
let test = that.animalsFight;
let feeds= test[first].TigerPlans[second].TigerPlanFeeds;
//console.log(feeds);
let textIconFlag = false;
// let data=that.animalsFight[first].TigerPlans[second].TigerPlanFeeds;
$('#collapseOne_'+ first + '_' + second)["collapse"]('show');
let item = $(this).attr('id');
if(item == 'eastern'){
if(feeds == undefined){
easternFlag = true;
}
else if(feeds.length>0){
for(var i=0;i<feeds.length;i++){
if(feeds[i].animalHumming == 11){
if(feeds[i].operationType == "animalsDryer") {
feeds[i].operationType = "";
feeds[i].isFeedAvailable = false;
}
easternFlag = true;
break;
}
}
}
let animalsMouseDeath={
operationType : "Create",
TigerItems:[],
planNo:3507607,
animalStamina:0,
animalsNokia:0,
animalHumming:11,
feedName:'EASTERN',
feedOpIssue:{issueDesc:''},
textIconFlag:true,
isFeedAvailable:false
};
if(!easternFlag){
feeds.push(animalsMouseDeath);
}
}else if(item == 'central'){
let centralFlag=false;
if(feeds == undefined){
centralFlag = true;
}else if(feeds.length>0){
for(var i=0;i<feeds.length;i++){
if(feeds[i].animalHumming == 12){
if(feeds[i].operationType == "animalsDryer") {
feeds[i].operationType = "";
feeds[i].isFeedAvailable = false;
}
centralFlag = true;
break;
}
}
}
let animalsMouseDeath={
operationType : "Create",
TigerItems:[],
planNo:3507607,
animalStamina:0,
animalsNokia:0,
animalHumming:12,
feedName:'CENTRAL',
feedOpIssue:{issueDesc:''},
textIconFlag:true,
isFeedAvailable:false
};
if(!centralFlag){
feeds.push(animalsMouseDeath);
}
}else if(item == 'mountain'){
let mountainFlag =false;
if(feeds == undefined){
mountainFlag = true;
}else if(feeds.length>0){
for(var i=0;i<feeds.length;i++){
if(feeds[i].animalHumming == 13){
if(feeds[i].operationType == "animalsDryer") {
feeds[i].operationType = "";
feeds[i].isFeedAvailable = false;
}
mountainFlag = true;
break;
}
}
}
let animalsMouseDeath={
operationType : "Create",
TigerItems:[],
planNo:3507607,
animalStamina:0,
animalsNokia:0,
animalHumming:13,
feedName:'MOUNTAIN',
feedOpIssue:{issueDesc:''},
textIconFlag:true,
isFeedAvailable:false
};
if(!mountainFlag){
feeds.push(animalsMouseDeath);
}
}else if(item == 'pacfic'){
let pacficFlag =false;
if(feeds == undefined){
pacficFlag = true;
}else if(feeds.length>0){
for(var i=0;i<feeds.length;i++){
if(feeds[i].animalHumming == 14){
if(feeds[i].operationType == "animalsDryer") {
feeds[i].operationType = "";
feeds[i].isFeedAvailable = false;
}
pacficFlag = true;
break;
}
}
}
let animalsMouseDeath={
operationType : "Create",
TigerItems:[],
planNo:3507607,
animalStamina:0,
animalsNokia:0,
animalHumming:14,
feedName:'PACIFIC',
feedOpIssue:{issueDesc:''},
textIconFlag:true,
isFeedAvailable:false
};
if(!pacficFlag){
feeds.push(animalsMouseDeath);
}
}else if(item == 'all'){
let allFlag =false;
if(feeds == undefined){
allFlag = true;
}else if(feeds.length > 0){
let cntDel = 0;
for(let i=0;i<feeds.lenght;i++){
if(feeds[i].operationType == "animalsDryer") {
feeds[i].operationType = "";
feeds[i].isFeedAvailable = false;
feeds.splice(i--,1);
cntDel += 1;
}
}
if(cntDel == 0)
allFlag = false;
else
allFlag = true;
//allFlag = true;
}
let animalsMouseDeath=[{
operationType : "Create",
TigerItems:[],
planNo:3507607,
animalStamina:0,
animalsNokia:0,
animalHumming:11,
feedName:'EASTERN',
feedOpIssue:{issueDesc:''},
textIconFlag:true,
isFeedAvailable:false
},
{
operationType : "Create",
TigerItems:[],
planNo:3507607,
animalStamina:0,
animalsNokia:0,
animalHumming:12,
feedName:'CENTRAL',
feedOpIssue:{issueDesc:''},
textIconFlag:true,
isFeedAvailable:false
},
{
operationType : "Create",
TigerItems:[],
planNo:3507607,
animalStamina:0,
animalsNokia:0,
animalHumming:13,
feedName:'MOUNTAIN',
feedOpIssue:{issueDesc:''},
textIconFlag:true,
isFeedAvailable:false
},
{
operationType : "Create",
TigerItems:[],
planNo:3507607,
animalStamina:0,
animalsNokia:0,
animalHumming:14,
feedName:'PACFIC',
feedOpIssue:{issueDesc:''},
textIconFlag:true,
isFeedAvailable:false
}];
if(!allFlag){
for(let i=0;i<4;i++){
feeds.push(animalsMouseDeath[i]);
}
}
}
that.enableanimalsJeansSave(false);
let destinationEvent= jQuery.extend(true, [], that.animalsFight);
let extraValue={
"iscollapse":true,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
});
$("#copyPlanEvents").click(function(){
//that.TigerCopyPlans.copyPlansEvent("2016",that.animalStrategy,that.animalStamina);
if (that.animalsJeansSaveButton) {
that.TigerCopyPlans.copyPlansEvent(that.animalStrategy.animalSkin,that.animalStrategy,that.animalStamina);
//this.clearSave();
//this.callServiceLoadData();
} else {
$(".ballPlayingAnimal").text("Do you want to save the changes?");
let newdialogConfirm = $("#savePopUpDialog").data("animalsEatinGindow").center().open();
$("#savePopupYes").unbind().click(function () {
newdialogConfirm.close();
that.saveServiceCall().then(function (data) {
if(data){
that.TigerCopyPlans.copyPlansEvent(that.animalStrategy.animalSkin, that.animalStrategy, that.animalStamina);
}
})
});
$("#savePopupNo").unbind().click(function () {
newdialogConfirm.close();
that.callServiceLoadData().then(function(data) {
if (data) {
that.TigerCopyPlans.copyPlansEvent(that.animalStrategy.animalSkin, that.animalStrategy, that.animalStamina);
}
})
});
$("#savePopupCancel").unbind().click(function () {
newdialogConfirm.close();
});
}
});
if(this.isNewTab){
this.crowFlyingHigh.push({"index":this.FoxKILLService.TigerConditonalTabData.selectedTabindex-1,
"animalsBirthDay": this.TigerLeftTab.ParrotanimalsBirthDay,
"animalsName":'',
"leftEventAPT": this.TigerLeftTab.leftEvent,
"publishFlag": this.TigerLeftTab.publishFlag,
"TigerData":[],
"TigerId":[],
});
}
//$('#animalsClapping').on('click',function(){
// $(".panelEventCol").click(function(e){
/* $('.panelEventCol').on('click',function(e){
var panelEvent=$(this).parents(".panel").find(".panelEvent");
// var panelEventCol=$(this).parents(".panel").find(".panelEventCol");
var panelEventCol=$(this);
if(panelEvent.hasClass('in')) {
panelEvent.removeClass('in');
panelEvent.attr('aria-expanded', 'false');
panelEventCol.attr('aria-expanded', 'false');
} else {
panelEvent.addClass('in');
panelEvent.attr('aria-expanded', 'true');
panelEventCol.attr('aria-expanded', 'true');
}
}); */
$("#contiIcon").on('click',function(){
if(that.animalStrategy.isToogleFlag == true){
that.resetToogle()
that.animalStrategy.isToogleFlag = false;
}
});
}
animalsForgot(){
const AnimalsSnoaring=AnimalsSnoaringument as any;
var sel, range;
if (window.getSelection) {
sel = window.getSelection && window.getSelection();
if (sel.animalsForgotAt && sel.rangeCount) {
range = sel.animalsForgotAt(0);
return range;
}
// else{
// range = AnimalsSnoaring.createRange();
// range.setStart(sel.anchorNode,sel.anchorOffset);
// range.setEnd(sel.focusNode,sel.focusOffset);
// return range;
// }
}
}
animalsBreaking() {
const AnimalsSnoaring=AnimalsSnoaringument as any;
if (window.getSelection) {
if (window.getSelection().empty) {
window.getSelection().empty();
} else if (window.getSelection().removeAllRanges) {
window.getSelection().removeAllRanges();
}
} else if (AnimalsSnoaring.selection) {
AnimalsSnoaring.selection.empty();
}
}
amimalsApple(containerEl) {
let that=this;
const AnimalsSnoaring=AnimalsSnoaringument as any;
var start,rangeSave,end;
if (window.getSelection && AnimalsSnoaringument.createRange) {
var range = window.getSelection().animalsForgotAt(0);
var preSelectionRange = range.cloneRange();
preSelectionRange.selectNodeContents(containerEl);
// try {
preSelectionRange.selectNodeContents(containerEl);
// }catch (e){
// }
preSelectionRange.setEnd(range.startContainer, range.startOffset);
var rangeNode = AnimalsSnoaringument.getElementById(containerEl);
start = preSelectionRange.toString().length;
that.rangey = range;
//console.log(that.rangey)
return {
start: start,
end: start + range.toString().length,
rangeSave: range
}
}
else if (AnimalsSnoaring.selection && AnimalsSnoaring.body.createTextRange) {
var selectedTextRange = AnimalsSnoaring.selection.createRange();
var preSelectionTextRange = AnimalsSnoaring.body.createTextRange();
preSelectionTextRange.moveToElementText(containerEl);
preSelectionTextRange.setEndPoint("EndToStart", selectedTextRange);
start = preSelectionTextRange.text.length;
that.rangey = preSelectionTextRange;
return {
start: start,
end: start + selectedTextRange.text.length,
rangeSave: range
}
}
//console.log(range) ;
}
restoreSelection(containerEl, savedSel) {
let that=this;
const AnimalsSnoaring=AnimalsSnoaringument as any;
// console.log(that.rangey)
if(savedSel=='noRestore'){
}
else{
if (window.getSelection && AnimalsSnoaringument.createRange) {
var charIndex = 0, range = AnimalsSnoaringument.createRange();
// try {
range.setStart(containerEl, 0);
// }catch (e){
// console.log('error');
// }
range.collapse(true);
var nodeStack = [containerEl], node, foundStart = false, stop = false;
while (!stop && (node = nodeStack.pop())) {
if (node.nodeType == 3) {
var nextCharIndex = charIndex + node.length;
if (!foundStart && savedSel.start >= charIndex && savedSel.start <= nextCharIndex) {
range.setStart(node, savedSel.start - charIndex);
foundStart = true;
}
if (foundStart && savedSel.end >= charIndex && savedSel.end <= nextCharIndex) {
range.setEnd(node, savedSel.end - charIndex);
stop = true;
}
charIndex = nextCharIndex;
} else {
var i = node.childNodes.length;
while (i--) {
nodeStack.push(node.childNodes[i]);
}
}
}
var reSel = window.getSelection();
reSel.removeAllRanges();
reSel.addRange(range);
//console.log(range);
that.rangey = range;
// console.log(that.rangey)
}
else {
var textRange = AnimalsSnoaring.body.createTextRange();
textRange.moveToElementText(containerEl);
textRange.collapse(true);
textRange.moveEnd("character", savedSel.end);
textRange.moveStart("character", savedSel.start);
textRange.select();
}
}
}
animalsSoap(html,fact) {
const AnimalsSnoaring=AnimalsSnoaringument as any;
var that = this;
var rangex=that.rangey;
var sel = window.getSelection();
if (sel.animalsForgotAt && sel.rangeCount) {
rangex.animalsDryerContents();
var el = AnimalsSnoaringument.createElement("div");
el.innerHTML = html;
var frag = AnimalsSnoaringument.createAnimalsSnoaringumentFragment(), node, lastNode;
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node);
}
rangex.collapse(false);
rangex.insertNode(frag)
if (lastNode) {
rangex = rangex.cloneRange();
rangex.setStartAfter(lastNode);
rangex.collapse(false);
rangex = AnimalsSnoaringument.createRange();
var text = AnimalsSnoaring.getElementById("HenEventDesc");
var referenceNode = AnimalsSnoaringument.getElementsByClassName("e-"+that.isSelected+"")[0];
rangex.selectNodeContents(referenceNode);
rangex.selectNode(referenceNode);
sel.removeAllRanges();
sel.addRange(rangex);
that.rangey = rangex;
//console.log(rangex)
}
}
else if (AnimalsSnoaring.selection && AnimalsSnoaring.selection.type != "Control") {
AnimalsSnoaring.selection.createRange().pasteHTML(html);
}
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById("HenEventDesc"));
}
animalsSoap1(html,fact) {
const AnimalsSnoaring=AnimalsSnoaringument as any;
var that = this;
var rangex1=that.rangey;
var sel = window.getSelection();
if (sel.animalsForgotAt && sel.rangeCount) {
rangex1.animalsDryerContents();
var el = AnimalsSnoaringument.createElement("div");
el.innerHTML = html;
var frag = AnimalsSnoaringument.createAnimalsSnoaringumentFragment(), node, lastNode;
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node);
}
rangex1.collapse(false);
rangex1.insertNode(frag);
if (lastNode) {
rangex1 = rangex1.cloneRange();
rangex1.setStartAfter(lastNode);
rangex1.collapse(false);
rangex1 = AnimalsSnoaringument.createRange();
var text = AnimalsSnoaring.getElementById("fact");
var referenceNode = AnimalsSnoaringument.getElementsByClassName("e-"+that.isSelected+"")[0];
rangex1.selectNodeContents(referenceNode);
rangex1.selectNode(referenceNode);
sel.removeAllRanges();
sel.addRange(rangex1);
that.rangey = rangex1;
//console.log(rangex1)
}
} else if (AnimalsSnoaring.selection && AnimalsSnoaring.selection.type != "Control") {
AnimalsSnoaring.selection.createRange().pasteHTML(html);
}
that.savedSelection = that.amimalsApple( AnimalsSnoaringument.getElementById(fact));
}
animalsRocket(el) {
let that = this;
const AnimalsSnoaring=AnimalsSnoaringument as any;
//el.focus();
if (typeof window.getSelection != "undefined"
&& typeof AnimalsSnoaringument.createRange != "undefined") {
var range = AnimalsSnoaringument.createRange();
// try {
range.selectNodeContents(el);
// }catch (e){
// console.log('error');
// }
range.collapse(false);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
} else if (typeof AnimalsSnoaring.body.createTextRange != "undefined") {
var textRange = AnimalsSnoaring.body.createTextRange();
textRange.moveToElementText(el);
textRange.collapse(false);
textRange.select();
}
}
getSelectedTextWithin(el) {
const AnimalsSnoaring=AnimalsSnoaringument as any;
var selectedText = "";
if (typeof window.getSelection != "undefined") {
var sel = window.getSelection(), rangeCount;
if ( (rangeCount = sel.rangeCount) > 0 ) {
var range = AnimalsSnoaringument.createRange();
for (var i = 0, selRange; i < rangeCount; ++i) {
range.selectNodeContents(el);
selRange = sel.animalsForgotAt(i);
if (selRange.compareBoundaryPoints(range.START_TO_END, range) == 1 && selRange.compareBoundaryPoints(range.END_TO_START, range) == -1) {
if (selRange.compareBoundaryPoints(range.START_TO_START, range) == 1) {
range.setStart(selRange.startContainer, selRange.startOffset);
}
if (selRange.compareBoundaryPoints(range.END_TO_END, range) == -1) {
range.setEnd(selRange.endContainer, selRange.endOffset);
}
selectedText += range.toString();
}
}
}
} else if (typeof AnimalsSnoaring.selection != "undefined" && AnimalsSnoaring.selection.type == "Text") {
var selTextRange = AnimalsSnoaring.selection.createRange();
var textRange = selTextRange.duplicate();
textRange.moveToElementText(el);
if (selTextRange.compareEndPoints("EndToStart", textRange) == 1 && selTextRange.compareEndPoints("StartToEnd", textRange) == -1) {
if (selTextRange.compareEndPoints("StartToStart", textRange) == 1) {
textRange.setEndPoint("StartToStart", selTextRange);
}
if (selTextRange.compareEndPoints("EndToEnd", textRange) == -1) {
textRange.setEndPoint("EndToEnd", selTextRange);
}
selectedText = textRange.text;
}
}
return selectedText;
}
expandView(event){
var element=$(event.target);
var panelEvent=$(event.target).closest(".panel").children(".accordEvent");
var panelClickedElement=$(event.target).closest(".panel").children(".panel-heading").children(".panel-title").children("a");
if(panelEvent.hasClass('in')) {
panelEvent.removeClass('in');
panelEvent.attr('aria-expanded', 'false');
element.attr('aria-expanded', 'false');
panelClickedElement.attr('aria-expanded', 'false');
} else {
panelEvent.addClass('in');
panelEvent.attr('aria-expanded', 'true');
element.attr('aria-expanded', 'true');
panelClickedElement.attr('aria-expanded', 'true');
}
}
deathAliveForContingency(animalsTalking,destinationEvent,iscollapse){
this.animalsFightdeathAlive.push(jQuery.extend(true, [], this.animalsFight));
if(animalsTalking!=destinationEvent){
var dataPass={
"type": "deathAliveForContingency",
"animalsTalking": animalsTalking,
"destinationEvent": destinationEvent,
"occurence": iscollapse,
"action": "deathAliveForContingency" }
// this.TigerEnableSave.emit({ "type": "enableSaveWithCount", "animalsTalking": URData, "destinationEvent": {}, "occurence": {}, "action": "left" });
this.animalsSwimmingAllRecordedNight(dataPass);
}
}
deathAliveForContingencyFn(item,extraValue){
if(extraValue.iscollapse){
this.animalsFight=item;
}else{
//this.animalsFight=item.animalsSeeing;
if(extraValue.isEventText){
$("#HenEventDesc")[0].innerHTML=item.eventOpDes;
}else{
this.animalStrategy=item;
}
}
}
isDetailsTempChange(template:any){
this.detailsTemplate=template;
}
copyToAll(animalHumming:any,feedName:any,desc:any){
this.copyTextToAllArr.push({
operationType : "Create",
TigerItems:[],
planNo:3507607,
animalStamina:0,
animalsNokia:0,
animalHumming:animalHumming,
feedName:feedName,
feedOpIssue:{issueDesc:desc},
isFeedAvailable:false
})
}
callFunction(data,i_index,j_index){
if(this.animalsAliveDeath.length==0){
var saveObj={
id:0,
id1:0,
animalStrategy:data,
}
let copy = Object.assign({}, saveObj);
this.animalsAliveDeath.push(jQuery.extend(true, [], saveObj));
}
}
ngAfterContentInit() {
let that = this;
$("#crowanimalsJetHen").kendoPanelBar().data("kendoPanelBar");
$('.TigerTabList > li').eq(2).hide();
$("#apt_network_preview").click(function() {
let expectedPlan=that.checkIsExpectedPlan();
that.aptNetworkPreview.setInputValue(expectedPlan.ParrotanimalsBirthDay,expectedPlan.ParrotanimalsShaking,expectedPlan.ParrotanimalsDeathDay,expectedPlan.ParrotanimalsUnderstanding);
that.aptNetworkPreview.aptNetworkPreviewPopupOpen();
});
}
ngAfterViewInit() {
$("#crowEventSplitter").kendoSplitter({
orientation: "horizontal",
panes: [
{ collapsible: true, size: "25%" },
{ },
{ collapsible: true, size: "30%" }
],
expand: function(e) {
if($(e.pane).hasClass('eventLeftParrotSplitterPane')){
$("#crowEventSplitter").data("kendoSplitter").size(".alieNpane:first", "25%");
} else if($(e.pane).hasClass('eventInfoRightTab')) {
$("#crowEventSplitter").data("kendoSplitter").size(".alieNpane:last", "30%");
}
}
});
}
bindHeaderDayDate(){
let dayDate = "";
if(this.animalStrategy.aptDate != ""){
this.bindHeaderDayDat = kendo.toString(new Date(this.animalStrategy.aptDate), "dddd") + " " + kendo.toString(new Date(this.animalStrategy.aptDate), "MM/dd/yyyy")
}
//return dayDate;
}
decompressJsonResponse(data): any {
// Decode base64 (convert ascii to binary)
let strData = atob(data);
// Convert binary string to character-number array
let charData = strData.split('').map(function (x) { return x.charCodeAt(0); });
// Turn number array into byte-array
let binData = new Uint8Array(charData);
// animalsIntelligence decompress
let inflateData = animalsIntelligence.inflateRaw(binData);
// Convert gunzipped byteArray back to ascii string:
//let value = String.fromCharCode.apply(null, new Uint16Array(inflateData));
let value = new animalThinking("utf-8").decode(inflateData);
return JSON.parse(value);
//return "";
}
callServiceLoadData() {
let that=this;
this.progress.requestStart();
return new Promise(resolve => {
this.animalService.getResponse("contingencyplans/v1/events?animalStamina=" + this.animalStamina + "&type=1", 'get', "")
.subscribe(data => {
//data = this.decompressJsonResponse(data.zipdata);
//console.log(data);
//console.log(data);
let animalStamina=this.animalStamina;
if(this.FoxKILLService.TigerConditonalTabData.crowFlyingHigh[this.tabIndex].animalsName==""){
this.FoxKILLService.TigerConditonalTabData.crowFlyingHigh[this.tabIndex].animalsName=animalStamina;
}
let schedItems=data.TigerItems;
let animalsCommunicationTigerItems=[];
if(schedItems && schedItems.length > 0){
schedItems.forEach(function (value: any,index) {
// let animalsDeathDay=new Date(value.end);
let animalsDeathDay = new Date(that.Tigercrow.getMacSupportDate(value.end));
if(that.Tigercrow.accessFutureDays(that.Tigercrow,animalsDeathDay)){
animalsCommunicationTigerItems.push(value);
}
});
}
data.TigerItems=animalsCommunicationTigerItems;
this.backupData = data;
this.backupDataOrg = $.extend(true, {}, data);
this.insertanimalsMouseDeath=[]
for(var i=0;i<data.TigerEventTemplatesMap.General.length;i++){
this.insertanimalsMouseDeath.push({name:data.TigerEventTemplatesMap.General[i].TigerEventTemplateName,No:data.TigerEventTemplatesMap.General[i].TigerEventTemplateNo})
}
this.animalsMocking = true;
this.animalsJeansRedoButton = true;
this.animalsJeansSaveButton = true;
that.TigerService.condianimalsJeansSaveButton = true;
this.animalsJeansRefreshButton = false;
if (data.TigerEvent) {
let sch_data = data.TigerEvent;
this.animalStrategy.commonInfo = {
"eventanimalsBirthDay": sch_data.eventanimalsBirthDay, "eventanimalsShaking": sch_data.eventanimalsShaking,
"eventanimalsDeathDay": sch_data.eventanimalsDeathDay, "eventanimalsUnderstanding": sch_data.eventanimalsUnderstanding
}
this.animalStrategy.animalsSeeing = data.TigerEvent.TigerPlanCategories;
this.animalsInternet = jQuery.extend(true,[],this.animalStrategy.animalsSeeing);
let schedId='Tiger_Nat_Main';
this.animalStrategy.animalsCommunication =this.timeAnimalsTeethConversion(data.TigerItems,"animalsCommunication",{},schedId);
//this.animalStrategy.animalsCommunication = data.TigerItems;
this.animalStrategy.pen = data.TigerEvent.eventName;
this.animalStrategy.animalSkin = data.TigerEvent.animalSkin;
this.animalStrategy.eventOpDes = "";
if(data.TigerEvent.eventOpIssue){
if(data.TigerEvent.eventOpIssue.issueDesc)
this.animalStrategy.eventOpDes = data.TigerEvent.eventOpIssue.issueDesc
}
this.animalStrategy.aptDate = data.TigerEvent.aptDisplayDate;
}
let response ={
source:data,
refreshTemplate:false
};
this.FoxKILLService.setAnimalsTeethTemplates(response);
//this.animalsJet();
//Issue CAS-185 Starts Here
this.clearSave();
if(this.animalStrategy.isContingencyView != true){
this.animalsJet();
}else{
this.contingencyView();
}
// Ends here
this.bindHeaderDayDate();
//this.progress.requestEnd();
resolve(true);
},
err => { this.progress.requestEnd();
resolve(false);
});
});
}
loadView(){
let that = this;
let data={};
let action = "Tigersaggregator/v1/listOfValues?type=NS";
let type="get";
this.blockMenuInit();
this.progress.requestStart();
this.animalService.getResponse(action, type, data).subscribe(data => {
that.TigercrowRight.runTypeList=data.runTypes;
that.TigercrowRight.pgRatingList=data.pgRatings;
that.TigercrowRight.displayTitlesList=data.displayTitles;
that.TigercrowRight.formatsList=data.formats;
that.TigerCopyPlans.seasonList=data.seasons;
that.TigerService.seasons = data.seasons;
if (data.networks[0] && data.networks[0].futureAccessDays) {
if (data.networks[0].futureAccessDays == "") {
this.Tigercrow.futureAccessDays = 9999;
this.TigerService.crowFutureAccessDays=9999;
} else {
this.Tigercrow.futureAccessDays = parseInt(data.networks[0].futureAccessDays);
this.TigerService.crowFutureAccessDays=parseInt(data.networks[0].futureAccessDays);
//this.TigerComponent.futureAccessDays=2;
}
}
else {
this.Tigercrow.futureAccessDays = 9999;
this.TigerService.crowFutureAccessDays=9999;
}
that.progress.requestEnd();
if(that.animalStamina==0){
$("#copyPlanEvents").addClass('actionanimalsJeansd');
setTimeout(function(){
that.loadanimalsCommunication('Tiger_Nat_Main',"","","","");
}, 10);
}
else{
that.callServiceLoadData();
}
let tabList = $('.TigerList .ParrotList > li');
for(let i=0; i<tabList.length; i++){
tabList.eq(i).removeClass('active');
}
setTimeout(function(){
tabList.eq(that.TigerService.TigerTabData.selectedTabindex).addClass('active');
},100);
},
err =>{
let tabList = $('.TigerList .ParrotList > li');
for(let i=0; i<tabList.length; i++){
tabList.eq(i).removeClass('active');
}
setTimeout(function(){
tabList.eq(that.TigerService.TigerTabData.selectedTabindex).addClass('active');
},1000);
});
}
confingencySaveFlag(){
let that=this;
$('.changeContentFlag').each(function(){
var id=$(this).attr('id');
var getText=$(this).html();
if(id=='HenEventDesc'){
that.animalStrategy.eventOpDes = getText;
}
else{
let replaceStr = id.replace("lv_","");
let replaceStr1 = replaceStr.replace("_feedTextarea","");
var animalsGiveUp = replaceStr1.split("_");
let firstIndex = animalsGiveUp[0];
if(animalsGiveUp.length === 1){
that.animalsFight[firstIndex].categoryOpIssue.issueDesc = getText;
// console.log("applied 1");
// console.log(that.animalsFight[firstIndex].categoryOpIssue.issueDesc);
}else if(animalsGiveUp.length === 2){
let firstIndex = animalsGiveUp[0];
let secondIndex = animalsGiveUp[1];
that.animalsFight[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc = getText;
// console.log(that.animalsFight[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc) ;
// console.log("applied 2") ;
}else if(animalsGiveUp.length === 3){
let firstIndex = animalsGiveUp[0];
let secondIndex = animalsGiveUp[1];
let thirdIndex = animalsGiveUp[2];
that.animalsFight[firstIndex].TigerPlans[secondIndex].TigerPlanFeeds[thirdIndex].feedOpIssue.issueDesc = getText;
// console.log(that.animalsFight[firstIndex].TigerPlans[secondIndex].TigerPlanFeeds[thirdIndex].feedOpIssue.issueDesc);
// console.log("applied 3");
}
//console.log(that.animalsFight[firstIndex].categoryOpIssue.issueDesc);
}
});
$('.eventContingencyViewHolder').removeClass('changeContentFlag');
}
aptDateRangeCheck(aptDate: any) {
var aptDateRange = false;
let AnimalsTeethanimalsBirthDay = kendo.toString(new Date(this.animalStrategy.commonInfo.eventanimalsBirthDay), 'MM/dd/yyyy');
let AnimalsTeethanimalsDeathDay = kendo.toString(new Date(this.animalStrategy.commonInfo.eventanimalsDeathDay), 'MM/dd/yyyy');
let animalsBirthDay = kendo.toString(new Date(AnimalsTeethanimalsBirthDay), 'MM/dd/yyyy');
let aptanimalsDeathDay = kendo.toString(new Date(aptDate), 'MM/dd/yyyy');
var dateDiff = Math.ceil(Math.abs(new Date(animalsBirthDay).getTime() - new Date(aptanimalsDeathDay).getTime()) / (1000 * 3600 * 24));
if (AnimalsTeethanimalsBirthDay <= aptanimalsDeathDay && AnimalsTeethanimalsDeathDay >= aptanimalsDeathDay) {
aptDateRange = true;
}
let animalsTaxianimalsDeathDay=this.TigerLeftTab.plansDetailsArr;
for (var i = 0; i < animalsTaxianimalsDeathDay.length; i++) {
let planeanimalsBirthDay = new Date(animalsTaxianimalsDeathDay[i].animalsBirthDay);
let planeanimalsDeathDay = new Date(animalsTaxianimalsDeathDay[i].animalsDeathDay);
if (planeanimalsBirthDay <= new Date(aptanimalsDeathDay) && planeanimalsDeathDay >= new Date(aptanimalsDeathDay)) {
aptDateRange = true;
}
}
return aptDateRange;
}
/* Actual save hit is change process in saveHit() method */
save() {
if(!this.Tigercrow.isEditanimalsTyphoid()){
let that = this;
// my save
that.confingencySaveFlag();
/* Here for check the date change alert function */
/*let dateDiffVals = this.TigerService.getOptionalData();
let that = this;
if(dateDiffVals !== undefined){
$("#dateDiffDialog").find('.ballPlayingAnimal').text(dateDiffVals.msg);
let dateDiffDialog = $("#dateDiffDialog").data("animalsEatinGindow").center().open();
$("#dateDiffOK").unbind().click(function() {
dateDiffDialog.close();
that.saveHit();
});
}else{
that.saveHit();
}*/
let aptDate = this.TigerLeftTab["leftEvent"].apt.aptDate;
let aptDateOutsideOfEventandPlan = this.aptDateRangeCheck(aptDate);
if(aptDateOutsideOfEventandPlan){
that.saveHit();
}else{
let overRideConfirm = $("#overideAptConfirmation").data("animalsEatinGindow").center().open();
$("#overRideApt").text("APT Display Date is outside of Events and plan(s) Range. Proceed?");
//$('#overideAptConfirmation').prev().find(".alieNwindow-title").text("Proceed?");
$("#overideAptYes").unbind().click(function() {
overRideConfirm.close();
that.saveHit();
});
$("#overideAptNo").unbind().click(function() {
overRideConfirm.close();
return false
});
}
}else{
this.Tigercrow.singleButtonDialog("Please click on Ok or Cancel in APT Info tab to animalsPolice or revert the changes.");
}
}
// saveConfirmYes(){
// let that = this;
// let saveConfirmAlert = $("#saveConfirmAlert").data("animalsEatinGindow");
// that.saveHit();
// saveConfirmAlert.close();
// this.animalsJeansSaveButton = true;
// that.router.navigate([that.urlStateWatch[0].urlAfterRedirects]);
// }
//
// saveConfirmNo(){
// let that = this;
// let saveConfirmAlert = $("#saveConfirmAlert").data("animalsEatinGindow");
// saveConfirmAlert.close();
// this.animalsJeansSaveButton = true;
// that.router.navigate([that.urlStateWatch[0].urlAfterRedirects]);
// }
checkOverlap(){
let all_data = this.animalStrategy;
this.generateSchedPlanCategories(all_data.animalsSeeing);
}
saveHit(){
this.animalsJeansSaveButton = false;
let that = this;
let gapArray = that.Tigercrow.checkGap();
let overlapArray = that.Tigercrow.getOverlapData();
if(overlapArray.length > 0){
let overlapTitle = "Overlap Notification";
let data = { "url": overlapArray, "columns": that.getOverlapNotificationColumn(), "title": overlapTitle, "excelFileName": "overlapNotification" };
//console.log(data)
that.animalsMarker.openPopup(data);
}
else if (gapArray.length > 0) {
let title = "Gap exists(Less than or equal to five minutes). Please confirm";
let data = { "url": gapArray, "columns": that.getGapNotificationColumn(), "title": title, "excelFileName": "gapNotification" };
that.animalsMarker.openPopup(data);
}else{
that.saveServiceCall();
}
}
getOverlapNotificationColumn(){
let columns= [
{ field:'contextRow',title:" ", width: 25, locked: true },
// { field:"plan", title: "Plan",width: 200 },
// { field: "timezone",title: "Time Zone", width: 200},
{ field: "categoryAndPlanDesc", title: "Plan",width: 200},
{ field:"nameOfTimeZone", title: "Time Zone",width: 200},
{ field: "date", title: "Date",width: 200},
{ field: "showName",title: "This Show", width: 200},
{ field: "animalsUnderstanding",title: "ending At",width: 200},
{ field: "overlapShow",title: "overlaps with this show", width: 200},
{ field: "animalsShaking",title: "starting At",width: 200},
];
return columns;
}
getGapNotificationColumn() {
let columns = [
{ field: 'contextRow', title: " ", width: 25, locked: true },
{
field: "date", title: "Date", width: 200
},
{
field: "gap", title: "Gap", width: 200
},
{
field: "firstShow", title: "This Show", width: 200
},
{
field: "firstShowEnd", title: "End Time", width: 200
},
{
field: "secondShow", title: "This Show", width: 200
},
{
field: "secondShowStart", title: "Start Time", width: 200
}
];
return columns;
}
gapNotificationTrigger(value) {
if (value) {
this.saveServiceCall();
}
}
showanimalsJet() {
// this.animalStrategy.isConti ew = false;
// this.FoxKILLService.set View(true);
let that = this;
// setTime tion(){
// for(var i = 0 ; i<that.animalStrategy.event ngth ;i++){
// for(var j = 0 ; j<that.animalStrategy.animalsSeeing[i].TigerPlans.le +){
// that.onI icker(i,j);
// that.onInitTimepicker(i,j);
// let planData = that.animalStrategy.animalsSeeing[i].TigerPlans[j];
// //that.TigerGroupingResources(planData,i,j);
// that.loadTigerDataByDefault(planData,i,j)
// }
// }
// let start_date = that.animalStrategy.commonInfo.eventanimalsBirthDay;
// let start_time = that.animalStrategy.commonInfo.eventanimalsBirthDay +" "+ that.animalStrategy.commonInfo.eventanimalsShaking
// that.loadanimalsCommunication('Tiger_Nat_Main',start_date,start_time);
// }, 1000);
this.progress.requestStart();
this.animalsJet();
}
animalsJet() {
this.animalStrategy.isContingencyView = false;
this.resetanimalsJetSplitterSize();
this.FoxKILLService.setselectedView(true);
let that = this;
// Issue Id: CAS-188
// Logic for load function only once start here
//if(this.animalStrategy.isanimalsJetFlag !== false){
//this.animalStrategy.isanimalsJetFlag = false;
setTimeout(function() {
for (var i = 0; i < that.animalStrategy.animalsSeeing.length; i++) {
for (var j = 0; j < that.animalStrategy.animalsSeeing[i].TigerPlans.length; j++) {
let listOfTigerPlanFeeds = that.animalStrategy.animalsSeeing[i].TigerPlans[j].TigerPlanFeeds;
that.animalStrategy.animalsSeeing[i].TigerPlans[j].bookPlanID = i + '_' + j;
var BookedPlanData = that.animalStrategy.animalsSeeing[i].TigerPlans[j].bookPlanID;
that.onInitanimalsPPO(i, j);
that.onInitTimepicker(i, j);
let planData = that.animalStrategy.animalsSeeing[i].TigerPlans[j];
//console.log(planData);
if(listOfTigerPlanFeeds){
listOfTigerPlanFeeds = listOfTigerPlanFeeds.filter(function(data){
if(data.isFeedAvailable && (data.operationType == "Create" || data.operationType == "")) return true;
})
}
//that.TigerGroupingResources(planData,i,j);
$('#btnanimalsPolice_' + i + '_' + j).addClass('actionanimalsJeansd');
if (listOfTigerPlanFeeds) {
listOfTigerPlanFeeds.sort(function(a, b) {
return a.animalHumming - b.animalHumming;
})
let indexOfLastAvailableFeed = listOfTigerPlanFeeds.length - 1;
listOfTigerPlanFeeds.forEach(function(data, index) {
let timeZoneName;
if (data.animalHumming == 11) {
timeZoneName = "Tiger_Est";
} else if (data.animalHumming == 12) {
timeZoneName = "Tiger_Cent";
} else if (data.animalHumming == 13) {
timeZoneName = "Tiger_Mount";
} else if (data.animalHumming == 14) {
timeZoneName = "Tiger_Pacifi";
}
let animalsName = timeZoneName + '_' + i + '_' + j;
if (indexOfLastAvailableFeed == index) {
that.lastAvailableTimeZone.push(animalsName);
} else {
that.availableTimeZoneExceptLastOne.push(animalsName);
}
})
}
that.availableTimeZoneExceptLastOne.push('Tiger_Nat_' + i + '_' + j);
that.loadTigerDataByDefault(planData, i, j)
}
}
that.TigerLeftTab.animalsPoliceBookEvent(that.animalStrategy.animalsSeeing, BookedPlanData)
let start_date = that.animalStrategy.commonInfo.eventanimalsBirthDay;
let start_time = that.animalStrategy.commonInfo.eventanimalsBirthDay + " " + that.animalStrategy.commonInfo.eventanimalsShaking;
let end_date = that.animalStrategy.commonInfo.eventanimalsDeathDay;
let end_time = that.animalStrategy.commonInfo.eventanimalsDeathDay + " " + that.animalStrategy.commonInfo.eventanimalsUnderstanding
that.loadanimalsCommunication('Tiger_Nat_Main', start_date, start_time, end_date, end_time);
that.animalsBye();
setTimeout(function() {
let overlapArray = that.Tigercrow.getOverlapData();
if (overlapArray.length > 0) {
let overlapTitle = "Overlap Notification";
let data = { "url": overlapArray, "columns": that.getOverlapNotificationColumn(), "title": overlapTitle, "excelFileName": "overlapNotification" };
that.animalsMarker.openPopup(data);
}
that.progress.requestEnd();
}, 0);
}, 1000);
//}
}
animalsBye() {
let that = this;
if (that.availableTimeZoneExceptLastOne) {
that.availableTimeZoneExceptLastOne.forEach(function(animalsName) {
$('#' + animalsName).addClass("schedOverFlow");
})
}
if (that.lastAvailableTimeZone) {
that.lastAvailableTimeZone.forEach(function(animalsName) {
$('#' + animalsName).removeClass("schedOverFlow");
})
}
this.lastAvailableTimeZone = [];
this.availableTimeZoneExceptLastOne = [];
}
animalsHello() {
for (var i = 0; i < this.animalStrategy.animalsSeeing.length; i++) {
for (var j = 0; j < this.animalStrategy.animalsSeeing[i].TigerPlans.length; j++) {
this.animalStrategy.animalsSeeing[i].TigerPlans[j].bookPlanID = i + '_' + j;
var BookedPlanData = this.animalStrategy.animalsSeeing[i].TigerPlans[j].bookPlanID;
}
}
this.TigerLeftTab.animalsPoliceBookEvent(this.animalStrategy.animalsSeeing, BookedPlanData);
}
contingencyView(){
if($('.crowTigeranimalsJetHolder + .alieNsplitbar').attr('aria-expanded') == "true") {
this.splitterLastChildState = 1;
$("#crowEventSplitter").data("kendoSplitter").collapse(".alieNpane:last");
} else {
this.splitterLastChildState = 0;
}
this.animalStrategy.isContingencyView = true;
this.FoxKILLService.setselectedView(false);
/*
for(var i=0;i<test.TigerEvent.TigerPlans.length;i++){
var category = test.TigerEvent.TigerPlans[i].categoryDesc;
for(var j=0;j<test.TigerEvent.TigerPlans[i].Tigerwhale.length;j++){
}
}*/
if(this.animalStrategy.eventOpDes == ''){
this.animalStrategy.eventOpDes = null;
}
/* for(var i=0; i<this.animalStrategy.animalsSeeing.length;i++){
if(this.animalStrategy.animalsSeeing[i].categoryOpIssue == '')
this.animalStrategy.animalsSeeing[i].categoryOpIssue == null;
if(this.animalStrategy.animalsSeeing[i].categoryOpIssue.issueDesc == '')
this.animalStrategy.animalsSeeing[i].categoryOpIssue = null;
//this.animalStrategy.animalsSeeing[i].categoryOpIssuea == null;
for(var j=0; j<this.animalStrategy.animalsSeeing[i].TigerPlans.length;j++){
if(this.animalStrategy.animalsSeeing[i].TigerPlans[j].planOpIssue == '')
this.animalStrategy.animalsSeeing[i].TigerPlans[j].planOpIssue == null;
if(this.animalStrategy.animalsSeeing[i].TigerPlans[j].planOpIssue.issueDesc == '')
this.animalStrategy.animalsSeeing[i].TigerPlans[j].planOpIssue = null;
}
}*/
/*getContigencyMockJSON(since: number): Observable<any> {
let url: string = 'https://api.myjson.com/bins/13bdqr';
return this.http.get(url).map(response => response.json());
} */
//this.animalsFight = [{"operationType":"","categoryOpIssue":{"issueDesc":null},"animalsNokia":1,"categoryDesc":"Expected","TigerPlans":[{"operationType":"","TigerPlanFeeds":[{"operationType":"","feedOpIssue":{"issueDesc":null},"TigerItems":[],"planNo":3509806,"animalStamina":0,"animalsNokia":0,"animalHumming":12,"delFlag":"","feedName":"CENTRAL","isFeedAvailable":true},{"operationType":"","feedOpIssue":{"issueDesc":null},"TigerItems":[],"planNo":3509806,"animalStamina":0,"animalsNokia":0,"animalHumming":14,"delFlag":"","feedName":"PACIFIC","isFeedAvailable":true},{"operationType":"","feedOpIssue":{"issueDesc":null},"TigerItems":[],"planNo":3509806,"animalStamina":0,"animalsNokia":0,"animalHumming":11,"delFlag":"","feedName":"EASTERN","isFeedAvailable":true},{"operationType":"","feedOpIssue":{"issueDesc":null},"TigerItems":[],"planNo":3509806,"animalStamina":0,"animalsNokia":0,"animalHumming":13,"delFlag":"","feedName":"MOUNTAIN","isFeedAvailable":true}],"planOpIssue":{"issueDesc":null},"planNo":3509806,"animalStamina":0,"animalsNokia":1,"planDesc":"","displaySeq":1,"delFlag":"","animalsBirthDay":"09/24/2017","animalsShaking":"01:00:00 AM","animalsDeathDay":"09/24/2017","animalsUnderstanding":"01:30:00 AM","plananimalsBirthDay":1506225600000,"plananimalsDeathDay":1506225600000,"categoryDesc":"Expected","animalsShakingInt":72000,"animalsUnderstandingInt":73800,"bookPlanID":"0_0","CT":true,"ALL":true,"PT":true,"ET":true,"MT":true}]}];
this.animalsFight = this.animalStrategy.animalsSeeing;
// let tempArr = this.animalStrategy.animalsSeeing;
// for(var i=0;i<tempArr.length;i++){
// tempArr[i].operationType="";
// for(var j=0;j<tempArr[i].TigerPlans.length;j++){
// if(tempArr[i].TigerPlans[j].TigerPlanFeeds == undefined){
// tempArr[i].TigerPlans[j].TigerPlanFeeds=[];
// }
// }
// }
// this.animalsFight = tempArr;
let that = this;
that.blockMenuInit();
// setTimeout(function() {
// $("#context-menuAspect").kenAnimalsSnoaringontextMenu({
// target: ".trippleDotContingencyView",
// showOn: "click"
// });
// }, 1000);
// CAS-188 commented below codes for the Issue
/*setTimeout(function() {
that.collapseAll();
}, 10); */
//Ends Here
this.animalsSleeping.push(jQuery.extend(true, [], that.animalStrategy.animalsSeeing));
that.progress.requestEnd();
}
toggleOpen(event) {
event.preventDefault();
if (!this.isanimalsJeansd) {
this.animalsCar = !this.animalsCar;
}
}
appendPlanAdded(Maindata: any) {
let that = this;
let addedData;
let isCallUndo=false;
if(Maindata.type && Maindata.type == "planNamedeathAlive"){
addedData = Maindata.animalsTalking.dataStore;
isCallUndo=true;
}
else{
addedData=Maindata;
}
//$('#subTabsBox li.active .js-event-plan').hasClass('js-Expected')
if ($('.js-event-plan').hasClass('js-Expected') && this.isExpectedPresent() && addedData.categoryDesc.toUpperCase().trim()=='EXPECTED' ) {
this.setDialog("An Expected Plan already exists in this Event.");
}else{
if(addedData.animalsNokia == 1&&!isCallUndo){
let that = this;
let selectedPlananimalsShaking = addedData.TigerPlans[0].animalsShaking;
let selectedPlan24hrsanimalsShaking = that.timeTo24HrsFormat(addedData.TigerPlans[0].animalsShaking);
let selectedPlananimalsBirthDay = addedData.TigerPlans[0].animalsBirthDay+' '+selectedPlananimalsShaking;
let selectedPlananimalsUnderstanding = addedData.TigerPlans[0].animalsUnderstanding;
let selectedPlan24hrsanimalsUnderstanding = that.timeTo24HrsFormat(addedData.TigerPlans[0].animalsUnderstanding);
let selectedPlananimalsDeathDay = addedData.TigerPlans[0].animalsDeathDay+' '+selectedPlananimalsUnderstanding;
let action = "contingencyplans/v1/expectedPlanOverlaps";
let type = "post";
let datas ={
"animalsShaking":selectedPlan24hrsanimalsShaking,
"animalsUnderstanding":selectedPlan24hrsanimalsUnderstanding,
"animalsBirthDay":selectedPlananimalsBirthDay,
"animalsDeathDay":selectedPlananimalsDeathDay,
"animalStamina":that.animalStamina,
"checkExpectedExistForSameEvent" : "N",
"networkNo" : "101"
};
that.progress.requestStart();
that.animalService.getResponse(action, type, datas)
.subscribe(data => {
if(data.code == 'S500'){
that.TigerLeftTab.animalsDreamComeTrue();
that.animalsPoliceDataStore(addedData,"planNamedeathAlive");
/* if(isCallUndo){
let length= that.animalStrategy.animalsSeeing.length;
Maindata.animalsTalking=that.animalStrategy.animalsSeeing[length-1];
Maindata.destinationEvent=that.animalStrategy.animalsSeeing[length-1];
that.animalsSwimmingAllRecordedNight(Maindata);
}*/
if(addedData.isPlanAdded){
that.animalStrategy.isContingencyView = false;
}
}else if(data.code == 'E500'){
//that.setDialog("An Expected Plan already exists in this Event.");
let that = this;
// $(".ballPlayingAnimal").text("The expected Plan overlaps with following Event(s):");
// let expectedPlanConfirm = $("#expectedOverlapConfirmDialog").data("animalsEatinGindow").center().open();
// let messageDetails = data.details;
// let getMessageDetail = "";
// for(let k=0;k<messageDetails.length;k++){
// getMessageDetail = getMessageDetail + ("<div class='expectedOverlapEvent'>"+messageDetails[k].animalsBirthDay+ " " +messageDetails[k].eventDesc+"</div>")
// }
// $("#expectedOverlapEventList").html(getMessageDetail);
// let windowHeight = $(window).outerHeight();
// windowHeight = windowHeight - 150;
// $('.expectedOverlapEventsList').css({ "max-height": windowHeight+"px" });
// $("#expectedYES").unbind().click(function() {
that.TigerLeftTab.animalsDreamComeTrue();
that.animalsPoliceDataStore(addedData,"planNamedeathAlive");
// expectedPlanConfirm.close();
// });
// $("#expectedNO").unbind().click(function() {
// expectedPlanConfirm.close();
// });
}
that.progress.requestEnd();
}, err => {
that.setDialog("Undefined error, Please try again.");
that.progress.requestEnd();
});
}else{
this.TigerLeftTab.animalsDreamComeTrue();
that.animalsPoliceDataStore(addedData,"planNamedeathAlive");
/*if(isCallUndo){
let length= that.animalStrategy.animalsSeeing.length;
Maindata.animalsTalking=that.animalStrategy.animalsSeeing[length-1];
Maindata.destinationEvent=that.animalStrategy.animalsSeeing[length-1];
that.animalsSwimmingAllRecordedNight(Maindata);
}*/
if(addedData.isPlanAdded){
that.animalStrategy.isContingencyView = false;
}
}
}
/*else {
this.animalsPoliceDataStore(data);
if(isCallUndo){
let length= this.animalStrategy.animalsSeeing.length;
Maindata.animalsTalking=this.animalStrategy.animalsSeeing[length-1];
Maindata.destinationEvent=this.animalStrategy.animalsSeeing[length-1];
this.animalsSwimmingAllRecordedNight(Maindata);
}
if(data.isPlanAdded){
this.animalStrategy.isContingencyView = false;
}
}*/
}
pgmAddHeader(data:any){
let that = this;
this.animalsPoliceDataStore(data,"pgmAddHeader");
this.animalStrategy.isContingencyView = true;
}
//animalsPolice animalStrategy Array with TimeZone Level Tiger Items
animalsPoliceanimalStrategyPlanScheItem(data: any){
let that = this;
if(that.animalStrategy != undefined && data != undefined && that.animalStrategy.animalsSeeing != undefined
&& that.animalStrategy.animalsSeeing.length > 0 && data.length >0){
$.each(data,function(dataKey,dataValue){
for(var i=0;i<that.animalStrategy.animalsSeeing.length;i++){
if(that.animalStrategy.animalsSeeing[i].operationType != "animalsDryer"){
let TigerPlans = that.animalStrategy.animalsSeeing[i].TigerPlans;
for (var j = 0; j < TigerPlans.length; j++) {
if (data[dataKey].planeId == TigerPlans[j].bookPlanID){
let TigerPlanFeeds = TigerPlans[j].TigerPlanFeeds;
for (var k = 0; k < TigerPlanFeeds.length; k++) {
if(data[dataKey].animalHumming == TigerPlanFeeds[k].animalHumming){
if(TigerPlanFeeds[k].TigerItems != undefined){
TigerPlanFeeds[k].TigerItems = data[dataKey].value;
}
}
}
}
}
}
}
});
}
}
//Ends Here
animalsPoliceDataStore(data: any,planAdded) {
let that = this;
let animalsTalking= jQuery.extend(true,[],that.animalStrategy);
let levelIndex=[],lastItem;
if(that.animalStrategy.animalsSeeing.length>0){
for(let i=1; i<=that.animalStrategy.animalsSeeing.length; i++){
if(that.animalStrategy.animalsSeeing[i-1].operationType !== "animalsDryer"){
levelIndex.push(i-1);
}
}
lastItem = levelIndex[levelIndex.length-1]; //let lastItem = that.animalStrategy.animalsSeeing.length - 1;
}
else{ lastItem=-1;}
if (lastItem != -1) {
//setTimeout(function(){
if ((that.animalStrategy.animalsSeeing[lastItem].categoryDesc.toUpperCase().trim() === data.categoryDesc.toUpperCase()) && (that.animalStrategy.animalsSeeing[lastItem].operationType !== "animalsDryer")) {
that.animalStrategy.animalsSeeing[lastItem].TigerPlans.push(data.TigerPlans[0]);
let firstIndex = that.animalStrategy.animalsSeeing.length - 1;;
let secondIndex = that.animalStrategy.animalsSeeing[lastItem].TigerPlans.length - 1;
let thirdIndex = secondIndex-1;
$('#collapseOne_'+ firstIndex)["collapse"]('show');
$('#btnanimalsPolice_' + firstIndex + '_' + secondIndex).addClass('actionanimalsJeansd');
setTimeout(function() {
/*$("#lv_" + firstIndex + '_' + secondIndex).parent().addClass("selectedActive");
$("#lv_" + firstIndex + '_' + 0).parent().removeClass("selectedActive");
$("#lv_" + firstIndex + '_' + thirdIndex).parent().removeClass("selectedActive");*/
$("#lv_" + firstIndex + '_' + secondIndex).addClass("selectedActive");
that.animalStrategy.animalsEar = "lv_" + firstIndex + '_' + secondIndex;
that.TigerLeftTab.setSelectedId(that.animalStrategy.animalsEar);
$("#lv_" + firstIndex + '_' + 0).removeClass("selectedActive");
$("#lv_" + firstIndex + '_' + thirdIndex).removeClass("selectedActive");
that.onInitanimalsPPO(firstIndex, secondIndex);
that.onInitTimepicker(firstIndex, secondIndex);
let destinationEvent= jQuery.extend(true, [], that.animalStrategy);
if(planAdded=="planNamedeathAlive"){
that.setEventUndo(animalsTalking,destinationEvent,firstIndex,secondIndex,"planNamedeathAlive",that);
}else{
let extraValue={
"iscollapse":false,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
}
}, 100);
} else {
that.animalStrategy.animalsSeeing.push(data);
let firstIndex = that.animalStrategy.animalsSeeing.length - 1;
/*$('#btnanimalsPolice_' + firstIndex + '_' + 0).parent().addClass('actionanimalsJeansd');
setTimeout(function() {
$("#lv_" + firstIndex + '_' + 0).parent().addClass("selectedActive");
that.onInitanimalsPPO(firstIndex, 0);
that.onInitTimepicker(firstIndex, 0);
}, 100);*/
$('#btnanimalsPolice_' + firstIndex + '_' + 0).addClass('actionanimalsJeansd');
setTimeout(function() {
$("#lv_" + firstIndex + '_' + 0).addClass("selectedActive");
that.animalStrategy.animalsEar = "lv_" + firstIndex+ '_' + 0;
that.TigerLeftTab.setSelectedId(that.animalStrategy.animalsEar);
that.onInitanimalsPPO(firstIndex, 0);
that.onInitTimepicker(firstIndex, 0);
let destinationEvent= jQuery.extend(true, [], that.animalStrategy);
if(planAdded=="planNamedeathAlive"){
that.setEventUndo(animalsTalking,destinationEvent,firstIndex,0,"planNamedeathAlive",that);
}else{
let extraValue={
"iscollapse":false,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
}
}, 100);
}
} else {
that.animalStrategy.animalsSeeing.push(data);
let firstIndex = that.animalStrategy.animalsSeeing.length - 1;
//$('#btnanimalsPolice_' + firstIndex + '_' + 0).parent().addClass('actionanimalsJeansd');
$('#btnanimalsPolice_' + firstIndex + '_' + 0).addClass('actionanimalsJeansd');
setTimeout(function() {
that.onInitanimalsPPO(firstIndex, 0);
that.onInitTimepicker(firstIndex, 0);
let destinationEvent= jQuery.extend(true, [], that.animalStrategy);
if(planAdded=="planNamedeathAlive"){
that.setEventUndo(animalsTalking,destinationEvent,firstIndex,0,"planNamedeathAlive",that);
}else{
let extraValue={
"iscollapse":false,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
}
}, 100);
}
//that.animalsAliveDeathSet(firstIndex,0,that.animalStrategy.animalsSeeing,that.animalsInternet);
that.animalsInternet = jQuery.extend(true,[],that.animalStrategy.animalsSeeing);
}
animalsPoliceDataStoreForCopyPlan(data: any) {
let that = this;
for (var i = 0; i < data.length; i++) {
let lastItem = that.animalStrategy.animalsSeeing.length - 1;
if (lastItem != -1) {
//setTimeout(function(){
if (that.animalStrategy.animalsSeeing[lastItem].categoryDesc.toUpperCase().trim() === data[i].categoryDesc.toUpperCase()) {
that.animalStrategy.animalsSeeing[lastItem].TigerPlans.push(data[i].TigerPlans[0]);
let firstIndex = that.animalStrategy.animalsSeeing.length - 1;
let secondIndex = that.animalStrategy.animalsSeeing[lastItem].TigerPlans.length - 1;
$('#btnanimalsPolice_' + firstIndex + '_' + secondIndex).addClass('actionanimalsJeansd');
setTimeout(function() {
that.onInitanimalsPPO(firstIndex, secondIndex);
that.onInitTimepicker(firstIndex, secondIndex);
}, 100);
} else {
that.animalStrategy.animalsSeeing.push(data[i]);
let firstIndex = that.animalStrategy.animalsSeeing.length - 1;
$('#btnanimalsPolice_' + firstIndex + '_' + 0).addClass('actionanimalsJeansd');
setTimeout(function() {
that.onInitanimalsPPO(firstIndex, 0);
that.onInitTimepicker(firstIndex, 0);
}, 100);
}
} else {
that.animalStrategy.animalsSeeing.push(data[i]);
let firstIndex = that.animalStrategy.animalsSeeing.length - 1;
$('#btnanimalsPolice_' + firstIndex + '_' + 0).addClass('actionanimalsJeansd');
setTimeout(function() {
that.onInitanimalsPPO(firstIndex, 0);
that.onInitTimepicker(firstIndex, 0);
}, 100);
}
}
}
auditOptions(data){
this.auditFlag=true;
this.Tigercrow.targetvalue=data.target.value;
this.Tigercrow.changevalue=this.auditFlag;
this.Tigercrow.auditOptions();
}
auditChangeOptions(data){
this.auditFlag=data.target.checked;
this.Tigercrow.changevalue=this.auditFlag;
this.Tigercrow.auditOptions();
}
storedanimalsTyphoidlValues(animalsDots: any):any{
let that = this;
let animalsTyphoidlValues = {"animalsBirthDay":"","animalsDeathDay":"","animalsShaking":"","animalsUnderstanding":""};
let findId = animalsDots.substr(animalsDots.indexOf("_") + 1);
if(!isNaN(findId)){
animalsTyphoidlValues.animalsBirthDay = that.animalStrategy.animalsSeeing[findId]['animalsBirthDay'];
animalsTyphoidlValues.animalsDeathDay = that.animalStrategy.animalsSeeing[findId]['animalsDeathDay'];
animalsTyphoidlValues.animalsShaking = that.animalStrategy.animalsSeeing[findId]['animalsShaking'];
animalsTyphoidlValues.animalsUnderstanding = that.animalStrategy.animalsSeeing[findId]['animalsUnderstanding'];
}
return animalsTyphoidlValues;
}
onInitanimalsPPO(id:any,id1:any){
let that = this;
$('#animalsBirthDay_'+id+'_'+id1).animalsTension({
min: new Date(1000, 0, 1), max: new Date(3000, 11, 31),
format: "MM/dd/yyyy", parseFormats: ["MM/dd/yyyy"],
change(e){
let a = this.value();
let animalsDots = this.element[0].id;
let findId = animalsDots.substr(animalsDots.indexOf("_") + 1);
var animalsGiveUp = findId.split("_");
var firstIndex = animalsGiveUp[0];
var secondIndex = animalsGiveUp[1];
//that.animalStrategy.animalsSeeing.animalsBirthDay=this._oldText;
//that.animalStrategy.animalsSeeing[firstIndex].TigerPlans[secondIndex].animalsBirthDay = this._oldText;
//that.animalsPoliceFieldNganimalsTyphoidl(this.value(),firstIndex,secondIndex,"animalsBirthDay_",that.animalStrategy.animalsSeeing,"animalsBirthDay","MM/dd/yyyy");
//let dataStored = that.storedanimalsTyphoidlValues(this.element[0].id);
that.datechangeStart(that.animalStrategy.animalsSeeing,firstIndex,secondIndex);
}
});
$('#animalsDeathDay_'+id+'_'+id1).animalsTension({
min: new Date(1000, 0, 1), max: new Date(3000, 11, 31),
format: "MM/dd/yyyy", parseFormats: ["MM/dd/yyyy"],
change(e){
//that.animalStrategy.animalsSeeing.animalsDeathDay=this._oldText;
let a = this.value();
let animalsDots = this.element[0].id;
let findId = animalsDots.substr(animalsDots.indexOf("_") + 1);
var animalsGiveUp = findId.split("_");
var firstIndex = animalsGiveUp[0];
var secondIndex = animalsGiveUp[1];
//that.animalStrategy.animalsSeeing[firstIndex].TigerPlans[secondIndex].animalsDeathDay = this._oldText;
//that.animalsPoliceFieldNganimalsTyphoidl(this.value(),firstIndex,secondIndex,"animalsDeathDay_",that.animalStrategy.animalsSeeing,"animalsDeathDay","MM/dd/yyyy");
//let dataStored = that.storedanimalsTyphoidlValues(this.element[0].id);
that.datechangeEnd(that.animalStrategy.animalsSeeing,firstIndex,secondIndex);
}
});
}
onInitTimepicker(id:any,id1:any){
let that=this;
let animalsShaking = $('#animalsShaking_'+id+'_'+id1).kendoTimePicker({
format: "hh:mm:ss tt",
interval: 60,
min: new Date(2000, 0, 1, 5, 0, 0),
max: new Date(3000, 11, 31, 4, 0, 0),
parseFormats: ["hh:mm:ss tt"],
change(e){
//that.pickerTimeChnage('#animalsShaking_'+id+'_'+id1);
//that.animalStrategy.animalsSeeing.animalsShaking=this._oldText;
let a = this.value();
let animalsDots = this.element[0].id;
let findId = animalsDots.substr(animalsDots.indexOf("_") + 1);
var animalsGiveUp = findId.split("_");
var firstIndex = animalsGiveUp[0];
var secondIndex = animalsGiveUp[1];
//that.animalStrategy.animalsSeeing[firstIndex].TigerPlans[secondIndex].animalsShaking = this._oldText;
//that.animalsPoliceFieldNganimalsTyphoidl(this.value(),firstIndex,secondIndex,"animalsShaking_",that.animalStrategy.animalsSeeing,"animalsShaking","hh:mm:ss tt");
//let dataStored = that.storedanimalsTyphoidlValues(this.element[0].id);
that.timeChangeStart(that.animalStrategy.animalsSeeing,firstIndex,secondIndex);
}
});
let animalsUnderstanding = $('#animalsUnderstanding_'+id+'_'+id1).kendoTimePicker({
format: "hh:mm:ss tt",
interval: 60,
parseFormats: ["hh:mm:ss tt"],
min: new Date(2000, 0, 1, 5, 0, 0),
max: new Date(3000, 11, 31, 4, 0, 0),
change(e){
//that.pickerTimeChnage('#animalsUnderstanding_'+id+'_'+id1);
//that.animalStrategy.animalsSeeing.animalsUnderstanding=this._oldText;
let a = this.value();
let animalsDots = this.element[0].id;
let findId = animalsDots.substr(animalsDots.indexOf("_") + 1);
var animalsGiveUp = findId.split("_");
var firstIndex = animalsGiveUp[0];
var secondIndex = animalsGiveUp[1];
//that.animalStrategy.animalsSeeing[firstIndex].TigerPlans[secondIndex].animalsUnderstanding = this._oldText;
//that.animalsPoliceFieldNganimalsTyphoidl(this.value(),firstIndex,secondIndex,"animalsUnderstanding_",that.animalStrategy.animalsSeeing,"animalsUnderstanding","hh:mm:ss tt");
//let dataStored = that.storedanimalsTyphoidlValues(this.element[0].id);
that.timeChangeEnd(that.animalStrategy.animalsSeeing,firstIndex,secondIndex);
}
});
}
sameDayValidation(plananimalsShaking,plananimalsUnderstanding,id,id1,controlFrom): any {
// if ET < "05:00:00 AM" && ST > "01:00:00 AM"
let isValidTime = false;
if (kendo.parseDate(plananimalsUnderstanding) >= kendo.parseDate("12:00:00 AM")) {
//$("#saveEventAction").removeClass('actionanimalsJeansd');
//checking between 12am to 5 am
if (kendo.parseDate(plananimalsShaking) >= kendo.parseDate("12:00:00 AM")
&& kendo.parseDate(plananimalsShaking) < kendo.parseDate("05:00:00 AM")
&& kendo.parseDate(plananimalsUnderstanding) < kendo.parseDate("05:00:00 AM")
&& kendo.parseDate(plananimalsUnderstanding) > kendo.parseDate("12:00:00 AM")
) {
if (kendo.parseDate(plananimalsShaking) < kendo.parseDate(plananimalsUnderstanding)) {
isValidTime = true;
}
}
// checking between (start time)4am to 12 and (ent time) bw 12 to 5am
else if (kendo.parseDate(plananimalsShaking) < kendo.parseDate("11:59:59 PM")
&& kendo.parseDate(plananimalsShaking) >= kendo.parseDate("05:00:00 AM")
&& kendo.parseDate(plananimalsUnderstanding) < kendo.parseDate("05:00:00 AM")
&& kendo.parseDate(plananimalsUnderstanding) >= kendo.parseDate("12:00:00 AM")) {
isValidTime = true;
}
}
// checking between 5am to 12
if (kendo.parseDate(plananimalsUnderstanding) < kendo.parseDate("11:59:59 PM")
&& kendo.parseDate(plananimalsShaking) >= kendo.parseDate("05:00:00 AM")) {
if (kendo.parseDate(plananimalsShaking) < kendo.parseDate(plananimalsUnderstanding)) {
isValidTime = true;
}
}
if(isValidTime){
this.clearFields(id+"_"+id1);
}else{
if(controlFrom == "st"){
$("#stError_"+id+"_"+id1).addClass('mandatoryField');
}else if(controlFrom == "et"){
$("#etError_"+id+"_"+id1).addClass('mandatoryField');
}else if(controlFrom == "sd"){
$("#animalsHMO_"+id+"_"+id1).addClass('mandatoryField');
}else if(controlFrom == "ed"){
$("#edError_"+id+"_"+id1).addClass('mandatoryField');
}
$('#btnanimalsPolice_'+id+'_'+id1).addClass('actionanimalsJeansd');
//$("#saveEventAction").addClass('actionanimalsJeansd');
}
/* */
//else if "12:10:00 AM" < "12:20:00 AM"
}
animalsPoliceFieldNganimalsTyphoidl(selectedVal: any, firstIndex: any, secondIndex: any, replaceStr: string,animalsTyphoidlArray: any,animalsTyphoidlField: string,format:string){
animalsTyphoidlArray[firstIndex].TigerPlans[secondIndex].animalsTyphoidlField = kendo.toString(new Date(selectedVal), format);
/*if(!isNaN(findId)){
animalsTyphoidlArray[findId][animalsTyphoidlField] = kendo.toString(new Date(selectedVal), format);
}*/
}
animalsPoliceCheckboxNganimalsTyphoidl(whale:any,timeZone:any){
/*var isChecked = false;
if(whale.TigerPlanFeeds){
for(var i=0; i<whale.TigerPlanFeeds.length;i++){
if(whale.TigerPlanFeeds[i].feedName.toUppercase().trim() === timeZone){
isChecked = true;
}
}
}else{
isChecked = false;
}
return isChecked; */
}
animalsFever(data){
var regex = /(<([^>]+)>)/ig;
if(data != undefined || data != null){
var removeHtmlTag=data.replace(regex, "");
var removeSpace=removeHtmlTag.replace(/\&nbsp;/g,'');
var finalData=removeSpace.replace(/\s/g,'');
if(finalData.length>0){
return true
}
else{
return false;
}
}
else{
return false;
}
}
finalizereturnData(data){
if(data != undefined || data != null){
var dom = $("<p/>").html(data).html();
var finalData=dom;
// console.log(data);
// console.log(finalData);
return finalData;
}
}
animalsDryerPlansItem(id:number,id1:number,event){
event.stopPropagation();
let that=this;
var status=false;
let data;
if(this.animalStrategy.animalsSeeing.length>0){
if(this.animalStrategy.animalsSeeing[id].operationType!='animalsDryer'){
if(this.animalStrategy.animalsSeeing[id].categoryOpIssue.issueDesc!='' && this.animalStrategy.animalsSeeing[id].categoryOpIssue.issueDesc!= "undefined"){
data=this.animalStrategy.animalsSeeing[id].categoryOpIssue.issueDesc;
if(data==null){
if($('#lv_'+id+'_feedTextarea').length>0){
data=$('#lv_'+id+'_feedTextarea').html();
}
}
if(that.animalsFever(data)==true){
status=true;
}
}
if(this.animalStrategy.animalsSeeing[id].TigerPlans.length>0){
if(this.animalStrategy.animalsSeeing[id].TigerPlans[id1].operationType != "animalsDryer" ){
if(this.animalStrategy.animalsSeeing[id].TigerPlans[id1].planOpIssue.issueDesc!='' && this.animalStrategy.animalsSeeing[id].TigerPlans[id1].planOpIssue.issueDesc!= "undefined"){
var newCreateData=this.animalStrategy.animalsSeeing[id].TigerPlans[id1].planOpIssue.issueDesc;
if(newCreateData==null){
if($('#lv_'+id+'_'+id1+'_feedTextarea').length>0){
newCreateData=$('#lv_'+id+'_'+id1+'_feedTextarea').html();
}
}
if(typeof(newCreateData) == "undefined" ){
status= false;
}
else{
if(that.animalsFever(newCreateData)==true){
status=true;
}
}
}
for(let c=0;c<this.animalStrategy.animalsSeeing[id].TigerPlans[id1].TigerPlanFeeds.length;c++){
if(this.animalStrategy.animalsSeeing[id].TigerPlans[id1].TigerPlanFeeds[c].operationType != "animalsDryer"){
if(this.animalStrategy.animalsSeeing[id].TigerPlans[id1].TigerPlanFeeds[c].feedOpIssue.issueDesc!='' && this.animalStrategy.animalsSeeing[id].TigerPlans[id1].TigerPlanFeeds[c].feedOpIssue.issueDesc!= "undefined"){
var newCreateData=this.animalStrategy.animalsSeeing[id].TigerPlans[id1].TigerPlanFeeds[c].feedOpIssue.issueDesc;
if(newCreateData==null){
if($('#lv_'+id+'_'+id1+'_'+c+'_feedTextarea').length>0){
newCreateData=$('#lv_'+id+'_'+id1+'_'+c+'_feedTextarea').html();
}
}
if(typeof(newCreateData) == "undefined" ){
status= false;
}
else{
if(that.animalsFever(newCreateData)==true){
status=true;
}
}
}
}
}
}
}
}
}
if(status==false) {
that.confirmDialog("This will animalsDryer the plan",id,id1);
}
else{
that.confirmDialog("This will animalsDryer the Plan and Contingency Text",id,id1);
}
}
categoryDD(category:any,id:any,id1: any,oldCategory:any){
this.preSelectedCategory = oldCategory.animalsNokia;
var isError = this.isFieldError(id+"_"+id1);
if(isError){
//$("#btnanimalsPolice_"+id).prop('animalsJeansd', true);
$('#btnanimalsPolice_' +id+'_'+id1).addClass('actionanimalsJeansd');
}else{
//$("#btnanimalsPolice_"+id).prop('animalsJeansd', false);
$('#btnanimalsPolice_' +id+'_'+id1).removeClass('actionanimalsJeansd');
}
}
selectedCheckbox(selectedIdChk: any, plansItem:any,planRowId:any,id1:any,isChecked:any,currentPlan:any){
let that = this;
this.animalsPolicedeathAliveSource={
"id":planRowId,
"id1":id1,
"animalStrategy":this.animalStrategy,
};
var isError = this.isFieldError(planRowId+"_"+id1);
if(isError){
//$("#btnanimalsPolice_"+planRowId+"_"+id1).prop('animalsJeansd', true);
$('#btnanimalsPolice_'+planRowId+'_'+id1).addClass('actionanimalsJeansd');
}else{
//$("#btnanimalsPolice_"+planRowId+"_"+id1).prop('animalsJeansd', false);
$('#btnanimalsPolice_'+planRowId+'_'+id1).removeClass('actionanimalsJeansd');
}
//To Enable the Popup Dialog Box push the event status into delanimalsPoliceTZ variable
//Will used in animalsPoliceTiger Function
//that.backUpTZChk = jQuery.extend(true, [], that.animalStrategy.animalsSeeing);
let feedAvailable=false;
if(currentPlan.TigerPlanFeeds.length==0){
this.delanimalsPoliceTZ.push(true);
}else {
for (let i=0;i<currentPlan.TigerPlanFeeds.length;i++){
let selIntID=parseInt(selectedIdChk);
selIntID=selIntID+10;
if(currentPlan.TigerPlanFeeds[i].animalHumming == selIntID){
if(currentPlan.TigerPlanFeeds[i].isFeedAvailable)
feedAvailable=true;
}
//If All Check box is TimeZone is UNCHECKED
if(selIntID == 15){
if(currentPlan.TigerPlanFeeds[i].isFeedAvailable)
feedAvailable=true;
}
//
}
if(feedAvailable){
this.delanimalsPoliceTZ[selectedIdChk]=isChecked;
}
}
///
if(selectedIdChk === '5'){
if(isChecked){
currentPlan.ET =true;
currentPlan.CT = true;
currentPlan.MT = true;
currentPlan.PT = true;
}else{
currentPlan.ET =false;
currentPlan.CT = false;
currentPlan.MT = false;
currentPlan.PT = false;
if(currentPlan.TigerPlanFeeds.length ==0 && feedAvailable == false){
this.delanimalsPoliceTZ[selectedIdChk] = true;
}
}
}
else{
//that.animalStrategy.animalsSeeing[planRowId]['ALL'] = false;
}
if(currentPlan.ET && currentPlan.MT && currentPlan.PT && currentPlan.CT){
currentPlan.ALL = true;
}
else{
currentPlan.ALL = false;
}
}
animalsPoliceCheckBoxFieldNganimalsTyphoidl(selectedVal: any,animalsDots: any, replaceStr: string,animalsTyphoidlArray: any,animalsTyphoidlField: string){
animalsTyphoidlArray[animalsDots][animalsTyphoidlField] = selectedVal;
return animalsTyphoidlArray;
}
isExpectedPresent():boolean{
let that = this;
for(var j = 0 ; j < this.animalStrategy.animalsSeeing.length ;j++){
if(this.animalStrategy.animalsSeeing[j].categoryDesc.toUpperCase().trim() === "EXPECTED" && this.animalStrategy.animalsSeeing[j].TigerPlans.length !== 0 && this.animalStrategy.animalsSeeing[j].operationType !== "animalsDryer"){
return true;
}
}
return false;
}
animalsPoliceTiger(id:any,id1:any){
this.callanimalsPoliceTiger(id,id1,this.animalStrategy,false);
// this.animalsAliveDeath.push(copy);
}
animalsAliveDeathSet(id:any,id1:any,destinationData,sourceData){
let animalsTalking={
"id":id,
"id1":id1,
"animalStrategy":sourceData,
};
let destinationEvent={
"id":id,
"id1":id1,
"animalStrategy":destinationData,
};
let passData={
"type": "animalsAliveDeath",
"animalsTalking":animalsTalking,
"destinationEvent": destinationEvent,
"initialValue": this.animalsAliveDeath[this.animalsAliveDeath.length-1],
"occurence": {},
"action": "animalsAliveDeath"
};
//let copy2 = Object.assign({}, passData);
this.animalsSwimmingAllRecordedNight(passData);
}
animalsAliveDeathFn(obj:any){
let id=obj.id;
let id1=obj.id1;
let animalStrategy=obj.animalStrategy;
//this.animalStrategy=obj.animalStrategy;
//
//this.animalsJet();
//this.TigerGroupingResources(this.animalStrategy.animalsSeeing[id].TigerPlans[id1],id,id1);
//this.loadTigerDataByDefault(animalStrategy[id].TigerPlans[id1],id,id1);
this.callanimalsPoliceTiger(id,id1,this.animalStrategy,true);
this.loadPreviousPlanDataUndo(animalStrategy[id].TigerPlans[id1],id,id1);
//let that = this;
//this.animalsJet();
}
timeTo12HrFormat(time)
{
var time_part_array = time.split(":");
if (time_part_array[0] > 12) {
time_part_array[0] = time_part_array[0] - 12;
if(time_part_array[0] < 10)
{
time_part_array[0] = "0" + time_part_array[0];
}
}
var formatted_time = time_part_array[0] + ':' + time_part_array[1] + ':' + time_part_array[2];
return formatted_time;
}
timeTo24HrsFormat(time:any){
var hours = Number(time.match(/^(\d+)/)[1]);
var minutes = Number(time.match(/:(\d+)/)[1]);
var AMPM = time.match(/\s(.*)$/)[1];
if (AMPM == "PM" && hours < 12) hours = hours + 12;
if (AMPM == "AM" && hours == 12) hours = hours - 12;
var sHours = hours.toString();
var sMinutes = minutes.toString();
if (hours < 10) sHours = "0" + sHours;
if (minutes < 10) sMinutes = "0" + sMinutes;
return (sHours +':'+sMinutes+':00');
}
callanimalsPoliceTiger(id:any,id1:any,animalStrategyPresent:any,isUndo){
let that = this;
let selectedanimalsNokia = $("#selectCategory_"+id+"_"+id1).val();
let isPlanOutofRange = false;
if(selectedanimalsNokia == 1){
let that = this;
if(selectedanimalsNokia == 1 && that.animalStrategy.animalsSeeing.length !== 1){
let isExpectedCount=0;
let selectedCategoryName = that.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsNokia;
for(var k = 0 ; k < that.animalStrategy.animalsSeeing.length ;k++){
for(let m=0;m<that.animalStrategy.animalsSeeing[k].TigerPlans.length;m++){
if(selectedCategoryName !==1 && that.animalStrategy.animalsSeeing[k].TigerPlans[m].animalsNokia == 1 && that.animalStrategy.animalsSeeing[k].TigerPlans[m].operationType !== 'animalsDryer'){
animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsNokia = selectedCategoryName;
that.setDialog("An Expected Plan already exists in this Event.");
$('#btnanimalsPolice_' + id + '_' + id1).addClass('actionanimalsJeansd');
$("#selectCategory_"+id+"_"+id1).val(animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsNokia);
return;
}
}
}
}
let selectedPlananimalsShaking = $("#animalsShaking_"+id+"_"+id1).val();//animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsShaking;
let selectedPlan24hrsanimalsShaking = that.timeTo24HrsFormat($("#animalsShaking_"+id+"_"+id1).val())//that.timeTo24HrsFormat(animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsShaking);
let selectedPlananimalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val()+' '+selectedPlananimalsShaking;//animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsBirthDay+' '+selectedPlananimalsShaking;
let selectedPlananimalsUnderstanding = $("#animalsUnderstanding_"+id+"_"+id1).val();//animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsUnderstanding;
let selectedPlan24hrsanimalsUnderstanding = that.timeTo24HrsFormat($("#animalsUnderstanding_"+id+"_"+id1).val());//that.timeTo24HrsFormat(animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsUnderstanding);
let selectedPlananimalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val()+' '+selectedPlananimalsUnderstanding; //animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsDeathDay+' '+selectedPlananimalsUnderstanding;
let action = "contingencyplans/v1/expectedPlanOverlaps";
let type = "post";
let data ={
"animalsShaking":selectedPlan24hrsanimalsShaking,
"animalsUnderstanding":selectedPlan24hrsanimalsUnderstanding,
"animalsBirthDay":selectedPlananimalsBirthDay,
"animalsDeathDay":selectedPlananimalsDeathDay,
"animalStamina":this.animalStamina,
"checkExpectedExistForSameEvent" : "N",
"networkNo" : "101"
};
that.progress.requestStart();
that.animalService.getResponse(action, type, data)
.subscribe(data => {
if(data.code == 'S500'){
that.callanimalsPolicePlan(id,id1,animalStrategyPresent,isUndo);
}else if(data.code == 'E500'){
this.expectedDetails = data.details;
//Issue Fixed - CR-18586 - Observation 2
isPlanOutofRange = that.validatePlanOutofRange(id,id1,animalStrategyPresent);
//
if(!isUndo) {
if(!isPlanOutofRange)
that.expectedDialog(id,id1,animalStrategyPresent,this.expectedDetails);
}else{
that.callanimalsPolicePlan(id,id1,animalStrategyPresent,isUndo);
}
}
that.progress.requestEnd();
}, err => {
that.setDialog("Undefined error, Please try again.");
that.progress.requestEnd();
});
}else{
that.callanimalsPolicePlan(id,id1,animalStrategyPresent,isUndo);
}
//that.enableanimalsJeansSave(true)
}
validatePlanOutofRange(id:any,id1:any,animalStrategyPresent:any){
let that = this;
// let selectedPlananimalsBirthDay = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsBirthDay;
// let selectedPlananimalsShaking = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsShaking;
let eventanimalsBirthDay = that.TigerLeftTab.ParrotanimalsBirthDay;
// let selectedPlananimalsDeathDay = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsDeathDay;
// let selectedPlananimalsUnderstanding = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsUnderstanding;
let selectedPlananimalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let selectedPlananimalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let selectedPlananimalsShaking = $("#animalsShaking_"+id+"_"+id1).val();
let selectedPlananimalsUnderstanding = $("#animalsUnderstanding_"+id+"_"+id1).val();
let eventanimalsDeathDay = that.TigerLeftTab.ParrotanimalsDeathDay;
let stTime = that.TigerLeftTab.ParrotanimalsShaking;
let animalsUnderstanding = that.TigerLeftTab.ParrotanimalsUnderstanding;
if(((Tigercrow.prototype.getNumberofDays(eventanimalsDeathDay,selectedPlananimalsDeathDay) -1) > 2) || ((Tigercrow.prototype.getNumberofDays(eventanimalsBirthDay,selectedPlananimalsBirthDay) -1) > 2))
{
// rohi code
if(((Tigercrow.prototype.getNumberofDays(eventanimalsDeathDay,selectedPlananimalsDeathDay) -1) > 2))
{
that.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsDeathDay=eventanimalsDeathDay;
}
if(((Tigercrow.prototype.getNumberofDays(eventanimalsBirthDay,selectedPlananimalsBirthDay) -1) > 2))
{
that.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsBirthDay=eventanimalsBirthDay;
}
// end
that.setDialogPlanDateRange(id,id1);
$('#btnanimalsPolice_' + id + '_' + id1).addClass('actionanimalsJeansd');
//isPlanFallsOutside = true;
//isExpectedPresent = true;
return true;
}
}
callanimalsPolicePlan(id:any,id1:any,animalStrategyPresent:any,isUndo){
let that = this;
let enableDialogPopup;
let plansLength = animalStrategyPresent.animalsSeeing.length;
let isExpectedPresent = false;
let isAirings = false;
let animalStrategy = animalStrategyPresent.animalsSeeing;
if(this.delanimalsPoliceTZ.length ===0){
enableDialogPopup = true;
}
for(var i=0; i<this.delanimalsPoliceTZ.length; i++){
if(this.delanimalsPoliceTZ[i] === false){
enableDialogPopup = this.delanimalsPoliceTZ[i];
}
}
this.delanimalsPoliceTZ = [];
let isPlanFallsOutside = false;
//Issue Fixed - CR-16268
// let selectedPlananimalsBirthDay = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsBirthDay;
// let selectedPlananimalsShaking = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsShaking;
let eventanimalsBirthDay = that.TigerLeftTab.ParrotanimalsBirthDay;
// let selectedPlananimalsDeathDay = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsDeathDay;
// let selectedPlananimalsUnderstanding = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsUnderstanding;
let selectedPlananimalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let selectedPlananimalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let selectedPlananimalsShaking = $("#animalsShaking_"+id+"_"+id1).val();
let selectedPlananimalsUnderstanding = $("#animalsUnderstanding_"+id+"_"+id1).val();
let eventanimalsDeathDay = that.TigerLeftTab.ParrotanimalsDeathDay;
let stTime = that.TigerLeftTab.ParrotanimalsShaking;
let animalsUnderstanding = that.TigerLeftTab.ParrotanimalsUnderstanding;
if(((Tigercrow.prototype.getNumberofDays(eventanimalsDeathDay,selectedPlananimalsDeathDay) -1) > 2) || ((Tigercrow.prototype.getNumberofDays(eventanimalsBirthDay,selectedPlananimalsBirthDay) -1) > 2))
{
// rohi code
if(((Tigercrow.prototype.getNumberofDays(eventanimalsDeathDay,selectedPlananimalsDeathDay) -1) > 2))
{
that.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsDeathDay=eventanimalsDeathDay;
}
if(((Tigercrow.prototype.getNumberofDays(eventanimalsBirthDay,selectedPlananimalsBirthDay) -1) > 2))
{
that.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsBirthDay=eventanimalsBirthDay;
}
// end
that.setDialogPlanDateRange(id,id1);
$('#btnanimalsPolice_' + id + '_' + id1).addClass('actionanimalsJeansd');
isPlanFallsOutside = true;
isExpectedPresent = true;
// setTimeout(function() {
// that.enableanimalsJeansSave(true);
// }, 1000);
return;
}
//Ends Here
let sch_plan_feeds = that.animalStrategy.animalsSeeing[id].TigerPlans[id1].TigerPlanFeeds;
let TigerPlananimalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let TigerPlananimalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let TigerPlananimalsShaking = $("#animalsShaking_"+id+"_"+id1).val();
let TigerPlananimalsUnderstanding = $("#animalsUnderstanding_"+id+"_"+id1).val();
/*let TigerPlananimalsBirthDay = that.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsBirthDay;
let TigerPlananimalsShaking = that.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsShaking;
let TigerPlananimalsDeathDay = that.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsDeathDay;
let TigerPlananimalsUnderstanding = that.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsUnderstanding; */
//Condition to check prevData (that.animalsInternet) present for the selected plan
if(that.animalsInternet != undefined && that.animalsInternet.length > 0){
if(that.animalsInternet[id] != undefined){
if(that.animalsInternet[id].TigerPlans[id1] != undefined){
let preTigerPlananimalsBirthDay = that.animalsInternet[id].TigerPlans[id1].animalsBirthDay;
let preTigerPlananimalsShaking = that.animalsInternet[id].TigerPlans[id1].animalsShaking;
let preTigerPlananimalsDeathDay = that.animalsInternet[id].TigerPlans[id1].animalsDeathDay;
let preTigerPlananimalsUnderstanding = that.animalsInternet[id].TigerPlans[id1].animalsUnderstanding;
//Condition to Check Airing while animalsPolice plan
// if((kendo.parseDate(TigerPlananimalsBirthDay + " " + TigerPlananimalsShaking).getTime() > (kendo.parseDate(preTigerPlananimalsBirthDay + " " + preTigerPlananimalsShaking).getTime())) || (kendo.parseDate(TigerPlananimalsDeathDay + " " + TigerPlananimalsUnderstanding).getTime() < (kendo.parseDate(preTigerPlananimalsDeathDay + " " + preTigerPlananimalsUnderstanding)).getTime()) )
isAirings = true;
let animalsBirthDayTemp = new Date(TigerPlananimalsBirthDay + " " + TigerPlananimalsShaking);
let preanimalsBirthDayTemp = new Date(preTigerPlananimalsBirthDay + " " + preTigerPlananimalsShaking);
let animalsDeathDayTemp = new Date(TigerPlananimalsDeathDay + " " + TigerPlananimalsUnderstanding);
let preanimalsDeathDayTemp = new Date(preTigerPlananimalsDeathDay + " " + preTigerPlananimalsUnderstanding);
if(animalsBirthDayTemp.getHours() >= 5){
animalsBirthDayTemp.setHours(animalsBirthDayTemp.getHours()-5);
}else{
animalsBirthDayTemp.setHours(animalsBirthDayTemp.getHours()+19);
}
if(preanimalsBirthDayTemp.getHours() >= 5){
preanimalsBirthDayTemp.setHours(preanimalsBirthDayTemp.getHours()-5);
}else{
preanimalsBirthDayTemp.setHours(preanimalsBirthDayTemp.getHours()+19);
}
if(animalsDeathDayTemp.getHours() >= 5){
animalsDeathDayTemp.setHours(animalsDeathDayTemp.getHours()-5);
}else{
animalsDeathDayTemp.setHours(animalsDeathDayTemp.getHours()+19);
}
if(preanimalsDeathDayTemp.getHours() >= 5){
preanimalsDeathDayTemp.setHours(preanimalsDeathDayTemp.getHours()-5);
}else{
preanimalsDeathDayTemp.setHours(preanimalsDeathDayTemp.getHours()+19);
}
if((kendo.parseDate(TigerPlananimalsBirthDay + " " + TigerPlananimalsShaking).getTime() != (kendo.parseDate(preTigerPlananimalsBirthDay + " " + preTigerPlananimalsShaking).getTime()))){
if(animalsBirthDayTemp > preanimalsBirthDayTemp){
isAirings = true;
}else{
isAirings = false;
}
}
if((kendo.parseDate(TigerPlananimalsDeathDay + " " + TigerPlananimalsUnderstanding).getTime() != (kendo.parseDate(preTigerPlananimalsDeathDay + " " + preTigerPlananimalsUnderstanding)).getTime()) ){
if(animalsDeathDayTemp < preanimalsDeathDayTemp){
isAirings = true;
}else{
isAirings = false;
}
}
}
}
}
//Ends here
if(!isPlanFallsOutside){
let selectedCategory = $("#selectCategory_"+id+"_"+id1).val();
if(selectedCategory == 1 && animalStrategy.length !== 1){
for(var k = 0 ; k < animalStrategy.length ;k++){
if(id !== k){
if(animalStrategy[k].animalsNokia == 1 && animalStrategy[k].operationType !== 'animalsDryer'){
that.setDialog("An Expected Plan already exists in this Event.");
$("#selectCategory_"+id+"_"+id1).val(animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsNokia);
isExpectedPresent = true;
}
}
}
}
}
if(!isExpectedPresent){
TigerPlananimalsBirthDay = TigerPlananimalsBirthDay + " " + TigerPlananimalsShaking;
TigerPlananimalsDeathDay = TigerPlananimalsDeathDay + " " + TigerPlananimalsUnderstanding;
let kendoanimalsBirthDayTime = new Date(TigerPlananimalsBirthDay);
let kendoanimalsDeathDayTime = new Date(TigerPlananimalsDeathDay);
if(kendoanimalsBirthDayTime.getHours() >= 5){
kendoanimalsBirthDayTime.setHours(kendoanimalsBirthDayTime.getHours()-5);
}else{
kendoanimalsBirthDayTime.setHours(kendoanimalsBirthDayTime.getHours()+19);
}
if(kendoanimalsDeathDayTime.getHours() >= 5){
kendoanimalsDeathDayTime.setHours(kendoanimalsDeathDayTime.getHours()-5);
}else{
kendoanimalsDeathDayTime.setHours(kendoanimalsDeathDayTime.getHours()+19);
}
let TigerPlanConfigData = that.Tigercrow.TigerPlanConfigData[id+'_'+id1];
if(TigerPlanConfigData != undefined && TigerPlanConfigData.length >0 && isAirings){
for(var i=0; i<TigerPlanConfigData.length; i++) {
if (!TigerPlanConfigData[i].includes("Tiger_Nat")) {
let animalAgeanimalsBirthDay:any = [];
let animalAgeanimalsDeathDay:any = [];
var animalAgeData = [];
if(that.Tigercrow._TigeranimalAge[TigerPlanConfigData[i]] !== undefined){
animalAgeData = that.Tigercrow._TigeranimalAge[TigerPlanConfigData[i]]._data;
}
for(var j=0; j<animalAgeData.length; j++){
var start = new Date(animalAgeData[j].start);
var end = new Date(animalAgeData[j].end);
if (TigerPlanConfigData[i].includes("Tiger_Est")) {
animalAgeanimalsBirthDay.push({"start":start});
animalAgeanimalsDeathDay.push({"end":end});
} else if (TigerPlanConfigData[i].includes("Tiger_Cent")) {
animalAgeanimalsBirthDay.push({"start":start});
animalAgeanimalsDeathDay.push({"end":end});
} else if (TigerPlanConfigData[i].includes("Tiger_Mount")) {
animalAgeanimalsBirthDay.push({"start":start});
animalAgeanimalsDeathDay.push({"end":end});
} else if (TigerPlanConfigData[i].includes("Tiger_Pacifi")) {
animalAgeanimalsBirthDay.push({"start":start});
animalAgeanimalsDeathDay.push({"end":end});
}
}
let cloneanimalsBirthDayanimalAge = new kendo.data.Query(animalAgeanimalsBirthDay);
let filteranimalsBirthDayData = cloneanimalsBirthDayanimalAge.filter({
operator: "lt",
field: "start",
value: kendoanimalsBirthDayTime
}).data;
let cloneanimalsDeathDayanimalAge = new kendo.data.Query(animalAgeanimalsDeathDay);
let filteranimalsDeathDayData = cloneanimalsDeathDayanimalAge.filter({
operator: "gt",
field: "end",
value: kendoanimalsDeathDayTime
}).data;
if(filteranimalsBirthDayData.length > 0 || filteranimalsDeathDayData.length >0 ){
let selectedCategory = $("#selectCategory_"+id+"_"+id1).val();
that.airingsConfirmDialog("This will animalsDryer airing(s) that fall outside new Plan range.", id, id1, animalStrategyPresent,selectedCategory,isUndo);
return;
}
}
}
}
/* for(var i =0 ; i<sch_plan_feeds.length ; i++){
let TigerPlans = sch_plan_feeds[i];
let animalAgeanimalsBirthDay:any = [];
let animalAgeanimalsDeathDay:any = [];
if(TigerPlans.TigerItems && TigerPlans.TigerItems.length > 0 && isAirings){
for(var r=0; r<TigerPlans.TigerItems.length; r++){
var start = new Date(TigerPlans.TigerItems[r].start);
var end = new Date(TigerPlans.TigerItems[r].end);
if(TigerPlans.TigerItems[r].animalHumming == 11){
animalAgeanimalsBirthDay.push({"start":start});
animalAgeanimalsDeathDay.push({"end":end});
}else if(TigerPlans.TigerItems[r].animalHumming == 12){
animalAgeanimalsBirthDay.push({"start":start});
animalAgeanimalsDeathDay.push({"end":end});
}else if(TigerPlans.TigerItems[r].animalHumming == 13){
animalAgeanimalsBirthDay.push({"start":start});
animalAgeanimalsDeathDay.push({"end":end});
}else if(TigerPlans.TigerItems[r].animalHumming == 14){
animalAgeanimalsBirthDay.push({"start":start});
animalAgeanimalsDeathDay.push({"end":end});
}
//
if(TigerPlans.TigerItems[r].animalHumming == 11){
animalAgeanimalsBirthDay.push({"start":new Date(start.setHours(start.getHours()-5))});
animalAgeanimalsDeathDay.push({"end":new Date(end.setHours(end.getHours()-5))});
}else if(TigerPlans.TigerItems[r].animalHumming == 12){
animalAgeanimalsBirthDay.push({"start":new Date(start.setHours(start.getHours()-4))});
animalAgeanimalsDeathDay.push({"end":new Date(end.setHours(end.getHours()-4))});
}else if(TigerPlans.TigerItems[r].animalHumming == 13){
animalAgeanimalsBirthDay.push({"start":new Date(start.setHours(start.getHours()-3))});
animalAgeanimalsDeathDay.push({"end":new Date(end.setHours(end.getHours()-3))});
}else if(TigerPlans.TigerItems[r].animalHumming == 14){
animalAgeanimalsBirthDay.push({"start":new Date(start.setHours(start.getHours()-2))});
animalAgeanimalsDeathDay.push({"end":new Date(end.setHours(end.getHours()-2))});
}
//
}
let cloneanimalsBirthDayanimalAge = new kendo.data.Query(animalAgeanimalsBirthDay);
let filteranimalsBirthDayData = cloneanimalsBirthDayanimalAge.filter({
operator: "lt",
field: "start",
value: kendoanimalsBirthDayTime
}).data;
let cloneanimalsDeathDayanimalAge = new kendo.data.Query(animalAgeanimalsDeathDay);
let filteranimalsDeathDayData = cloneanimalsDeathDayanimalAge.filter({
operator: "gt",
field: "end",
value: kendoanimalsDeathDayTime
}).data;
if(filteranimalsBirthDayData.length > 0 || filteranimalsDeathDayData.length >0 ){
let selectedCategory = $("#selectCategory_"+id+"_"+id1).val();
that.airingsConfirmDialog("This will animalsDryer airing(s) that fall outside new Plan range.", id, id1, animalStrategyPresent,selectedCategory);
return;
}
}
}
*/
let animalsPoliceData;
if(enableDialogPopup === false) {
let animalsDryerTZConfirm = $("#animalsDryerTZConfirmDialog").data("animalsEatinGindow").center().open();
$("#tZanimalsPoliceMsg").text("This will animalsDryer the TimeZone Grid");
$('#animalsDryerTZConfirmDialog').prev().find(".alieNwindow-title").text("Fox");
$("#animalsDryerTZYES").unbind().click(function() {
let planData = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1];
let isanimalsCommunicationDataChanged = that.isanimalsCommunicationDataChanged(that.animalsInternet,id,id1);
//if the plan timings and date's are changed/modified means isanimalsCommunicationDataChanged will be true
if(isanimalsCommunicationDataChanged){
that.plananimalsCommunicationanimalsPoliced(planData,id,id1, animalStrategyPresent,isUndo);
}else{
that.plananimalsPolice(planData,id,id1, animalStrategyPresent,isUndo);
}
animalsDryerTZConfirm.close();
});
$("#animalsDryerTZNO").unbind().click(function() {
//console.log(that.animalsInternet);
that.loadPreviousPlanData(that.animalsInternet,id,id1);
animalsDryerTZConfirm.close();
});
}else if(typeof enableDialogPopup != undefined && enableDialogPopup != false){
animalsPoliceData = true;
}
//that.animalStrategy.animalsSeeing[id].categoryDesc = that.animalStrategy.animalsSeeing[id]['name'];
//that.generateTiger("animalsCommunicationTiger_"+id);
if(animalsPoliceData){
let that = this;
let planData = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1];
let selectedCategory = $("#selectCategory_"+id+"_"+id1).val();
if(that.animalsInternet != undefined){
let isanimalsCommunicationDataChanged = that.isanimalsCommunicationDataChanged(that.animalsInternet,id,id1);
//if the plan timings and date's are changed/modified means isanimalsCommunicationDataChanged will be true
if(isanimalsCommunicationDataChanged){
that.plananimalsCommunicationanimalsPoliced(planData,id,id1, animalStrategyPresent,isUndo);
}else{
that.plananimalsPolice(planData,id,id1, animalStrategyPresent,isUndo);
}
}
}
}
//console.log(animalStrategyPresent);
this.enableanimalsJeansSave(false);
}
plananimalsPolice(planData:any,id:any,id1:any, animalStrategyPresent:any,isUndo:any){
let that = this;
let TigerPlananimalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let TigerPlananimalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let TigerPlananimalsShaking = $("#animalsShaking_"+id+"_"+id1).val();
let TigerPlananimalsUnderstanding = $("#animalsUnderstanding_"+id+"_"+id1).val();
planData.animalsBirthDay = kendo.toString(kendo.parseDate(TigerPlananimalsBirthDay), "MM/dd/yyyy");
planData.animalsDeathDay = kendo.toString(kendo.parseDate(TigerPlananimalsDeathDay), "MM/dd/yyyy");
planData.animalsShaking = kendo.toString(kendo.parseDate(TigerPlananimalsShaking),"hh:mm:ss tt");
planData.animalsUnderstanding = kendo.toString(kendo.parseDate(TigerPlananimalsUnderstanding), "hh:mm:ss tt");
that.TigerGroupingResources(planData,id,id1);
that.Tigercrow.TigerId = 'Tiger_Nat_Main';
if(that.animalsInternet != undefined){
let extendPlanLength = that.animalsInternet.length;
$('#btnanimalsPolice_' + id + '_' + id1).addClass('actionanimalsJeansd');
let selectedCategory = $("#selectCategory_"+id+"_"+id1).val();
if((selectedCategory != that.animalsInternet[id].animalsNokia)){
that.regroupanimalStrategy1(that.animalStrategy.animalsSeeing,id,id1,that.categoryType(selectedCategory),selectedCategory);
}
}
if(!isUndo){
that.animalsAliveDeathSet(id,id1,animalStrategyPresent.animalsSeeing,that.animalsInternet);
}
that.animalsInternet = jQuery.extend(true,[],animalStrategyPresent.animalsSeeing);
that.animalsHello();
that.delanimalsPoliceTZ = [];
}
plananimalsCommunicationanimalsPoliced(planData:any,id:any,id1:any, animalStrategyPresent:any,isUndo:any){
let that = this;
let selectedanimalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let selectedanimalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let selectedanimalsShaking = $("#animalsShaking_"+id+"_"+id1).val();
let selectedanimalsUnderstanding = $("#animalsUnderstanding_"+id+"_"+id1).val();
let datas = {
"networks": [101],
"days": [0, 1, 2, 3, 4, 5, 6],
"animalsBirthDay": kendo.toString(new Date(selectedanimalsBirthDay), 'yyyy-MM-dd'),
"animalsDeathDay": kendo.toString(new Date(selectedanimalsDeathDay), 'yyyy-MM-dd'),
"animalsShaking": that.convertTo24HouranimalsCommunication(selectedanimalsShaking),
"animalsUnderstanding": that.convertTo24HouranimalsCommunication(selectedanimalsUnderstanding),
"type": "NE",
"strTime": selectedanimalsShaking,
"endEveTime": selectedanimalsUnderstanding
};
let action = "Tigers/v1/Tigers";
that.progress.requestStart();
that.animalService.getResponse(action, 'post', datas).subscribe(data => {
let decompressedData = that.decompressJsonResponse(data.zipdata);
if (decompressedData.code == "S304") {
//console.log(decompressedData);
let decompressedData = that.decompressJsonResponse(data.zipdata);
var animalsCommunicationItems = jQuery.extend(true,[],decompressedData.Tigers.TigerItems);
if(that.backupDataOrg.TigerEvent.TigerPlanCategories){
for(var t=0;t<that.backupDataOrg.TigerEvent.TigerPlanCategories.length;t++){
for(var s=0;s<that.backupDataOrg.TigerEvent.TigerPlanCategories[t].TigerPlans.length;s++){
that.backupDataOrg.TigerEvent.TigerPlanCategories[t].TigerPlans[s].animalsCommunicationItems = animalsCommunicationItems;
}
}
}
animalStrategyPresent.animalsSeeing[id].TigerPlans[id1].animalsCommunicationItems=decompressedData.Tigers.TigerItems;
let TigerPlananimalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let TigerPlananimalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let TigerPlananimalsShaking = $("#animalsShaking_"+id+"_"+id1).val();
let TigerPlananimalsUnderstanding = $("#animalsUnderstanding_"+id+"_"+id1).val();
planData.animalsBirthDay = kendo.toString(kendo.parseDate(TigerPlananimalsBirthDay), "MM/dd/yyyy");
planData.animalsDeathDay = kendo.toString(kendo.parseDate(TigerPlananimalsDeathDay), "MM/dd/yyyy");
planData.animalsShaking = kendo.toString(kendo.parseDate(TigerPlananimalsShaking),"hh:mm:ss tt");
planData.animalsUnderstanding = kendo.toString(kendo.parseDate(TigerPlananimalsUnderstanding), "hh:mm:ss tt");
that.TigerGroupingResources(planData,id,id1);
that.Tigercrow.TigerId = 'Tiger_Nat_Main';
if(that.animalsInternet != undefined){
let extendPlanLength = that.animalsInternet.length;
$('#btnanimalsPolice_' + id + '_' + id1).addClass('actionanimalsJeansd');
let selectedCategory = $("#selectCategory_"+id+"_"+id1).val();
if((selectedCategory != that.animalsInternet[id].animalsNokia)){
that.regroupanimalStrategy1(that.animalStrategy.animalsSeeing,id,id1,that.categoryType(selectedCategory),selectedCategory);
}
}
if(!isUndo){
that.animalsAliveDeathSet(id,id1,animalStrategyPresent.animalsSeeing,that.animalsInternet);
}
that.animalsInternet = jQuery.extend(true,[],animalStrategyPresent.animalsSeeing);
that.animalsHello();
that.delanimalsPoliceTZ = [];
}
that.progress.requestEnd();
}, err => {
that.setDialog("Undefined error, Please try again.");
that.progress.requestEnd();
});
}
isanimalsCommunicationDataChanged(orginalData:any,id:any,id1:any){
let that = this;
let selectedanimalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let selectedanimalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let selectedanimalsShaking = $("#animalsShaking_"+id+"_"+id1).val();
let selectedanimalsUnderstanding = $("#animalsUnderstanding_"+id+"_"+id1).val();
let isDataChanged = false;
if(selectedanimalsBirthDay != that.animalsInternet[id].TigerPlans[id1].animalsBirthDay ||
selectedanimalsDeathDay != that.animalsInternet[id].TigerPlans[id1].animalsDeathDay ||
selectedanimalsShaking != that.animalsInternet[id].TigerPlans[id1].animalsShaking ||
selectedanimalsUnderstanding != that.animalsInternet[id].TigerPlans[id1].animalsUnderstanding
){
isDataChanged = true;
}
//console.log(isDataChanged);
return isDataChanged;
}
regroupCategoryDataanimalsClapping(animalStrategy:any,position:any,animalsTyphoid,get,put){
let that=this;
//console.log(animalStrategy);
//console.log(position);
if(animalsTyphoid==true){
this.chkMoveMergeDialog('upCat',animalStrategy,position,animalsTyphoid,get,put);
return;
}
else{
if(position.length ==1){
let levelIndex=[];
$('#cntContext .forCntChkPopup').each(function(){
if($.trim($(this).text())!='') {
levelIndex.push($(this).index())
}
});
// for(let i=1; i<=animalStrategy.length; i++){
// if(animalStrategy[i-1].operationType !== "animalsDryer"){
// levelIndex.push(i-1);
// }
// }
//console.log(levelIndex)
let currentPostion = parseInt(position[0]);
let getIndex=levelIndex.indexOf(currentPostion);
let previousPosition;
if(levelIndex[getIndex-2]!=undefined){
previousPosition = levelIndex[getIndex-2]; //currentPostion-2;
}else{
previousPosition=-1;
}
let nextPosition = levelIndex[getIndex+1]; //currentPostion+1;
let movePosition=levelIndex[getIndex-1]; //currentPostion-1;
let isanimalsDryerd = false;
let isanimalsDryerd1 = false;
if(previousPosition<0){
animalStrategy.splice(0,0,animalStrategy[currentPostion]);
animalStrategy.splice(currentPostion+1,1);
}
else{
let isData = false;
let isNextanimalStrategyanimalsDryerd = false;
let immediatePreviosPosition = movePosition;
if(animalStrategy[immediatePreviosPosition].operationType == 'animalsDryer'){
isData = true;
}
outterLoop:
for(let i=previousPosition;i>=0;i--){
isNextanimalStrategyanimalsDryerd = true;
if(animalStrategy[i].operationType != 'animalsDryer'){
if(animalStrategy[currentPostion].operationType != 'animalsDryer'){
if(animalStrategy[i].categoryDesc == animalStrategy[currentPostion].categoryDesc){
for(let j=0;j<animalStrategy[currentPostion].TigerPlans.length;j++){
if(animalStrategy[currentPostion].TigerPlans[j].operationType !="Create"){
animalStrategy[currentPostion].TigerPlans[j].operationType ="animalsPolice"
}
animalStrategy[i].TigerPlans.push(animalStrategy[currentPostion].TigerPlans[j]);
if(animalStrategy[i].operationType !="Create"){
animalStrategy[i].operationType='animalsPolice';
}
}
isanimalsDryerd = true;
animalStrategy.splice(currentPostion,1);
}else{
if(isData){
let pos = i-1;
if(pos<=0){
animalStrategy.splice(0,0,animalStrategy[currentPostion]);
}else{
animalStrategy.splice(pos,0,animalStrategy[currentPostion]);
}
}else{
animalStrategy.splice(i+1,0,animalStrategy[currentPostion]);
}
//animalStrategy[currentPostion].operationType = 'animalsDryer';
//console.log();
animalStrategy.splice(currentPostion+1,1);
}
isNextanimalStrategyanimalsDryerd = false;
break outterLoop;
}
}
}
if(isNextanimalStrategyanimalsDryerd){
animalStrategy.splice(previousPosition,0,animalStrategy[currentPostion]);
//animalStrategy[currentPostion].operationType = 'animalsDryer';
//console.log(currentPostion+1);
animalStrategy.splice(currentPostion+1,1);
}
}
let currentPos;
let nextPos;
// if(isanimalsDryerd){
// currentPos = movePosition;
// nextPos = parseInt(currentPos)+1;
// }else{
// currentPos =currentPostion;
// nextPos = parseInt(currentPos)+1;
// //nextPos = movePosition;
// }
if(isanimalsDryerd){
currentPos = movePosition;
nextPos = nextPosition;
}else{
currentPos = position[0];
nextPos = nextPosition;
}
outterLoop1:
for(let k=nextPos;k<animalStrategy.length;k++){
if(animalStrategy[k].operationType != 'animalsDryer'){
if(animalStrategy[currentPos].operationType != 'animalsDryer'){
if(animalStrategy[k].categoryDesc == animalStrategy[currentPos].categoryDesc){
for(let j=0;j<animalStrategy[k].TigerPlans.length;j++){
if(animalStrategy[k].TigerPlans[j].operationType !="Create"){
animalStrategy[k].TigerPlans[j].operationType ="animalsPolice";
}
animalStrategy[currentPos].TigerPlans.push(animalStrategy[k].TigerPlans[j]);
if(animalStrategy[currentPos].operationType !="Create"){
animalStrategy[currentPos].operationType='animalsPolice';
}
}
//if(animalStrategy[k].operationType !="Create"){
//animalStrategy[k].operationType ="animalsDryer";
//}else{
animalStrategy.splice(k,1);
//}
}
break outterLoop1;
}
}
}
if(isanimalsDryerd){
//if(animalStrategy[currentPostion].operationType !="Create"){
//animalStrategy[currentPostion].operationType ="animalsDryer";
//}else{
//animalStrategy.splice(currentPostion,1);
//}
}
if(isanimalsDryerd1){
//if(animalStrategy[currentPostion].operationType !="Create"){
//animalStrategy[currentPostion].operationType ="animalsDryer";
//}else{
//animalStrategy.splice(currentPostion+1,1);
//}
}
}
//console.log(animalStrategy);
}
}
regroupPlanDataanimalsClapping(animalStrategy:any,position:any,animalsTyphoid,get,put){
//console.log(animalsTyphoid)
let that=this;
if(animalsTyphoid==true){
this.chkMoveMergeDialog('upPlan',animalStrategy,position,animalsTyphoid,get,put);
return;
}
else{
let currentanimalsNokia = parseInt(position[0]);
let currentPlanNo = parseInt(position[1]);
let isanimalsDryerd = false;
//console.log(currentanimalsNokia);
//console.log(currentPlanNo);
//console.log(animalStrategy);
var backUpData = jQuery.extend(true, [], animalStrategy);
//console.log(backUpData);
if(currentanimalsNokia == 1){
let previousanimalsNokia = currentanimalsNokia-1;
if(animalStrategy[previousanimalsNokia].operationType!="animalsDryer"){
if(animalStrategy[currentanimalsNokia].TigerPlans.length==1){
//console.log("splice the category itself");
animalStrategy.splice(0,0,animalStrategy[currentanimalsNokia]);
animalStrategy.splice(currentanimalsNokia+1,1);
}else{
//console.log("splice only that plan and check other plans are is animalsDryerd, if so then change the op type of the category to animalsDryer");
let temp = {
categoryDesc:animalStrategy[currentanimalsNokia].categoryDesc,
animalsNokia:animalStrategy[currentanimalsNokia].animalsNokia,
categoryOpIssue:{issueDesc:animalStrategy[currentanimalsNokia].categoryOpIssue.issueDesc},
operationType:"Create",
TigerPlans:[]
};
temp.TigerPlans.push(animalStrategy[currentanimalsNokia].TigerPlans[0]);
animalStrategy.splice(0,0,temp);
animalStrategy[currentanimalsNokia+1].TigerPlans.splice(0,1);
let defaultOperationType = animalStrategy[currentanimalsNokia+1].operationType;
animalStrategy[currentanimalsNokia+1].operationType = 'animalsDryer';
for(let i=0;i<animalStrategy[currentanimalsNokia+1].TigerPlans.length;i++){
if(animalStrategy[currentanimalsNokia+1].TigerPlans[i].operationType !='animalsDryer'){
animalStrategy[currentanimalsNokia+1].operationType = defaultOperationType;
break;
}
}
}
}
let currentPos = position[0];
let nextPos = parseInt(currentPos)+1;
outterLoop1:
for(let k=nextPos;k<animalStrategy.length;k++){
if(animalStrategy[k].operationType != 'animalsDryer'){
if(animalStrategy[currentPos].operationType != 'animalsDryer'){
if(animalStrategy[k].categoryDesc == animalStrategy[currentPos].categoryDesc){
for(let j=0;j<animalStrategy[k].TigerPlans.length;j++){
if(animalStrategy[k].TigerPlans[j].operationType !="Create"){
animalStrategy[k].TigerPlans[j].operationType ="animalsPolice";
}
animalStrategy[currentPos].TigerPlans.push(animalStrategy[k].TigerPlans[j]);
if(animalStrategy[currentPos].operationType !="Create"){
animalStrategy[currentPos].operationType='animalsPolice';
}
}
//if(animalStrategy[k].operationType !="Create"){
//animalStrategy[k].operationType ="animalsDryer";
//}else{
animalStrategy.splice(k,1);
//}
}
break outterLoop1;
}
}
}
}else{
let prevanimalsNokia = currentanimalsNokia-2;
let isNextDataanimalsDryerd = false;
let isData = false;
let immediatePreviosPosition = currentanimalsNokia-1;
if(animalStrategy[immediatePreviosPosition].operationType == 'animalsDryer'){
isData = true;
}
for(let i=prevanimalsNokia;i>=0;i--){
isNextDataanimalsDryerd = true;
if(animalStrategy[i].operationType!="animalsDryer"){
if(animalStrategy[currentanimalsNokia].operationType!="animalsDryer"){
if(animalStrategy[i].categoryDesc == animalStrategy[currentanimalsNokia].categoryDesc){
if(animalStrategy[currentanimalsNokia].TigerPlans.length==1){
//console.log("splice the category itself");
animalStrategy[i].TigerPlans.push(animalStrategy[currentanimalsNokia].TigerPlans[currentPlanNo]);
animalStrategy.splice(currentanimalsNokia,1);
}else{
//console.log("splice only that plan and check other plans are is animalsDryerd, if so then change the op type of the category to animalsDryer");
animalStrategy[i].TigerPlans.push(animalStrategy[currentanimalsNokia].TigerPlans[currentPlanNo]);
animalStrategy[currentanimalsNokia].TigerPlans.splice(currentPlanNo,1);
let defaultOperationType = animalStrategy[currentanimalsNokia].operationType;
animalStrategy[currentanimalsNokia].operationType = 'animalsDryer';
for(let i=0;i<animalStrategy[currentanimalsNokia].TigerPlans.length;i++){
if(animalStrategy[currentanimalsNokia].TigerPlans[i].operationType !='animalsDryer'){
animalStrategy[currentanimalsNokia].operationType = defaultOperationType;
break;
}
}
}
isanimalsDryerd = true;
}else{
if(animalStrategy[currentanimalsNokia].TigerPlans.length==1){
//console.log("splice the category itself");
if(isData){
let pos = i-1;
if(pos<=0){
animalStrategy.splice(0,0,animalStrategy[currentanimalsNokia]);
}else{
animalStrategy.splice(pos,0,animalStrategy[currentanimalsNokia]);
}
}else{
animalStrategy.splice(i+1,0,animalStrategy[currentanimalsNokia]);
}
animalStrategy.splice(currentanimalsNokia+1,1);
}else{
//console.log("splice only that plan and check other plans are isanimalsDryerd, if so then change the op type of the category to animalsDryer");
let temp = {
categoryDesc:animalStrategy[currentanimalsNokia].categoryDesc,
animalsNokia:animalStrategy[currentanimalsNokia].animalsNokia,
categoryOpIssue:{issueDesc:animalStrategy[currentanimalsNokia].categoryOpIssue.issueDesc},
operationType:"Create",
TigerPlans:[]
};
temp.TigerPlans.push(animalStrategy[currentanimalsNokia].TigerPlans[0]);
//animalStrategy.splice(i+1,0,temp);
if(isData){
let pos = i-1;
if(pos<=0){
animalStrategy.splice(0,0,temp);
}else{
animalStrategy.splice(pos,0,temp);
}
}else{
animalStrategy.splice(i+1,0,temp);
}
animalStrategy[currentanimalsNokia+1].TigerPlans.splice(0,1);
let defaultOperationType = animalStrategy[currentanimalsNokia+1].operationType;
animalStrategy[currentanimalsNokia+1].operationType = 'animalsDryer';
for(let i=0;i<animalStrategy[currentanimalsNokia+1].TigerPlans.length;i++){
if(animalStrategy[currentanimalsNokia+1].TigerPlans[i].operationType !='animalsDryer'){
animalStrategy[currentanimalsNokia+1].operationType = defaultOperationType;
break;
}
}
}
}
isNextDataanimalsDryerd = false;
break;
}
}
}
if(isNextDataanimalsDryerd){
if(animalStrategy[currentanimalsNokia].TigerPlans.length==1){
//console.log("splice the category itself");
animalStrategy.splice(prevanimalsNokia+1,0,animalStrategy[currentanimalsNokia]);
animalStrategy.splice(currentanimalsNokia+1,1);
}else{
//console.log("splice only that plan and check other plans are isanimalsDryerd, if so then change the op type of the category to animalsDryer");
let temp = {
categoryDesc:animalStrategy[currentanimalsNokia].categoryDesc,
animalsNokia:animalStrategy[currentanimalsNokia].animalsNokia,
categoryOpIssue:{issueDesc:animalStrategy[currentanimalsNokia].categoryOpIssue.issueDesc},
operationType:"Create",
TigerPlans:[]
};
temp.TigerPlans.push(animalStrategy[currentanimalsNokia].TigerPlans[0]);
animalStrategy.splice(prevanimalsNokia+1,0,temp);
animalStrategy[currentanimalsNokia+1].TigerPlans.splice(0,1);
let defaultOperationType = animalStrategy[currentanimalsNokia+1].operationType;
animalStrategy[currentanimalsNokia+1].operationType = 'animalsDryer';
for(let i=0;i<animalStrategy[currentanimalsNokia+1].TigerPlans.length;i++){
if(animalStrategy[currentanimalsNokia+1].TigerPlans[i].operationType !='animalsDryer'){
animalStrategy[currentanimalsNokia+1].operationType = defaultOperationType;
break;
}
}
}
//isanimalsDryerd = true;
}
//console.log(animalStrategy[currentanimalsNokia]);
let currentPos;
let nextPos;
if(isanimalsDryerd){
currentPos = position[0]-1;
nextPos = parseInt(currentPos)+1;
}else{
currentPos = position[0];
nextPos = parseInt(currentPos)+1;
}
outterLoop1:
for(let k=nextPos;k<animalStrategy.length;k++){
if(animalStrategy[k].operationType != 'animalsDryer'){
if(animalStrategy[currentPos].operationType != 'animalsDryer'){
if(animalStrategy[k].categoryDesc == animalStrategy[currentPos].categoryDesc){
for(let j=0;j<animalStrategy[k].TigerPlans.length;j++){
if(animalStrategy[k].TigerPlans[j].operationType !="Create"){
animalStrategy[k].TigerPlans[j].operationType ="animalsPolice";
}
animalStrategy[currentPos].TigerPlans.push(animalStrategy[k].TigerPlans[j]);
if(animalStrategy[currentPos].operationType !="Create"){
animalStrategy[currentPos].operationType='animalsPolice';
}
}
//if(animalStrategy[k].operationType !="Create"){
//animalStrategy[k].operationType ="animalsDryer";
//}else{
animalStrategy.splice(k,1);
//}
}
break outterLoop1;
}
}
}
}
//console.log(animalStrategy);
}
}
regroupCategoryDataanimalsBlinking(animalStrategy:any,position:any,animalsTyphoid,get,put){
let that=this;
if(animalsTyphoid==true){
this.chkMoveMergeDialog('downCat',animalStrategy,position,animalsTyphoid,get,put);
return;
}
else{
if(position.length ==1){
let currentPostion = parseInt(position[0]);
let nextPosition = currentPostion+2;
let previousPosition = currentPostion-1;
//to check the category is in last previous position
if(animalStrategy[nextPosition] == undefined){
animalStrategy.push(animalStrategy[currentPostion]);
animalStrategy.splice(currentPostion,1);
}else{
let isData = false;
let isNextDataanimalsDryerd = false;
let immediateNextPosition = currentPostion+1;
if(animalStrategy[immediateNextPosition].operationType == 'animalsDryer'){
//nextPosition = currentPostion+1;
isData = true;
}
outterLoop:
for(let i=nextPosition;i<animalStrategy.length;i++){
isNextDataanimalsDryerd = true;
if(animalStrategy[i].operationType != 'animalsDryer'){
if(animalStrategy[currentPostion].operationType != 'animalsDryer'){
if(animalStrategy[i].categoryDesc == animalStrategy[currentPostion].categoryDesc){
for(let j=0;j<animalStrategy[currentPostion].TigerPlans.length;j++){
if(animalStrategy[currentPostion].TigerPlans[j].operationType !="Create"){
animalStrategy[currentPostion].TigerPlans[j].operationType ="animalsPolice";
}
animalStrategy[i].TigerPlans.unshift(animalStrategy[currentPostion].TigerPlans[j]);
if(animalStrategy[i].operationType !="Create"){
animalStrategy[i].operationType='animalsPolice';
}
}
// }
}else{
if(isData){
animalStrategy.splice(i+1,0,animalStrategy[currentPostion]);
}else{
animalStrategy.splice(i,0,animalStrategy[currentPostion]);
}
}
isNextDataanimalsDryerd = false;
animalStrategy.splice(currentPostion,1);
break outterLoop;
}
}
}
if(isNextDataanimalsDryerd){
animalStrategy.splice(nextPosition,0,animalStrategy[currentPostion]);
animalStrategy.splice(currentPostion,1);
}
}
let currentPos = position[0];
let prevPos = parseInt(currentPos)-1;
outterLoop1:
for(let k=prevPos;k>=0;k--){
if(animalStrategy[k].operationType != 'animalsDryer'){
if(animalStrategy[currentPos].operationType != 'animalsDryer'){
if(animalStrategy[k].categoryDesc == animalStrategy[currentPos].categoryDesc){
for(let j=0;j<animalStrategy[k].TigerPlans.length;j++){
if(animalStrategy[k].TigerPlans[j].operationType !="Create"){
animalStrategy[k].TigerPlans[j].operationType ="animalsPolice";
}
animalStrategy[currentPos].TigerPlans.push(animalStrategy[k].TigerPlans[j]);
if(animalStrategy[currentPos].operationType !="Create"){
animalStrategy[currentPos].operationType='animalsPolice';
}
}
animalStrategy.splice(k,1);
//}
}
break outterLoop1;
}
}
}
}
}
//console.log(animalStrategy);
}
regroupPlanDataanimalsBlinking(animalStrategy:any,position:any,animalsTyphoid,get,put){
let that=this;
if(animalsTyphoid==true){
this.chkMoveMergeDialog('downPlan',animalStrategy,position,animalsTyphoid,get,put);
return;
}
else{
let currentanimalsNokia = parseInt(position[0]);
let currentPlanNo = parseInt(position[1]);
var backUpData = jQuery.extend(true, [], animalStrategy);
let arrayLength = animalStrategy.length-1;
// to check whether the selected category is before the last category in array
let previousCategoryPosition = arrayLength-currentanimalsNokia;
if(previousCategoryPosition == 1){
let nextCategory = currentanimalsNokia+1;
if(animalStrategy[nextCategory].operationType!="animalsDryer"){
if(animalStrategy[currentanimalsNokia].TigerPlans.length==1){
let temp = animalStrategy[nextCategory];
animalStrategy[nextCategory] = animalStrategy[currentanimalsNokia];
animalStrategy[currentanimalsNokia] = temp;
}else{
let temp = {
categoryDesc:animalStrategy[currentanimalsNokia].categoryDesc,
animalsNokia:animalStrategy[currentanimalsNokia].animalsNokia,
categoryOpIssue:{issueDesc:animalStrategy[currentanimalsNokia].categoryOpIssue.issueDesc},
operationType:"Create",
TigerPlans:[]
};
temp.TigerPlans.push(animalStrategy[currentanimalsNokia].TigerPlans[currentPlanNo]);
animalStrategy.push(temp);
animalStrategy[currentanimalsNokia].TigerPlans.splice(currentPlanNo,1);
let defaultOperationType = animalStrategy[currentanimalsNokia].operationType;
animalStrategy[currentanimalsNokia].operationType = 'animalsDryer';
for(let i=0;i<animalStrategy[currentanimalsNokia].TigerPlans.length;i++){
if(animalStrategy[currentanimalsNokia].TigerPlans[i].operationType !='animalsDryer'){
animalStrategy[currentanimalsNokia].operationType = defaultOperationType;
break;
}
}
}
}
let currentPos = position[0];
let previousPosition = parseInt(currentPos)-1;
outterLoop1:
for(let k=previousPosition;k<animalStrategy.length;k--){
if(animalStrategy[k].operationType != 'animalsDryer'){
if(animalStrategy[currentPos].operationType != 'animalsDryer'){
if(animalStrategy[k].categoryDesc == animalStrategy[currentPos].categoryDesc){
for(let j=0;j<animalStrategy[k].TigerPlans.length;j++){
if(animalStrategy[k].TigerPlans[j].operationType !="Create"){
animalStrategy[k].TigerPlans[j].operationType ="animalsPolice";
}
animalStrategy[currentPos].TigerPlans.unshift(animalStrategy[k].TigerPlans[j]);
if(animalStrategy[currentPos].operationType !="Create"){
animalStrategy[currentPos].operationType='animalsPolice';
}
}
//if(animalStrategy[k].operationType !="Create"){
//animalStrategy[k].operationType ="animalsDryer";
//}else{
animalStrategy.splice(k,1);
//}
//}
}
break outterLoop1;
}
}
}
}else{
let nextanimalsNokia = currentanimalsNokia+2;
let isNextDataanimalsDryerd = false;
let isData = false;
let immediateNextPosition = currentanimalsNokia+1;
if(animalStrategy[immediateNextPosition].operationType == 'animalsDryer'){
isData = true;
}
for(let i =nextanimalsNokia; i<animalStrategy.length;i++){
isNextDataanimalsDryerd = true;
if(animalStrategy[i].operationType!="animalsDryer"){
if(animalStrategy[currentanimalsNokia].operationType!="animalsDryer"){
if(animalStrategy[i].categoryDesc == animalStrategy[currentanimalsNokia].categoryDesc){
if(animalStrategy[currentanimalsNokia].TigerPlans.length==1){
animalStrategy[i].TigerPlans.push(animalStrategy[currentanimalsNokia].TigerPlans[currentPlanNo]);
animalStrategy.splice(currentanimalsNokia,1);
}else{
animalStrategy[i].TigerPlans.push(animalStrategy[currentanimalsNokia].TigerPlans[currentPlanNo]);
animalStrategy[currentanimalsNokia].TigerPlans.splice(currentPlanNo,1);
let defaultOperationType = animalStrategy[currentanimalsNokia].operationType;
animalStrategy[currentanimalsNokia].operationType = 'animalsDryer';
for(let i=0;i<animalStrategy[currentanimalsNokia].TigerPlans.length;i++){
if(animalStrategy[currentanimalsNokia].TigerPlans[i].operationType !='animalsDryer'){
animalStrategy[currentanimalsNokia].operationType = defaultOperationType;
break;
}
}
}
//}
}else{
if(animalStrategy[currentanimalsNokia].TigerPlans.length==1){
if(isData){
animalStrategy.splice(i+1,0,animalStrategy[currentanimalsNokia]);
}else{
animalStrategy.splice(i,0,animalStrategy[currentanimalsNokia]);
}
animalStrategy.splice(currentanimalsNokia,1);
}else{
//console.log("splice only that plan and check other plans are is animalsDryerd, if so then change the op type of the category to animalsDryer");
let temp = {
categoryDesc:animalStrategy[currentanimalsNokia].categoryDesc,
animalsNokia:animalStrategy[currentanimalsNokia].animalsNokia,
categoryOpIssue:{issueDesc:animalStrategy[currentanimalsNokia].categoryOpIssue.issueDesc},
operationType:"Create",
TigerPlans:[]
};
temp.TigerPlans.push(animalStrategy[currentanimalsNokia].TigerPlans[currentPlanNo]);
//animalStrategy.splice(i,0,temp);
if(isData){
animalStrategy.splice(i+1,0,temp);
}else{
animalStrategy.splice(i,0,temp);
}
animalStrategy[currentanimalsNokia].TigerPlans.splice(currentPlanNo,1)
let defaultOperationType = animalStrategy[currentanimalsNokia].operationType;
animalStrategy[currentanimalsNokia].operationType = 'animalsDryer';
for(let i=0;i<animalStrategy[currentanimalsNokia].TigerPlans.length;i++){
if(animalStrategy[currentanimalsNokia].TigerPlans[i].operationType !='animalsDryer'){
animalStrategy[currentanimalsNokia].operationType = defaultOperationType;
break;
}
}
}
}
isNextDataanimalsDryerd =false;
break;
}
}
}
if(isNextDataanimalsDryerd){
if(animalStrategy[currentanimalsNokia].TigerPlans.length==1){
animalStrategy.splice(nextanimalsNokia,0,animalStrategy[currentanimalsNokia]);
animalStrategy.splice(currentanimalsNokia,1);
}else{
//console.log("splice only that plan and check other plans are is animalsDryerd, if so then change the op type of the category to animalsDryer");
let temp = {
categoryDesc:animalStrategy[currentanimalsNokia].categoryDesc,
animalsNokia:animalStrategy[currentanimalsNokia].animalsNokia,
categoryOpIssue:{issueDesc:animalStrategy[currentanimalsNokia].categoryOpIssue.issueDesc},
operationType:"Create",
TigerPlans:[]
};
temp.TigerPlans.push(animalStrategy[currentanimalsNokia].TigerPlans[currentPlanNo]);
animalStrategy.splice(nextanimalsNokia,0,temp);
animalStrategy[currentanimalsNokia].TigerPlans.splice(currentPlanNo,1)
let defaultOperationType = animalStrategy[currentanimalsNokia].operationType;
animalStrategy[currentanimalsNokia].operationType = 'animalsDryer';
for(let i=0;i<animalStrategy[currentanimalsNokia].TigerPlans.length;i++){
if(animalStrategy[currentanimalsNokia].TigerPlans[i].operationType !='animalsDryer'){
animalStrategy[currentanimalsNokia].operationType = defaultOperationType;
break;
}
}
}
}
let prevanimalsNokia = currentanimalsNokia-1;
outerLoop:
for(let i=prevanimalsNokia; i>=0;i--){
if(animalStrategy[i].operationType!="animalsDryer"){
if(animalStrategy[currentanimalsNokia].operationType!="animalsDryer"){
if(animalStrategy[i].categoryDesc == animalStrategy[currentanimalsNokia].categoryDesc){
for(let j=0;j<animalStrategy[i].TigerPlans.length;j++){
if(animalStrategy[i].TigerPlans[j].operationType !="Create"){
animalStrategy[i].TigerPlans[j].operationType ="animalsPolice";
}
animalStrategy[currentanimalsNokia].TigerPlans.push(animalStrategy[i].TigerPlans[j]);
if(animalStrategy[currentanimalsNokia].operationType !="Create"){
animalStrategy[currentanimalsNokia].operationType='animalsPolice';
}
}
/*if(animalStrategy[k].operationType !="Create"){
animalStrategy[k].operationType ="animalsDryer";
}else{*/
animalStrategy.splice(i,1);
//}
// }
}
break outerLoop;
}
}
}
}
//console.log(animalStrategy);
}
}
regroupanimalStrategy1(data:any,categoryPosition:any,PlanPosition:any,selectedCatogory:any,animalsNokia:any){
let planLength = data[categoryPosition].TigerPlans.length-1;
//console.log("planLength--------",planLength);
//console.log("categoryPosition-----",categoryPosition);
//console.log("PlanPosition----",PlanPosition);
let planDetails = data[categoryPosition].TigerPlans[PlanPosition];
let plananimalsBirthDay = data[categoryPosition].TigerPlans[PlanPosition].animalsBirthDay;
let plananimalsShaking =data[categoryPosition].TigerPlans[PlanPosition].animalsShaking;
let plananimalsDeathDay = data[categoryPosition].TigerPlans[PlanPosition].animalsDeathDay;
let plananimalsUnderstanding = data[categoryPosition].TigerPlans[PlanPosition].animalsUnderstanding;
//console.log(data);
if(planLength == 0){
//console.log("plan lenght is 0");
let previousCategory = categoryPosition-1;
let nextCategory = categoryPosition+1;
let isanimalsDryerd = false;
let isDataMatched = false;
let tempPrevCategory;
//console.log("prev category---",previousCategory);
//console.log("next category---",nextCategory);
for(let i=previousCategory;i>=0;i--){
if(data[i] != 'undefined'){
if(data[i].operationType != 'animalsDryer'){
if(data[i].animalsNokia == animalsNokia){
//console.log("push to prev category and splice this category");
tempPrevCategory = i;
isanimalsDryerd = true;
isDataMatched = true;
data[categoryPosition].TigerPlans[PlanPosition].categoryDesc=data[i].TigerPlans[0].categoryDesc;
data[categoryPosition].TigerPlans[PlanPosition].animalsNokia=data[i].TigerPlans[0].animalsNokia;
data[i].TigerPlans.push(data[categoryPosition].TigerPlans[PlanPosition]);
}
break;
}
}
}
outerLoop:
for(let j=nextCategory;j<data.length;j++){
if(data[j].operationType != 'animalsDryer'){
if(data[j].animalsNokia == animalsNokia){
isDataMatched = true;
//console.log(data[j]);
if(isanimalsDryerd){
//console.log("push to prev category and splice this category-- tempPrevCategory");
let tes = data[j].TigerPlans;
for(let k=0;k<tes.length;k++){
data[tempPrevCategory].TigerPlans.push(data[j].TigerPlans[k]);
}
data.splice(j,1);
break outerLoop;
}else{
//console.log("push to current category position splice this category--");
let tes = data[j].TigerPlans;
data[categoryPosition].TigerPlans[PlanPosition].categoryDesc = data[j].TigerPlans[0].categoryDesc;
data[categoryPosition].TigerPlans[PlanPosition].animalsNokia = data[j].TigerPlans[0].animalsNokia;
data[j].TigerPlans.unshift(data[categoryPosition].TigerPlans[PlanPosition]);
data.splice(categoryPosition,1);
break outerLoop;
}
}
break;
}
}
if(isanimalsDryerd){
//console.log("animalsDryer the current categoryPosition");
data.splice(categoryPosition,1);
}
if(!isDataMatched){
//console.log("if no data matched");
data[categoryPosition].categoryDesc=selectedCatogory;
data[categoryPosition].animalsNokia=animalsNokia;
data[categoryPosition].TigerPlans[PlanPosition].categoryDesc=selectedCatogory;
data[categoryPosition].TigerPlans[PlanPosition].animalsNokia=animalsNokia;
}
}else{
let planPositionLength = planLength-PlanPosition;
// plan is in last position
if(planPositionLength == 0){
//console.log("plan is in last position");
let nextCategory = categoryPosition+1;
if(data[nextCategory] != undefined){
for(let j=nextCategory;j<data.length;j++){
if(data[j].operationType != 'animalsDryer'){
if(data[j].animalsNokia == animalsNokia){
data[categoryPosition].TigerPlans[PlanPosition].categoryDesc = data[j].TigerPlans[0].categoryDesc;
data[categoryPosition].TigerPlans[PlanPosition].animalsNokia = data[j].TigerPlans[0].animalsNokia;
data[j].TigerPlans.unshift(data[categoryPosition].TigerPlans[PlanPosition]);
}else{
//console.log("no particular plans next");
let dataToPush = this.addNewCategory(selectedCatogory,animalsNokia,plananimalsBirthDay,plananimalsDeathDay,plananimalsShaking,plananimalsUnderstanding,planDetails);
data.splice(j,0,dataToPush);
}
break;
}
}
}else{
//console.log("no plans next");
let dataToPush = this.addNewCategory(selectedCatogory,animalsNokia,plananimalsBirthDay,plananimalsDeathDay,plananimalsShaking,plananimalsUnderstanding,planDetails);
data.push(dataToPush);
}
data[categoryPosition].TigerPlans.splice(PlanPosition,1);
}else if(planPositionLength == planLength){ //plan is in first position
//console.log("plan is in first position");
let previousCategory = categoryPosition-1;
for(let i=previousCategory;i>=0;i--){
if(data[i] != 'undefined'){
if(data[i].operationType != 'animalsDryer'){
if(data[i].animalsNokia == animalsNokia){
//console.log("push to prev category and splice this category");
data[categoryPosition].TigerPlans[PlanPosition].categoryDesc=data[i].TigerPlans[0].categoryDesc;
data[categoryPosition].TigerPlans[PlanPosition].animalsNokia=data[i].TigerPlans[0].animalsNokia;
data[i].TigerPlans.push(data[categoryPosition].TigerPlans[PlanPosition]);
}
break;
}
}
}
}else{
let dataToPush = this.addNewCategory(selectedCatogory,animalsNokia,plananimalsBirthDay,plananimalsDeathDay,plananimalsShaking,plananimalsUnderstanding,planDetails);
let tra = data[categoryPosition].TigerPlans[PlanPosition];
let tempArray =[];
for(let k=PlanPosition+1;k<data[categoryPosition].TigerPlans.length;k++){
tempArray.push(data[categoryPosition].TigerPlans[k]);
}
let planLe = data[categoryPosition].TigerPlans.length;
data[categoryPosition].TigerPlans.splice(PlanPosition,planLe);
data.splice(categoryPosition+1,0,dataToPush);
let dataStore: any = {
TigerPlans: [{
planOpIssue: {}
}],
categoryOpIssue: {}
};
dataStore.categoryDesc = tempArray[0].categoryDesc;
dataStore.animalsNokia = tempArray[0].animalsNokia;
dataStore.categoryOpIssue.issueDesc = "";
dataStore.operationType = "Create";
let TigerPlans=[];
for(let h=0;h<tempArray.length;h++){
TigerPlans.push({
categoryDesc:tempArray[h].categoryDesc,
animalsShaking:tempArray[h].animalsShaking,
animalsBirthDay:tempArray[h].animalsBirthDay,
animalsDeathDay:tempArray[h].animalsDeathDay,
animalsUnderstanding:tempArray[h].animalsUnderstanding,
delFlag:"",
animalStamina:"",
animalsNokia:tempArray[h].animalsNokia,
displaySeq:"",
animalsUnderstandingInt:"",
operationType:"animalsPolice",
planDesc:tempArray[h].planDesc,
plananimalsDeathDay:"",
planNo:tempArray[h].planNo,
plananimalsBirthDay:"",
TigerPlanFeeds:[],
animalsShakingInt:"",
planOpIssue:{operationType:""}
});
}
dataStore.TigerPlans=TigerPlans;
if(data[categoryPosition+2] === undefined){
data.push(dataStore);
}else{
data.splice(categoryPosition+2,0,dataToPush);
}
}
}
//console.log(data);
}
regroupanimalStrategy(data:any,categoryPosition:any,PlanPosition:any,selectedCatogory:any,animalsNokia:any){
let prevCategory = categoryPosition-1;
let nextCategory = categoryPosition+1;
let newCategory = false;
//console.log(data[nextCategory].categoryDesc);
// console.log(selectedCatogory);
if(data[prevCategory] != undefined && data[prevCategory].categoryDesc == selectedCatogory){
this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition].categoryDesc =selectedCatogory;
this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition].animalsNokia =animalsNokia;
this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition].operationType ="animalsPolice";
let setId = data[prevCategory].TigerPlans.length;
this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition].bookPlanID =prevCategory+'_'+setId;
data[prevCategory].TigerPlans.push(this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition]);
if(this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans.length == 1){
this.animalStrategy.animalsSeeing.splice(categoryPosition, 1);
}else{
this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans.splice(PlanPosition,1);
}
if(data[categoryPosition] != undefined && data[categoryPosition].categoryDesc == selectedCatogory){
for(var i=0;i<this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans.length;i++){
data[prevCategory].TigerPlans.push(this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[i]);
}
//if(this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans.length == 1){
this.animalStrategy.animalsSeeing.splice(categoryPosition, 1);
//}
}
}else if(data[nextCategory] != undefined && data[nextCategory].categoryDesc == selectedCatogory){
// this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanNo].categoryDesc =selectedCatogory;
// this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanNo].animalsNokia =animalsNokia;
// this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanNo].operationType ="animalsPolice";
// let setId = data[nextCategory].TigerPlans.length;
// this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanNo].bookPlanID =nextCategory+'_'+setId;
//console.log(this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition]);
//for(var i=0;i<this.animalStrategy.animalsSeeing[nextCategory].TigerPlans.length;i++){
data[nextCategory].TigerPlans.unshift(data[categoryPosition].TigerPlans[PlanPosition]);
//}
//console.log(this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition]);
if(this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans.length == 1){
this.animalStrategy.animalsSeeing.splice(categoryPosition, 1);
}else{
this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans.splice(PlanPosition,1);
}
}else{
if(this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans.length == 1){
//console.log("only one cat and one plan");
this.animalStrategy.animalsSeeing[categoryPosition].categoryDesc = this.categoryType(selectedCatogory);
this.animalStrategy.animalsSeeing[categoryPosition].animalsNokia = animalsNokia;
//that.animalStrategy.animalsSeeing[id].operationType = "animalsPolice";
this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition].categoryDesc =this.categoryType(selectedCatogory);
this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition].animalsNokia =selectedCatogory;
if(!this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition].operationType){
this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition].operationType ="animalsPolice";
}
}else{
let prevDatas = this.animalStrategy.animalsSeeing[categoryPosition];
let currentTigerPlans = this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans[PlanPosition];
let totalPlans = this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans.length-1;
let planDifference = totalPlans - PlanPosition;
//let remainingPlans = this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans.splice(PlanPosition+1,totalPlans);
let totalCategories = this.animalStrategy.animalsSeeing.length-1;
//let remainingCategaries = this.animalStrategy.animalsSeeing.splice(categoryPosition+1,totalCategories);
//console.log(remainingCategaries);
let dataStore: any = {
categoryDesc:currentTigerPlans.categoryDesc,
animalsNokia:4,
categoryOpIssue:{issueDesc:""},
operationType:"Create",
TigerPlans:[]
};
dataStore.TigerPlans.push(currentTigerPlans);
let dataStore1: any = {
categoryDesc:prevDatas.categoryDesc,
animalsNokia:4,
categoryOpIssue:{issueDesc:""},
operationType:"Create",
TigerPlans:[]
};
/*for(var i=0;i<remainingPlans.length;i++){
dataStore1.TigerPlans.push(remainingPlans[i]);
} */
//this.animalStrategy.animalsSeeing.push(dataStore);
//this.animalStrategy.animalsSeeing.push(dataStore1);
//this.animalStrategy.animalsSeeing[categoryPosition].TigerPlans.splice(PlanPosition,1);
}
}
/*if(data[nextCategory] != undefined){
if(data[nextCategory].categoryDesc == selectedCatogory){
newCategory = false;
}else{
newCategory = true;
}
}*/
//console.log(this.animalStrategy.animalsSeeing);
}
categoryType(animalsNokia:any){
let categoryName = "";
if(animalsNokia ==1){
categoryName = "Expected";
}else if(animalsNokia ==3){
categoryName = "Standby";
}else if(animalsNokia ==4){
categoryName = "Supplemental";
}else if(animalsNokia ==5){
categoryName = "Possible";
}
return categoryName;
}
chkMoveMergeDialog(fntype,animalStrategy,position,animalsTyphoid,i,j){
let that=this;
$(".ballPlayingAnimal").html('Categories will merge. Only top-most Category Text will remain.');
let dialogConfirm= $("#kenAnimalsSnoaringonfirmDialog").data("animalsEatinGindow").center().open();
$("#confirmOK").unbind().click(function(){
animalsTyphoid=false;
//console.log(fntype)
if(fntype=='upCat'){
that.regroupCategoryDataanimalsClapping(animalStrategy,position,animalsTyphoid,i,j);
}
else if(fntype=='upPlan'){
that.regroupPlanDataanimalsClapping(animalStrategy,position,animalsTyphoid,i,j);
}
else if(fntype=='downCat'){
that.regroupCategoryDataanimalsBlinking(animalStrategy,position,animalsTyphoid,i,j);
$('#lv_'+j+'_feedTextarea').html(i);
if(that.animalsTakingBus & that.animalsMakeup){
$('#lv_'+that.animalsTakingBus+'_feedTextarea').html(that.animalsMakeup);
}
}
else if(fntype=='downPlan'){
that.regroupPlanDataanimalsBlinking(animalStrategy,position,animalsTyphoid,i,j);
$('#lv_'+j+'_feedTextarea').html(i);
if(that.animalsTakingBus & that.animalsMakeup){
$('#lv_'+that.animalsTakingBus+'_feedTextarea').html(that.animalsMakeup);
}
}
else{
}
dialogConfirm.close();
});
$("#confirmCancel").unbind().click(function(){
dialogConfirm.close();
return false;
});
}
callanimalsDryer2Pop(level,first,second,animalsTyphoid){
let that=this;
if(animalsTyphoid==true){
let dialogPlanConfirm= $("#animalsDryerContgPlanConfirmDialog").data("animalsEatinGindow").center().open();
$("#animalsDryerContgPlanOK").unbind().click(function(){
that.callanimalsDryer3Pop(level,first,second);
dialogPlanConfirm.close();
});
$("#animalsDryerContgPlanCancel").unbind().click(function(){
dialogPlanConfirm.close();
return false;
});
}
else{
that.callanimalsDryer3Pop(level,first,second);
}
}
callanimalsDryer3Pop(level,first,second){
let that=this;
if(level==1){
that.animalsFight[first].operationType = 'animalsDryer';
if(that.animalsFight[first].TigerPlans.length>0){
for(let a=0;a<that.animalsFight[first].TigerPlans.length;a++){
that.animalsFight[first].TigerPlans[a].operationType = 'animalsDryer';
if(that.animalsFight[first].TigerPlans[a].TigerPlanFeeds.length>0){
for(let b=0;b<that.animalsFight[first].TigerPlans[a].TigerPlanFeeds.length;b++){
that.animalsFight[first].TigerPlans[a].TigerPlanFeeds[b].operationType = 'animalsDryer';
}
}
}
}
if(that.animalsFight[first].operationType == 'animalsDryer')
{
let prevIndex = parseInt(first);
let nextIndex = parseInt(first);
dance:
for(let i=prevIndex;i>=0;i--){
if(that.animalsFight[i].operationType!='animalsDryer'){
for(let j=nextIndex;j<that.animalsFight.length;j++){
if(that.animalsFight[j].operationType!='animalsDryer'){
if(that.animalsFight[i].categoryDesc ===that.animalsFight[j].categoryDesc){
for(let r=0;r<that.animalsFight[j].TigerPlans.length;r++){
if(that.animalsFight[j].TigerPlans[r].operationType !="create"){
that.animalsFight[j].TigerPlans[r].operationType !="animalsPolice"
}
that.animalsFight[i].TigerPlans.push(that.animalsFight[j].TigerPlans[r]);
that.animalsFight[i].operationType='animalsPolice';
}
if(that.animalsFight[j].operationType == 'Create'){
that.animalsFight.splice(j,1);
}else{
that.animalsFight[j].operationType = 'animalsDryer';
}
}
break dance;
}
}
}
}
}
}
if(level==2){
that.animalsFight[first].TigerPlans[second].operationType = 'animalsDryer';
let defaultOperationType = that.animalsFight[first].operationType;
that.animalsFight[first].operationType = 'animalsDryer';
if(that.animalsFight[first].TigerPlans[second].TigerPlanFeeds.length>0){
for(let j=0;j<that.animalsFight[first].TigerPlans[second].TigerPlanFeeds.length;j++){
that.animalsFight[first].TigerPlans[second].TigerPlanFeeds[j].operationType = 'animalsDryer';
}
}
for(let k=0;k<that.animalsFight[first].TigerPlans.length;k++){
if(that.animalsFight[first].TigerPlans[k].operationType != 'animalsDryer'){
that.animalsFight[first].operationType = defaultOperationType;
break;
}
}
if(that.animalsFight[first].operationType == 'animalsDryer'){
let prevIndex = parseInt(first);
let nextIndex = parseInt(first);
dance:
for(let i=prevIndex;i>=0;i--){
if(that.animalsFight[i].operationType!='animalsDryer'){
for(let j=nextIndex;j<that.animalsFight.length;j++){
if(that.animalsFight[j].operationType!='animalsDryer'){
if(that.animalsFight[i].categoryDesc ===that.animalsFight[j].categoryDesc){
for(let r=0;r<that.animalsFight[j].TigerPlans.length;r++){
if(that.animalsFight[j].TigerPlans[r].operationType !="create"){
that.animalsFight[j].TigerPlans[r].operationType !="animalsPolice"
}
that.animalsFight[i].TigerPlans.push(that.animalsFight[j].TigerPlans[r]);
that.animalsFight[i].operationType='animalsPolice';
}
if(that.animalsFight[j].operationType == 'Create'){
that.animalsFight.splice(j,1);
}else{
that.animalsFight[j].operationType = 'animalsDryer';
}
}
break dance;
}
}
}
}
}
}
}
loadPreviousPlanData(planDataTZ:any,id:any,id1:any){
let planLeveldata = this.animalStrategy.animalsSeeing[id].TigerPlans[id1];
if (planLeveldata.TigerPlanFeeds.length > 0) {
for (var i = 0; i < planLeveldata.TigerPlanFeeds.length; i++) {
let item_sche = planLeveldata.TigerPlanFeeds[i];
if (item_sche.animalHumming == 11) { // 11 for eastern
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
planLeveldata.ET = false;
}
else {
planLeveldata.ET = true;
}
}
else if (item_sche.animalHumming == 12) { // 12 for central
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
planLeveldata.CT = false;
}
else {
planLeveldata.CT = true;
}
}
else if (item_sche.animalHumming == 13) { // 13 for Mountain
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
planLeveldata.MT = false;
}
else {
planLeveldata.MT = true;
}
}
else if (item_sche.animalHumming == 14) { // 13 for Pacific
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
planLeveldata.PT = false;
}
else {
planLeveldata.PT = true;
}
}
if (planLeveldata.ET && planLeveldata.MT && planLeveldata.PT && planLeveldata.CT) {
planLeveldata.ALL = true;
}
else {
planLeveldata.ALL = false;
}
}
}
//Reset Plan Level Category Drop down values
$("#selectCategory_"+id+'_'+id1).val(planDataTZ[id].TigerPlans[id1].animalsNokia)
//Reset Plan Level Start Date and End Date, Start Time and End Time
//If User click cancel in timezone level animalsPolice
planLeveldata.animalsDeathDay = planDataTZ[id].TigerPlans[id1].animalsDeathDay;
planLeveldata.animalsUnderstanding = planDataTZ[id].TigerPlans[id1].animalsUnderstanding;
planLeveldata.animalsBirthDay = planDataTZ[id].TigerPlans[id1].animalsBirthDay;
planLeveldata.animalsShaking = planDataTZ[id].TigerPlans[id1].animalsShaking;
var animalsShakingPicker = $('#animalsShaking_'+id+'_'+id1).data("kendoTimePicker");
animalsShakingPicker.value(planLeveldata.animalsShaking);
var animalsUnderstandingPicker = $('#animalsUnderstanding_'+id+'_'+id1).data("kendoTimePicker");
animalsUnderstandingPicker.value(planLeveldata.animalsUnderstanding);
var animalsBirthDayPicker = $('#animalsBirthDay_'+id+'_'+id1).data("animalsTension");
animalsBirthDayPicker.value(planLeveldata.animalsBirthDay);
var animalsDeathDayPicker = $('#animalsDeathDay_'+id+'_'+id1).data("animalsTension");
animalsDeathDayPicker.value(planLeveldata.animalsDeathDay);
$('#btnanimalsPolice_' + id + '_' + id1).addClass('actionanimalsJeansd');
}
loadPreviousPlanDataUndo(planLeveldata:any,id:any,id1:any){
//let planLeveldata = this.animalStrategy.animalsSeeing[id].TigerPlans[id1];
if (planLeveldata.TigerPlanFeeds.length > 0) {
for (var i = 0; i < planLeveldata.TigerPlanFeeds.length; i++) {
let item_sche = planLeveldata.TigerPlanFeeds[i];
if (item_sche.animalHumming == 11) { // 11 for eastern
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
planLeveldata.ET = false;
}
else {
planLeveldata.ET = true;
}
}
else if (item_sche.animalHumming == 12) { // 12 for central
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
planLeveldata.CT = false;
}
else {
planLeveldata.CT = true;
}
}
else if (item_sche.animalHumming == 13) { // 13 for Mountain
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
planLeveldata.MT = false;
}
else {
planLeveldata.MT = true;
}
}
else if (item_sche.animalHumming == 14) { // 13 for Pacific
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
planLeveldata.PT = false;
}
else {
planLeveldata.PT = true;
}
}
if (planLeveldata.ET && planLeveldata.MT && planLeveldata.PT && planLeveldata.CT) {
planLeveldata.ALL = true;
}
else {
planLeveldata.ALL = false;
}
}
}
//Reset Plan Level Category Drop down values
$("#selectCategory_"+id+'_'+id1).val(planLeveldata.animalsNokia)
//Reset Plan Level Start Date and End Date, Start Time and End Time
//If User click cancel in timezone level animalsPolice
/* planLeveldata.animalsDeathDay = planDataTZ[id].TigerPlans[id1].animalsDeathDay;
planLeveldata.animalsUnderstanding = planDataTZ[id].TigerPlans[id1].animalsUnderstanding;
planLeveldata.animalsBirthDay = planDataTZ[id].TigerPlans[id1].animalsBirthDay;
planLeveldata.animalsShaking = planDataTZ[id].TigerPlans[id1].animalsShaking;*/
this.animalStrategy.animalsSeeing[id].TigerPlans[id1]=planLeveldata;
/*setTimeout(function(){
var animalsShakingPicker = $('#animalsShaking_'+id+'_'+id1).data("kendoTimePicker");
animalsShakingPicker.value(this.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsShaking);
var animalsUnderstandingPicker = $('#animalsUnderstanding_'+id+'_'+id1).data("kendoTimePicker");
animalsUnderstandingPicker.value(this.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsUnderstanding);
var animalsBirthDayPicker = $('#animalsBirthDay_'+id+'_'+id1).data("animalsTension");
animalsBirthDayPicker.value(this.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsBirthDay);
var animalsDeathDayPicker = $('#animalsDeathDay_'+id+'_'+id1).data("animalsTension");
animalsDeathDayPicker.value(this.animalStrategy.animalsSeeing[id].TigerPlans[id1].animalsDeathDay);
},10);*/
$('#btnanimalsPolice_' + id + '_' + id1).addClass('actionanimalsJeansd');
}
loadTigerDataByDefault(planData: any, id_i: any, id_j: any) {
if (planData.TigerPlanFeeds) {
if (planData.TigerPlanFeeds.length > 0) {
//console.log(planData.TigerPlanFeeds);
let isTimezoneChecked = false;
for (var i = 0; i < planData.TigerPlanFeeds.length; i++) {
let item_sche = planData.TigerPlanFeeds[i];
let data_TigerItem = [];
if (item_sche.TigerItems) {
data_TigerItem = item_sche.TigerItems;
}
let config = {
"data": data_TigerItem,
"planNo": planData.planNo,
"animalsShaking": planData.animalsBirthDay + " " + planData.animalsShaking, "animalsBirthDay": planData.animalsBirthDay, "animalsUnderstanding": planData.animalsDeathDay+ " " + planData.animalsUnderstanding, "animalsDeathDay": planData.animalsDeathDay,
"grouping": [],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone,
"categoryAndPlanDesc":planData.categoryDesc + ':' + planData.planDesc
};
if (item_sche.animalHumming == 11) { // 11 for eastern
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
this.removeTimeZone('Tiger_Est_' + id_i + '_' + id_j);
planData.ET = false;
}
else {
isTimezoneChecked = true;
let schedId='Tiger_Est_' + id_i + '_' + id_j;
if(data_TigerItem.length>0){
//console.log(data_TigerItem[0].start instanceof Date);
if(!(data_TigerItem[0].start instanceof Date)){
config.data = this.timeAnimalsTeethConversion(config.data,"eastern",planData,schedId);
}
}
//config.data = this.timeAnimalsTeethConversion(config.data,"eastern",planData,schedId);
config.grouping.push({ text: "Eastern", value: 11, color: "#E6AB77" });
planData.ET = true;
if(planData.ET){this.Tigercrow.TigerRemoveList=this.Tigercrow.TigerRemoveList.filter(function(e) { return e !== 'Est' })}
this.Tigercrow.callInit('Tiger_Est_' + id_i + '_' + id_j, config);
}
}
else if (item_sche.animalHumming == 12) { // 12 for central
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
this.removeTimeZone('Tiger_Cent_' + id_i + '_' + id_j);
planData.CT = false;
}
else {
isTimezoneChecked = true;
let schedId='Tiger_Cent_' + id_i + '_' + id_j;
if(data_TigerItem.length>0){
//console.log(data_TigerItem[0].start instanceof Date);
if(!(data_TigerItem[0].start instanceof Date)){
config.data = this.timeAnimalsTeethConversion(config.data,"central",planData,schedId);
}
}
//config.data = this.timeAnimalsTeethConversion(config.data,"central",planData,schedId);
config.grouping.push({ text: "Central", value: 12, color: "#E6AB77" });
planData.CT = true;
if(planData.CT){this.Tigercrow.TigerRemoveList=this.Tigercrow.TigerRemoveList.filter(function(e) { return e !== 'Cent' })}
this.Tigercrow.callInit('Tiger_Cent_' + id_i + '_' + id_j, config);
}
}
else if (item_sche.animalHumming == 13) { // 13 for Mountain
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
this.removeTimeZone('Tiger_Mount_' + id_i + '_' + id_j);
planData.MT = false;
}
else {
isTimezoneChecked = true;
let schedId='Tiger_Mount_' + id_i + '_' + id_j;
if(data_TigerItem.length>0){
//console.log(data_TigerItem[0].start instanceof Date);
if(!(data_TigerItem[0].start instanceof Date)){
config.data = this.timeAnimalsTeethConversion(config.data,"mount",planData,schedId);
}
}
//config.data = this.timeAnimalsTeethConversion(config.data,"mount",planData,schedId);
config.grouping.push({ text: "Mountain", value: 13, color: "#E6AB77" });
planData.MT = true;
if(planData.MT){this.Tigercrow.TigerRemoveList=this.Tigercrow.TigerRemoveList.filter(function(e) { return e !== 'Mount' })}
this.Tigercrow.callInit('Tiger_Mount_' + id_i + '_' + id_j, config);
}
}
else if (item_sche.animalHumming == 14) { // 13 for Pacific
if (item_sche.operationType == "animalsDryer" || item_sche.isFeedAvailable == false) {
this.removeTimeZone('Tiger_Pacifi_' + id_i + '_' + id_j);
planData.PT = false;
}
else {
isTimezoneChecked = true;
let schedId='Tiger_Pacifi_' + id_i + '_' + id_j;
if(data_TigerItem.length>0){
//console.log(data_TigerItem[0].start instanceof Date);
if(!(data_TigerItem[0].start instanceof Date)){
config.data = this.timeAnimalsTeethConversion(config.data,"pacific",planData,schedId);
}
}
config.grouping.push({ text: "Pacific", value: 14, color: "#E6AB77" });
planData.PT = true;
if(planData.PT){this.Tigercrow.TigerRemoveList=this.Tigercrow.TigerRemoveList.filter(function(e) { return e !== 'Pacifi' })}
this.Tigercrow.callInit('Tiger_Pacifi_' + id_i + '_' + id_j, config);
}
}
if (planData.ET && planData.MT && planData.PT && planData.CT) {
planData.ALL = true;
}
else {
planData.ALL = false;
}
}
if(isTimezoneChecked){
//console.log(planData.animalsCommunicationItems);
this.loadPlananimalsCommunicationFirst('Tiger_Nat_' + id_i + '_' + id_j, planData.animalsBirthDay, planData.animalsBirthDay + " " + planData.animalsShaking, planData.animalsDeathDay, planData.animalsDeathDay + " " + planData.animalsUnderstanding,planData.animalsCommunicationItems,true);
}else{
this.removeTimeZone('Tiger_Nat_' + id_i + '_' + id_j);
}
}
}
}
onanimalsPoliceanimalsBye(plananimalAge, id_i, id_j){
let that = this;
let planData = $.extend(true, {}, plananimalAge);
if(planData){
let listOfFeeds;
let planDataObjectKeys = Object.keys(planData);
let existingTimeZones = [];
let existingTimeZonesObject = {};
let newlyAddedTimeZones = [];
let feedsConcatObjects;
let timeZoneKeys;
let onfreshanimalsPolicesTimeZones = [];
let checkAndUncheckItems = [];
timeZoneKeys = planDataObjectKeys.filter(function(keyNames,index){
if((keyNames.includes("ET") && planData["ET"])||
(keyNames.includes("CT") && planData["CT"])||
(keyNames.includes("MT") && planData["MT"])||
(keyNames.includes("PT") && planData["PT"])) return true;
})
if(timeZoneKeys){
timeZoneKeys.forEach(function(keyData){
let keysValue = {};
if(keyData=="ET"){
keysValue = { "ET" : planData[keyData]};
}else if(keyData=="CT"){
keysValue = { "CT" : planData[keyData]};
}else if(keyData=="MT"){
keysValue = { "MT" : planData[keyData]};
}else if(keyData=="PT"){
keysValue = { "PT" : planData[keyData]};
}
checkAndUncheckItems.push(keysValue);
})
}
if(planData.TigerPlanFeeds.length>0){
listOfFeeds = planData.TigerPlanFeeds;
listOfFeeds.sort(function(a,b){
return a.animalHumming - b.animalHumming;
})
if(checkAndUncheckItems && existingTimeZones){
let etzOjbect = existingTimeZonesObject;
checkAndUncheckItems.forEach(function(checkdata){
if(checkdata.hasOwnProperty("ET")){
if(checkdata.ET){
existingTimeZones.push(11);
}
}else if(checkdata.hasOwnProperty("CT")){
if(checkdata.CT){
existingTimeZones.push(12);
}
}else if(checkdata.hasOwnProperty("MT")){
if(checkdata.MT){
existingTimeZones.push(13);
}
}else if(checkdata.hasOwnProperty("PT")){
if(checkdata.PT){
existingTimeZones.push(14);
}
}
})
}
if(existingTimeZones){
existingTimeZones.sort(function(a,b){
return a - b;
})
let objectsLength = existingTimeZones.length - 1;
existingTimeZones.forEach(function(data,index){
let timeZoneName;
if(data==11){
timeZoneName="Tiger_Est";
}else if(data==12){
timeZoneName="Tiger_Cent";
}else if(data==13){
timeZoneName="Tiger_Mount";
}else if(data==14){
timeZoneName="Tiger_Pacifi";
}
if(index==objectsLength){
that.lastAvailableTimeZone.push(timeZoneName+'_'+id_i+'_'+id_j);
}else{
that.availableTimeZoneExceptLastOne.push(timeZoneName+'_'+id_i+'_'+id_j);
}
})
that.availableTimeZoneExceptLastOne.push('Tiger_Nat_'+id_i+'_'+id_j);
}
}else{
let timeZoneKeysLength = timeZoneKeys.length - 1
timeZoneKeys.forEach(function(keyName,index){
let timeZoneName;
let timeZoneanimalHumming;
if(keyName=="ET"){
timeZoneName = "Tiger_Est";
timeZoneanimalHumming = 11;
}else if(keyName=="CT"){
timeZoneName="Tiger_Cent";
timeZoneanimalHumming = 12;
}else if(keyName=="MT"){
timeZoneName="Tiger_Mount";
timeZoneanimalHumming = 13;
}else if(keyName=="PT"){
timeZoneName="Tiger_Pacifi";
timeZoneanimalHumming = 14;
}
if(planData[keyName]){
onfreshanimalsPolicesTimeZones.push(timeZoneanimalHumming)
}
})
if(onfreshanimalsPolicesTimeZones){
onfreshanimalsPolicesTimeZones.sort(function(a,b){
return a - b;
})
onfreshanimalsPolicesTimeZones.forEach(function(data,index){
let timeZoneName;
if(data==11){
timeZoneName="Tiger_Est";
}else if(data==12){
timeZoneName="Tiger_Cent";
}else if(data==13){
timeZoneName="Tiger_Mount";
}else if(data==14){
timeZoneName="Tiger_Pacifi";
}
if(index==timeZoneKeysLength){
that.lastAvailableTimeZone.push(timeZoneName+'_'+id_i+'_'+id_j);
}else{
that.availableTimeZoneExceptLastOne.push(timeZoneName+'_'+id_i+'_'+id_j);
}
})
that.availableTimeZoneExceptLastOne.push('Tiger_Nat_'+id_i+'_'+id_j);
}
}
}
}
TigerGroupingResources(planData: any,id_i:any,id_j:any){
//console.log(planData);
let allRemoveList=["ET","CT","MT","PT"];
this.Tigercrow.TigerRemoveList=["Est","Cent","Mount","Pacifi"];
this.onanimalsPoliceanimalsBye(planData, id_i, id_j);
//for(let z=0;z<allRemoveList.length;z++){
if(planData.ET){this.Tigercrow.TigerRemoveList=this.Tigercrow.TigerRemoveList.filter(function(e) { return e !== 'Est' })}
if(planData.CT){this.Tigercrow.TigerRemoveList=this.Tigercrow.TigerRemoveList.filter(function(e) { return e !== 'Cent' })}
if(planData.MT){this.Tigercrow.TigerRemoveList=this.Tigercrow.TigerRemoveList.filter(function(e) { return e !== 'Mount' })}
if(planData.PT){this.Tigercrow.TigerRemoveList=this.Tigercrow.TigerRemoveList.filter(function(e) { return e !== 'Pacifi' })}
/*for(let z=0;z<allRemoveList.length;z++){
if(planData[allRemoveList[z]]){
this.Tigercrow.TigerRemoveList.splice(z, 1);
}
}*/
let isTimezoneChecked = false;
if(planData.TigerPlanFeeds){
if(planData.TigerPlanFeeds.length>0){
for (var i = 0; i < planData.TigerPlanFeeds.length ; i++) {
let item_sche = planData.TigerPlanFeeds[i];
if(item_sche.animalHumming == 11 && !planData.ET){ // 11 for eastern
// planData.TigerPlanFeeds.splice(i, 1);
planData.TigerPlanFeeds[i].isFeedAvailable = false;
if(planData.TigerPlanFeeds[i].operationType == ''){
planData.TigerPlanFeeds[i].operationType ='animalsDryer';
}else if(planData.TigerPlanFeeds[i].operationType.toUpperCase().trim() == 'CREATE'){
planData.TigerPlanFeeds[i].TigerItems =[];
}
this.removeTimeZone('Tiger_Est_'+id_i+'_'+id_j);
}
else if(item_sche.animalHumming == 12 && !planData.CT){ // 12 for central
planData.TigerPlanFeeds[i].isFeedAvailable = false;
if(planData.TigerPlanFeeds[i].operationType == ''){
planData.TigerPlanFeeds[i].operationType ='animalsDryer';
}else if(planData.TigerPlanFeeds[i].operationType.toUpperCase().trim() == 'CREATE'){
planData.TigerPlanFeeds[i].TigerItems =[];
}
this.removeTimeZone('Tiger_Cent_'+id_i+'_'+id_j);
}
else if(item_sche.animalHumming == 13 && !planData.MT){ // 13 for Mountain
planData.TigerPlanFeeds[i].isFeedAvailable = false;
if(planData.TigerPlanFeeds[i].operationType == ''){
planData.TigerPlanFeeds[i].operationType ='animalsDryer';
}else if(planData.TigerPlanFeeds[i].operationType.toUpperCase().trim() == 'CREATE'){
planData.TigerPlanFeeds[i].TigerItems =[];
}
this.removeTimeZone('Tiger_Mount_'+id_i+'_'+id_j);
}
else if(item_sche.animalHumming == 14 && !planData.PT ){ // 13 for Pacific
planData.TigerPlanFeeds[i].isFeedAvailable = false;
if(planData.TigerPlanFeeds[i].operationType == ''){
planData.TigerPlanFeeds[i].operationType ='animalsDryer';
}else if(planData.TigerPlanFeeds[i].operationType.toUpperCase().trim() == 'CREATE'){
planData.TigerPlanFeeds[i].TigerItems =[];
}
this.removeTimeZone('Tiger_Pacifi_'+id_i+'_'+id_j);
}
}
if(planData.ET){ // 11 for eastern
let data_TigerItem = [];
let isExistPlanTZ = false;
isTimezoneChecked = true;
let Tiger = this.Tigercrow.getAllTigerData('Tiger_Est_'+id_i+'_'+id_j);
//console.log(Tiger);
for(var t=0;t< planData.TigerPlanFeeds.length ; t++){
let item_sche = planData.TigerPlanFeeds[t];
if(item_sche.TigerItems && item_sche.animalHumming == 11 && item_sche.operationType !='animalsDryer'){
item_sche.TigerItems = Tiger;
}
}
for (var i = 0; i < planData.TigerPlanFeeds.length ; i++) {
let item_sche = planData.TigerPlanFeeds[i];
if(item_sche.TigerItems && item_sche.animalHumming == 11 && item_sche.operationType !='animalsDryer'){
data_TigerItem = item_sche.TigerItems;
item_sche.isFeedAvailable = true;
isExistPlanTZ = true;
}
/*else{
planData.TigerPlanFeeds.push({"animalsNokia":planData.animalsNokia,"feedName":"Eastern","animalHumming",11,"planNo":planData.planNo})
}*/
}
if(!isExistPlanTZ){
planData.TigerPlanFeeds.push({"animalsNokia":planData.animalsNokia,"feedName":"Eastern","animalHumming":11,"isFeedAvailable":true,"planNo":planData.planNo,"TigerItems":[],"operationType": "Create","feedOpIssue" : {"issueDesc": ""}});
}
let config = {"data":data_TigerItem,
"planNo": planData.planNo,
"animalsShaking": planData.animalsBirthDay + " " + planData.animalsShaking, "animalsBirthDay": planData.animalsBirthDay, "animalsUnderstanding": planData.animalsDeathDay+ " " + planData.animalsUnderstanding, "animalsDeathDay": planData.animalsDeathDay,
"grouping":[],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone,
"categoryAndPlanDesc":planData.categoryDesc + ':' + planData.planDesc
};
//config.data = this.timeAnimalsTeethConversionFromTiger(config.data,"eastern");
config.grouping.push({ text: "Eastern", value: 11, color: "#E6AB77" });
this.Tigercrow.callInit('Tiger_Est_'+id_i+'_'+id_j,config);
}
if(planData.CT){ // 12 for Central
let data_TigerItem = [];
let isExistPlanTZ = false;
isTimezoneChecked = true;
let Tiger = this.Tigercrow.getAllTigerData('Tiger_Cent_'+id_i+'_'+id_j);
//console.log(Tiger);
for(var t=0;t< planData.TigerPlanFeeds.length ; t++){
let item_sche = planData.TigerPlanFeeds[t];
if(item_sche.TigerItems && item_sche.animalHumming == 12 && item_sche.operationType !='animalsDryer'){
item_sche.TigerItems = Tiger;
}
}
for (var i = 0; i < planData.TigerPlanFeeds.length ; i++) {
let item_sche = planData.TigerPlanFeeds[i];
if(item_sche.TigerItems && item_sche.animalHumming == 12 && item_sche.operationType !='animalsDryer'){
data_TigerItem = item_sche.TigerItems;
item_sche.isFeedAvailable = true;
isExistPlanTZ = true;
}
}
if(!isExistPlanTZ){
planData.TigerPlanFeeds.push({"animalsNokia":planData.animalsNokia,"feedName":"Central","animalHumming":12,"isFeedAvailable":true,"planNo":planData.planNo,"TigerItems":[],"operationType": "Create","feedOpIssue" : {"issueDesc": ""}});
}
let config = {"data":data_TigerItem,
"planNo": planData.planNo,
"animalsShaking": planData.animalsBirthDay + " " + planData.animalsShaking, "animalsBirthDay": planData.animalsBirthDay, "animalsUnderstanding": planData.animalsDeathDay+ " " + planData.animalsUnderstanding, "animalsDeathDay": planData.animalsDeathDay,
"grouping":[],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone,
"categoryAndPlanDesc":planData.categoryDesc + ':' + planData.planDesc};
//config.data = this.timeAnimalsTeethConversionFromTiger(config.data,"central");
config.grouping.push({ text: "Central", value: 12, color: "#E6AB77" });
this.Tigercrow.callInit('Tiger_Cent_'+id_i+'_'+id_j,config);
}
if(planData.MT){ // 13 for Mountain
let data_TigerItem = [];
let isExistPlanTZ = false;
isTimezoneChecked = true;
let Tiger = this.Tigercrow.getAllTigerData('Tiger_Mount_'+id_i+'_'+id_j);
//console.log(Tiger);
for(var t=0;t< planData.TigerPlanFeeds.length ; t++){
let item_sche = planData.TigerPlanFeeds[t];
if(item_sche.TigerItems && item_sche.animalHumming == 13 && item_sche.operationType !='animalsDryer'){
item_sche.TigerItems = Tiger;
}
}
for (var i = 0; i < planData.TigerPlanFeeds.length ; i++) {
let item_sche = planData.TigerPlanFeeds[i];
if(item_sche.TigerItems && item_sche.animalHumming == 13 && item_sche.operationType !='animalsDryer'){
data_TigerItem = item_sche.TigerItems;
item_sche.isFeedAvailable = true;
isExistPlanTZ = true;
}
}
if(!isExistPlanTZ){
planData.TigerPlanFeeds.push({"animalsNokia":planData.animalsNokia,"feedName":"Mountain","animalHumming":13,"isFeedAvailable":true,"planNo":planData.planNo,"TigerItems":[],"operationType": "Create","feedOpIssue" : {"issueDesc": ""}});
}
let config = {"data":data_TigerItem,
"planNo": planData.planNo,
"animalsShaking": planData.animalsBirthDay + " " + planData.animalsShaking, "animalsBirthDay": planData.animalsBirthDay, "animalsUnderstanding": planData.animalsDeathDay+ " " + planData.animalsUnderstanding, "animalsDeathDay": planData.animalsDeathDay,
"grouping":[],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone,
"categoryAndPlanDesc":planData.categoryDesc + ':' + planData.planDesc};
//config.data = this.timeAnimalsTeethConversionFromTiger(config.data,"mount");
config.grouping.push({ text: "Mountain", value: 13, color: "#E6AB77" });
this.Tigercrow.callInit('Tiger_Mount_'+id_i+'_'+id_j,config);
}
if(planData.PT){ // 14 for eastern
let data_TigerItem = [];
let isExistPlanTZ = false;
isTimezoneChecked = true;
let Tiger = this.Tigercrow.getAllTigerData('Tiger_Pacifi_'+id_i+'_'+id_j);
//console.log(Tiger);
for(var t=0;t< planData.TigerPlanFeeds.length ; t++){
let item_sche = planData.TigerPlanFeeds[t];
if(item_sche.TigerItems && item_sche.animalHumming == 14 && item_sche.operationType !='animalsDryer'){
item_sche.TigerItems = Tiger;
}
}
for (var i = 0; i < planData.TigerPlanFeeds.length ; i++) {
let item_sche = planData.TigerPlanFeeds[i];
if(item_sche.TigerItems && item_sche.animalHumming == 14 && item_sche.operationType !='animalsDryer'){
data_TigerItem = item_sche.TigerItems;
item_sche.isFeedAvailable = true;
isExistPlanTZ = true;
}
}
if(!isExistPlanTZ){
planData.TigerPlanFeeds.push({"animalsNokia":planData.animalsNokia,"feedName":"Pacific","animalHumming":14,"isFeedAvailable":true,"planNo":planData.planNo,"TigerItems":[],"operationType": "Create","feedOpIssue" : {"issueDesc": ""}});
}
let config = {"data":data_TigerItem,
"planNo": planData.planNo,
"animalsShaking": planData.animalsBirthDay + " " + planData.animalsShaking, "animalsBirthDay": planData.animalsBirthDay, "animalsUnderstanding": planData.animalsDeathDay+ " " + planData.animalsUnderstanding, "animalsDeathDay": planData.animalsDeathDay,
"grouping":[],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone,
"categoryAndPlanDesc":planData.categoryDesc + ':' + planData.planDesc};
//config.data = this.timeAnimalsTeethConversionFromTiger(config.data,"pacific");
config.grouping.push({ text: "Pacific", value: 14, color: "#E6AB77" });
this.Tigercrow.callInit('Tiger_Pacifi_'+id_i+'_'+id_j,config);
}
/*for (var i = 0; i < planData.TigerPlanFeeds.length ; i++) {
let item_sche = planData.TigerPlanFeeds[i];
let data_TigerItem = [];
if(item_sche.TigerItems){
data_TigerItem = item_sche.TigerItems;
}
let config = {"data":data_TigerItem,
"animalsShaking":planData.animalsBirthDay +" "+ planData.animalsShaking,"animalsBirthDay":planData.animalsBirthDay ,"animalsUnderstanding":"","animalsDeathDay":"",
"grouping":[]};
this.loadanimalsCommunication('Tiger_Nat_'+id_i+'_'+id_j,planData.animalsBirthDay,planData.animalsBirthDay +" "+ planData.animalsShaking);
if(item_sche.animalHumming == 11 && planData.ET){ // 11 for eastern
config.grouping.push({ text: "Eastern", value: 11, color: "#E6AB77" });
this.Tigercrow.callInit('Tiger_Est_'+id_i+'_'+id_j,config);
}
else if(item_sche.animalHumming == 12 && planData.CT){ // 12 for central
config.grouping.push({ text: "Central", value: 12, color: "#E6AB77" });
this.Tigercrow.callInit('Tiger_Cent_'+id_i+'_'+id_j,config);
}
else if(item_sche.animalHumming == 13 && planData.MT){ // 13 for Mountain
config.grouping.push({ text: "Mountain", value: 13, color: "#E6AB77" });
this.Tigercrow.callInit('Tiger_Mount_'+id_i+'_'+id_j,config);
}
else if(item_sche.animalHumming == 14 && planData.PT ){ // 13 for Pacific
config.grouping.push({ text: "Pacific", value: 14, color: "#E6AB77" });
this.Tigercrow.callInit('Tiger_Pacifi_'+id_i+'_'+id_j,config);
}
if(planData.ET && planData.MT && planData.PT && planData.CT){
planData.ALL = true;
}
else{
planData.ALL = false;
}
} */
if(planData.ET && planData.MT && planData.PT && planData.CT){
planData.ALL = true;
}
else{
planData.ALL = false;
}
var BookedPlanData = this.animalStrategy.animalsSeeing[id_i].TigerPlans[id_j].bookPlanID;
this.TigerLeftTab.animalsPoliceBookEvent(this.animalStrategy.animalsSeeing, BookedPlanData);
}
else{
if(planData.ET){
isTimezoneChecked = true;
let config = {"data":[],
"planNo": planData.planNo,
"animalsShaking": planData.animalsBirthDay + " " + planData.animalsShaking, "animalsBirthDay": planData.animalsBirthDay, "animalsUnderstanding": planData.animalsDeathDay+ " " + planData.animalsUnderstanding, "animalsDeathDay": planData.animalsDeathDay,
"grouping":[],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone,
"categoryAndPlanDesc":planData.categoryDesc + ':' + planData.planDesc};
//config.data = this.timeAnimalsTeethConversionFromTiger(config.data,"eastern");
config.grouping.push({ text: "Eastern", value: 11, color: "#E6AB77" });
planData.TigerPlanFeeds.push({"animalsNokia":planData.animalsNokia,"feedName":"Eastern",
"animalHumming":11,"isFeedAvailable":true,"TigerItems":[],
"operationType": "create","planNo": 0, "animalStamina": 0,"feedOpIssue" : {"issueDesc": ""}});
this.Tigercrow.callInit('Tiger_Est_'+id_i+'_'+id_j,config);
// planData.TigerPlanFeeds.push({})
}
if(planData.CT){ // 12 for central
isTimezoneChecked = true;
let config = {"data":[],
"planNo": planData.planNo,
"animalsShaking": planData.animalsBirthDay + " " + planData.animalsShaking, "animalsBirthDay": planData.animalsBirthDay, "animalsUnderstanding": planData.animalsDeathDay+ " " + planData.animalsUnderstanding, "animalsDeathDay": planData.animalsDeathDay,
"grouping":[],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone,
"categoryAndPlanDesc":planData.categoryDesc + ':' + planData.planDesc};
//config.data = this.timeAnimalsTeethConversionFromTiger(config.data,"central");
config.grouping.push({ text: "Central", value: 12, color: "#E6AB77" });
planData.TigerPlanFeeds.push({"animalsNokia":planData.animalsNokia,"feedName":"Central","animalHumming":12,"isFeedAvailable":true,"TigerItems":[],
"operationType": "create","planNo": 0, "animalStamina": 0,"feedOpIssue" : {"issueDesc": ""}});
this.Tigercrow.callInit('Tiger_Cent_'+id_i+'_'+id_j,config);
}
if(planData.MT){ // 13 for Mountain
isTimezoneChecked = true;
let config = {"data":[],
"planNo": planData.planNo,
"animalsShaking": planData.animalsBirthDay + " " + planData.animalsShaking, "animalsBirthDay": planData.animalsBirthDay, "animalsUnderstanding": planData.animalsDeathDay+ " " + planData.animalsUnderstanding, "animalsDeathDay": planData.animalsDeathDay,
"grouping":[],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone,
"categoryAndPlanDesc":planData.categoryDesc + ':' + planData.planDesc};
//config.data = this.timeAnimalsTeethConversionFromTiger(config.data,"mount");
config.grouping.push({ text: "Mountain", value: 13, color: "#E6AB77" });
planData.TigerPlanFeeds.push({"animalsNokia":planData.animalsNokia,"feedName":"Mountain","animalHumming":13,"isFeedAvailable":true,"TigerItems":[],
"operationType": "create","planNo": 0, "animalStamina": 0,"feedOpIssue" : {"issueDesc": ""}});
this.Tigercrow.callInit('Tiger_Mount_'+id_i+'_'+id_j,config);
}
if(planData.PT){ // 13 for Pacific
isTimezoneChecked = true;
let config = {"data":[],
"planNo": planData.planNo,
"animalsShaking": planData.animalsBirthDay + " " + planData.animalsShaking, "animalsBirthDay": planData.animalsBirthDay, "animalsUnderstanding": planData.animalsDeathDay+ " " + planData.animalsUnderstanding, "animalsDeathDay": planData.animalsDeathDay,
"grouping":[],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone,
"categoryAndPlanDesc":planData.categoryDesc + ':' + planData.planDesc};
//config.data = this.timeAnimalsTeethConversionFromTiger(config.data,"pacific");
config.grouping.push({ text: "Pacific", value: 14, color: "#E6AB77" });
planData.TigerPlanFeeds.push({"animalsNokia":planData.animalsNokia,"feedName":"Pacific","animalHumming":14,"isFeedAvailable":true,"TigerItems":[],
"operationType": "create","planNo": 0, "animalStamina": 0,"feedOpIssue" : {"issueDesc": ""}});
this.Tigercrow.callInit('Tiger_Pacifi_'+id_i+'_'+id_j,config);
}
this.animalStrategy.animalsSeeing[id_i].TigerPlans[id_j].bookPlanID = id_i + '_' + id_j;
var BookedPlanData = this.animalStrategy.animalsSeeing[id_i].TigerPlans[id_j].bookPlanID;
this.TigerLeftTab.animalsPoliceBookEvent(this.animalStrategy.animalsSeeing, BookedPlanData);
}
if(isTimezoneChecked){
//console.log(planData.animalsCommunicationItems);
this.loadPlananimalsCommunication('Tiger_Nat_'+id_i+'_'+id_j,planData.animalsBirthDay,planData.animalsBirthDay +" "+ planData.animalsShaking,planData.animalsDeathDay,planData.animalsDeathDay +" "+ planData.animalsUnderstanding,planData.animalsCommunicationItems,false);
}else{
this.removeTimeZone('Tiger_Nat_'+id_i+'_'+id_j);
}
}
this.animalsBye();
//console.log(planData,id_i,id_j);
}
removeTimeZone(timeZone:any){
let that = this;
if($("#"+timeZone).data("kendoTiger")){
let Tigerdestroy = $("#"+timeZone).data("kendoTiger");
Tigerdestroy.destroy();
Tigerdestroy.wrapper.unbind();
//that.animalsBye();
}
}
generateTimeZoneObj(plan:any):any{
return{
operationType : null,TigerItems:[],planNo : 3507607,animalStamina : 0,animalsNokia : 0,
animalHumming : 11,
feedName : "EASTERN ",
issueDesc : "",
isFeedAvailable : true
}
}
loadanimalsCommunication(animalsCommunicationId: any, start: any, animalsShaking, animalsDeathDay: any, animalsUnderstanding: any) {
let that = this;
let config;
if(this.isanimalsPoliceCurrentanimalsCommunicationPlanEvents){
let Tiger:any = $('#Tiger_Nat_Main').data("kendoTiger");
if(Tiger){
if(Tiger.animalAge._data){
let animalAge = Tiger.animalAge._data;
let newanimalAge = [];
animalAge.forEach(function(events){
let newObj = {};
let objKeys = Object.keys(events);
objKeys.forEach(function(key){
if(key!="uid" || key!="_events" || key!="_handlers"){
newObj[key] = events[key];
}
})
newanimalAge.push(newObj);
})
this.animalStrategy.animalsCommunication = newanimalAge;
this.isanimalsPoliceCurrentanimalsCommunicationPlanEvents = false;
}
}
}
config = {
"data": this.animalStrategy.animalsCommunication,
"planNo": 0,
"animalsShaking": animalsShaking, "animalsBirthDay": start, "animalsUnderstanding": animalsUnderstanding, "animalsDeathDay": animalsDeathDay,
"grouping": [],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone
};
config.grouping.push({ text: "animalsCommunication", value: 11, color: "#e1f0df" });
this.Tigercrow.callInit(animalsCommunicationId, config);
}
loadPlananimalsCommunicationFirst(animalsCommunicationId: any, start: any, animalsShaking, animalsDeathDay: any, animalsUnderstanding: any,planData:any,initialLoad:any) {
let that = this;
let config;
let flag = true;
if(planData == undefined){
planData = this.animalStrategy.animalsCommunication;
flag = false;
}
config = {
"data": planData,
"planNo": 0,
"animalsShaking": animalsShaking, "animalsBirthDay": start, "animalsUnderstanding": animalsUnderstanding, "animalsDeathDay": animalsDeathDay,
"grouping": [],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone
};
if(initialLoad){
if(planData.length>0){
if(!(planData[0].start instanceof Date)){
if(flag){
config.data = this.timeAnimalsTeethConversion(config.data,"animalsCommunication",{},animalsCommunicationId);
}
}
}
}
config.grouping.push({ text: "animalsCommunication", value: 11, color: "#e1f0df" });
this.Tigercrow.callInit(animalsCommunicationId, config);
}
loadPlananimalsCommunication(animalsCommunicationId: any, start: any, animalsShaking, animalsDeathDay: any, animalsUnderstanding: any,planData:any,initialLoad:any) {
let that = this;
let config;
//console.log(planData);
/*if(this.isanimalsPoliceCurrentanimalsCommunicationPlanEvents){
let Tiger:any = $('#Tiger_Nat_Main').data("kendoTiger");
if(Tiger){
if(Tiger.animalAge._data){
let animalAge = Tiger.animalAge._data;
let newanimalAge = [];
animalAge.forEach(function(events){
let newObj = {};
let objKeys = Object.keys(events);
objKeys.forEach(function(key){
if(key!="uid" || key!="_events" || key!="_handlers"){
newObj[key] = events[key];
}
})
newanimalAge.push(newObj);
})
this.animalStrategy.animalsCommunication = newanimalAge;
this.isanimalsPoliceCurrentanimalsCommunicationPlanEvents = false;
}
}
}*/
let flag = true;
if(planData == undefined){
planData = this.animalStrategy.animalsCommunication;
flag = false;
}
config = {
"data": planData,
"planNo": 0,
"animalsShaking": animalsShaking, "animalsBirthDay": start, "animalsUnderstanding": animalsUnderstanding, "animalsDeathDay": animalsDeathDay,
"grouping": [],
"availableTimeZonesExceptLastOne":this.availableTimeZoneExceptLastOne,
"lastAvailableTimeZones":this.lastAvailableTimeZone
};
if(flag){
if(planData.length>0){
if(!(planData[0].start instanceof Date)){
config.data = this.timeAnimalsTeethConversion(config.data,"animalsCommunication",{},animalsCommunicationId);
}
}
}
config.grouping.push({ text: "animalsCommunication", value: 11, color: "#e1f0df" });
this.Tigercrow.callInit(animalsCommunicationId, config);
}
convertTo24Hour(time) {
var hours = parseInt(time.substr(0, 2));
if(time.indexOf('AM') != -1 && hours == 12) {
time = time.replace('12', '0');
}
if(time.indexOf('PM') != -1 && hours < 12) {
time = time.replace(hours, (hours + 12));
}
return time.replace(/(AM|PM)/, '');
}
convertTo24HouranimalsCommunication(time) {
var hours = parseInt(time.substr(0, 2));
if (time.indexOf('AM') != -1 && hours == 12) {
time = time.replace('12', '0');
}
if (time.indexOf('PM') != -1 && hours < 12) {
time = time.replace(hours, (hours + 12));
}
var x = time.replace(/(AM|PM)/, '');
var times = x.split(":");
var hours = (parseInt(times[0], 10) * 60 * 60);
var mins = (parseInt(times[1], 10) * 60);
var secs = parseInt(times[2], 10);
var final = hours + mins + secs;
return final;
}
timeAnimalsTeethConversion(natData,zone,planData:any,schedId:any) {
let plananimalsBirthDay='';
let zoneTime = {"animalsCommunication":5,"eastern":5,"central":4,"mount":3,"pacific":2};
let planTime={"animalsCommunication":0,"eastern":0,"central":1,"mount":2,"pacific":3}
if(JSON.stringify(planData) !== '{}'){
plananimalsBirthDay=planData.animalsBirthDay+' '+this.convertTo24Hour(planData.animalsShaking);
}
for (let i = 0; i < natData.length; i++) {
let parseanimalsBirthDay = kendo.parseDate(natData[i].start);
let parsedStDate = kendo.toString(parseanimalsBirthDay, "yyyy-MM-dd HH:mm:ss");
let parseanimalsDeathDay = kendo.parseDate(natData[i].end);
let parsedEnDate = kendo.toString(parseanimalsDeathDay, "yyyy-MM-dd HH:mm:ss");
natData[i]['isFwdIcon'] = "N";
natData[i]['isBwdIcon'] = "N";
if(zone == 'animalsCommunication'){
//checking span icon for starting
if( kendo.parseDate(natData[i].start, "yyyy-MM-dd").getTime() == kendo.parseDate( this.animalStrategy.commonInfo.eventanimalsBirthDay).getTime()){
// checking between 5am to 12pm
if (kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].start), "HH:mm:ss tt")) < kendo.parseDate("11:59:59 PM")
&& kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].start), "HH:mm:ss tt")) >= kendo.parseDate("05:00:00 AM")) {
//is span found
if(kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].start), "HH:mm:ss tt"))
< kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsShaking)){
natData[i]['isBwdIcon'] = "Y";
}
}
if (kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].start), "HH:mm:ss tt")) >= kendo.parseDate("12:00:00 AM")
&& kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].start), "HH:mm:ss tt")) < kendo.parseDate("05:00:00 AM")
){
//is span found
if(kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].start), "HH:mm:ss tt"))
< kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsShaking)
&& kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsShaking) >= kendo.parseDate("12:00:00 AM")
&& kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsShaking) < kendo.parseDate("05:00:00 AM")){
natData[i]['isBwdIcon'] = "Y";
}
}
if (kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].start), "HH:mm:ss tt")) >= kendo.parseDate("12:00:00 AM")
&& kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].start), "HH:mm:ss tt")) > kendo.parseDate("05:00:00 AM")
){
//is span found
if(kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].start), "HH:mm:ss tt"))
> kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsShaking)
&& kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsShaking) >= kendo.parseDate("12:00:00 AM")
&& kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsShaking) < kendo.parseDate("05:00:00 AM")){
natData[i]['isBwdIcon'] = "Y";
}
}
}
//checking span icon for end
if( kendo.parseDate(natData[i].end, "yyyy-MM-dd").getTime() == kendo.parseDate( this.animalStrategy.commonInfo.eventanimalsDeathDay).getTime()){
if (kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].end), "HH:mm:ss tt")) < kendo.parseDate("11:59:59 PM")
&& kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].end), "HH:mm:ss tt")) <= kendo.parseDate("04:59:00 AM")) {
if (kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].end), "HH:mm:ss tt"))
> kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsUnderstanding)) {
natData[i]['isFwdIcon'] = "Y";
}
}
if (kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].end), "HH:mm:ss tt")) >= kendo.parseDate("12:00:00 AM")
&& kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].end), "HH:mm:ss tt")) > kendo.parseDate("04:59:00 AM")
){
//is span found
if(kendo.parseDate(kendo.toString(kendo.parseDate(natData[i].end), "HH:mm:ss tt"))
> kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsUnderstanding)
&& kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsUnderstanding) >= kendo.parseDate("12:00:00 AM")
&& kendo.parseDate(this.animalStrategy.commonInfo.eventanimalsUnderstanding) > kendo.parseDate("04:59:00 AM")){
natData[i]['isFwdIcon'] = "Y";
}
}
}
}
natData[i]["cloneStart"]=this.timeSlotConversion(parsedStDate,zone);
natData[i]["cloneEnd"] = this.timeSlotConversion(parsedEnDate,zone);
let evntDateClone = new Date(natData[i]["cloneStart"]);
natData[i]["clonedanimalsBirthDay"] = this.Tigercrow.dateString(evntDateClone);
if(plananimalsBirthDay != ''){
let animalsSeeingtart=new Date(plananimalsBirthDay);
let eventPlananimalsShaking=new Date(plananimalsBirthDay);
eventPlananimalsShaking.setHours(1);
eventPlananimalsShaking.setMinutes(0);
eventPlananimalsShaking.setSeconds(0);
let animalsSeeingtartHours=animalsSeeingtart.getHours();
// if(animalsSeeingtartHours ==5 || animalsSeeingtartHours ==6 || animalsSeeingtartHours ==7){
animalsSeeingtartHours=animalsSeeingtartHours-planTime[zone];
let eventanimalsBirthDay = new Date(natData[i].start);
let eventanimalsBirthDayTime = new Date(natData[i].start);
let eventanimalsDeathDay = new Date(natData[i].end);
let eventanimalsBirthDayHours=eventanimalsBirthDay.getHours();
eventanimalsBirthDayTime.setHours(1);
eventanimalsBirthDayTime.setMinutes(0);
eventanimalsBirthDayTime.setSeconds(0);
if(eventanimalsBirthDayHours >= animalsSeeingtartHours && eventanimalsBirthDayHours<5){
//if(eventPlananimalsShaking.getTime() != eventanimalsBirthDayTime.getTime()){
eventanimalsBirthDay.setDate(eventanimalsBirthDay.getDate()+1);
let eventanimalsShaking=new Date(eventanimalsBirthDay).getTime();
let durationLength=parseInt(natData[i].programLength)*1000;
let eventanimalsUnderstanding=eventanimalsShaking+durationLength;
let eventanimalsDeathDayTime = new Date();
eventanimalsDeathDayTime.setTime(eventanimalsUnderstanding);
natData[i].start=eventanimalsBirthDay;
natData[i].end=eventanimalsDeathDayTime;
//}
}
// }
}
let eventanimalsBirthDay = kendo.parseDate(natData[i].start);
let eventStDate = kendo.toString(eventanimalsBirthDay, "yyyy-MM-dd HH:mm:ss");
let eventanimalsDeathDay = kendo.parseDate(natData[i].end);
let eventEnDate = kendo.toString(eventanimalsDeathDay, "yyyy-MM-dd HH:mm:ss");
natData[i].start = this.timeSlotConversion(eventStDate,zone);
natData[i].end = this.timeSlotConversion(eventEnDate,zone);
let uniqueSpanId = this.getUniqueSpanId()+i;
natData[i]['spanID'] = uniqueSpanId;
natData[i]['currentSchedID']=schedId;
}
return natData;
}
timeSlotConversion(date,zone) {
//console.log(date);
let convDate = new Date(date);
let splitDate = date.split(" ");
let splitTime = splitDate[1].split(":");
let hours: any = parseInt(splitTime[0]);
// let zoneTime = {"animalsCommunication":5,"eastern":5,"central":5,"mount":5,"pacific":5};
let zoneTime = {"animalsCommunication":5,"eastern":5,"central":4,"mount":3,"pacific":2};
if (hours >= zoneTime[zone]) {
hours = hours - zoneTime[zone];
} else {
hours = hours + (24-zoneTime[zone]);
}
hours = parseInt(hours) < 10 ? '0' + hours : hours;
let mergeTime = hours + ":" + splitTime[1] + ":" + splitTime[2];
let mergeDate = splitDate[0] + " " + mergeTime;
return mergeDate;
}
timeAnimalsTeethConversionFromTiger(natData,zone) {
for (let i = 0; i < natData.length; i++) {
let parseanimalsBirthDay = kendo.parseDate(natData[i].start);
let parsedStDate = kendo.toString(parseanimalsBirthDay, "yyyy-MM-dd HH:mm:ss");
let parseanimalsDeathDay = kendo.parseDate(natData[i].end);
let parsedEnDate = kendo.toString(parseanimalsDeathDay, "yyyy-MM-dd HH:mm:ss");
natData[i].start = this.timeSlotConversion(parsedStDate,zone);
natData[i].end = this.timeSlotConversion(parsedEnDate,zone);
}
return natData;
}
datechangeStart(data:any,id:any,id1:any){
// let animalsBirthDay = data[id].TigerPlans[id1].animalsBirthDay;
// let animalsDeathDay = data[id].TigerPlans[id1].animalsDeathDay;
// let startTi = data[id].TigerPlans[id1].animalsShaking;
// let endTi = data[id].TigerPlans[id1].animalsUnderstanding;
let animalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let animalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let startTi = $("#animalsShaking_"+id+"_"+id1).val();
let endTi = $("#animalsUnderstanding_"+id+"_"+id1).val();
let animalsShaking = kendo.toString(kendo.parseDate(startTi), "HH:mm:ss tt");
let animalsUnderstanding = kendo.toString(kendo.parseDate(endTi), "HH:mm:ss tt");
if(animalsShaking != null && animalsUnderstanding != null && animalsDeathDay != null){
if(animalsBirthDay > animalsDeathDay){
$("#animalsHMO_"+id+"_"+id1).addClass('mandatoryField');
$('#btnanimalsPolice_'+id+'_'+id1).addClass('actionanimalsJeansd');
//$("#saveEventAction").addClass('actionanimalsJeansd');
}else{
if(animalsBirthDay < animalsDeathDay){
this.clearFields(id+"_"+id1);
}else{
this.sameDayValidation(animalsShaking,animalsUnderstanding,id,id1,"sd");
/*if(animalsShaking >= animalsUnderstanding){
$("#animalsHMO_"+id+"_"+id1).addClass('mandatoryField');
$('#btnanimalsPolice_'+id+'_'+id1).addClass('actionanimalsJeansd');
}else{
this.clearFields(id+"_"+id1);
} */
}
//$("#saveEventAction").removeClass('actionanimalsJeansd');
}
}
}
datechangeEnd(data:any,id:any,id1:any){
let animalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let animalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let startTi = $("#animalsShaking_"+id+"_"+id1).val();
let endTi = $("#animalsUnderstanding_"+id+"_"+id1).val();
let animalsShaking = kendo.toString(kendo.parseDate(startTi), "HH:mm:ss tt");
let animalsUnderstanding = kendo.toString(kendo.parseDate(endTi), "HH:mm:ss tt");
if(animalsShaking != null && animalsUnderstanding != null && animalsBirthDay != null){
if(animalsBirthDay > animalsDeathDay){
$("#edError_"+id+"_"+id1).addClass('mandatoryField');
$('#btnanimalsPolice_'+id+'_'+id1).addClass('actionanimalsJeansd');
//$("#saveEventAction").addClass('actionanimalsJeansd');
}else{
if(animalsBirthDay < animalsDeathDay){
this.clearFields(id+"_"+id1);
}else{
this.sameDayValidation(animalsShaking,animalsUnderstanding,id,id1,"ed");
/*if(animalsShaking >= animalsUnderstanding){
$("#edError_"+id+"_"+id1).addClass('mandatoryField');
$('#btnanimalsPolice_'+id+'_'+id1).addClass('actionanimalsJeansd');
}else{
this.clearFields(id+"_"+id1);
} */
}
//$("#saveEventAction").removeClass('actionanimalsJeansd');
}
}
}
timeChangeStart(data:any,id:any,id1:any){
let animalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let animalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let startTi = $("#animalsShaking_"+id+"_"+id1).val();
let endTi = $("#animalsUnderstanding_"+id+"_"+id1).val();
let animalsShaking = kendo.toString(kendo.parseDate(startTi), "HH:mm:ss tt");
let animalsUnderstanding = kendo.toString(kendo.parseDate(endTi), "HH:mm:ss tt");
if(animalsBirthDay != null && animalsDeathDay != null && animalsUnderstanding != null){
if(animalsBirthDay > animalsDeathDay){
$("#stError_"+id+"_"+id1).addClass('mandatoryField');
$('#btnanimalsPolice_'+id+'_'+id1).addClass('actionanimalsJeansd');
}else{
if(animalsBirthDay < animalsDeathDay){
this.clearFields(id+"_"+id1);
}else{
this.sameDayValidation(animalsShaking,animalsUnderstanding,id,id1,"st");
/*if(animalsShaking >= animalsUnderstanding){
$("#stError_"+id+"_"+id1).addClass('mandatoryField');
$('#btnanimalsPolice_'+id+'_'+id1).addClass('actionanimalsJeansd');
}else{
this.clearFields(id+"_"+id1);
}*/
}
}
}
}
timeChangeEnd(data:any,id:any,id1:any){
// let animalsBirthDay = data[id].TigerPlans[id1].animalsBirthDay;
// let animalsDeathDay = data[id].TigerPlans[id1].animalsDeathDay;
// let startTi = data[id].TigerPlans[id1].animalsShaking;
// let endTi = data[id].TigerPlans[id1].animalsUnderstanding;
let animalsBirthDay = $("#animalsBirthDay_"+id+"_"+id1).val();
let animalsDeathDay = $("#animalsDeathDay_"+id+"_"+id1).val();
let startTi = $("#animalsShaking_"+id+"_"+id1).val();
let endTi = $("#animalsUnderstanding_"+id+"_"+id1).val();
let animalsShaking = kendo.toString(kendo.parseDate(startTi), "HH:mm:ss tt");
let animalsUnderstanding = kendo.toString(kendo.parseDate(endTi), "HH:mm:ss tt");
if(animalsBirthDay != null && animalsDeathDay != null && animalsShaking != null){
if(animalsBirthDay > animalsDeathDay){
$("#etError_"+id+"_"+id1).addClass('mandatoryField');
$('#btnanimalsPolice_'+id+'_'+id1).addClass('actionanimalsJeansd');
}else{
if(animalsBirthDay < animalsDeathDay){
this.clearFields(id+"_"+id1);
}else{
this.sameDayValidation(animalsShaking,animalsUnderstanding,id,id1,"et");
/* if(animalsShaking >= animalsUnderstanding){
$("#etError_"+id+"_"+id1).addClass('mandatoryField');
$('#btnanimalsPolice_'+id+'_'+id1).addClass('actionanimalsJeansd');
}else{
this.clearFields(id+"_"+id1);
} */
}
}
}
}
clearFields(id:any){
$("#animalsHMO_"+id).removeClass('mandatoryField');
$("#stError_"+id).removeClass('mandatoryField');
$("#edError_"+id).removeClass('mandatoryField');
$("#etError_"+id).removeClass('mandatoryField');
$('#btnanimalsPolice_'+id).removeClass('actionanimalsJeansd');
}
isFieldError(id:any){
var animalsBirthDayError = $("#animalsHMO_"+id).hasClass('mandatoryField');
var animalsShakingError = $("#stError_"+id).hasClass('mandatoryField');
var animalsDeathDayError = $("#edError_"+id).hasClass('mandatoryField');
var animalsUnderstandingError = $("#etError_"+id).hasClass('mandatoryField');
if(animalsBirthDayError || animalsShakingError || animalsDeathDayError || animalsUnderstandingError){
return true;
}else{
return false;
}
}
animalsBigBoss(dialogId) { // init pop dialog
$(dialogId).animalsEatinGindow({
title: "COMPASS",
width: "350px",
height: "150px",
visible: false,
resizable: false,
draggable: false,
modal: true,
actions: {},
open: function(e) { $("html, body").css("overflow", "hidden"); },
close: function(e) { $("html, body").css("overflow", ""); }
});
}
animalsSmallBox(dialogId) { // init pop dialog
$(dialogId).animalsEatinGindow({
title: false,
width: "350px",
visible: false,
resizable: false,
draggable: false,
modal: true,
actions: {},
open: function(e) { $("html, body").css("overflow", "hidden"); },
close: function(e) { $("html, body").css("overflow", ""); }
});
}
setDialog(data:any){
$(".ballPlayingAnimal").text(data);
let newdialogConfirm= $("#kendoOkDialog").data("animalsEatinGindow").center().open();
$("#animalsDryerOK").unbind().click(function(){
newdialogConfirm.close();
});
}
setDialogPlanDateRange(id:any,id1:any){
let that = this;
$(".ballPlayingAnimal").text("All Plan(s) should fall within 2 days of Event Start Date and Event End Date");
let PlanRangeDialogConfirm = $("#kendoPlanDateRangeDialog").data("animalsEatinGindow").center().open();
$("#planDateRangeOK").unbind().click(function(){
that.loadPreviousPlanData(that.animalsInternet,id,id1);
PlanRangeDialogConfirm.close();
});
}
expectedDialog(id:any,id1:any,animalStrategyPresent:any,data:any){
let that= this;
//Issue Fixed - CR-18586 - Observation 1
let allFalse = Object.keys(that.delanimalsPoliceTZ).every(function(k){ return that.delanimalsPoliceTZ[k] });
//
if(allFalse){
$(".ballPlayingAnimal").text("The expected Plan overlaps with following Event(s):");
let animalsDryerTZConfirm = $("#expectedOverlapConfirmDialog").data("animalsEatinGindow").center().open();
let messageDetails = data;
let getMessageDetail = "";
for(let k=0;k<messageDetails.length;k++){
getMessageDetail = getMessageDetail + ("<div class='expectedOverlapEvent'>"+messageDetails[k].animalsBirthDay+ " " +messageDetails[k].eventDesc+"</div>")
}
$("#expectedOverlapEventList").html(getMessageDetail);
let windowHeight = $(window).outerHeight();
windowHeight = windowHeight - 150;
$('.expectedOverlapEventsList').css({ "max-height": windowHeight+"px" });
$("#expectedYES").unbind().click(function() {
that.callanimalsPolicePlan(id,id1,animalStrategyPresent,false);
animalsDryerTZConfirm.close();
});
$("#expectedNO").unbind().click(function() {
//that.loadPreviousPlanData(that.animalsInternet,id,id1);
animalsDryerTZConfirm.close();
});
}else{
that.callanimalsPolicePlan(id,id1,animalStrategyPresent,false);
}
}
saveDialogBox(data:any){
let that= this;
// let new_dialogConfirm = null;
$(".ballPlayingAnimal").text(data);
let newdialogConfirm= $("#savePopUpDialog").data("animalsEatinGindow").center().open();
$("#savePopupYes").unbind().click(function(){
// if($("#txtArea").val().trim()==""){
// $(".ballPlayingAnimal").text("Please enter all the mandatory fields before proceeding to save");
// new_dialogConfirm = $("#insideSavePopup").data("animalsEatinGindow").center().open();
// } else{
newdialogConfirm.close();
that.saveServiceCall();
//that.clearSave();
//this.animalsFight=[];
//that.callServiceLoadData();
//}
/* CAS-85 */
window.sessionStorage.removeItem('scrollLeftPos');
newdialogConfirm.close();
//that.saveServiceCall();
});
$("#savePopupNo").unbind().click(function() {
that.isanimalsPoliceCurrentanimalsCommunicationPlanEvents = false;
that.callServiceLoadData();
newdialogConfirm.close();
window.sessionStorage.removeItem('scrollLeftPos');
for (let i = 0; i < that.TigerService.TigerEventsList.length; i++) {
if (that.TigerService.TigerEventsList[i].operationType == "Create") {
that.TigerService.TigerEventsList.splice(i--, 1);
}
}
});
$("#savePopupCancel").unbind().click(function(){
newdialogConfirm.close();
});
// $("#itsOkay").unbind().click(function(){
// newdialogConfirm.close();
// new_dialogConfirm.close();
// });
}
confirmDialog(data:any,id:any,id1:any){
let that = this;
$(".ballPlayingAnimal").text(data);
let newdialogConfirm= $("#animalsDryerPlanConfirmDialog").data("animalsEatinGindow").center().open();
$("#animalsDryerPlanYES").unbind().click(function(){
//let animalsTalking= that.getanimalsTalking(that.animalStrategy.animalsSeeing[id],"animalsDryer");
let animalsTalking= jQuery.extend(true, [], that.animalStrategy);
if(that.animalStrategy.animalsSeeing[id].categoryDesc.toUpperCase().trim()==="EXPECTED"){
that.animalStrategy.animalsSeeing[id].operationType= "animalsDryer";
}
that.animalStrategy.animalsSeeing[id].TigerPlans[id1].operationType = "animalsDryer";
//that.animalStrategy.animalsSeeing[id].TigerPlans.splice([id1],1);
//console.log(that.animalStrategy.animalsSeeing);
that.animalsHello();
//console.log(that.animalStrategy.animalsSeeing);
let DestinationEvent = that.getDestEvent(that.animalStrategy.animalsSeeing[id],"animalsDryer");
let destinationEvent= jQuery.extend(true, [], that.animalStrategy);
that.setEventUndo(animalsTalking,destinationEvent,id,id1,"planNamedeathAlive",that);
that.enableanimalsJeansSave(false);
newdialogConfirm.close();
//console.log(that.animalStrategy.animalsSeeing[id].TigerPlans[id1].operationType)
});
$("#animalsDryerPlanNO").unbind().click(function(){
newdialogConfirm.close();
});
}
getanimalsTalking(eventplan:any,operationtype:any){
let clonevent= jQuery.extend(true, {}, eventplan);
let planObject = {
"planName": clonevent.categoryDesc,
"addedPlanValue": clonevent.animalsNokia,
"operation":operationtype,
"dataStore": clonevent
};
return planObject;
}
getDestEvent(eventplan:any,operationtype:any){
let clonevent= jQuery.extend(true, {}, eventplan);
let planObject = {
"planName": clonevent.categoryDesc,
"addedPlanValue": clonevent.animalsNokia,
"operation":operationtype,
"dataStore": clonevent
};
return planObject;
}
setEventUndo(animalsTalking,DestinationEvent,id,id1,type,that){
let data={
"type": type,
"EventAddedID":id,
"TigerPlanId":id1,
"animalsTalking": jQuery.extend(true, {}, animalsTalking),
"destinationEvent": jQuery.extend(true, {}, DestinationEvent),
"occurence": {},
"action": type
}
that.animalsSwimmingAllRecordedNight(data);
}
airingsConfirmDialog(data:any,id:any,id1:any,animalStrategyPresent : any,selectedCategory:any,isUndo:any){
let that = this;
$(".ballPlayingAnimal").text(data);
let airingsDialogConfirm= $("#animalsDryerAiringsConfirmDialog").data("animalsEatinGindow").center().open();
$("#animalsDryerAiringsYES").unbind().click(function(){
let planData = animalStrategyPresent.animalsSeeing[id].TigerPlans[id1];
let isanimalsCommunicationDataChanged = that.isanimalsCommunicationDataChanged(that.animalsInternet,id,id1);
//if the plan timings and date's are changed/modified means isanimalsCommunicationDataChanged will be true
if(isanimalsCommunicationDataChanged){
that.plananimalsCommunicationanimalsPoliced(planData,id,id1, animalStrategyPresent,isUndo);
}else{
that.plananimalsPolice(planData,id,id1, animalStrategyPresent,isUndo);
}
airingsDialogConfirm.close();
});
$("#animalsDryerAiringsNO").unbind().click(function(){
//console.log(that.animalsInternet);
that.loadPreviousPlanData(that.animalsInternet,id,id1);
airingsDialogConfirm.close();
});
}
blockMenuInit(){
let that=this;
setTimeout(function(){
//$('.alieNevent').append('<span class="TigerContextMenuRow"><span class="contextMenuRow"></span></span>');
$("#context-menuAspect").unbind().kenAnimalsSnoaringontextMenu({
// filter: ".panel .panel-default",
hoverDelay: 100,
target : "#cntContext",
popupCollision: "fit",
select: function(e) {
let selectedMenuItem=$(e.item).children(".alieNlink").text();
let target = $(e.target);
let selTab = that.animalStrategy.animalsEar;
if(selectedMenuItem=="EASTERN"){
let textArea = $("#"+selTab+"_feedTextarea");
let setTab = selTab.replace(/.$/,"0");
$("#"+setTab+"_feedTextarea").val(textArea.val());
} else if(selectedMenuItem=="CENTRAL"){
let textArea = $("#"+selTab+"_feedTextarea");
let setTab = selTab.replace(/.$/,"1");
$("#"+setTab+"_feedTextarea").val(textArea.val());
} else if(selectedMenuItem=="MOUNTAIN"){
let textArea = $("#"+selTab+"_feedTextarea");
let setTab = selTab.replace(/.$/,"2");
$("#"+setTab+"_feedTextarea").val(textArea.val());
} else if(selectedMenuItem=="PACFIC"){
let textArea = $("#"+selTab+"_feedTextarea");
let setTab = selTab.replace(/.$/,"3");
$("#"+setTab+"_feedTextarea").val(textArea.val());
} else if(selectedMenuItem=="ALL"){
let textArea = $("#"+selTab+"_feedTextarea");
for(let ct = 0; ct< 4; ct++){
let setTab = selTab.replace(/.$/,""+ct+"");
$("#"+setTab+"_feedTextarea").val(textArea.val());
}
}
let contextMenu = $("#context-menuAspect").data("kenAnimalsSnoaringontextMenu");
if(contextMenu){
contextMenu.close($("#context-menuAspect"));
}
},
open:function(e){
//that.disbleMenuItem();
let target = $(e.target);
}
});
}, 10);
setTimeout(function(){
$("#context-eventMenu").unbind().kenAnimalsSnoaringontextMenu({
filter: "#HenEventHeader",
hoverDelay: 100,
target : "#evntContext",
popupCollision: "fit",
select: function(e) {
let selectedMenuItem=$(e.item).children(".alieNlink").text();
let target = $(e.target);
let contextMenu = $("#context-eventMenu").data("kenAnimalsSnoaringontextMenu");
if(contextMenu){
contextMenu.close($("#context-eventMenu"));
}
},
open:function(e){
//that.disbleMenuItem();
let target = $(e.target);
}
});
}, 10);
}
addPGMDetailundo(htmlValue: any) {
$(".KILLcrowMainContent ").html("");
$(".KILLcrowMainContent ").html(htmlValue);
}
addPGMDetail(PGMvalue: any) {
/*let animalsTalking=$(".KILLcrowMainContent ").html();
{
let value ={
"type": "enableSaveWithCount",
"animalsTalking":animalsTalking,
"destinationEvent" : $(".KILLcrowMainContent ").html(),
"occurence": {},
"action" :"addPGMDetail"
}
this.animalsSwimmingAllRecordedNight(value);
}*/
//this.previousPGMValue = PGMvalue;
let that=this;
let animalsEar = this.animalStrategy.animalsEar;
let replaceStr = this.animalStrategy.animalsEar.replace("lv_", "");
var animalsGiveUp = replaceStr.split("_");
if(animalsEar == "HenEventHeader" || animalsEar == "HenEventcollapse" || animalsEar == "HenEventDesc") {
let getLength = $("#HenEventDesc").length;
if(getLength==0){
that.animalStrategy.eventOpDes = '';
$("#HenEventcollapse").addClass("in");
$("#HenEventcollapse").css("height","auto");
setTimeout(function(){
that.animalsRocket($('#HenEventDesc').get(0));
that.rangey= that.animalsForgot();
$('body #removeText').show();
$('body #insertText').hide();
},100);
}
setTimeout(function(){
let getText = $("#HenEventDesc");
$('#HenEventcollapse')["collapse"]('show');
$("#HenEventDesc div").each(function(){
var evHas=$(this).removeAttr("class");
});
that.isSelected=1+that.isSelected;
var PGMtextToInsert="<div class='e-"+that.isSelected+"'>"+PGMvalue+"</div>";
that.animalsSoap(PGMtextToInsert,'HenEventDesc');
$('#HenEventDesc').addClass('changeContentFlag');
$('#HenEventDesc').addClass('pgmInsertText');
if(!$("#HenEventcollapse").hasClass("in")){
$("#HenEventcollapse").addClass("in");
$("#HenEventcollapse").css("height","auto");
}
},200);
this.animalsGame("HenEventDesc");
}
else{
// console.log("else")
if (animalsGiveUp.length === 1 && (animalsGiveUp.indexOf("HenEventHeader") == -1 && animalsGiveUp.indexOf("HenEventcollapse") == -1)) {
that.selectedID=animalsEar;
let firstIndex = animalsGiveUp[0];
var fact=animalsEar + "_feedTextarea";
let tempGetLength = $("#" + animalsEar + "_feedTextarea").length;
if(tempGetLength==0){
$('#insertText').trigger("click");
setTimeout(function(){
that.animalsRocket($("#" + animalsEar + "_feedTextarea").get(0));
that.rangey= that.animalsForgot();
$('body #AnimalsTeethremoveText').show();
$('body #AnimalsTeethinsertText').hide();
},100);
}
setTimeout(function(){
$("#" + animalsEar + "_feedTextarea div").each(function(){
var evHas=$(this).removeAttr("class");
});
that.isSelected=1+that.isSelected;
var PGMtextToInsert1="<div class='e-"+that.isSelected+"'>"+PGMvalue+"</div>";
that.animalsSoap1(PGMtextToInsert1,fact);
$("#" + animalsEar + "_feedTextarea").addClass('changeContentFlag');
},200);
$('#collapseOne_'+ firstIndex)["collapse"]('show');
this.animalsGame(fact);
} else if (animalsGiveUp.length === 2) {
that.selectedID=animalsEar;
let firstIndex = animalsGiveUp[0];
let secondIndex = animalsGiveUp[1];
var fact=animalsEar + "_feedTextarea";
let tempGetLength = $("#" + animalsEar + "_feedTextarea").length;
if(tempGetLength==0){
$('#insertText').trigger("click");
setTimeout(function(){
that.animalsRocket($("#" + animalsEar + "_feedTextarea").get(0));
that.rangey= that.animalsForgot();
$('body #AnimalsTeethremoveText').show();
$('body #AnimalsTeethinsertText').hide();
},300);
}
setTimeout(function(){
$("#" + animalsEar + "_feedTextarea div").each(function(){
var evHas=$(this).removeAttr("class");
});
that.isSelected=1+that.isSelected;
var PGMtextToInsert1="<div class='e-"+that.isSelected+"'>"+PGMvalue+"</div>";
that.animalsSoap1(PGMtextToInsert1,fact);
$("#" + animalsEar + "_feedTextarea").addClass('changeContentFlag');
},400);
$('#collapseOne_'+ firstIndex + '_' + secondIndex)["collapse"]('show');
this.animalsGame(fact);
} else if (animalsGiveUp.length === 3) {
that.selectedID=animalsEar;
let firstIndex = animalsGiveUp[0];
let secondIndex = animalsGiveUp[1];
let thirdIndex = animalsGiveUp[2];
var fact=animalsEar + "_feedTextarea";
let tempGetLength = $("#" + animalsEar + "_feedTextarea").length;
if(tempGetLength==0){
$('#insertText').trigger("click");
setTimeout(function(){
that.animalsRocket($("#" + animalsEar + "_feedTextarea").get(0));
that.rangey= that.animalsForgot();
$('body #AnimalsTeethremoveText').show();
$('body #AnimalsTeethinsertText').hide();
},100);
}
setTimeout(function(){
$("#" + animalsEar + "_feedTextarea div").each(function(){
var evHas=$(this).removeAttr("class");
});
that.isSelected=1+that.isSelected;
var PGMtextToInsert1="<div class='e-"+that.isSelected+"'>"+PGMvalue+"</div>";
that.animalsSoap1(PGMtextToInsert1,fact);
$("#" + animalsEar + "_feedTextarea").addClass('changeContentFlag');
},200);
$('#collapseOne_'+ firstIndex + '_' + secondIndex + '_' + thirdIndex)["collapse"]('show');
this.animalsGame(fact);
}
}
//console.log(("#"+animalsEar+"_feedTextarea")) ;
/* if ($("#" + animalsEar + "_feedTextarea").val()) {
PGMvalue = $("#" + animalsEar + "_feedTextarea").val() + ' ' + PGMvalue;
}*/
// $("#" + animalsEar + "_feedTextarea").kendoEditor({
// tools: [],
// })
// let AnimalsTeethDetaileditor = $("#" + animalsEar + "_feedTextarea").data("kendoEditor");
// AnimalsTeethDetaileditor.value(PGMvalue);
//$("#" + animalsEar + "_feedTextarea").val(PGMvalue);
//issue id CAS-174 starts here
this.animalsGame(animalsEar + "_feedTextarea");
//issue id CAS-174 ends here
}
animalsGame(animalsEar){
$("#" + animalsEar).css("overflow","hidden");
$("#" + animalsEar).focus();
$("#" + animalsEar).on('input focus load change blur keyup keydown paste cut', function () {
// $(this).height(0).height(this.scrollHeight);
$(this).height(0).height('auto');
}).find("#" + animalsEar).load();
}
onSaveEnable(id){
let that=this;
let test = that.animalsFight;
//console.log(test)
let getText=$("#"+id).html();
if(id=='HenEventDesc'){
let animalStrategy;
if(that.animalStrategy.eventOpDes){
animalStrategy=that.animalStrategy.eventOpDes;
} else{ animalStrategy=''; }
if(that.finalizereturnData(animalStrategy) != that.finalizereturnData(getText)){
this.enableanimalsJeansSave(false);
}
}
else{
let replaceStr = id.replace("lv_","");
let replaceStr1 = replaceStr.replace("_feedTextarea","");
var animalsGiveUp = replaceStr1.split("_");
let checkVal;
if(animalsGiveUp.length === 1){
let firstIndex = animalsGiveUp[0];
if(test[firstIndex].categoryOpIssue.issueDesc!=''){
checkVal=test[firstIndex].categoryOpIssue.issueDesc;
}
else{ checkVal=''; }
if(that.finalizereturnData(checkVal) != that.finalizereturnData(getText)){
this.enableanimalsJeansSave(false);
}
}
else if(animalsGiveUp.length === 2){
let firstIndex = animalsGiveUp[0];
let secondIndex = animalsGiveUp[1];
if(test[firstIndex].categoryOpIssue.issueDesc){
checkVal=test[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc;
}
else{ checkVal=''; }
if(that.finalizereturnData(checkVal) != that.finalizereturnData(getText)){
this.enableanimalsJeansSave(false);
}
}
else if(animalsGiveUp.length === 3){
let firstIndex = animalsGiveUp[0];
let secondIndex = animalsGiveUp[1];
let thirdIndex = animalsGiveUp[2];
if(test[firstIndex].categoryOpIssue.issueDesc){
checkVal=test[firstIndex].TigerPlans[secondIndex].TigerPlanFeeds[thirdIndex].feedOpIssue.issueDesc;
}
else{ checkVal=''; }
if(that.finalizereturnData(checkVal) != that.finalizereturnData(getText)){
this.enableanimalsJeansSave(false);
}
}
}
}
onTextChangeDesc(id,e){
let that=this;
let textChangeJson= jQuery.extend(true, [], that.animalsFight);
// if(that.sourceTextChangeJson){}else{that.sourceTextChangeJson = jQuery.extend(true, [], that.animalsFight);}
that.sourceTextChangeJson = jQuery.extend(true, [], that.animalsFight);
let getText = $("#"+id)[0].innerHTML;
let replaceStr = id.replace("lv_","");
let replaceStr1 = replaceStr.replace("_feedTextarea","");
var animalsGiveUp = replaceStr1.split("_");
let checkVal;
if(animalsGiveUp.length === 1){
let firstIndex = animalsGiveUp[0];
if(that.sourceTextChangeJson[firstIndex].categoryOpIssue.issueDesc){
checkVal=that.sourceTextChangeJson[firstIndex].categoryOpIssue.issueDesc;
}else{ checkVal=''; }
if(that.finalizereturnData(checkVal) != that.finalizereturnData(getText)){
let previousText=that.sourceTextChangeJson[firstIndex].categoryOpIssue.issueDesc;
textChangeJson[firstIndex].categoryOpIssue.issueDesc = getText;
//console.log("applied 1");
that.sourceTextChangeJson[firstIndex].categoryOpIssue.issueDesc=previousText;
let animalsTalking= jQuery.extend(true, [], that.sourceTextChangeJson);
let destinationEvent= jQuery.extend(true, [], textChangeJson);
let extraValue={
"iscollapse":true,
"isEventText":true
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
that.sourceTextChangeJson=jQuery.extend(true, [], textChangeJson);
that.sourceTextChangeJson=textChangeJson;
this.enableanimalsJeansSave(false);
}
}else if(animalsGiveUp.length === 2){
let firstIndex = animalsGiveUp[0];
let secondIndex = animalsGiveUp[1];
let checkVal=that.sourceTextChangeJson[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc;
if(that.sourceTextChangeJson[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc){
checkVal=that.sourceTextChangeJson[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc;
}else{ checkVal=''; }
//if (checkVal.toLowerCase() != getText.toLowerCase()){
if(that.finalizereturnData(checkVal) != that.finalizereturnData(getText)){
let previousText=that.sourceTextChangeJson[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc;
textChangeJson[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc = getText;
//console.log("applied 2") ;
that.sourceTextChangeJson[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc=previousText;
let animalsTalking= jQuery.extend(true, [], that.sourceTextChangeJson);
let destinationEvent= jQuery.extend(true, [], textChangeJson);
that.sourceTextChangeJson=jQuery.extend(true, [], textChangeJson);
let extraValue={
"iscollapse":true,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
this.enableanimalsJeansSave(false);
}
}else if(animalsGiveUp.length === 3){
let firstIndex = animalsGiveUp[0];
let secondIndex = animalsGiveUp[1];
let thirdIndex = animalsGiveUp[2];
if(that.sourceTextChangeJson[firstIndex].TigerPlans[secondIndex].TigerPlanFeeds[thirdIndex].feedOpIssue.issueDesc){
checkVal=that.sourceTextChangeJson[firstIndex].TigerPlans[secondIndex].TigerPlanFeeds[thirdIndex].feedOpIssue.issueDesc;
}else{ checkVal=''; }
if(that.finalizereturnData(checkVal) != that.finalizereturnData(getText)){
let previousText=that.sourceTextChangeJson[firstIndex].TigerPlans[secondIndex].TigerPlanFeeds[thirdIndex].feedOpIssue.issueDesc;
that.sourceTextChangeJson[firstIndex].TigerPlans[secondIndex].TigerPlanFeeds[thirdIndex].feedOpIssue.issueDesc = getText;
//console.log("applied 3");
that.sourceTextChangeJson[firstIndex].TigerPlans[secondIndex].TigerPlanFeeds[thirdIndex].feedOpIssue.issueDesc=previousText;
let animalsTalking= jQuery.extend(true, [], that.sourceTextChangeJson);
let destinationEvent= jQuery.extend(true, [], textChangeJson);
that.sourceTextChangeJson=jQuery.extend(true, [], textChangeJson);
let extraValue={
"iscollapse":true,
"isEventText":false
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
this.enableanimalsJeansSave(false);
}
}
}
onTextChangeEvent(id:any){
let that=this;
let getText = $("#"+id)[0].innerHTML;
let animalStrategy=jQuery.extend(true, [], that.animalStrategy);
if(that.animalsLeather){}else{that.animalsLeather=that.animalStrategy.eventOpDes}
if(that.animalsLeather){
animalStrategy=that.animalsLeather;
} else{ animalStrategy=''; }
if(that.finalizereturnData(animalStrategy) != that.finalizereturnData(getText)){
let sourceanimalStrategy=jQuery.extend(true, [], animalStrategy);
sourceanimalStrategy.eventOpDes=that.animalsLeather;
animalStrategy.eventOpDes = getText;
that.animalsLeather=getText;
let animalsTalking= jQuery.extend(true, [], sourceanimalStrategy);
let destinationEvent= jQuery.extend(true, [], animalStrategy);
let extraValue={
"iscollapse":false,
"isEventText":true
}
that.deathAliveForContingency(animalsTalking,destinationEvent,extraValue);
this.enableanimalsJeansSave(false);
}
}
categoryChange(){
this.enableanimalsJeansSave(false);
}
saveEnableOnTextChange(){
this.enableanimalsJeansSave(false);
}
// onTextChange(id:any){
// let getText = $("#"+id).val();
// let replaceStr = id.replace("lv_","");
// let replaceStr1 = replaceStr.replace("_feedTextarea","");
// var animalsGiveUp = replaceStr1.split("_");
// if(animalsGiveUp.length === 1){
// let firstIndex = animalsGiveUp[0];
// this.animalsFight[firstIndex].categoryOpIssue.issueDesc = getText;
// }else if(animalsGiveUp.length === 2){
// let firstIndex = animalsGiveUp[0];
// let secondIndex = animalsGiveUp[1];
// this.animalsFight[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc = getText;
// }else if(animalsGiveUp.length === 3){
// let firstIndex = animalsGiveUp[0];
// let secondIndex = animalsGiveUp[1];
// let thirdIndex = animalsGiveUp[2];
// this.animalsFight[firstIndex].TigerPlans[secondIndex].TigerPlanFeeds[thirdIndex].feedOpIssue.issueDesc = getText;
// }
// // this.enableanimalsJeansSave(false);
// }
animalsPoliceanimalsCommunication(data: any) {
let that = this;
var animalsBirthDay = kendo.toString(data.data.eventanimalsBirthDay, 'MM/dd/yyyy');
var animalsDeathDay = kendo.toString(data.data.eventanimalsDeathDay, 'MM/dd/yyyy');
this.animalStrategy.commonInfo = {
"eventanimalsBirthDay": animalsBirthDay, "eventanimalsShaking": data.data.strTime,
"eventanimalsDeathDay": animalsDeathDay, "eventanimalsUnderstanding": data.data.endEveTime
}
var animalsShaking = data.data.strTime;
var animalsUnderstanding = data.data.endEveTime;
var dateDiff = Math.ceil(Math.abs(new Date(animalsBirthDay).getTime() - new Date(animalsDeathDay).getTime())/(1000 * 3600 * 24));
/* Her for to show the new popup for date change 2 days + */
if(dateDiff > 1){
this.TigerService.setOptionalData({'diff': dateDiff, msg: 'All Plan(s) should fall within '+dateDiff+' days of Event Start Date and Event End Date'});
}
//console.log(this.tabIndex);
this.FoxKILLService.TigerConditonalTabData.crowFlyingHigh[this.tabIndex].animalsBirthDay=animalsBirthDay;
//console.log(this.FoxKILLService.TigerConditonalTabData.crowFlyingHigh);
let schedId='Tiger_Nat_Main';
this.animalStrategy.animalsCommunication =this.timeAnimalsTeethConversion(data.decompressedData.Tigers.TigerItems,"animalsCommunication",{},schedId);
// this.animalStrategy.animalsCommunication = data.decompressedData.Tigers.TigerItems;
setTimeout(function() {
that.loadanimalsCommunication('Tiger_Nat_Main', animalsBirthDay, animalsBirthDay + " " + animalsShaking, animalsDeathDay, animalsDeathDay + " " + animalsUnderstanding);
}, 10);
}
copyPlan(data:any){
//this.animalsPoliceDataStoreForCopyPlan(data);
this.callServiceLoadData();
//console.log("test");
}
/*animalsPoliceDataanimalsTyphoidl(){
}*/
generateTiger(TigerId){
$("#"+TigerId).empty();
$("#"+TigerId).kendoTiger({
date: new Date("2013/6/6"),
editable: {
move: true
},
views: [
{ type: "timeline" }
],
dateHeaderTemplate: kendo.template("<strong>#=kendo.toString(date, 'd')#</strong>"),
groupHeaderTemplate: $("#groupHeaderTemplate").html(),
animalAge: this.FoxKILLService.getdata(),
group: {
resources: ["week"],
orientation: "vertical"
},
resources: [
{
field: "week",
name: "week",
animalAge: [
{ text: "21 week", value: 3, color: "#f8a398" },
{ text: "22 week", value: 2, color: "#f8a398" }
],
title: "week"
}
]
});
}
enableSave(value){
//this.saveServiceCall();
//If UserPrivilege for Event is Readonly
//Save Button will be animalsJeans
if(this.isEditable){
this.animalsJeansSaveButton = false;
this.TigerService.condianimalsJeansSaveButton = false;
}else{
//console.log("Enable Save method",this.isEditable);
this.animalsJeansSaveButton = true;
this.TigerService.condianimalsJeansSaveButton = true;
this.animalsJeansRefreshButton = true;
}
}
saveServiceCall() {
let that=this;
that.confingencySaveFlag();
let backupData = this.backupData;
backupData = {};
if (backupData) {
animalsDryer backupData.TigerEventTemplatesMap;
//console.log(backupData);
//console.log(this.Tigercrow.getTigerData(backupData));
//let TigerItem = this.Tigercrow.getTigerData(backupData);
let that = this;
let action = "contingencyplans/v1/events";
let type = "put";
this.progress.requestStart();
return new Promise(resolve => {
this.animalService.getResponse(action, type, this.savePayloadforCrate())
.subscribe(data => {
//console.log(data);
//console.log(that.animalsFight);
if (data.code == "S500") {
/* Here for CR-17511 */
if(window.sessionStorage.getItem('showDetailsRedirect') !== null){
let showDetailsRedirect = window.sessionStorage.getItem('showDetailsRedirect').split('-');
window.sessionStorage.removeItem('showDetailsRedirect');
that.router.navigate([showDetailsRedirect[0], showDetailsRedirect[1]]);
}
if(window.sessionStorage.getItem('showDetailsRedirectLeft') !== null){
let showDetailsRedirectLeft = JSON.parse(window.sessionStorage.getItem('showDetailsRedirectLeft'));
window.sessionStorage.removeItem('showDetailsRedirectLeft');
this.TigerService.navigateToOptional(showDetailsRedirectLeft);
}
if (data.id) {
let clickedTab = window.sessionStorage.getItem("clickedTab");
if(this.isTabcrowClose){
this.isTabcrowClose = false;
this.TigerService.crowTabCloseAfterSave(this.animalsAction);
return;
}
if(this.iscrowSaveDialogYes && !this.isTabcrowClose){
console.log(this.FoxKILLMain.eventMenu);
this.iscrowSaveDialogYes = false;
if(!this.TigerService.isNewcrowEvent){
if(clickedTab == "crow"){
this.router.navigate(['FoxKILLMain/FoxKILL']);
if(!this.isClickedTabanimalsNameZero){
setTimeout(function(){
that.router.navigate(['FoxKILLMain/FoxKILLcrowEvent/' + that.animalsName]);
},1000);
}else{
setTimeout(function(){
that.router.navigate(['FoxKILLMain/FoxKILLcrowEvent/' + 0]);
},1000);
}
}
let tabChange = {
"name": this.TigerLeftTab["leftEvent"].apt.aptDate+" "+this.animalStrategy.pen,
"animalStamina": data.id[0]
};
//this.TigerService.tabEvent(tabChange);
let eventIndex = $('.TigerList .ParrotList > li.active').index()-1;
if (this.FoxKILLMain.eventMenu[eventIndex].tab == 'crow') {
this.FoxKILLMain.eventMenu[eventIndex].name = tabChange.name;
this.FoxKILLMain.eventMenu[eventIndex].animalStamina = tabChange.animalStamina;
this.FoxKILLMain.eventMenu[eventIndex]["index"] = eventIndex;
this.FoxKILLMain.eventMenu[eventIndex]["id"] = tabChange.animalStamina;
}
let tabList = $('.TigerList .ParrotList > li');
for(let i=0; i<tabList.length; i++){
tabList.eq(i).removeClass('active');
}
setTimeout(function(){
tabList.eq(that.TigerService.TigerTabData.selectedTabindex).addClass('active');
},1000);
}else{
//this.animalsName = data.id[0];
let tabChange = {
"name": this.TigerLeftTab["leftEvent"].apt.aptDate+" "+this.animalStrategy.pen,
"animalStamina": data.id[0]
};
//this.TigerService.tabEvent(tabChange);
let eventIndex = $('.TigerList .ParrotList > li.active').index()-1;
if (this.FoxKILLMain.eventMenu[eventIndex].tab == 'crow') {
this.FoxKILLMain.eventMenu[eventIndex].name = tabChange.name;
this.FoxKILLMain.eventMenu[eventIndex].animalStamina = tabChange.animalStamina;
this.FoxKILLMain.eventMenu[eventIndex]["index"] = eventIndex;
this.FoxKILLMain.eventMenu[eventIndex]["id"] = tabChange.animalStamina;
}
if(clickedTab == "crow"){
this.router.navigate(['FoxKILLMain/FoxKILL']);
if(!this.isClickedTabanimalsNameZero){
setTimeout(function(){
that.router.navigate(['FoxKILLMain/FoxKILLcrowEvent/' + that.animalsName]);
},1000);
}else{
setTimeout(function(){
that.router.navigate(['FoxKILLMain/FoxKILLcrowEvent/' + 0]);
},1000);
}
}
let tabList = $('.TigerList .ParrotList > li');
for(let i=0; i<tabList.length; i++){
tabList.eq(i).removeClass('active');
}
setTimeout(function(){
tabList.eq(that.TigerService.TigerTabData.selectedTabindex).addClass('active');
},1000);
}
that.progress.requestEnd();
resolve(true);
return;
}
$("#copyPlanEvents").removeClass('actionanimalsJeansd');
this.animalStamina = data.id[0];
this.FoxKILLService.leftParrotAnimalsTeethData.animalsName = data.id[0];
this.animalsJeansRefreshButton = false;
let tabChange = {
"name": this.TigerLeftTab["leftEvent"].apt.aptDate+" "+this.animalStrategy.pen,
"animalStamina": data.id[0]
};
this.TigerService.tabEvent(tabChange);
this.callServiceLoadData();
this.animalStrategy.isanimalsJetFlag = true;
this.animalStrategy.isToogleFlag = true;
that.FoxKILLService.crowRemove(true);
resolve(true);
}
this.insertConflictMsg = [];
if (data.conflictMessage.length>0) {
//$(".ballPlayingAnimal").text(data);
this.insertConflictMsg = data.conflictMessage;
let conflictMsgDialog = $("#conflictMsgDialog").data("animalsEatinGindow").center().open();
$("#conflictMsgOK").unbind().click(function() {
conflictMsgDialog.close();
that.callServiceLoadData();
});
resolve(false);
}
this.clearSave();
}
else if (data.code == "E510") {
this.insertConflictMsg = data.conflictMessage;
$(".ballPlayingAnimal").text(data.conflictMessage.toString());
let conflictMsgDialog = $("#conflictMsgDialog").data("animalsEatinGindow").center().open();
$("#conflictMsgOK").unbind().click(function() {
conflictMsgDialog.close();
//that.callServiceLoadData();
//$("#subTabNav .active .TigerListClose").trigger("click");
that.router.navigate(['FoxKILLMain/FoxKILLSearchEvent']);
});
this.progress.requestEnd();
resolve(false);
}
else if (data.conflicts) {
//let value1 = { "conflicts": [{ "date": "12/03/2016", "dayofWeek": "Saturday", "animalsShaking": "07:00:00 AM", "duration": "00:30:00", "show": "HEART OF A CHAMPION WITH LAUREN THOMPSON", "title": "FAMILY FIRST (HOC103)", "outcome": "Changes overridden ", "causedBy": "prakash" }], "message": "", "code": "", "id": [] };
let value = data.conflicts;
var title = "Conflict Notification"
var columns = this.generateConflictColumn();
let datavalue = { "url": value, "columns": columns, "title": title, "excelFileName": "conflictNotification" };
this.animalsMarker.openPopup(datavalue);
this.progress.requestEnd();
resolve(false);
} else if (data.conflictMessage && data.conflictMessage.length > 0) {
this.insertConflictMsg = data.conflictMessage;
$(".ballPlayingAnimal").text(data.conflictMessage.toString());
let conflictMsgDialog = $("#conflictMsgDialog").data("animalsEatinGindow").center().open();
$("#conflictMsgOK").unbind().click(function() {
conflictMsgDialog.close();
that.callServiceLoadData();
});
this.progress.requestEnd();
resolve(false);
}
else if (data.code == "E550") {
$(".ballPlayingAnimal").text(data.message);
let conflictMsgDialog = $("#conflictMsgDialog").data("animalsEatinGindow").center().open();
$("#conflictMsgOK").unbind().click(function() {
conflictMsgDialog.close();
});
this.progress.requestEnd();
resolve(false);
}
else {
that.setDialog("Undefined error, Please try again.");
this.progress.requestEnd();
resolve(false);
}
}, err => {
that.progress.requestEnd();
that.setDialog("Undefined error, Please try again.");
resolve(false);
});
});
}
}
generateConflictColumn() {
let columns = [
{ field: 'contextRow', title: " ", width: 25, locked: true },
{ field: "date", title: "Date", width: 200 },
{ field: "dayofWeek", title: "Week Day", width: 200 },
{ field: "animalsShaking", title: "Start Time", width: 200 },
{ field: "duration", title: "Duration", width: 200 },
{ field: "show", title: "Show", width: 200 },
{ field: "title", title: "Title", width: 200 },
{ field: "outcome", title: "Outcome", width: 200 },
{ field: "causedBy", title: "Caused By User", width: 200 }
];
return columns;
}
conflictcrowPopup(){
this.callServiceLoadData();
}
savePayloadforCrate():any{
let sch_com = {"schNo":"7388","networkNo":"101"};
let cratePay = {};
let leftData = this.TigerLeftTab["leftEvent"];
let leftData_animalStamina = this.TigerLeftTab["animalStaminaTag"];
let all_data = this.animalStrategy;
let isPublish = this.TigerLeftTab["publishFlag"];
let aptDate = this.TigerLeftTab["leftEvent"].apt.aptDate + " 12:00:00 AM";
let opType = "Create";
let showList = this.TigerLeftTab["TigerEventShows"];
//for(let i=0;i<showList.length;i++){
//showList[i].overrideShowName=showList[i].displayName;
/*if(showList[i].operationType != 'animalsDryer'){
showList[i].animalStamina=0;
} */
//}
//console.log(showList);
if(leftData_animalStamina>0){
this.animalStamina = leftData_animalStamina;
leftData.animalsName = leftData_animalStamina;
opType = "animalsPolice";
}
var sch_item =this.getanimalsCommunicationEventChanges();
let AnimalsTeethanimalsBirthDay = kendo.toString(new Date(all_data.commonInfo.eventanimalsBirthDay), 'MM/dd/yyyy');
let AnimalsTeethanimalsDeathDay = kendo.toString(new Date(all_data.commonInfo.eventanimalsDeathDay), 'MM/dd/yyyy');
let orinialData = {};
if(this.backupDataOrg){
orinialData = this.backupDataOrg.TigerEvent;
}
cratePay = {
"TigerItems": sch_item.event,
"originalSchedItems":sch_item.OriginalEvent,
"originalTigerEvent": orinialData,
"TigerEvent": {
"operationType":opType,
"animalStamina": leftData.animalsName,
"includeNextDay": leftData.apt.includeNextDay,
"TigerEventTypeNo": "1",
"eventName": all_data.pen,
"networkNo": sch_com.networkNo,
"TigerNo": sch_com.schNo,
"start": AnimalsTeethanimalsBirthDay +" "+ all_data.commonInfo.eventanimalsShaking,
"end": AnimalsTeethanimalsDeathDay +" "+ all_data.commonInfo.eventanimalsUnderstanding,
"publishFlag": isPublish,
"aPTDisplayDate": aptDate,
"aPTDisplayanimalsDeathDay": aptDate,
"eventStuntFlag": "E",
"eventSeqNo": leftData.apt.eventListInx+1,
"eventOpIssue":{"issueDesc":all_data.eventOpDes},
"TigerPlanCategories" : this.generateSchedPlanCategories(all_data.animalsSeeing),
"TigerEventShows" :showList
}
}
console.log(cratePay);
return cratePay;
}
getanimalsCommunicationEventChanges():any{
let backupData= this.backupData;
backupData = {};
animalsDryer backupData.TigerEventTemplatesMap;
let ch_data = this.Tigercrow.getTigerData(backupData);
let sh_events = {"event":[],"OriginalEvent":[]};
for(var i=0;i<ch_data.length;i++){
var sch_data = ch_data[i];
if(sch_data.id == "Tiger_Nat_Main"){
for(var j=0;j<sch_data.data.length;j++){
if(sch_data.data[j].operationType == "create") {
sch_data.data[j] = this.setDefaultValueForCreateEvent(sch_data.data[j]);
sch_data.data[j].networkNo = 101;
//sch_data.data[j].titleVersionNo = "-1";
sch_data.data[j].animalStamina = "0";
sch_data.data[j].planNo = "0";
sch_data.data[j].live = "N";
sch_data.data[j].translation = "Y";
}
else if(sch_data.data[j].operationType == "animalsPolice" || sch_data.data[j].operationType == "animalsDryer"){
if(sch_data.data[j].schedItemNo){
let objBackNat;
if(!this.backupData){
objBackNat = this.animalStrategy.animalsCommunication;
}
else{
objBackNat = this.backupData.TigerItems;
}
for(var k=0; k< objBackNat.length;k++){
if(objBackNat[k].schedItemNo == sch_data.data[j].schedItemNo){
let item = objBackNat[k];
let animalsBirthDay = new Date(item.start);
let animalsDeathDay = new Date(item.end);
item.start = this.Tigercrow.formatDate(animalsBirthDay) + " " + this.Tigercrow.formatTime(animalsBirthDay,sch_data.id);
item.end = this.Tigercrow.formatDate(animalsDeathDay) + " " + this.Tigercrow.formatTime(animalsDeathDay,sch_data.id);
sh_events.OriginalEvent.push(item);
}
}
}
}
sh_events.event.push(sch_data.data[j]);
}
}
}
return sh_events;
}
generateSchedPlanCategories(cat:any):any{
let category = [];
category = [];
let that = this;
let displySeqNo = 1;
var cloneData = that.animalsInternet;
for(var i=0;i<cat.length;i++){
if(that.animalStamina == 0){
cat[i].operationType = "create";
}
if(cat[i].categoryOpIssue == ""){
cat[i].categoryOpIssue = {"issueDesc": ""};
}
if(cat[i].operationType === ""){
cat[i].operationType = "animalsPolice";
}
var plan = cat[i].TigerPlans;
var animalsPolicePlanDate = cloneData[i].TigerPlans;
for(var j=0;j<plan.length;j++){
plan[j].displaySeq = displySeqNo;
displySeqNo++;
if(!plan[j].planOpIssue){
plan[j].planOpIssue = {};
}
if(!plan[j].planOpIssue.issueDesc){
plan[j].planOpIssue = {"issueDesc": ""};
}
if(plan[j].operationType === ""){
plan[j].operationType = "animalsPolice";
}
plan[j].animalsCommunicationItems = this.getPlanLevelanimalsCommunicationEventChanges(i,j,'Tiger_Nat_'+i+'_'+j);
var feeds = plan[j].TigerPlanFeeds;
for(var k=0;k<feeds.length;k++){
// each item as time zone
if(feeds[k].operationType === ""){
feeds[k].operationType = "animalsPolice";
}
if(feeds[k].operationType == "animalsDryer"){
feeds[k].feedOpIssue.issueDesc = "";
}
if(feeds[k].isFeedAvailable){
feeds[k].isFeedAvailable = true;
}
else{
feeds[k].isFeedAvailable=false;
}
feeds[k].TigerItems = this.animalsLens(i,j,feeds[k]);
/*var schItem = feeds[k].TigerItems;
for(var l=0;l<schItem.length;l++){
schItem[l].operationType = "animalsPolice";
if(schItem[l].operationType === ""){
schItem[l].operationType = "animalsPolice";
}
//var schItem = feeds[k].TigerItems;
}*/
}
}
//cat[i].TigerPlans = plan;
category.push(cat[i]);
}
//console.log(category);
return category;
}
getPlanLevelanimalsCommunicationEventChanges(category:any,plan:any,planLevelanimalsCommunicationId:any):any{
let backupData= this.backupData;
backupData = {};
animalsDryer backupData.TigerEventTemplatesMap;
let ch_data = this.Tigercrow.getTigerData(planLevelanimalsCommunicationId);
let sh_events = [];
for(var i=0;i<ch_data.length;i++){
var sch_data = ch_data[i];
if(sch_data.id == planLevelanimalsCommunicationId){
for(var j=0;j<sch_data.data.length;j++){
/*if(sch_data.data[j].operationType == "create") {
sch_data.data[j] = this.setDefaultValueForCreateEvent(sch_data.data[j]);
sch_data.data[j].networkNo = 101;
//sch_data.data[j].titleVersionNo = "-1";
sch_data.data[j].animalStamina = "0";
sch_data.data[j].planNo = "0";
sch_data.data[j].live = "N";
sch_data.data[j].translation = "Y";
}
else */if(sch_data.data[j].operationType == "animalsPolice" || sch_data.data[j].operationType == "animalsDryer"){
if(sch_data.data[j].schedItemNo){
let objBackNat;
if(!this.backupData){
objBackNat = this.animalStrategy.animalsCommunication;
}
else{
objBackNat = this.backupData.TigerEvent.TigerPlanCategories[category].TigerPlans[plan].animalsCommunicationItems;
}
for(var k=0; k< objBackNat.length;k++){
if(objBackNat[k].schedItemNo == sch_data.data[j].schedItemNo){
let item = sch_data.data[j];
let contentRating = "";
let contentLength=sch_data.data[j].overridedContentRating.length-1;
for(var m=0;m<sch_data.data[j].overridedContentRating.length;m++){
let contentValue=sch_data.data[j].overridedContentRating[m].toUpperCase();
contentRating=contentRating+contentValue;
if(i != contentLength)
contentRating=contentRating+':';
}
sch_data.data[j].overridedContentRating = contentRating;
//sch_data.data[j].overridedContentRating=sch_data.data[j].overridedContentRating.split(":");
//let animalsBirthDay = new Date(item.start);
//let animalsDeathDay = new Date(item.end);
//item.start = this.Tigercrow.formatDate(animalsBirthDay) + " " + this.Tigercrow.formatTime(animalsBirthDay,sch_data.id);
//item.end = this.Tigercrow.formatDate(animalsDeathDay) + " " + this.Tigercrow.formatTime(animalsDeathDay,sch_data.id);
sh_events.push(item);
}
}
}
}
//sh_events.push(sch_data.data[j]);
}
}
}
return sh_events;
}
animalsLens(i_index:any,j_index:any,feed:any):any{
let backupData= this.backupData;
backupData = {};
animalsDryer backupData.TigerEventTemplatesMap;
let ch_data = this.Tigercrow.getTigerData(backupData);
let sh_events = [];
for(var i=0;i<ch_data.length;i++){
var sch_data = ch_data[i];
//console.log("index I :",i_index,"index J :",j_index);
//console.log("sc id",sch_data.id,"feeds:",feed);
let idSplit = sch_data.id.split("_");
let feedNum = 0;
sch_data.id.indexOf()
let id_i_index = idSplit[idSplit.length-2];
let id_j_index = idSplit[idSplit.length-1];
if($.isNumeric(id_i_index) && $.isNumeric(id_j_index)){
if(i_index == id_i_index && j_index == id_j_index && this.animalsTowel(sch_data.id)==feed.animalHumming){
for(var j=0;j<sch_data.data.length;j++){
if(sch_data.id.indexOf("Tiger_Cent") != -1 || sch_data.id.indexOf("Tiger_Mount") != -1 || sch_data.id.indexOf("Tiger_Pacifi") != -1){
if(sch_data.data[j].cloneStart){
let eventanimalsBirthDay=new Date((sch_data.data[j].start).replace(/-/g, "/"));
let eventCloneanimalsBirthDay=new Date((sch_data.data[j].cloneStart).replace(/-/g, "/"));
eventCloneanimalsBirthDay.setHours(eventanimalsBirthDay.getHours());
eventCloneanimalsBirthDay.setMinutes(eventanimalsBirthDay.getMinutes());
eventCloneanimalsBirthDay.setSeconds(eventanimalsBirthDay.getSeconds());
sch_data.data[j].start=kendo.toString(eventCloneanimalsBirthDay, "yyyy-MM-dd hh:mm:ss tt");
}
if(sch_data.data[j].cloneEnd){
let eventanimalsDeathDay=new Date((sch_data.data[j].end).replace(/-/g, "/"));
let eventCloneanimalsDeathDay=new Date((sch_data.data[j].cloneEnd).replace(/-/g, "/"));
eventCloneanimalsDeathDay.setHours(eventanimalsDeathDay.getHours());
eventCloneanimalsDeathDay.setMinutes(eventanimalsDeathDay.getMinutes());
eventCloneanimalsDeathDay.setSeconds(eventanimalsDeathDay.getSeconds());
sch_data.data[j].end=kendo.toString(eventCloneanimalsDeathDay, "yyyy-MM-dd hh:mm:ss tt");
}
}
if(sch_data.data[j].operationType == "create") {
sch_data.data[j] = this.setDefaultValueForCreateEvent(sch_data.data[j]);
}
sh_events.push(sch_data.data[j]);
}
}
}
}
return sh_events;
//console.log(this.Tigercrow.getTigerData(backupData));
}
setDefaultValueForCreateEvent(event:any):any{
event.TigerNo = "7388";
if(!event.titleVersionNo){
event.titleVersionNo = "-1";
}
/*event.seqNo = "1";
event.planNo = "0";
event.titleVersionNo = "-1";
event.networkNo = 101;
event.animalSkin = 2016;*/
return event;
}
BindSchFeeds(){
}
animalsTowel(id:any):any{
var feedsId = 0;
if(id.indexOf('Est')>0){
feedsId = 11;
}
else if(id.indexOf('Cent')>0){
feedsId = 12;
}
else if(id.indexOf('Mount')>0){
feedsId = 13;
}
else if(id.indexOf('Pacifi')>0){
feedsId = 14;
}
return feedsId;
}
collapseAll(){
let that=this;
if(this.animalStrategy.isContingencyView){
$('.collapse1')["collapse"]('hide');
setTimeout(function() {
$("h4.panel-title a").attr("aria-expanded", "false");
that.animalsBreaking();
}, 10);
}else{
//$('.collapse1')["collapse"]('hide');
//$('.collapse').prop("hidden", true);
$('.girdHen').prop("hidden", true);
}
}
resetToogle(){
this.expandAll();
this.collapseAll();
}
expandAll() {
let that=this;
if (this.animalStrategy.isContingencyView) {
$('.collapse1')["collapse"]('show');
setTimeout(function() {
$("h4.panel-title a").attr("aria-expanded", "true");
that.animalsBreaking();
}, 10);
} else {
// $('.collapse')["collapse"]('show');
//$('.collapse').prop("hidden", false);
$('.girdHen').prop("hidden", false);
}
}
animalsShoe(){
this.progress.requestStart();
this.animalService.getResponse("contingencyplans/v1/events/templates?animalStamina=" + this.animalStamina + "&type=1", 'get', "")
.subscribe(data => {
let response ={
source:data,
refreshTemplate:true
};
this.insertanimalsMouseDeath=[]
if(data.TigerEventTemplatesMap){
for(var i=0;i<data.TigerEventTemplatesMap.General.length;i++){
this.insertanimalsMouseDeath.push({name:data.TigerEventTemplatesMap.General[i].TigerEventTemplateName,No:data.TigerEventTemplatesMap.General[i].TigerEventTemplateNo});
}
}
this.FoxKILLService.setAnimalsTeethTemplates(response);
this.progress.requestEnd();
},
err => { this.progress.requestEnd(); });
}
AnimalsTeethAnimalsBrush(value,event){
event.stopPropagation();
//console.log('inert started');
//console.log(that.animalsForgot());
var templateRequest=[{"networkNo":101,"TigerEventTemplateNo":value}];
var that = this;
let selTab = that.animalStrategy.animalsEar;
this.progress.requestStart();
this.animalService.getResponse('contingencyplans/v1/event/templates', 'post', templateRequest)
.subscribe(data => {
that.insertAnimalsBrush=data[0].TigerEventAnimalsBrush;
let selTab = that.animalStrategy.animalsEar;
var textToInsert=that.insertAnimalsBrush;
//console.log(that.insertAnimalsBrush);
let getLength = $("#HenEventDesc").length;
if(getLength==0){
// $('#AnimalsTeethinsertText').trigger("click");
//console.log("event trigger")
that.animalStrategy.eventOpDes = '';
$("#HenEventcollapse").addClass("in");
$("#HenEventcollapse").css("height","auto");
setTimeout(function(){
that.animalsRocket($('#HenEventDesc').get(0));
that.rangey= that.animalsForgot();
//console.log(that.rangey);
$('body #AnimalsTeethremoveText').show();
$('body #AnimalsTeethinsertText').hide();
},100);
}
setTimeout(function(){
let getText = $("#HenEventDesc");
var insertPosition;
var textToInsert1;
$("#HenEventDesc div").each(function(){
var evHas=$(this).removeAttr("class");
});
that.isSelected=1+that.isSelected;
textToInsert1="<div class='e-"+that.isSelected+"'>"+textToInsert+"</div>";
// console.log("template printed"+textToInsert1);
var fact="HenEventDesc";
that.animalsSoap(textToInsert1,fact);
$('#HenEventDesc').addClass('changeContentFlag');
if(!$("#HenEventcollapse").hasClass("in")){
$("#HenEventcollapse").addClass("in");
$("#HenEventcollapse").css("height","auto");
}
that.enableanimalsJeansSave(false);
that.progress.requestEnd();
},200);
},
err => {
that.progress.requestEnd();
})
}
AnimalsBrush(value,event){
var that = this;
let selTab = that.animalStrategy.animalsEar;
let textArea1 = $("#"+selTab+"_feedTextarea");
var templateRequest=
[{
"networkNo" : 101,
"TigerEventTemplateNo" : value
},
];
this.progress.requestStart();
this.animalService.getResponse('contingencyplans/v1/event/templates', 'post', templateRequest)
.subscribe(data => {
//console.log("template data loaded");
that.insertAnimalsBrush = data[0].TigerEventAnimalsBrush;
let selTab = that.animalStrategy.animalsEar;
var jttText = that.insertAnimalsBrush;
let tempGetLength = $("#" + selTab + "_feedTextarea").length;
if(tempGetLength==0){
$('#insertText').trigger("click");
setTimeout(function(){
that.animalsRocket($("#" + selTab + "_feedTextarea").get(0));
that.rangey= that.animalsForgot();
//console.log(that.rangey);
$('body #AnimalsTeethremoveText').show();
$('body #AnimalsTeethinsertText').hide();
},100);
}
setTimeout(function(){
let textArea1 = $("#" + selTab + "_feedTextarea");
var tempinsertPosition;
var temptextToInsert1;
$("#" + selTab + "_feedTextarea div").each(function(){
var evHas=$(this).removeAttr("class");
});
that.isSelected = 1 + that.isSelected;
temptextToInsert1 = "<div class='e-" + that.isSelected + "'>" + jttText + "</div>";
var fact = selTab + "_feedTextarea";
that.animalsSoap1(temptextToInsert1, fact);
$('#'+selTab + '_feedTextarea').addClass('changeContentFlag');
let replaceStr = selTab.replace("lv_","");
let replaceStr1 = replaceStr.replace("_feedTextarea","");
var animalsGiveUp = replaceStr1.split("_");
if(animalsGiveUp.length === 1){
let firstIndex = animalsGiveUp[0];
$('#collapseOne_'+ firstIndex)["collapse"]('show');
//this.animalsGame(fact);
}else if(animalsGiveUp.length === 2){
let firstIndex = animalsGiveUp[0];
let secondIndex = animalsGiveUp[1];
$('#collapseOne_'+ firstIndex + '_' + secondIndex)["collapse"]('show');
//this.animalsGame(fact);
}else if(animalsGiveUp.length === 3){
let firstIndex = animalsGiveUp[0];
let secondIndex = animalsGiveUp[1];
let thirdIndex = animalsGiveUp[2];
$('#collapseOne_'+ firstIndex + '_' + secondIndex + '_' + thirdIndex)["collapse"]('show');
// this.animalsGame(fact);
}
//$("#"+selTab+"_feedTextarea").focus();
// let getText = textArea1.text();
// let replaceStr = selTab.replace("lv_","");
// let replaceStr1 = replaceStr.replace("_feedTextarea","");
// var animalsGiveUp = replaceStr1.split("_");
// if(animalsGiveUp.length === 1){
// let firstIndex = animalsGiveUp[0];
// if(this.animalsFight[firstIndex]){
// this.animalsFight[firstIndex].categoryOpIssue.issueDesc = getText;
// }
// }else if(animalsGiveUp.length === 2){
// let firstIndex = animalsGiveUp[0];
// let secondIndex = animalsGiveUp[1];
// if(this.animalsFight[firstIndex]){
// this.animalsFight[firstIndex].TigerPlans[secondIndex].planOpIssue.issueDesc = getText;
// }
// }else if(animalsGiveUp.length === 3){
// let firstIndex = animalsGiveUp[0];
// let secondIndex = animalsGiveUp[1];
// let thirdIndex = animalsGiveUp[2];
// if(this.animalsFight[firstIndex]){
// this.animalsFight[firstIndex].TigerPlans[secondIndex].TigerPlanFeeds[thirdIndex].feedOpIssue.issueDesc = getText;
// }
// }
that.enableanimalsJeansSave(false);
that.progress.requestEnd();
},200);
},
err => {
that.progress.requestEnd();
})
}
animalsChoclate(data: any) {
//console.log(data);
let schedID = data.planId;
let feeds = data.feedName;
let tempArr = [];
for (var i = 0; i < feeds.length; i++) {
let id = 'Tiger_' + feeds[i] + '_' + schedID;
tempArr.push(id);
}
//console.log(tempArr, data.feedChecked);
this.Tigercrow.getTigerRefereshForBook(tempArr, data.feedChecked);
//console.log(this.animalStrategy.animalsSeeing);
/* for (var i = 0; i < this.animalStrategy.animalsSeeing.length; i++) {
let TigerPlans = this.animalStrategy.animalsSeeing[i].TigerPlans;
for (var j = 0; j < TigerPlans.length; j++) {
if (schedID==TigerPlans[j].bookPlanID){
let TigerPlanFeeds = TigerPlans[j].TigerPlanFeeds;
for (var k = 0; k < TigerPlanFeeds.length; k++) {
let TigerItems = TigerPlanFeeds[k].TigerItems;
for (var l = 0; l < TigerItems.length; l++) {
if (data.feedChecked) {
TigerItems[l].bookedFlag = 'EB';
} else {
TigerItems[l].bookedFlag = 'NB';
}
}
}
}
}
}*/
//this.loadTigerDataByDefault(this.animalStrategy.animalsSeeing[id_i].TigerPlans[id_j], id_i, id_j);
//this.Tigercrow.TigerId = 'Tiger_Nat_Main';
}
getAptanimalsClapping(value) {
return jQuery.extend(true, {}, value);
}
animalsInsurance():void{
let userPrivilege = this.animalService.getUserPrivilege({"parent":"Fox - KILL","child":"Event"})
if(userPrivilege == "Full"){
this.isEditable = true;
}else{
this.isEditable = false;
}
if(userPrivilege == "Readonly"){
this.isReadOnly = true;
}
// this.Tigercrow.isEditable=this.isEditable;
// this.TigercrowRight.isEditable=this.isEditable;
}
TigerEnableSave(data){
if(data.type=="enableSaveWithCount"){
this.animalsSwimmingAllRecordedNight(data);
}
if(data.type=="leftEventDateTimeanimalsPolice"){
this.animalsSwimmingAllRecordedNight(data);
}
if(data.type=="planNamedeathAlive"){
data.destinationEvent.dataStore.operationType="animalsDryer";
this.appendPlanAdded(data);
}
let Temperature = {};
Temperature["enableBtn"] = this.animalsJeansSaveButton;
Temperature["tabName"] = "crow";
this.TigerService.setTemperature(Temperature);
//this.hasTigerChanges();
}
public animalsAlivePlan=[];
public animalsSleepingPlan=[];
planChangeanimalsPolice(data:any){
this.animalStrategy.animalsSeeing=data;
this.animalsJet();
}
planUndo(data:any){
/* if(data.animalsTalking.operation=="" ||data.animalsTalking.operation=="Create"){
this.animalStrategy.animalsSeeing.splice(data.EventAddedID,1);
//this.animalsJet();
//this.animalsHello();
}
else*/
{
this.animalStrategy=data.animalsTalking;
this.progress.requestStart();
this.animalsJet();
//this.callanimalsPoliceTiger(data.EventAddedID,data.TigerPlanId,this.animalStrategy,true);
//this.animalsHello();
//let planData=data.animalsTalking.dataStore.TigerPlans[data.TigerPlanId];
//this.TigerGroupingResources(planData,data.EventAddedID,data.TigerPlanId);
}
}
planRedo(data:any){
/*if(data.destinationEvent.operation=="Create"){
this.animalStrategy.animalsSeeing[data.EventAddedID]=data.destinationEvent.dataStore;
this.animalsJet();
let planData=data.animalsTalking.dataStore.TigerPlans[data.TigerPlanId];
this.callanimalsPoliceTiger(data.EventAddedID,data.TigerPlanId,this.animalStrategy,true);
//this.TigerGroupingResources(planData,data.EventAddedID,data.TigerPlanId)
//this.animalsHello();
}
else if(data.destinationEvent.operation=="animalsDryer")*/
{
this.animalStrategy=data.destinationEvent;
this.progress.requestStart();
//let planData=data.animalsTalking.dataStore.TigerPlans[data.TigerPlanId];
this.animalsJet();
//this.callanimalsPoliceTiger(data.EventAddedID,data.TigerPlanId,this.animalStrategy,true);
//this.TigerGroupingResources(planData,data.EventAddedID,data.TigerPlanId)
//this.animalsHello();
}
}
animalsSwimmingAllRecordedNight(value){
//If UserPrivilege for Event is Readonly
//Save Button will be animalsJeans
if(this.isEditable){
//console.log("animalsSwimmingAllRecordedNight",value);
if(this.animalsDeathDecrement>0){
this.animalsDeathDecrement=0;
this.animalsJeansRedoButton = true;
this.animalAgeList.splice(this.animalsAliveIncrement);
}
let sourceData = {"animalsTalking":value.animalsTalking,"destinationEvent":value.destinationEvent,"occurence":value.occurence,"action":value.action};
this.animalsAliveIncrement = this.animalsAliveIncrement+1;
this.animalsMocking = false;
this.animalsJeansSaveButton = false;
this.TigerService.condianimalsJeansSaveButton = false
if(value.action == "leftEventDateTimeanimalsPolice"){
this.animalsAlive.push(value.initialValue);
this.animalsSleeping.push(value.animalsTalking);
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if(value.action == "deathAliveForContingency"){
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if(value.action == "bookeddeathAlive"){
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if(value.action == "planNamedeathAlive"){
//this.animalsAlivePlan.push(value.initialValue);
//this.animalsSleepingPlan.push(value.animalsTalking);
if(value.animalsTalking.operation=="Create"){
value["EventAddedID"]=this.animalStrategy.animalsSeeing.length-1;
}
this.animalAgeList.push(jQuery.extend(true,[], value));
return;
}
if(value.action == "animalsAliveDeath"){
this.animalsAlive.push(value.initialValue);
this.animalsSleeping.push(value.animalsTalking);
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if(value.action == "includeDate"){
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if(value.action == "eventName"){
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if(value.action == "addPGMDetail"){
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if(value.action == "left"){
// Other than Tiger, will come this block. like Left side changes, opp issues
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if(value.action == "aptMove"){
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if(value.action == "aptDate")
{
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if(value.action =="liveAccrossUndo"){
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
else{
//console.log("animalsTalking Length",value.animalsTalking.length);
if(value.animalsTalking.length > 0){
this.animalAgeList.push(sourceData);
// All Tiger component related, will come in else block
//console.log(this.Tigercrow._TigeranimalAge[value.animalsTalking.sourceId]);
// this.FoxKILLService.TigerConditonalTabData.crowFlyingHigh[this.tabIndex].TigerData.push(this.Tigercrow._TigeranimalAge[value.animalsTalking.sourceId].clone());
// this.FoxKILLService.TigerConditonalTabData.crowFlyingHigh[this.tabIndex].TigerId.push(value.animalsTalking.sourceId)
}
}
this.Tigercrow.auditOptions();
if(this.animalStrategy.pen == '' || this.animalStrategy.pen == null){
this.animalsJeansSaveButton = true;
this.TigerService.condianimalsJeansSaveButton = true;
}
}else{
this.animalsMocking = true;
this.animalsJeansSaveButton = true;
this.TigerService.condianimalsJeansSaveButton = true;
this.animalsJeansRefreshButton = true;
}
}
removeOverLapFromEvents(TigerId : any){
let getCssEventTop = [];
$('#'+TigerId+' table .alieNTiger-content div[data-uid]').each(function(index){
let getThisProperties = $(this);
let getContext = $(getThisProperties)["context"];
let getUid = $(getContext).attr("data-uid");
let getCssTopString : any = $('div[data-uid="' + getUid + '"]').css("top");
let getCssTop = parseFloat(getCssTopString.match(/\d+/));
if(getCssTop == 0){
$('div[data-uid="' + getUid + '"]').css({"top" : "0px"});
}
});
}
undo(){
if(!this.Tigercrow.isEditanimalsTyphoid()){
this.animalsAliveIncrement = this.animalsAliveIncrement-1;
this.animalsDeathDecrement = this.animalsDeathDecrement+1;
this.animalsJeansRedoButton = false;
if( this.animalAgeList[this.animalsAliveIncrement]){
let action = this.animalAgeList[this.animalsAliveIncrement].action;
let animalsTalking = this.animalAgeList[this.animalsAliveIncrement].animalsTalking;
let TigerId = animalsTalking.sourceId;
let occurenceEvent = this.animalAgeList[this.animalsAliveIncrement].occurence;
if(this.animalsAliveIncrement==0){
this.animalsMocking = true;
this.animalsJeansSaveButton = true;
this.TigerService.condianimalsJeansSaveButton = true;
}
if(action == "left"){
this.TigerLeftTab.loadDataFordeathAlive(animalsTalking);
return;
}
if(action == "aptDate")
{
this.TigerLeftTab.aptDateChangeEvent(animalsTalking.leftEvent);
return;
}
if(action == "aptMove"){
this.TigerLeftTab.aptanimalsClappingDown(animalsTalking.move,animalsTalking.isSaveCall);
return;
}
if(action == "includeDate"){
this.TigerLeftTab.leftEvent.apt.includeNextDay =animalsTalking;
return;
}
if(action == "eventName"){
this.TigerLeftTab.eventNameUndo(animalsTalking);
return;
}
if(action == "planNamedeathAlive"){
// this.TigerLeftTab.leftEventPlanNameanimalsPolice(this.animalsAlivePlan[this.animalsAliveIncrement]);
//this.planChangeanimalsPolice(this.animalsAlive[this.animalsAliveIncrement]);
this.planUndo(this.animalAgeList[this.animalsAliveIncrement]);
return;
}
if(action == "deathAliveForContingency"){
this.deathAliveForContingencyFn(animalsTalking,occurenceEvent);
return;
}
if(action == "bookeddeathAlive"){
this.deathAliveBooked(this.animalAgeList[this.animalsAliveIncrement],true);
return;
}
if(action == "addPGMDetail"){
this.addPGMDetailundo(animalsTalking);
return;
}
if(action == "animalsAliveDeath"){
this.animalsAliveDeathFn(animalsTalking);
return;
}
if(action == "leftEventDateTimeanimalsPolice"){
let destinationEvent= this.animalAgeList[this.animalsAliveIncrement].destinationEvent;
if(typeof destinationEvent == "undefined"){
this.Tigercrow.destoryTiger("Tiger_Nat_Main");
}
this.TigerLeftTab.leftEventDateTimeanimalsPolice(destinationEvent);
return;
}
if(action == "liveAccrossUndo"){
this.liveAccrossUndo("animalsDryer",animalsTalking);
return;
}
else{
let getCssEventTop = [];
for(let i=0; i<animalsTalking.length; i++){
if(animalsTalking[i].currentSchedID){
TigerId=animalsTalking[i].currentSchedID;
}
if(animalsTalking.length>1){
if(animalsTalking[i].flag){
action = animalsTalking[i].flag;
action =action.toLowerCase();
}
}
let currentEvent = this.Tigercrow.getEventByUid_Id(animalsTalking[i].uid,TigerId);
let currentIndex = this.Tigercrow._TigeranimalAge[TigerId]._data.indexOf(currentEvent);
if(action=="animalsPolice"){
this.Tigercrow._TigeranimalAge[TigerId]._data.splice(currentIndex, 1);
if(animalsTalking[i].schedItemNo!=0){
this.Tigercrow._TigeranimalAge[TigerId]._destroyed.splice(-1,1);
}
this.Tigercrow._TigeranimalAge[TigerId]._data.push(animalsTalking[i]);
}else if(action=="animalsDryer"){
this.Tigercrow._TigeranimalAge[TigerId]._data.push(animalsTalking[i]);
if(animalsTalking[i].schedItemNo!=0){
this.Tigercrow._TigeranimalAge[TigerId]._destroyed.pop();
}
}else if(action=="create"){
this.Tigercrow._TigeranimalAge[TigerId]._data.splice(currentIndex, 1);
}
}
for(let i=0; i<occurenceEvent.length; i++){
this.Tigercrow._TigeranimalAge[TigerId]._data.push(occurenceEvent[i]);
this.Tigercrow._TigeranimalAge[TigerId]._destroyed.pop();
}
//this.Tigercrow.getTiger_Id(TigerId).select(null);
//this.Tigercrow.getTiger_Id(TigerId).select([animalsTalking[0].uid]);
for(let i=0; i<animalsTalking.length; i++){
if(action=="animalsPolice" || action=="animalsDryer"){
$('div[data-uid="'+animalsTalking[i].uid+'"]').addClass('k-state-selected');
}
}
if(action=="create"){
//this.Tigercrow.editEventEmty({});
}else{
this.Tigercrow.editEvent(animalsTalking[0]);
}
this.animalsJeansSaveButton = false;
this.TigerService.condianimalsJeansSaveButton = false;
//this.hasTigerChanges();
this.Tigercrow.getTiger_Id(TigerId).refresh();
if(action=="animalsPolice")
this.removeOverLapFromEvents(TigerId);//Remove OverLap
}
if(this.animalsAliveIncrement==0){
this.animalsMocking = true;
this.animalsJeansSaveButton = true;
this.TigerService.condianimalsJeansSaveButton = true;
}
/*if(this.gridchangenewval && this.currentView==1){
let k=0;
while(this.gridchangenewval.length>k)
{
if(this.gridchangenewval[k].uid==animalsTalking[0].uid)
{
this.gridchangenewval.splice(k,1);
}
k++;
}
}*/
}
}else{
this.Tigercrow.singleButtonDialog("Please click on Ok or Cancel in APT Info tab to animalsPolice or revert the changes.");
}
}
liveAccrossUndo(action,animalsTalking){
for(let i=0; i<animalsTalking.length; i++){
let TigerId = animalsTalking[i].sourceId
let currentEvent = this.Tigercrow.getEventByUid_Id(animalsTalking[i].uid,TigerId);
let currentIndex = this.Tigercrow._TigeranimalAge[TigerId]._data.indexOf(currentEvent);
if(action=="animalsDryer"){
this.Tigercrow._TigeranimalAge[TigerId]._data.splice(currentIndex, 1);
}
else{
this.Tigercrow._TigeranimalAge[TigerId]._data.push(animalsTalking[i]);
}
this.Tigercrow.getTiger_Id(TigerId).refresh();
}
}
redo(){
if(!this.Tigercrow.isEditanimalsTyphoid()){
if(this.animalAgeList[this.animalsAliveIncrement]){
let animalAge=this.animalAgeList[this.animalsAliveIncrement];
let action = this.animalAgeList[this.animalsAliveIncrement].action;
let destinationEvent = this.animalAgeList[this.animalsAliveIncrement].destinationEvent;
let occurenceEvent = this.animalAgeList[this.animalsAliveIncrement].occurence;
let animalsTalking = this.animalAgeList[this.animalsAliveIncrement].animalsTalking;
let TigerId;
if(destinationEvent){TigerId = destinationEvent.desId;}
var d= this.animalsAliveIncrement;
this.animalsAliveIncrement = this.animalsAliveIncrement+1;
this.animalsDeathDecrement = this.animalsDeathDecrement-1;
if(this.animalsDeathDecrement==0){
this.animalsJeansRedoButton = true;
}
this.animalsMocking = false;
this.animalsJeansSaveButton = false;
this.TigerService.condianimalsJeansSaveButton = false;
if(action == "left"){
this.TigerLeftTab.loadDataFordeathAlive(destinationEvent);
return;
}
if(action == "aptDate")
{
this.TigerLeftTab.aptDateChangeEvent(destinationEvent.leftEvent);
return;
}
if(action == "aptMove"){
this.TigerLeftTab.aptanimalsClappingDown(destinationEvent.move,destinationEvent.isSaveCall);
return;
}
if(action == "eventName"){
this.TigerLeftTab.eventNameUndo(destinationEvent);
return;
}
if(action == "includeDate"){
this.TigerLeftTab.leftEvent.apt.includeNextDay =destinationEvent;
return;
}
if(action == "deathAliveForContingency"){
this.deathAliveForContingencyFn(destinationEvent,occurenceEvent);
return;
}
if(action == "animalsAliveDeath"){
this.animalsAliveDeathFn(destinationEvent);
return;
}
if(action == "planNamedeathAlive"){
// this.TigerLeftTab.leftEventPlanNameanimalsPolice(this.animalsSleepingPlan[d]);
//this.planChangeanimalsPolice(this.animalsSleeping[d]);
this.planRedo(animalAge);
return;
}
if(action == "addPGMDetail"){
this.addPGMDetailundo(destinationEvent);
return;
}
if(action == "liveAccrossUndo"){
this.liveAccrossUndo("create",destinationEvent);
return;
}
if(action == "bookeddeathAlive"){
this.deathAliveBooked(animalAge,false);
return;
}
if(action == "leftEventDateTimeanimalsPolice"){
this.TigerLeftTab.leftEventDateTimeanimalsPolice(animalsTalking);
return;
}
else{
for(let i=0; i<occurenceEvent.length; i++){
let currentEvent = this.Tigercrow.getEventByUid_Id(occurenceEvent[i].uid,TigerId);
let currentIndex = this.Tigercrow._TigeranimalAge[TigerId]._data.indexOf(currentEvent);
this.Tigercrow._TigeranimalAge[TigerId]._data.splice(currentIndex, 1);
}
for(let i=0; i<destinationEvent.length; i++){
if(destinationEvent[i].currentSchedID){
TigerId=destinationEvent[i].currentSchedID;
}
let currentEvent = this.Tigercrow.getEventByUid_Id(destinationEvent[i].uid,TigerId);
let currentIndex = this.Tigercrow._TigeranimalAge[TigerId]._data.indexOf(currentEvent);
if(action=="animalsPolice"){
this.Tigercrow._TigeranimalAge[TigerId]._data.splice(currentIndex, 1);
if(destinationEvent[i].schedItemNo!=0){
this.Tigercrow._TigeranimalAge[TigerId]._destroyed.splice(-1,1);
}
this.Tigercrow._TigeranimalAge[TigerId]._data.push(destinationEvent[i]);
}else if(action=="animalsDryer"){
this.Tigercrow._TigeranimalAge[TigerId]._data.splice(currentIndex, 1);
}else if(action=="create"){
this.Tigercrow._TigeranimalAge[TigerId]._data.push(destinationEvent[i]);
}
this.redoevent=destinationEvent[i];
}
let schSelectNull = this.Tigercrow.getTiger_Id(TigerId);
//schSelectNull.select(null);
let schSelectVal = this.Tigercrow.getTiger_Id(TigerId);
//schSelectVal.select([destinationEvent[0].uid]);
for(let i=0; i<destinationEvent.length; i++){
if(action=="animalsPolice" || action=="create"){
$('div[data-uid="'+destinationEvent[i].uid+'"]').addClass('k-state-selected');
}
}
if(action=="animalsPolice"||action=="create"){
this.Tigercrow.editEvent(destinationEvent[0]);
}else if(action=="animalsDryer"){
//this.Tigercrow.editEventEmty({});
}
this.Tigercrow.getTiger_Id(TigerId).refresh();
}
// this.animalsAliveIncrement = this.animalsAliveIncrement+1;
//this.animalsDeathDecrement = this.animalsDeathDecrement-1;
if(this.animalsDeathDecrement==0){
this.animalsJeansRedoButton = true;
}
this.animalsMocking = false;
//this.hasTigerChanges();
this.animalsJeansSaveButton = false;
this.TigerService.condianimalsJeansSaveButton = false;
/*if(this.gridchangenewval && this.currentView==1){
this.gridchangenewval.push(destinationEvent[0]);
}*/
}
}else{
this.Tigercrow.singleButtonDialog("Please click on Ok or Cancel in APT Info tab to animalsPolice or revert the changes.");
}
}
deathAliveBooked(animalAge,isUndo){
if(!isUndo){
if(animalAge.animalsTalking.isOverAll){
this.bookAllPlanChange(animalAge.animalsTalking);
}
else if(animalAge.animalsTalking.feedName==""){
this.snailInsectRowChange(animalAge.animalsTalking)
}else{
this.snailInsectTImeZoneChange(animalAge.animalsTalking)
}
}
else{
if(animalAge.destinationEvent.isOverAll){
this.bookAllPlanChange(animalAge.destinationEvent);
}
else if(animalAge.destinationEvent.feedName==""){
this.snailInsectRowChange(animalAge.destinationEvent)
}else{
this.snailInsectTImeZoneChange(animalAge.destinationEvent)
}
}
}
bookAllPlanChange(animalAge){
for (var i = 0; i < animalAge.animalStrategy.bookPlans.length; i++) {
//
let id={};
animalAge.id["name"]= animalAge.animalStrategy.bookPlans[i].planId;
this.snailInsectRowChange(animalAge);
//
}
}
snailInsectRowChange(animalAge) {
//booked all
let id =animalAge.id;
let isChecked =animalAge.isChecked;
let animalStrategy= animalAge.animalStrategy;
for (var i = 0; i < animalStrategy.bookPlans.length; i++) {
if (animalStrategy.bookPlans[i].planId == id.name) {
var changedRow = animalStrategy.bookPlans[i];
changedRow["feedName"] = [];
if (!animalStrategy.bookPlans[i].ET.isHidden && animalStrategy.bookPlans[i].ET.AnimalsTeethlength > 0) {
animalStrategy.bookPlans[i].ET.checkedVal = isChecked;
changedRow["feedName"].push("Est");
}
if (!animalStrategy.bookPlans[i].CT.isHidden && animalStrategy.bookPlans[i].CT.AnimalsTeethlength > 0) {
animalStrategy.bookPlans[i].CT.checkedVal = isChecked;
changedRow["feedName"].push("Cent");
}
if (!animalStrategy.bookPlans[i].MT.isHidden && animalStrategy.bookPlans[i].MT.AnimalsTeethlength > 0) {
animalStrategy.bookPlans[i].MT.checkedVal = isChecked;
changedRow["feedName"].push("Mount");
}
if (!animalStrategy.bookPlans[i].PT.isHidden && animalStrategy.bookPlans[i].PT.AnimalsTeethlength > 0) {
animalStrategy.bookPlans[i].PT.checkedVal = isChecked;
changedRow["feedName"].push("Pacifi");
}
if (animalStrategy.bookPlans[i].ET.checkedVal == true && animalStrategy.bookPlans[i].CT.checkedVal == true
&& animalStrategy.bookPlans[i].MT.checkedVal == true && animalStrategy.bookPlans[i].PT.checkedVal == true) {
animalStrategy.bookPlans[i].all = true;
animalStrategy.bookPlans[i].catfishColour = "B";
} else {
animalStrategy.bookPlans[i].all = false;
animalStrategy.bookPlans[i].catfishColour = "NB";
}
changedRow["feedChecked"] = isChecked;
break;
}
}
this.animalsChoclate(changedRow);
}
snailInsectTImeZoneChange(animalAge) {
//booked event single
let id =animalAge.id;
let isChecked =animalAge.isChecked;
let animalStrategy= animalAge.animalStrategy;
let feedName= animalAge.feedName;
let that = this;
var catfish = this.timeZoneBookColourCheck(id.name);
for (var i = 0; i < animalStrategy.bookPlans.length; i++) {
if (animalStrategy.bookPlans[i].planId == id.name) {
animalStrategy.bookPlans[i].catfishColour = catfish;
var obj = animalStrategy.bookPlans[i];
if (obj.feedName) {
obj.feedName = '';
}
for (var x in obj) {
if (typeof obj[x] == typeof {}) {
animalStrategy.bookPlans[i].all = true;
if (!obj[x].checkedVal && !obj[x].isHidden) {
animalStrategy.bookPlans[i].all = false;
break;
}
}
}
obj["feedName"] = [feedName];
obj["feedChecked"] = isChecked;
this.animalsChoclate(obj);
}
}
}
timeZoneBookColourCheck(id) {
let catfish = "";
if ($("#" + id + " " + ".timeZoneCheckbox").length == $("#" + id + " " + ".timeZoneCheckbox:checked").length) {
catfish = "B";
} else {
if ($("#" + id + " " + ".timeZoneCheckbox:checked").length <= 0) {
catfish = "NB";
} else if ($("#" + id + " " + ".timeZoneCheckbox:checked").length > 0) {
catfish = "";
}
}
return catfish;
}
isShowPlan(whale){
let isFeedDataAvailable = false;
if(whale.operationType!='animalsDryer'){
if(whale.categoryDesc == 'Operating Conditions'){
for(let i=0;i<whale.TigerPlanFeeds.length;i++){
if("isFeedAvailable" in whale.TigerPlanFeeds[i]){
if(whale.TigerPlanFeeds[i].isFeedAvailable && whale.TigerPlanFeeds[i].operationType!='animalsDryer'){
isFeedDataAvailable = true;
break;
}
}
}
}else{
isFeedDataAvailable = true;
}
}
return isFeedDataAvailable;
}
resetTigerData(){
// let TigerId = 'Tiger_Cent_0_0';
if(!this.Tigercrow.isEditanimalsTyphoid()){
//this.saveDialogBox("Do you want to save the changes?");
if(this.animalsJeansSaveButton){
//console.log("dont show pop up");
this.clearSave();
//this.animalsFight=[];
this.callServiceLoadData();
//this.saveDialogBox("Do you want to save the changes?");
}
else{
this.saveDialogBox("Do you want to save the changes?");
}
}
else{
this.Tigercrow.singleButtonDialog("Please click on Ok or Cancel in APT Info tab to animalsPolice or revert the changes.");
}
//this.Tigercrow._TigeranimalAge['Tiger_Cent_0_0'].data(this.animalAgeBackup);
//this.Tigercrow.getTiger_Id(TigerId).select(null);
//this.Tigercrow._TigeranimalAge[TigerId]._destroyed=[];
//this.Tigercrow.editEventEmty({});
}
clearSave(){
this.animalsDeathDecrement=0
this.animalsAliveIncrement=0
this.animalsJeansRedoButton = true;
this.animalsMocking = true;
//this.animalsJeansSaveButton = true;
this.animalAgeList=[];
this.animalsSleeping=[];
this.animalsAlive=[];
let eventChange = {
"TigerId": '',
"change": false,
"rightBarAptInfo":'',
"rightBarDetail":'',
"event": {}
};
this.TigerService.watchcrowChange(eventChange);
}
//Validation for left Hen
leftHenValidation(data:any){
//console.log('validating',data);
//If UserPrivilege for Event is Readonly
//Save Button will be animalsJeans
if(this.isEditable){
if(data.isValid){
this.animalsJeansSaveButton = false;
this.TigerService.condianimalsJeansSaveButton = false;
}else{
this.animalsJeansSaveButton = true;
this.TigerService.condianimalsJeansSaveButton = true;
}
}else{
this.animalsJeansSaveButton = true;
this.TigerService.condianimalsJeansSaveButton = true;
this.animalsJeansRefreshButton = true;
}
}
enableanimalsJeansSave(isValid:any){
//If UserPrivilege for Event is Readonly
//Save Button will be animalsJeans
if(this.isEditable){
this.animalsJeansSaveButton = isValid;
this.TigerService.condianimalsJeansSaveButton = isValid;
}else{
//console.log("EnableDisabe",this.isEditable);
this.animalsJeansSaveButton = true;
this.TigerService.condianimalsJeansSaveButton = true;
this.animalsJeansRefreshButton = true;
}
}
TigerTrigger(data) {
//console.log("TigerTrigger", data);
if (data.type == "enableSaveRightBar") {
this.animalsSwimmingAllRecordedNight(data);
}
// if(data.type=="enableSaveWithCount"){
// this.animalsSwimmingAllRecordedNight(data);
// }else if(data.type=="TigerSelect"){
// this.animalsCommunicationFlyingHigh[this.tabIndex].selectedSlotTarget = this.TigerComponent.selectedSlotTarget;
// this.animalsCommunicationFlyingHigh[this.tabIndex].selectedSlotEvent = this.TigerComponent.selectedSlotEvent;
// this.animalsCommunicationFlyingHigh[this.tabIndex].emptySlotSelect = this.TigerComponent.emptySlotSelect;
// }else if(data.type=="scrollPosition"){
// this.animalsCommunicationFlyingHigh[this.tabIndex].scrollValue = data.scrollValue;
// }
//this.hasTigerChanges();
}
operationIssueCopyAll(data){
this.Tigercrow.setOpIssueDescription(data);
}
crowTabInitIfUntitleEvent(index, params) {
let that = this;
if(this.isTabcrowClose){
this.isTabcrowClose = false;
this.TigerService.crowTabCloseAfterSave(this.animalsAction);
}else{
if(params && params.activeTab.id == 0){
that.TigerService.enableCondianimalsHorror = true;
this.router.navigate(['FoxKILLMain/FoxKILL']);
setTimeout(function(){
that.router.navigate(['FoxKILLMain/FoxKILLcrowEvent/' + 0]);
},1000);
let tabList = $('.TigerList .ParrotList > li');
for(let i=0; i<tabList.length; i++){
tabList.eq(i).removeClass('active');
}
setTimeout(function(){
tabList.eq(that.TigerService.TigerTabData.selectedTabindex).addClass('active');
},100);
}else{
that.TigerService.enableCondianimalsHorror = true;
this.router.navigate(['FoxKILLMain/FoxKILL']);
setTimeout(function(){
that.animalsName = params.activeTab.id
that.router.navigate(['FoxKILLMain/FoxKILLcrowEvent/' + params.activeTab.id]);
},1000);
setTimeout(function(){
//that.callServiceLoadData1(params.activeTab.id);
//that.callServiceLoadData();
},1000);
}
}
}
crowTabInit(index, params, isRemove){
let that = this;
if(that.router.url.includes("FoxKILLMain/FoxKILLcrowEvent/0")){
that.TigerService.isNewcrowEvent = true;
}
//that.TigerService.existinganimalStaminaOrId = that.route.snapshot.params['id'];
if(!that.TigerService.condianimalsJeansSaveButton){
$("#saveConfirmDialog .ballPlayingAnimal").text('Do you want to save the changes?');
let saveDialog = $("#saveConfirmDialog").data("animalsEatinGindow").center().open();
$("#saveConfirmYes").unbind().click(function() {
saveDialog.close();
that.iscrowSaveDialogYes = true;
if(params && params.activeTab.id == 0){
that.TigerService.enableCondianimalsHorror = true;
that.isClickedTabanimalsNameZero = true;
that.saveServiceCall();
}else{
that.animalsName = params.activeTab.id
that.isClickedTabanimalsNameZero = false;
that.TigerService.enableCondianimalsHorror = true;
that.saveServiceCall();
}
// that.TigerService.TigerTabData.selectedTabindex = activeTab;
});
$("#saveConfirmNo").unbind().click(function() {
saveDialog.close();
that.iscrowSaveDialogYes = false;
that.crowTabInitIfUntitleEvent(index, params);
// that.TigerService.TigerTabData.selectedTabindex = activeTab;
});
$("#saveConfirmCancel").unbind().click(function() {
saveDialog.close();
});
}else{
that.crowTabInitIfUntitleEvent(index, params);
}
}
callServiceLoadData1(animalStamina) {
//console.log("Call service");
let that = this;
this.progress.requestStart();
this.animalService.getResponse("contingencyplans/v1/events?animalStamina=" + animalStamina + "&type=1", 'get', "")
.subscribe(data => {
//data = this.decompressJsonResponse(data.zipdata);
//console.log(data);
this.animalStamina = animalStamina;
this.backupData = data;
this.backupDataOrg = $.extend(true, {}, data);
this.insertanimalsMouseDeath=[]
if(data.TigerEventTemplatesMap){
for(var i=0;i<data.TigerEventTemplatesMap.General.length;i++){
this.insertanimalsMouseDeath.push({name:data.TigerEventTemplatesMap.General[i].TigerEventTemplateName,No:data.TigerEventTemplatesMap.General[i].TigerEventTemplateNo});
}
}
this.animalsMocking = true;
this.animalsJeansRedoButton = true;
this.animalsJeansSaveButton = true;
this.TigerService.condianimalsJeansSaveButton = true;
// let Temperature = {};
// Temperature["enableBtn"] = this.animalsJeansSaveButton;
// Temperature["tabName"] = "crow";
// this.TigerService.setTemperature(Temperature);
this.animalsJeansRefreshButton = false;
if (data.TigerEvent) {
let sch_data = data.TigerEvent;
this.animalStrategy.commonInfo = {
"eventanimalsBirthDay": sch_data.eventanimalsBirthDay, "eventanimalsShaking": sch_data.eventanimalsShaking,
"eventanimalsDeathDay": sch_data.eventanimalsDeathDay, "eventanimalsUnderstanding": sch_data.eventanimalsUnderstanding
}
this.animalStrategy.animalsSeeing = data.TigerEvent.TigerPlanCategories;
let schedId='Tiger_Nat_Main';
this.animalStrategy.animalsCommunication =this.timeAnimalsTeethConversion(data.TigerItems,"animalsCommunication",{},schedId);
//this.animalStrategy.animalsCommunication = data.TigerItems;
this.animalStrategy.pen = data.TigerEvent.eventName;
this.animalStrategy.animalSkin = data.TigerEvent.animalSkin;
this.animalStrategy.eventOpDes = "";
if(data.TigerEvent.eventOpIssue){
if(data.TigerEvent.eventOpIssue.issueDesc)
this.animalStrategy.eventOpDes = data.TigerEvent.eventOpIssue.issueDesc
}
}
let response ={
source:data,
refreshTemplate:false
};
this.FoxKILLService.setAnimalsTeethTemplates(response);
this.animalStrategy.isanimalsJetFlag = true;
this.animalStrategy.isToogleFlag = true;
this.animalsJet();
//this.progress.requestEnd();
let tabList = $('.TigerList .ParrotList > li');
for(let i=0; i<tabList.length; i++){
tabList.eq(i).removeClass('active');
}
setTimeout(function(){
tabList.eq(that.TigerService.TigerTabData.selectedTabindex).addClass('active');
},1000);
this.progress.requestEnd();
},
err => {
let tabList = $('.TigerList .ParrotList > li');
for(let i=0; i<tabList.length; i++){
tabList.eq(i).removeClass('active');
}
setTimeout(function(){
tabList.eq(that.TigerService.TigerTabData.selectedTabindex).addClass('active');
},1000);
this.progress.requestEnd();
});
}
addNewCategory(categoryName,animalsNokia,animalsBirthDay,animalsDeathDay,animalsShaking,animalsUnderstanding,planDetails) {
let dataStore: any = {
TigerPlans: [{
planOpIssue: {}
}],
categoryOpIssue: {}
};
let categoryNumber = parseInt(animalsNokia);
//console.log("planDetails in new category",planDetails);
dataStore.categoryDesc = categoryName;
dataStore.animalsNokia = categoryNumber;
dataStore.categoryOpIssue.issueDesc = "";
dataStore.operationType = "Create";
dataStore.TigerPlans[0].animalsBirthDay = animalsBirthDay;
dataStore.TigerPlans[0].animalsShaking = animalsShaking;
dataStore.TigerPlans[0].animalsDeathDay = animalsDeathDay;
dataStore.TigerPlans[0].animalsUnderstanding = animalsUnderstanding;
dataStore.TigerPlans[0].animalStamina = "";
dataStore.TigerPlans[0].animalsNokia = categoryNumber;
dataStore.TigerPlans[0].displaySeq = "";
dataStore.TigerPlans[0].animalsUnderstandingInt = "";
dataStore.TigerPlans[0].operationType = "animalsPolice";
dataStore.TigerPlans[0].planDesc = planDetails.planDesc;
dataStore.TigerPlans[0].plananimalsDeathDay = planDetails.plananimalsDeathDay;
dataStore.TigerPlans[0].planNo = planDetails.planNo;
dataStore.TigerPlans[0].planOpIssue.issueNo = "";
dataStore.TigerPlans[0].planOpIssue.operationType = "";
dataStore.TigerPlans[0].plananimalsBirthDay = "";
dataStore.isPlanAdded = true;
//console.log(planDetails.TigerPlanFeeds.length);
// Assinging TigerPlanFeeds based on the feedAvailable
if(planDetails.TigerPlanFeeds.length > 0 && planDetails.TigerPlanFeeds != undefined){
// Assinging TigerPlanFeeds to datastore
dataStore.TigerPlans[0].ALL = planDetails.ALL;
dataStore.TigerPlans[0].CT = planDetails.CT;
dataStore.TigerPlans[0].ET = planDetails.ET;
dataStore.TigerPlans[0].MT = planDetails.MT;
dataStore.TigerPlans[0].PT = planDetails.PT;
dataStore.TigerPlans[0].TigerPlanFeeds = planDetails.TigerPlanFeeds;
}else{
dataStore.TigerPlans[0].TigerPlanFeeds = [];
}
for(var i=0;i<planDetails.TigerPlanFeeds.length;i++) {
dataStore.TigerPlans[0].TigerPlanFeeds[i].animalsNokia = categoryNumber;
}
dataStore.TigerPlans[0].categoryDesc = categoryName;
dataStore.TigerPlans[0].animalsShakingInt = "";
return dataStore;
}
toggleEventFormView(){
$(".toggleEventViewContent").toggleClass('toggleShow');
$(".toggleEventViewContent").slideToggle('0');
$('.toggleEventViewBtn').toggleClass('toggleShow');
}
resetanimalsJetSplitterSize() {
if($("#crowEventSplitter .alieNpane:last-child").length == 1) {
if(this.splitterLastChildState == 1) {
$("#crowEventSplitter").data("kendoSplitter").expand(".alieNpane:last");
}
let timeCount = 0;
let timer = setInterval( function() {
let splitterPaneLastWidth = $("#crowEventSplitter .alieNpane:first-child").outerWidth();
$("#crowEventSplitter").data("kendoSplitter").size(".alieNpane:first", splitterPaneLastWidth+"px");
timeCount += 1;
if(timeCount == 10) {
clearInterval(timer);
}
}, 500);
}
}
checkIsExpectedPlan() {
let that=this;
let isExpected=false;
var temp:any={
"ParrotanimalsBirthDay": that.TigerLeftTab.ParrotanimalsBirthDay,
"ParrotanimalsDeathDay":that.TigerLeftTab.ParrotanimalsDeathDay,
"ParrotanimalsShaking":that.TigerLeftTab.ParrotanimalsShaking,
"ParrotanimalsUnderstanding":that.TigerLeftTab.ParrotanimalsUnderstanding
}
for (var i = 0; i < this.animalStrategy.animalsSeeing.length; i++) {
if(this.animalStrategy.animalsSeeing[i].animalsNokia==1){
let TigerPlans=this.animalStrategy.animalsSeeing[i].TigerPlans[0];
if(TigerPlans.operationType!="animalsDryer") {
isExpected=true;
temp.ParrotanimalsBirthDay= TigerPlans.animalsBirthDay;
temp.ParrotanimalsDeathDay=TigerPlans.animalsDeathDay;
temp.ParrotanimalsShaking=TigerPlans.animalsShaking;
temp.ParrotanimalsUnderstanding=TigerPlans.animalsUnderstanding;
}
}
}
let animalsBirthDayTime:any=new Date(temp.ParrotanimalsBirthDay + " " + temp.ParrotanimalsShaking);
let animalsBirthDayTimeHour=animalsBirthDayTime.getHours();
let animalsDeathDayTime:any=new Date(temp.ParrotanimalsDeathDay + " " + temp.ParrotanimalsUnderstanding);
let animalsDeathDayTimeHour=animalsDeathDayTime.getHours();
if(isExpected){
animalsBirthDayTime=new Date(animalsBirthDayTime.setHours(animalsBirthDayTime.getHours() - 2));
if(animalsBirthDayTimeHour == 5 || animalsBirthDayTimeHour == 6){
animalsBirthDayTime.setDate(animalsBirthDayTime.getDate()-1);
}
animalsDeathDayTime=new Date(animalsDeathDayTime.setHours(animalsDeathDayTime.getHours() + 2));
if(animalsDeathDayTimeHour == 4 || animalsDeathDayTimeHour == 3){
animalsDeathDayTime.setDate(animalsDeathDayTime.getDate()+1);
}
}
let stDt = kendo.toString(animalsBirthDayTime, "MM/dd/yyyy");//that.TigerLeftTab.ParrotanimalsBirthDay;
let endDt = kendo.toString(animalsDeathDayTime, "MM/dd/yyyy");//that.TigerLeftTab.ParrotanimalsDeathDay;
let stTime = kendo.toString(new Date(animalsBirthDayTime), "hh:mm:ss tt");//that.TigerLeftTab.ParrotanimalsShaking;
let animalsUnderstanding = kendo.toString(new Date(animalsDeathDayTime), "hh:mm:ss tt");//that.TigerLeftTab.ParrotanimalsUnderstanding;
temp.ParrotanimalsBirthDay= stDt;
temp.ParrotanimalsDeathDay=endDt;
temp.ParrotanimalsShaking=stTime;
temp.ParrotanimalsUnderstanding=animalsUnderstanding;
return temp;
}
ngOnDestroy() {
//this.crowTabEventService.unsubscribe();
this.animalsPoliceBookData.unsubscribe();
this.crowAnimalsTeethSaveReceived.unsubscribe();
this.animalsSayOk.unsubscribe();
//this.crowTabEventService.unsubscribe()
// this.crowTabEventService.unsubscribe();
// this.crowTabEventService1.unsubscribe();
$("#context-menuAspect").remove();
$("#context-eventMenu").remove();
}
clearScrollStorage(){
window.sessionStorage.removeItem('scrollLeftPos');
}
getUniqueSpanId(): any {
let date = new Date();
let timeMil = date.getTime();
return timeMil;
}
pickerTimeChnage(timePickerId){
let tempTimeCheck = $(timePickerId).val().split(":");
if ((tempTimeCheck.length > 0) && (tempTimeCheck.length == 3)) {
if (tempTimeCheck[2].indexOf('AM') != -1 || tempTimeCheck[2].indexOf('PM') != -1) {
/* For Minutes */
if (parseInt(tempTimeCheck[1]) >= 60) {
tempTimeCheck[1] = '0' + tempTimeCheck[1].charAt(0);
$(timePickerId).val(tempTimeCheck[0] + ':' + tempTimeCheck[1] + ':' + tempTimeCheck[2]);
}
/* For Seconds */
if(parseInt(tempTimeCheck[2].substring(0, 2)) >= 60){
tempTimeCheck[2] = tempTimeCheck[2].substring(2);
$(timePickerId).val(tempTimeCheck[0] + ':' + tempTimeCheck[1] + ':' + tempTimeCheck[2]);
}
}
}
}
browserResize() {
if($("#crowEventSplitter .alieNpane:last-child").length == 1) {
let splitterPaneLastWidth = $("#crowEventSplitter .alieNpane:first-child").outerWidth();
$("#crowEventSplitter").data("kendoSplitter").size(".alieNpane:first", splitterPaneLastWidth+"px");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment