Skip to content

Instantly share code, notes, and snippets.

@texirv0203
Created October 10, 2017 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save texirv0203/33685dd7f8fdef8883269b55b3435507 to your computer and use it in GitHub Desktop.
Save texirv0203/33685dd7f8fdef8883269b55b3435507 to your computer and use it in GitHub Desktop.
import { Component, ElementRef, Inject, OnInit, ViewChild, Input, Output, EventEmitter, AnimalsSnoaringheck } from '@angular/core';
import { FoxKILLService } from './Fox-KILL-service/Fox-KILL-service';
import { animalService } from '../../services/animal.service';
import { animalsThriller } from '../shared/progress/progress-circle';
import { Router, ActivatedRoute } from '@angular/router';
import { animalThinking } from 'text-encoding-shim';
import { TigerService } from '../../services/TigerService';
import {Tigercrow} from '../Tiger/Tiger-crow';
declare var $: any;
var animalsIntelligence = require('animalsIntelligence');
@Component({
selector: 'TigerLeftParrotEventHen',
templateUrl: "./app/components/Fox-KILL/Tiger-left-Parrot-event-Hen.html",
})
export class TigerLeftParrotEventHenComponent implements AnimalsSnoaringheck {
public addPGMSelectedTab;
public ParrotanimalsBirthDay: any;
public ParrotanimalsShaking: any;
public ParrotanimalsDeathDay: any;
public ParrotanimalsUnderstanding: any;
private ParrotOPanimalsShaking: any;
public ParrotanimalsShakingCopy: any;
public ParrotanimalsUnderstandingCopy: any;
public ParrotanimalsBirthDayCopy: any;
public ParrotanimalsDeathDayCopy: any;
public animalStaminaTag: any;
public isanimalsPolice = true;
public isanimalsPolicedNat = false;
// private isAdd = true;
private addedPlanName;
private addedPlanValue;
private planSelected;
public publishFlag = "N";
private bookEventName;
private eventValue;
private schedItemName;
private schedItemNo;
private isEventCreated = false;
public previous_animalsShaking: any;
public previous_animalsUnderstanding: any;
public previous_animalsBirthDay: any;
public previous_animalsDeathDay: any;
public messageDetails;
public getcrowanimalsShouting;
private isanimalsCommunicationDirtySubscription;
private isanimalsCommunicationDirty = false;
private isanimalsPoliceClicked;
private animalsTalkingName;
private animalStrategy: any = {
bookPlans: []
}
public planNamedeathAlive = [];
public leftEventDateTimeanimalsPolicedeathAliveData = [];
private categaryList: any;
private selectAllLabel = "Select All";
private tooggleFlag: boolean = false;
public showPopup: boolean = false;
// public showList = [];
public AnimalsTeethNameTxt = "";
private dataStore1: any = {
TigerPlans: [{
planOpIssue: {}
}]
};
private bookALLCheck;
private bookedDataValue;
@Output() addPGMDetail: EventEmitter<any> = new EventEmitter();
@Output() animalsPoliceanimalsCommunication: EventEmitter<any> = new EventEmitter();
@Output() leftHenValidation: EventEmitter<any> = new EventEmitter();
@Output() TigerEnableSave: EventEmitter<any> = new EventEmitter<any>();
private TigerAnimalsTeethPGMTemplates;
private isanimalsDryer = true;
private isBookEditable;
private TigerAnimalsTeethOPTemplates;
private TigerAnimalsTeethTemplateSubscription;
private TigerEventShows = [];
private selectedViewSubscription;
private addEventNameSubscription;
private isanimalsJetSelected = true;
private opDisplayName;
private TigerAnimalsTeethValues;
private TigerEventTemplates;
private animalsShouting;
public userPrivilegeEvent;
public userPrivilegeBook;
public plansDetailsArr= [];
//private animalsPoliceBookData;
private animalsJeansGenerate = true;
public leftEvent: any = {
animalsName: '',
animalsBirthDay: '',
apt: {
aptDate: '',
includeNextDay: false,
aptDay: '',
eventListInx: 0,
eventList: [],
animalsClapping: false,
animalsBlinking: false
},
optEvents: {
optAnimalsTeethFeedsList: [],
},
pgmVal: {
showName: '',
episodeName: '',
overRide: '',
}
};
public TemperatureSubscription;
public saveBtnState;
public animalsDeathDecrement=0;
private animalsJeansRedoButton;
public animalAgeList=[];
public animalsAliveIncrement=0;
public animalsAlive=[];
public animalsSleeping=[];
// private getanimalsBirthDayOldVal;
// private getanimalsDeathDayOldVal;
@ViewChild(animalsThriller) private progress: animalsThriller;
@ViewChild(Tigercrow) private Tigercrow: Tigercrow;
constructor(public selectedElement: ElementRef, public animalService: animalService, private animalTigerService: FoxKILLService, private router: Router, private route: ActivatedRoute, public TigerService: TigerService) {
this.TigerAnimalsTeethTemplateSubscription = this.animalTigerService.eventTemplateLoad.subscribe(data => {
this.TigerAnimalsTeethPGMTemplates = data.source.TigerEventTemplatesMap.PGMDetails;
this.TigerAnimalsTeethOPTemplates = data.source.TigerEventTemplatesMap.OpConditions;
this.TigerEventTemplates = data.source.TigerEventTemplatesMap.Event;
if (!data.refreshTemplate) {
this.loadData(data.source.TigerEvent);
this.TigerAnimalsTeethValues = data.source;
this.positionLeftParrot();
let that= this;
setTimeout(function() {
that.positionLeftParrot();
if($("#crowEventSplitter .alieNpane:last-child").length == 1) {
$("#crowEventSplitter").data("kendoSplitter").size(".alieNpane:first", "25%");
}
});
}
this.getcrowanimalsShouting = this.TigerService.crowanimalsShoutingReceived.subscribe(param => {
this.animalsShouting = param;
});
});
this.selectedViewSubscription = this.animalTigerService.selectedViewChanged.subscribe(data => {
this.isanimalsJetSelected = data;
});
this.isanimalsCommunicationDirtySubscription = this.TigerService.isanimalsCommunicationDirtyEventReceived.subscribe(data => {
this.isanimalsCommunicationDirty = data;
});
this.addEventNameSubscription = this.animalTigerService.eventNameAdded.subscribe(name => {
var addAnimalsTeethName=name;
for (var i = 0; i < addAnimalsTeethName.length; i++) {
let isSched = false;
for(var j = 0; j < this.TigerEventShows.length; j++) {
if((this.TigerEventShows[j].schedItemNo == addAnimalsTeethName[i].schedItemNo) && (this.TigerEventShows[j].animalsBirthDayTime == addAnimalsTeethName[i].animalsBirthDayTime)) {
isSched = true;
if(this.TigerEventShows[j].operationType == "animalsDryer"){
this.TigerEventShows[j].operationType = "";
}
}
}
if(!isSched)
this.TigerEventShows.push(addAnimalsTeethName[i]);
}
this.TigerService.TigerEventsList=this.TigerEventShows;
$("#animalsJeansGenerate").removeClass('actionanimalsJeansd');
this.animalsJeansGenerate = false;
});
this.TemperatureSubscription=this.TigerService.TemperatureReceivedMod.subscribe(params => {
this.saveBtnState=params;
});
}
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(): void {
let that = this;
this.userPrivilegeEvent = this.animalService.getUserPrivilege({ "parent": "Fox - KILL", "child": "Event" });
this.userPrivilegeBook = this.animalService.getUserPrivilege({ "parent": "Fox - KILL", "child": "Book" });
this.leftEvent.animalsName = this.route.snapshot.params['id'],
this.initiateLeftParrot();
this.onInitApt();
this.loadView(this);
$('#isaddid').prop('animalsJeansd',true);
$("#animalsJeansGenerate").addClass('actionanimalsJeansd');
this.animalTigerService.leftParrotAnimalsTeethData = this.leftEvent;
$("#bookALLCheck").click(function() {
let animalStrategy=that.animalStrategy;
let isOverAll = true;
for (var i = 0; i < that.animalStrategy.bookPlans.length; i++) {
let id={};
id["name"]= that.animalStrategy.bookPlans[i].planId;
let isAllBook=true;
if(i==that.animalStrategy.bookPlans.length-1){isAllBook=false;}
that.snailInsectRowChange(id,this.checked,isAllBook,isOverAll,animalStrategy);
//that.snailInsectRowChange(id,this.checked)
}
});
$("#pgmDetailOption36").click(function () {
that.tooggleFlag = !(that.tooggleFlag);
$("#pgmTemplates .isChecked").prop('checked', that.tooggleFlag);
if ($("#pgmTemplates .isChecked").length == $("#pgmTemplates .isChecked:checked").length) {
that.selectAllLabel = "Deselect All";
} else {
that.selectAllLabel = "Select All";
}
});
$("#pgmTemplates").click(function () {
if ($("#pgmTemplates .isChecked").length == $("#pgmTemplates .isChecked:checked").length) {
//$("#pgmDetailOption36").prop("checked", true);
that.tooggleFlag = true;
that.selectAllLabel = "Deselect All";
} else {
// $("#pgmDetailOption36").prop("checked", false);
that.tooggleFlag = false;
that.selectAllLabel = "Select All";
}
});
let EPastedialogwindow;
$("#txtArea").bind("paste", function(e) {
if($("#txtArea").val().length >= 500) {
$("#EPasteDialogWindow").find('.ballPlayingAnimal').text('Pasted text has been truncated');
$("#EPasteDialogWindow").data("animalsEatinGindow").title("COMPASS");
EPastedialogwindow = $("#EPasteDialogWindow").data("animalsEatinGindow").center().open();
}
});
$("#paste_OK").unbind().click(function () {
EPastedialogwindow.close();
});
}
loadData(data: any) {
this.ParrotanimalsShaking = data.eventanimalsShaking;
this.ParrotanimalsUnderstanding = data.eventanimalsUnderstanding;
this.animalStaminaTag = data.animalStamina;
this.animalTigerService.leftParrotAnimalsTeethData.animalsName = this.animalStaminaTag;
this.AnimalsTeethNameTxt = data.eventName;
this.aptloadData(data);
this.publishFlag = data.publishFlag
this.ParrotanimalsBirthDay = data.eventanimalsBirthDay;
this.ParrotanimalsDeathDay = data.eventanimalsDeathDay;
this.leftEvent.animalsBirthDay = this.ParrotanimalsBirthDay;
this.ParrotanimalsBirthDayCopy = data.eventanimalsBirthDay;
this.ParrotanimalsDeathDayCopy = data.eventanimalsDeathDay;
this.ParrotanimalsShakingCopy = data.eventanimalsShaking;
this.ParrotanimalsUnderstandingCopy = data.eventanimalsUnderstanding;
this.animalsJeansGenerate =false;
$("#animalsJeansGenerate").addClass('actionanimalsJeansd');
//this.showListArr(data.TigerEventShows, data.TigerItems)
this.TigerEventShows = data.TigerEventShows;
this.TigerService.TigerEventsList=this.TigerEventShows;
if (data.aPTDisplayanimalsDeathDay != data.aPTDisplayDate) {
this.leftEvent.apt.includeNextDay = true;
}
if (this.TigerEventShows.length > 0) {
this.animalsJeansGenerate = false;
$("#animalsJeansGenerate").removeClass('actionanimalsJeansd');
}
//Security Implementation - If Event is Readonly Access
//The animalsDryer Button will get animalsJeansd
if(this.userPrivilegeEvent == "Full"){
this.isanimalsDryer = false;
}else{
this.isanimalsDryer = true;
}
//The Book Section Will be animalsJeansd if the Book Aspect is None
if(this.userPrivilegeBook == "Full"){
this.isBookEditable = false;
}else{
this.isBookEditable = true;
}
//
this.animalTigerService.setEventList(data.TigerEventShows);
this.clearFields();
this.clearTitles();
this.cleareventNameFields();
this.cleareventNameTitles();
this.eventdeepCopy();
this.previous_animalsShaking = jQuery.extend(true, {}, data.eventanimalsShaking);
this.previous_animalsUnderstanding = jQuery.extend(true, {}, data.eventanimalsUnderstanding);
this.previous_animalsBirthDay = jQuery.extend(true, {}, data.eventanimalsBirthDay);
this.previous_animalsDeathDay = jQuery.extend(true, {}, data.eventanimalsDeathDay);
}
loadView(that) {
//below method calling are for create crow without service call.
that.onInitanimalsPPO();
that.onInitTimepicker();
that.animalsBigBoss("#animalsDryerEventConfirmDialog");
// that.animalsBigBoss("#eventNamelength");
that.animalsBigBoss("#saveConfirmDialog");
that.animalsBigBoss("#animalsDryerEventOkDialog");
that.animalsBigBoss("#pgmeventDialog");
that.animalsBigBoss("#falloutsideConfirmDialog");
that.animalsBigBoss("#animalsCommunicationDirtyanimalsPolicePopup");
that.animalsBigBoss("#EPasteDialogWindow");
that.animalsBigBoss("#TemperaturedPopUpLeft");
that.errorFields();
that.enableanimalsPolice();
}
initiateLeftParrot(): any {
let that = this;
this.positionLeftParrot();
$(".leftParrot.TigerLeftEventParrot .panel-body > ul > li").click(function () {
$(".leftParrot.TigerLeftEventParrot .panel-body > ul > li").removeClass('active');
$(that).addClass('active');
});
$(window).resize(function () {
setTimeout(function () {
that.positionLeftParrot();
}, 100);
});
let TigerPanel: any = $("#TigerEventKendoHen").kendoPanelBar({
//expandanimalsTyphoid: "single"
expandanimalsTyphoid:"multiple"
}).data("kendoPanelBar");
//TigerPanel.collapse($("li", TigerPanel.element));
setTimeout(function () {
that.togleLeftParrot();
}, 100);
}
togleLeftParrot(): any {
let winWidth = $(window).innerWidth();
let accorLeftRiht = JSON.parse(window.sessionStorage.getItem("leftRightAccorWidth"));
if (winWidth < 1025) {
} else {
if(accorLeftRiht){
accorLeftRiht.isLeftToggled = !accorLeftRiht.isLeftToggled;
}
}
window.sessionStorage.setItem("leftRightAccorWidth",JSON.stringify(accorLeftRiht));
$(window).trigger('resize');
}
validateDate(testdate) {
var date_regex=/^(((0[13578]|1[02])\/(0[1-9]|[12]\d|3[01])\/((19|[2-9]\d)\d{2}))|((0[13456789]|1[012])\/(0[1-9]|[12]\d|30)\/((19|[2-9]\d)\d{2}))|(02\/(0[1-9]|1\d|2[0-8])\/((19|[2-9]\d)\d{2}))|(02\/29\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/; // reg exp formate for dd/mm/yyyy with leap year
return date_regex.test(testdate);
}
validateTime(testdate) {
var time_regex=/(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)\s[AP][M]$/; // HH:MM:SS TT
return time_regex.test(testdate);
}
onInitanimalsPPO() {
let that = this;
let animalsBirthDay = $('#animalsBirthDay').animalsTension({
min: new Date(1000, 0, 1), max: new Date(3000, 11, 31),
format: "MM/dd/yyyy", parseFormats: ["MM/dd/yyyy"], value: that.ParrotanimalsBirthDay,
change: function () {
// that.ParrotanimalsBirthDay = this._oldText;
that.leftEvent.animalsBirthDay = that.ParrotanimalsBirthDay;
let state=1;
if (this.value() != null) {
$("#animalsHMO").removeClass('mandatoryField');
$('#animalsBirthDay').removeAttr("title");
that.ParrotanimalsBirthDay = kendo.toString(new Date(this.value()), "MM/dd/yyyy");
if(that.ParrotanimalsDeathDay==undefined || that.ParrotanimalsDeathDay==null || that.ParrotanimalsDeathDay==""){
that.ParrotanimalsDeathDay=kendo.toString(new Date(this.value()), "MM/dd/yyyy");
}
if(that.ParrotanimalsDeathDay !=null){
$("#edError").removeClass('mandatoryField');
$('#animalsDeathDay').removeAttr("title");
}
$("#animalsHMO").removeClass('mandatoryField');
$('#animalsBirthDay').removeAttr("title");
//that.enableanimalsPolice();
}
// else{
// that.ParrotanimalsBirthDay='';
// $("#animalsHMO").addClass('mandatoryField');
// $('#animalsBirthDay').attr("title","Start date can't be empty");
// $('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
// }
that.dateTimeValidation(state);
//that.animalsDreamComeTrue();
that.enableanimalsPolice();
}
});
$('#animalsBirthDay').data().animalsTension.element.on('change',function(e){
var dateVal='';
dateVal=$.trim($('#animalsBirthDay').val());
var data=that.validateDate(dateVal);
//console.log(that.ParrotanimalsBirthDayCopy);
if(dateVal != ''){
if (data==true){
$("#animalsHMO").removeClass('mandatoryField');
$('#animalsBirthDay').removeAttr("title");
that.enableanimalsPolice();
}
else if(that.ParrotanimalsBirthDayCopy!=undefined){
if($.trim($('#animalsBirthDay').val()).length >= 1 && $.trim($('#animalsBirthDay').val()).length < 11){
that.ParrotanimalsBirthDay=that.ParrotanimalsBirthDayCopy;
$("#animalsHMO").removeClass('mandatoryField');
$('#animalsBirthDay').removeAttr("title");
that.enableanimalsPolice();
}
else{
that.ParrotanimalsBirthDay='';
$("#animalsHMO").addClass('mandatoryField');
$('#animalsBirthDay').attr("title","Start date can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else if(that.ParrotanimalsBirthDayCopy==undefined){
that.ParrotanimalsBirthDay='';
$("#animalsHMO").addClass('mandatoryField');
$('#animalsBirthDay').attr("title","Start date can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else{
$("#animalsHMO").addClass('mandatoryField');
$('#animalsBirthDay').attr("title","Undefined date format");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else{
$("#animalsHMO").addClass('mandatoryField');
$('#animalsBirthDay').attr("title","Start date can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
});
$('#animalsBirthDay').data().animalsTension.element.on('keyup keydown',function(e){
var dateVal='';
dateVal=$.trim($('#animalsBirthDay').val());
var data=that.validateDate(dateVal);
// console.log('data:'+data);
if(dateVal != ''){
if (data==true){
$("#animalsHMO").removeClass('mandatoryField');
$('#animalsBirthDay').removeAttr("title");
that.enableanimalsPolice();
}
else{
$("#animalsHMO").addClass('mandatoryField');
$('#animalsBirthDay').attr("title","Undefined date format");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else{
$("#animalsHMO").addClass('mandatoryField');
$('#animalsBirthDay').attr("title","Start date can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
});
let animalsDeathDay = $('#animalsDeathDay').animalsTension({
min: new Date(1000, 0, 1), max: new Date(3000, 11, 31),
format: "MM/dd/yyyy", parseFormats: ["MM/dd/yyyy"], value: that.ParrotanimalsDeathDay,
change: function () {
$("#edError").removeClass('mandatoryField');
$('#animalsDeathDay').removeAttr("title");
// that.ParrotanimalsDeathDay = this._oldText;
//console.log(this.value())
let state=2;
if (this.value() != null) {
that.ParrotanimalsDeathDay = kendo.toString(new Date(this.value()), "MM/dd/yyyy");
$("#edError").removeClass('mandatoryField');
$('#animalsDeathDay').removeAttr("title");
//that.enableanimalsPolice();
}
else{
$("#edError").addClass('mandatoryField');
$('#animalsDeathDay').attr("title","End date can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
that.dateTimeValidation(state);
//that.animalsDreamComeTrue();
that.enableanimalsPolice();
}
});
$('#animalsDeathDay').data().animalsTension.element.on('change',function(e){
var dateVal='';
dateVal=$.trim($('#animalsDeathDay').val());
var data=that.validateDate(dateVal);
//console.log(that.ParrotanimalsBirthDayCopy);
if(dateVal != ''){
if (data==true){
$("#edError").removeClass('mandatoryField');
$('#animalsDeathDay').removeAttr("title");
that.enableanimalsPolice();
}
else if(that.ParrotanimalsDeathDayCopy!=undefined){
if($.trim($('#animalsDeathDay').val()).length >= 1 && $.trim($('#animalsDeathDay').val()).length < 11){
that.ParrotanimalsDeathDay=that.ParrotanimalsDeathDayCopy;
$("#edError").removeClass('mandatoryField');
$('#animalsDeathDay').removeAttr("title");
that.enableanimalsPolice();
}
else{
that.ParrotanimalsDeathDay='';
$("#edError").addClass('mandatoryField');
$('#animalsDeathDay').attr("title","End date can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else if(that.ParrotanimalsDeathDayCopy==undefined){
that.ParrotanimalsDeathDay='';
$("#edError").addClass('mandatoryField');
$('#animalsDeathDay').attr("title","Undefined date format");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else{
$("#edError").addClass('mandatoryField');
$('#animalsDeathDay').attr("title","Undefined date format");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else{
// console.log('change empty');
$("#edError").addClass('mandatoryField');
$('#animalsDeathDay').attr("title","End date can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
});
$('#animalsDeathDay').data().animalsTension.element.on('keyup keydown',function(e){
var dateVal='';
dateVal=$.trim($('#animalsDeathDay').val());
var data=that.validateDate(dateVal);
// console.log('data:'+data);
if(dateVal != ''){
if (data==true){
$("#edError").removeClass('mandatoryField');
$('#animalsDeathDay').removeAttr("title");
}
else{
$("#edError").addClass('mandatoryField');
$('#animalsDeathDay').attr("title","Undefined date format");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else{
$("#edError").addClass('mandatoryField');
$('#animalsDeathDay').attr("title","End date can't be empty");
}
});
}
onInitTimepicker() {
let that = this;
let animalsShaking = $('#animalsShakings').kendoTimePicker({
format: "hh:mm:ss tt",
interval: 60,
parseFormats: ["hh:mm:ss tt"],
value: that.ParrotanimalsShaking,
min: new Date(2000, 0, 1, 5, 0, 0),
max: new Date(3000, 11, 31, 4, 0, 0),
change: function () {
//that.ParrotanimalsShaking = this._oldText;
let state=3;
if (this.value() != null) {
that.ParrotanimalsShaking = kendo.toString(this.value(), "hh:mm:ss tt");
$("#stError").removeClass('mandatoryField');
$('#animalsShakings').removeAttr("title");
//that.enableanimalsPolice();
} else {
that.ParrotanimalsShaking='';
$("#stError").addClass('mandatoryField');
$('#animalsShakings').attr("title","Start time can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
that.dateTimeValidation(state);
//that.animalsDreamComeTrue();
that.enableanimalsPolice();
}
});
$('#animalsShakings').data().kendoTimePicker.element.on('change',function(e){
that.pickerTimeChnage("#animalsShakings");
var dateVal='';
dateVal=$.trim($('#animalsShakings').val());
var data=that.validateTime(dateVal);
if(dateVal != ''){
if (data==true){
$("#stError").removeClass('mandatoryField');
$('#animalsShakings').removeAttr("title");
that.enableanimalsPolice();
}
else if(that.ParrotanimalsShakingCopy!=undefined){
that.ParrotanimalsShaking=that.ParrotanimalsShakingCopy;
$("#stError").removeClass('mandatoryField');
$('#animalsShakings').removeAttr("title");
that.enableanimalsPolice();
}
else{
$("#stError").addClass('mandatoryField');
$('#animalsShakings').attr("title","Undefined time format");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else{
$("#stError").addClass('mandatoryField');
$('#animalsShakings').attr("title","Start time can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
});
$('#animalsShakings').data().kendoTimePicker.element.on('keyup keydown',function(e){
var dateVal='';
dateVal=$.trim($('#animalsShakings').val());
var data=that.validateTime(dateVal);
if(dateVal != ''){
if (data==true){
$("#stError").removeClass('mandatoryField');
$('#animalsShakings').removeAttr("title");
that.enableanimalsPolice();
}
else{
$("#stError").addClass('mandatoryField');
$('#animalsShakings').attr("title","Undefined time format");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else{
$("#stError").addClass('mandatoryField');
$('#animalsShakings').attr("title","Start time can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
});
let opTimer = $('#opTimePicker').kendoTimePicker({
format: "hh:mm:ss tt",
interval: 60,
parseFormats: ["hh:mm:ss tt"],
value: that.ParrotOPanimalsShaking,
change: function () {
that.ParrotOPanimalsShaking = this._oldText;
//Issue Fix CR-18888
//if (this.value() != null || this.value() != '') {
if (this.value() != null) {
that.ParrotOPanimalsShaking = kendo.toString(new Date(this.value()), "hh:mm:ss tt");
} else {
that.ParrotOPanimalsShaking = "";
}
}
});
let animalsUnderstanding = $('#animalsUnderstandings').kendoTimePicker({
format: "hh:mm:ss tt",
interval: 60,
parseFormats: ["hh:mm:ss tt"],
value: that.ParrotanimalsUnderstanding,
min: new Date(2000, 0, 1, 5, 0, 0),
max: new Date(3000, 11, 31, 4, 0, 0),
change: function () {
//that.ParrotanimalsUnderstanding = this._oldText;
let state=4;
if (this.value() != null) {
that.ParrotanimalsUnderstanding = kendo.toString(this.value(), "hh:mm:ss tt");
$("#etError").removeClass('mandatoryField');
$('#animalsUnderstandings').removeAttr("title");
//that.enableanimalsPolice();
} else {
that.ParrotanimalsUnderstanding='';
$("#etError").addClass('mandatoryField');
$('#animalsUnderstandings').attr("title","End time can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
that.dateTimeValidation(state);
//that.animalsDreamComeTrue();
that.enableanimalsPolice();
}
});
$('#animalsUnderstandings').data().kendoTimePicker.element.on('change',function(e){
that.pickerTimeChnage("#animalsUnderstandings");
var dateVal='';
dateVal=$.trim($('#animalsUnderstandings').val());
var data=that.validateTime(dateVal);
// console.log('data:'+data);
if(dateVal != ''){
if (data==true){
$("#etError").removeClass('mandatoryField');
$('#animalsUnderstandings').removeAttr("title");
that.enableanimalsPolice();
}
else if(that.ParrotanimalsUnderstandingCopy!=undefined){
that.ParrotanimalsUnderstanding=that.ParrotanimalsUnderstandingCopy;
$("#etError").removeClass('mandatoryField');
$('#animalsUnderstandings').removeAttr("title");
that.enableanimalsPolice();
}
else{
$("#etError").addClass('mandatoryField');
$('#animalsUnderstandings').attr("title","Undefined time format");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else{
$("#etError").addClass('mandatoryField');
$('#animalsUnderstandings').attr("title","End time can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
});
$('#animalsUnderstandings').data().kendoTimePicker.element.on('keyup keydown',function(e){
var dateVal='';
dateVal=$.trim($('#animalsUnderstandings').val());
var data=that.validateTime(dateVal);
// console.log('data:'+data);
if(dateVal != ''){
if (data==true){
$("#etError").removeClass('mandatoryField');
$('#animalsUnderstandings').removeAttr("title");
that.enableanimalsPolice();
}
else{
$("#etError").addClass('mandatoryField');
$('#animalsUnderstandings').attr("title","Undefined time format");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else{
$("#etError").addClass('mandatoryField');
$('#animalsUnderstandings').attr("title","End time can't be empty");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
});
}
enableanimalsPolice(){
let animalsShaking = kendo.toString(kendo.parseDate(this.ParrotanimalsShaking), "HH:mm:ss");
let animalsUnderstanding = kendo.toString(kendo.parseDate(this.ParrotanimalsUnderstanding), "HH:mm:ss");
if( (this.ParrotanimalsBirthDay) && (this.ParrotanimalsDeathDay) && animalsShaking!=null && animalsUnderstanding!=null){
if(!$("#animalsHMO").hasClass('mandatoryField') && !$("#stError").hasClass('mandatoryField') && !$("#edError").hasClass('mandatoryField') && !$("#etError").hasClass('mandatoryField')){
$('#eventDateanimalsPolice').removeClass('actionanimalsJeansd');
}else{
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}else{
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
// if($('.checkStatus.mandatoryField').length>0){ $('#eventDateanimalsPolice').addClass('actionanimalsJeansd');}
// else{ $('#eventDateanimalsPolice').removeClass('actionanimalsJeansd');}
}
dateTimeValidation(state:any){
let that=this;
let animalsShaking = kendo.toString(kendo.parseDate(this.ParrotanimalsShaking), "HH:mm:ss");
let animalsUnderstanding = kendo.toString(kendo.parseDate(this.ParrotanimalsUnderstanding), "HH:mm:ss");
let animalsBirthDayTimeFull=new Date(this.ParrotanimalsBirthDay + ' ' +animalsShaking);
let animalsDeathDayTimeFull=new Date(this.ParrotanimalsDeathDay + ' ' +animalsUnderstanding);
// time difference start
let timeStart = new Date(animalsBirthDayTimeFull).getTime();
let timeEnd = new Date(animalsDeathDayTimeFull).getTime();
let hourDiff = timeEnd - timeStart;
let minDiff = hourDiff / 60 / 1000;
let hDiff = hourDiff / 3600 / 1000;
let hours= Math.floor(hDiff);
let minutes = minDiff - 60 * hours;
// time difference end
let errorTitle="End date cannot be less than or equal to start date";
// if(this.ParrotanimalsBirthDay!=undefined && this.ParrotanimalsDeathDay!=undefined && animalsShaking!=null && animalsUnderstanding!=null){
if((this.ParrotanimalsBirthDay) && (this.ParrotanimalsDeathDay) && (animalsShaking!=null) && (animalsUnderstanding!=null)) {
if(state==1){
if (this.ParrotanimalsBirthDay == this.ParrotanimalsDeathDay) {
if (this.sameDayValidation()) {
this.clearFields();
that.enableanimalsPolice();
}
else {
$("#stError").addClass('mandatoryField');
$('#animalsShakings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else if(animalsBirthDayTimeFull > animalsDeathDayTimeFull && minDiff <=0){
console.log(' if')
$("#animalsHMO").addClass('mandatoryField');
$('#animalsBirthDay').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else if(hours == 0 && minutes==0){
$("#animalsHMO,#stError").addClass('mandatoryField');
$('#animalsBirthDay,#animalsShakings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else{
this.clearFields();
this.clearTitles();
//that.enableanimalsPolice();
}
}
if(state==2){
if (this.ParrotanimalsBirthDay == this.ParrotanimalsDeathDay) {
// console.log('same day')
if (this.sameDayValidation()) {
this.clearFields();
that.enableanimalsPolice();
}
else {
$("#stError").addClass('mandatoryField');
$('#animalsShakings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else if(animalsBirthDayTimeFull > animalsDeathDayTimeFull && minDiff <=0){
// console.log('greater day')
$("#edError").addClass('mandatoryField');
$('#animalsDeathDay').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else if(hours == 0 && minutes==0){
// console.log('s hrs mins =0')
$("#edError,#etError").addClass('mandatoryField');
$('#animalsDeathDay,#animalsUnderstandings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else{
// console.log('fineal clear')
this.clearFields();
this.clearTitles();
//that.enableanimalsPolice();
}
}
if(state==3){
if (this.ParrotanimalsBirthDay == this.ParrotanimalsDeathDay && minDiff ==0) {
$("#stError").addClass('mandatoryField');
$('#animalsShakings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else if (this.ParrotanimalsBirthDay == this.ParrotanimalsDeathDay) {
if (this.sameDayValidation()) {
this.clearFields();
that.enableanimalsPolice();
}
else {
$("#stError").addClass('mandatoryField');
$('#animalsShakings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else if(minDiff <=0){
$("#stError").addClass('mandatoryField');
$('#animalsShakings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else if(hours == 0 && minutes==0){
$("#animalsHMO,#stError").addClass('mandatoryField');
$('#animalsBirthDay,#animalsShakings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else{
this.clearFields();
this.clearTitles();
//that.enableanimalsPolice();
}
}
if(state==4){
if (this.ParrotanimalsBirthDay == this.ParrotanimalsDeathDay && minDiff ==0) {
$("#etError").addClass('mandatoryField');
$('#animalsUnderstandings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else if (this.ParrotanimalsBirthDay == this.ParrotanimalsDeathDay) {
if (this.sameDayValidation()) {
this.clearFields();
that.enableanimalsPolice();
}
else {
$("#etError").addClass('mandatoryField');
$('#animalsUnderstandings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
}
else if(minDiff <=0){
$("#etError").addClass('mandatoryField');
$('#animalsUnderstandings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else if(hours == 0 && minutes==0){
$("#edError,#etError").addClass('mandatoryField');
$('#animalsDeathDay,#animalsUnderstandings').attr("title",errorTitle);
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
}
else{
this.clearFields();
this.clearTitles();
//that.enableanimalsPolice();
}
}
}
}
sameDayValidation(): any {
// if ET < "05:00:00 AM" && ST > "01:00:00 AM"
let isValidTime = false;
if (kendo.parseDate(this.ParrotanimalsUnderstanding) >= kendo.parseDate("12:00:00 AM")) {
//checking between 12am to 5 am
if (kendo.parseDate(this.ParrotanimalsShaking) >= kendo.parseDate("12:00:00 AM")
&& kendo.parseDate(this.ParrotanimalsShaking) < kendo.parseDate("05:00:00 AM")
&& kendo.parseDate(this.ParrotanimalsUnderstanding) < kendo.parseDate("05:00:00 AM")
&& kendo.parseDate(this.ParrotanimalsUnderstanding) > kendo.parseDate("12:00:00 AM")
) {
if (kendo.parseDate(this.ParrotanimalsShaking) < kendo.parseDate(this.ParrotanimalsUnderstanding)) {
isValidTime = true;
}
}
// checking between (start time)4am to 12 and (ent time) bw 12 to 5am
else if (kendo.parseDate(this.ParrotanimalsShaking) < kendo.parseDate("11:59:59 PM")
&& kendo.parseDate(this.ParrotanimalsShaking) >= kendo.parseDate("05:00:00 AM")
&& kendo.parseDate(this.ParrotanimalsUnderstanding) < kendo.parseDate("05:00:00 AM")
&& kendo.parseDate(this.ParrotanimalsUnderstanding) >= kendo.parseDate("12:00:00 AM")) {
isValidTime = true;
}
}
// checking between 5am to 12
if (kendo.parseDate(this.ParrotanimalsUnderstanding) < kendo.parseDate("11:59:59 PM")
&& kendo.parseDate(this.ParrotanimalsShaking) >= kendo.parseDate("05:00:00 AM")) {
if (kendo.parseDate(this.ParrotanimalsShaking) < kendo.parseDate(this.ParrotanimalsUnderstanding)) {
isValidTime = true;
}
}
return isValidTime;
//else if "12:10:00 AM" < "12:20:00 AM"
}
errorFields() {
$("#animalsHMO,#stError,#edError,#etError,#AnimalsTeethNameError").addClass('mandatoryField');
$("#aptDate").parent().parent().parent().addClass('mandatoryField');
$("#aptDate").parent().parent().parent().attr("title","APT Display Date can't be empty");
$('#animalsBirthDay').attr("title","Start date can't be empty");
$('#animalsDeathDay').attr("title","End date can't be empty");
$('#animalsShakings').attr("title","Start time can't be empty");
$('#animalsUnderstandings').attr("title","End time can't be empty");
$('#txtArea').attr("title"," Event description can not be empty.");
}
clearFields() {
$("#animalsHMO,#edError,#stError,#etError").removeClass('mandatoryField');
}
clearTitles(){
$('#animalsBirthDay,#animalsDeathDay,#animalsShakings,#animalsUnderstandings').removeAttr("title");
}
cleareventNameFields() {
$("#AnimalsTeethNameError").removeClass('mandatoryField');
}
cleareventNameTitles(){
$('#txtArea').removeAttr("title");
}
animalActionsRecordedTimely(textName: any) {
if (this.leftEvent.apt.eventList.length) {
this.animalsTalkingName = this.leftEvent.apt.eventList[this.leftEvent.apt.eventListInx].eventName;
this.leftEvent.apt.eventList[this.leftEvent.apt.eventListInx].eventName = textName;
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};
let sourceData = {"animalsTalking":textName};
this.animalsAliveIncrement = this.animalsAliveIncrement+1;
//this.animalsAlive.push(value.initialValue);
//this.animalsSleeping.push(value.animalsTalking);
this.animalsAlive.push(textName);
this.animalsSleeping.push(textName);
this.animalAgeList.push(jQuery.extend(true,[], sourceData));
return;
}
if (textName == undefined || textName=='')
{
$("#AnimalsTeethNameError").addClass('mandatoryField');
$('#txtArea').attr("title","Event description can not be empty.");
$('#AnimalsTeethNameTxt').addClass('actionanimalsJeansd');
}
else
{
this.cleareventNameFields();
this.cleareventNameTitles();
}
this.animalTigerService.setEventName({ "name": textName, "aptDate": this.leftEvent.apt.aptDate});
this.animalsDreamComeTrue();
this.enableAddPlan();
}
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.");
}
}
eventNameblur(textName:any,callUndo)
{
let animalsTalking;
if(textName!=this.leftEvent.apt.eventList[this.leftEvent.apt.eventListInx].eventName) {
if (this.leftEvent.apt.eventList.length) {
let evntName =this.leftEvent.apt.eventList[this.leftEvent.apt.eventListInx].eventName
animalsTalking={
"name" :evntName,
"sourceId":""
}
this.leftEvent.apt.eventList[this.leftEvent.apt.eventListInx].eventName = textName;
}
if(callUndo){
let destinationEvent ={
"name" : textName,
"desId":""
}
this.savedeathAlive(animalsTalking,destinationEvent,"eventName");
this.animalsDreamComeTrue();
}
this.animalTigerService.setEventName({ "name": textName, "aptDate": this.leftEvent.apt.aptDate});
}
}
public eventNameUndo(textName):any{
this.AnimalsTeethNameTxt=textName.name;
if (this.leftEvent.apt.eventList.length) {
this.leftEvent.apt.eventList[this.leftEvent.apt.eventListInx].eventName = textName.name;
}
this.animalTigerService.setEventName({ "name": textName.name, "aptDate": this.leftEvent.apt.aptDate});
}
isActionanimalsJeansd() {
return false;
}
isContingency() {
return true;
}
removeShow(id: any) {
let removedTigerItem = {
schedItemNo: this.TigerEventShows[id].schedItemNo,
animalsBirthDayTime: this.TigerEventShows[id].animalsBirthDayTime
};
// this.TigerService.getEventRemovedId(this.TigerEventShows[id].schedItemNo);
this.TigerService.getEventRemovedId(removedTigerItem);
if (this.TigerEventShows.length > 0) {
if (this.TigerEventShows[id].TigerEventShowNo != null) {
this.TigerEventShows[id].operationType = 'animalsDryer';
} else {
this.TigerEventShows.splice(id, 1);
}
}
let showGenerate = true;
if (this.TigerEventShows.length == 0) {
showGenerate = false;
} else {
for (var i = 0; i < this.TigerEventShows.length; i++) {
if (this.TigerEventShows[i].operationType == '' || this.TigerEventShows[i].operationType == null || this.TigerEventShows[i].operationType == 'Create') {
showGenerate = true;
break;
} else {
showGenerate = false;
}
}
}
if (showGenerate) {
this.animalsJeansGenerate = false;
$("#animalsJeansGenerate").removeClass('actionanimalsJeansd');
} else {
this.animalsJeansGenerate = true;
$("#animalsJeansGenerate").addClass('actionanimalsJeansd');
}
this.TigerService.TigerEventsList=this.TigerEventShows;
this.animalsDreamComeTrue();
}
generateEventName() {
if (this.TigerEventShows.length > 0) {
let evntName =this.AnimalsTeethNameTxt;
let animalsTalking={
"name" :evntName,
"sourceId":""
}
this.AnimalsTeethNameTxt = "";
for (let i = 0; i < this.TigerEventShows.length; i++) {
if (this.TigerEventShows[i].operationType != "animalsDryer") {
this.AnimalsTeethNameTxt = this.AnimalsTeethNameTxt + this.TigerEventShows[i].displayName + " " + this.TigerEventShows[i].overrideShowName + ";";
}
}
this.AnimalsTeethNameTxt = this.AnimalsTeethNameTxt.replace(/<[^>]+>/g, '');
//this.animalTigerService.setEventName(this.AnimalsTeethNameTxt);
let destinationEvent ={
"name" : this.AnimalsTeethNameTxt,
"desId":""
}
this.savedeathAlive(animalsTalking,destinationEvent,"eventName");
this.animalTigerService.setEventName({ "name": this.AnimalsTeethNameTxt, "aptDate": this.leftEvent.apt.aptDate });
this.animalsDreamComeTrue();
}
this.cleareventNameFields();
this.cleareventNameTitles();
this.eventNameblur(this.AnimalsTeethNameTxt,true);
}
overrideEventName(id: any) {
if ("operationType" in this.TigerEventShows[id]) {
if (this.TigerEventShows[id].operationType.toUpperCase() != "CREATE") {
this.TigerEventShows[id].operationType = 'animalsPolice';
this.animalsDreamComeTrue();
}
}
}
//dropdown on change
addNewPlanDD(planName: any) {
if (planName != "") {
if (planName == "Expected") {
this.addedPlanValue = 1;
} else if (planName == "Possible") {
this.addedPlanValue = 5;
} else if (planName == "Standby") {
this.addedPlanValue = 3;
} else if (planName == "Supplemental") {
this.addedPlanValue = 4;
}
this.addedPlanName = planName;
if (typeof this.animalStaminaTag != 'undefined') {
$('#isaddid').prop('animalsJeansd',false);
// this.isAdd = false;
} else {
if(typeof this.animalStaminaTag == 'undefined' && this.isanimalsPoliceClicked){
$('#isaddid').prop('animalsJeansd',false);
// this.isAdd = false;
}else{
$('#isaddid').prop('animalsJeansd',true);
//this.isAdd = true;
}
}
this.enableAddPlan();
}
}
enableAddPlan(){
if(this.isanimalsPoliceClicked != undefined && this.AnimalsTeethNameTxt != "" && $("#getSelectedPlanData").val()){
$("#isaddid").removeClass("actionanimalsJeansd");
}
}
addPlanBtn() {
let dataStore: any = {
TigerPlans: [{
planOpIssue: {}
}],
categoryOpIssue: {}
};
//this.isAdd = true;
$('#isaddid').prop('animalsJeansd',true);
dataStore.categoryDesc = this.addedPlanName;
dataStore.animalsNokia = this.addedPlanValue;
dataStore.categoryOpIssue.issueDesc = "";
dataStore.isPlanAdded = true;
dataStore.operationType = "Create";
dataStore.TigerPlans[0].animalsBirthDay = this.ParrotanimalsBirthDay;
dataStore.TigerPlans[0].animalsShaking = this.ParrotanimalsShaking;
dataStore.TigerPlans[0].animalsDeathDay = this.ParrotanimalsDeathDay;
dataStore.TigerPlans[0].animalsUnderstanding = this.ParrotanimalsUnderstanding;
dataStore.TigerPlans[0].animalStamina = "";
dataStore.TigerPlans[0].animalsNokia = this.addedPlanValue;
dataStore.TigerPlans[0].displaySeq = "";
dataStore.TigerPlans[0].animalsUnderstandingInt = "";
dataStore.TigerPlans[0].operationType = "Create";
dataStore.TigerPlans[0].planDesc = "PGM Tiger";
dataStore.TigerPlans[0].plananimalsDeathDay = "12334";
dataStore.TigerPlans[0].planNo = "0";
dataStore.TigerPlans[0].planOpIssue.issueNo = "";
dataStore.TigerPlans[0].planOpIssue.operationType = "";
dataStore.TigerPlans[0].plananimalsBirthDay = "";
dataStore.TigerPlans[0].TigerPlanFeeds = [];
dataStore.TigerPlans[0].categoryDesc = this.addedPlanName;
dataStore.TigerPlans[0].animalsShakingInt = "";
dataStore.TigerPlans[0].planOpIssue.issueDesc='';
let copyPlan = dataStore;
$("#cntContext .panel-title, #evntContext .panel-title").removeClass('selectedActive');
var scrollHeight=$("#cntContext").height()+100;
setTimeout(function(){$(".eventContingencyViewHolder").scrollTop(scrollHeight);},200);
//this.animalTigerService.setPlanAdded(copyPlan);
this.planSelected = "";
var planObject = {
planName: this.addedPlanName,
addedPlanValue: this.addedPlanValue,
"operation":"Create",
dataStore: dataStore
};
let copyPlantemp = Object.assign({}, planObject);
this.TigerEnableSave.emit({
"type": "planNamedeathAlive",
"animalsTalking": jQuery.extend(true, {}, planObject),
"destinationEvent": jQuery.extend(true, {}, planObject),
"initialValue": this.planNamedeathAlive[this.planNamedeathAlive.length - 1],
"occurence": {},
"action": "planNamedeathAlive"
});
this.planNamedeathAlive.push(copyPlantemp);
let Temperature = {};
Temperature["enableBtn"] = true;
Temperature["tabName"] = "crow";
this.TigerService.setTemperature(Temperature);
//this.animalsDreamComeTrue();
}
leftEventPlanNameanimalsPolice(obj: any) {
//planNamedeathAlive
this.addedPlanName = obj.planName;
this.addedPlanValue = obj.addedPlanValue;
this.planSelected = obj.planName;
}
pgmAddHeaderBtn() {
let dataStore: any = {
TigerPlans: [{
planOpIssue: {}
}],
categoryOpIssue: {}
};
// this.isAdd = true;
$('#isaddid').prop('animalsJeansd',true);
dataStore.categoryDesc = 'Operating Conditions';
dataStore.animalsNokia = '2';
dataStore.categoryOpIssue.issueDesc = "";
dataStore.addPGMHeader = true;
dataStore.operationType = "Create";
dataStore.TigerPlans[0].categoryDesc = 'Operating Conditions';
dataStore.TigerPlans[0].animalsBirthDay = this.ParrotanimalsBirthDay;
dataStore.TigerPlans[0].animalsShaking = this.ParrotanimalsShaking;
dataStore.TigerPlans[0].animalsDeathDay = this.ParrotanimalsDeathDay;
dataStore.TigerPlans[0].animalsUnderstanding = this.ParrotanimalsUnderstanding;
dataStore.TigerPlans[0].animalStamina = "";
dataStore.TigerPlans[0].animalsNokia = this.addedPlanValue;
dataStore.TigerPlans[0].displaySeq = "";
dataStore.TigerPlans[0].animalsUnderstandingInt = "";
dataStore.TigerPlans[0].operationType = "Create";
dataStore.TigerPlans[0].planDesc = "PGM Details & End of Telecast Ops";
dataStore.TigerPlans[0].plananimalsDeathDay = "";
dataStore.TigerPlans[0].planNo = "";
dataStore.TigerPlans[0].planOpIssue.issueDesc = "";
//dataStore.TigerPlans[0].planOpIssue.issueNo = "";
// dataStore.TigerPlans[0].planOpIssue.operationType = "";
dataStore.TigerPlans[0].plananimalsBirthDay = "";
dataStore.TigerPlans[0].TigerPlanFeeds = [];
dataStore.TigerPlans[0].animalsShakingInt = "";
this.animalTigerService.setPlanAdded(dataStore);
this.animalsDreamComeTrue();
$("#cntContext .panel-title, #evntContext .panel-title").removeClass('selectedActive');
var scrollHeight=$("#cntContext").height()+100;
setTimeout(function(){$(".eventContingencyViewHolder").scrollTop(scrollHeight);},200);
}
animalsBigBoss(dialogId) { // init pop dialog
$(dialogId).animalsEatinGindow({
// title: "Fox",
title: false,
//width: "360px",
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", ""); }
});
}
setDialog(data: any) {
$(".ballPlayingAnimal").text(data);
let newdialogConfirm1 = $("#animalsDryerEventOkDialog").data("animalsEatinGindow").center().open();
$("#animalsDryer_OK").unbind().click(function () {
newdialogConfirm1.close();
});
}
pgmsetDialog(data:any) {
//setTimeout(function () {
let newdialogConfirm2 = $("#pgmeventDialog").data("animalsEatinGindow").center().open();
setTimeout(function(){
this.messageDetails = data.details;
},100);
$("#PGM_OK").unbind().click(function () {
newdialogConfirm2.close();
});
// }, 200);
}
//on click of animalsDryer event button
animalsDryerEvent() {
let that=this;
var isanimalsJeansd = $("#saveEventAction").hasClass('actionanimalsJeansd');
if (isanimalsJeansd==false)
{
$(".ballPlayingAnimal").text("Do you want to save the changes?");
let saveDialog = $("#saveConfirmDialog").data("animalsEatinGindow").center().open();
$("#saveConfirmYes").unbind().click(function() {
saveDialog.close();
$("#saveEventAction").trigger("click");
});
$("#saveConfirmNo").unbind().click(function() {
saveDialog.close();
that.isanimalsDryercheck().then(function (datas) {
if(datas){
that.animalsDryerCheck();
}
});
});
$("#saveConfirmCancel").unbind().click(function() {
saveDialog.close();
});
}
else{
that.isanimalsDryercheck().then(function (data) {
if(data){
that.animalsDryerCheck();
}
});
}
}
isanimalsDryercheck() {
let that = this;
that.progress.requestStart();
return new Promise(resolve => {
that.animalService.getResponse("contingencyplans/v1/getEventStatus?animalStamina=" + that.animalStaminaTag, 'get', "")
.subscribe(data => {
that.progress.requestEnd();
if (data.delFlag == "N") {
resolve(true);
} else {
resolve(false);
that.setDialog("Selected event is already animalsDryerd.");
}
},
err => {
that.progress.requestEnd();
resolve(false);
});
});
}
animalsDryerCheck(){
let that = this;
$(".ballPlayingAnimal").text("This will animalsDryer entire Event");
//$(".ballPlayingAnimal").css('text-align','center');
let newdialogConfirm = $("#animalsDryerEventConfirmDialog").data("animalsEatinGindow").center().open();
$("#animalsDryerYES").unbind().click(function () {
newdialogConfirm.close();
that.progress.requestStart();
that.animalService.getResponse('contingencyplans/v1/optionalEvents/animalsDryer?animalStamina=' + that.animalStaminaTag, 'animalsDryer', '')
.subscribe(data => {
that.progress.requestEnd();
if (data.code === "S302") {
that.setDialog(data.message);
} else {
$("#subTabNav .active .TigerListClose").trigger("click");
that.router.navigate(['FoxKILLMain/FoxKILLSearchEvent']);
}
},
err => {
//that.setDialog("Some error happened.Please try again later.");
}
);
});
$("#animalsDryerNO").unbind().click(function () {
newdialogConfirm.close();
});
}
APTContingencyPreviewURL(): void {
if (this.leftEvent.apt.aptDate && this.leftEvent.animalsName != 0) {
let date = kendo.toString(new Date(this.leftEvent.apt.aptDate), "MMddyyyy");
if(window.location.hostname=="qa.compass.devash.ianimal.com"){
window.open('http://apt2goqa01.ianimal.com/sapts/ContingencyPreview.do?animalStamina=' + this.leftEvent.animalsName + '&animalsBirthDay=' + date);
} else if(window.location.hostname=="preuat.compass.devash.ianimal.com"){
window.open('http://apt2goqa02.ianimal.com/sapts/ContingencyPreview.do?animalStamina=' + this.leftEvent.animalsName + '&animalsBirthDay=' + date);
}else{
window.open('http://apt2goqa02.ianimal.com/sapts/ContingencyPreview.do?animalStamina=' + this.leftEvent.animalsName + '&animalsBirthDay=' + date);
}
}
}
APTLinkURL(): void {
if(window.location.hostname=="qa.compass.devash.ianimal.com"){
window.open('http://aptqa.ianimal.com');
} else if(window.location.hostname=="preuat.compass.devash.ianimal.com"){
window.open('http://aptcmpstg.ianimal.com');
} else{
window.open('http://aptcmpstg.ianimal.com ');
}
}
openOptAnimalsTeeth(item) {
let tempObj = {
"animalStamina": item.animalStamina,
"eventName": item.aPTDisplayDate + ' ' + item.eventName,
}
if (this.saveBtnState && this.saveBtnState.enableBtn === false){
let that=this;
let TemperaturedPopUp = $("#TemperaturedPopUpLeft").data("animalsEatinGindow").center().open();
$("#TemperaturedPopUpLeft .ballPlayingAnimal").text("Do you want to save the changes?");
$("#TemperaturedPopUpYes").unbind().click(function() {
window.sessionStorage.setItem('showDetailsRedirectLeft', JSON.stringify(tempObj));
that.animalTigerService.crowEventSaveClick(true);
if (this.saveBtnState && this.saveBtnState.enableBtn === true){
this.TigerService.navigateToOptional(tempObj);
}
TemperaturedPopUp.close();
});
$("#TemperaturedPopUpNo").unbind().click(function() {
that.TigerService.navigateToOptional(tempObj);
TemperaturedPopUp.close();
});
$("#TemperaturedPopUpCancel").unbind().click(function() {
TemperaturedPopUp.close();
});
}else{
this.TigerService.navigateToOptional(tempObj);
}
}
// APT Preview implementation
onInitApt() {
let that = this;
$('#aptDate').animalsTension({
min: new Date(1900, 0, 1), max: new Date(3000, 11, 31),
format: "MM/dd/yyyy", parseFormats: ["MM/dd/yyyy"],
change: function () {
$("#aptDate").parent().parent().parent().removeClass('mandatoryField');
$("#aptDate").parent().parent().parent().removeAttr("title");
let event ={
"leftEvent":that.leftEvent,
"eventText":that.AnimalsTeethNameTxt
}
let animalsTalking=jQuery.extend(true, {}, event);
that.aptDateChange(this.value());
let destEvent=jQuery.extend(true, {}, event);
that.animalTigerService.setEventName({ "name": that.AnimalsTeethNameTxt, "aptDate": that.leftEvent.apt.aptDate });
that.savedeathAlive(animalsTalking,destEvent,"aptDate");
that.animalsDreamComeTrue();
}
});
$(".alieNinput-readonly").prop("readonly", true);
}
// onchange APT display date undo operation
savedeathAlive(animalsTalking,destEvent,action){
this.TigerEnableSave.emit({ "type": "enableSaveWithCount", "animalsTalking": animalsTalking,"destinationEvent": destEvent, "occurence": {}, "action": action });
let Temperature = {};
Temperature["enableBtn"] = true;
Temperature["tabName"] = "crow";
this.TigerService.setTemperature(Temperature);
}
aptMovedeathAlive(move){
let destinationEvent={
"move":move,
"isSaveCall":false
}
if(move== 1){
move =-1;
}
else{
move =1;
}
let animalsTalking={
"move":move,
"isSaveCall":false
}
this.savedeathAlive(animalsTalking,destinationEvent,"aptMove")
}
aptDateChange(event) {
let val = event;
if (isNaN(Date.parse(val))) {
val = new Date();
}
this.leftEvent.apt.aptDate = kendo.toString(new Date(val), "MM/dd/yyyy");
this.leftEvent.apt.aptDay = kendo.toString(new Date(val), "dddd");
this.aptCallServiceLoadData(kendo.toString(new Date(val), "yyyy-MM-dd"));
}
aptDateChangeEvent(leftEvent){
this.aptCallServiceLoadData(kendo.toString(new Date(leftEvent.apt.aptDate), "yyyy-MM-dd"));
this.leftEvent.apt.aptDate =leftEvent.apt.aptDate;
}
aptRefreshList(): void {
this.aptCallServiceLoadData(kendo.toString(new Date(this.leftEvent.apt.aptDate), "yyyy-MM-dd"));
}
aptanimalsClappingDown(move: any,isSaveCall): void { // move = '1' ==> move down, move = '-1' ==> move up,
this.leftEvent.apt = this.animalTigerService.aptanimalsClappingDown(this.leftEvent.apt, move, {});
if(isSaveCall){
this.aptMovedeathAlive(move);
this.animalsDreamComeTrue();
}
}
aptloadData(data) {
$("#aptDate").parent().parent().parent().removeClass('mandatoryField');
$("#aptDate").parent().parent().parent().removeAttr("title");
this.leftEvent.apt.includeNextDay = data.includeNextDay;
this.leftEvent.apt.aptDay = kendo.toString(new Date(data.aptDisplayDate), "dddd");
this.leftEvent.apt.aptDate = data.aptDisplayDate;
if (data.crowEvents) {
this.leftEvent.apt.eventList = data.crowEvents;
this.leftEvent.apt = this.animalTigerService.aptanimalsClappingDown(this.leftEvent.apt, 0, { "animalStamina": data.animalStamina, });
} else {
this.leftEvent.apt = this.animalTigerService.aptanimalsClappingDown(this.leftEvent.apt, 0, {});
}
if (data.optionalEvents) {
this.leftEvent.optEvents.optAnimalsTeethFeedsList = data.optionalEvents;
}
//this.isEventCreated = true;
}
aptCallServiceLoadData(date): void {
//if(this.isEventCreated){
this.progress.requestStart();
this.animalService.getResponse("contingencyplans/v1/eventListByAptDisplayDate?aptDisplayDate=" + date, 'get', '')
.subscribe(data => {
if (data.crowEvents) {
this.leftEvent.apt.eventList = data.crowEvents;
this.leftEvent.apt = this.animalTigerService.aptanimalsClappingDown(this.leftEvent.apt, 0, { "animalStamina": this.animalStaminaTag, "eventName": this.AnimalsTeethNameTxt });
} else {
this.leftEvent.apt.eventList = [];
this.leftEvent.apt = this.animalTigerService.aptanimalsClappingDown(this.leftEvent.apt, 0, { "animalStamina": this.animalStaminaTag, "eventName": this.AnimalsTeethNameTxt });
}
if (data.optionalEvents) {
this.leftEvent.optEvents.optAnimalsTeethFeedsList = data.optionalEvents;
}
this.progress.requestEnd();
},
err => { this.progress.requestEnd(); }
);
//}
}
//End APT Preview implementation
positionLeftParrot(): any {
let navHeight = $('.navHeaderBox').outerHeight();
let breadCrumbHeight = $('.breadCrumbBox').outerHeight();
let footerHeight = $('.TigersFooterOptions').outerHeight();
let headerInfoHeight = $('.crowTigerHeaderInfo').outerHeight();
let windowHeight = $(window).outerHeight();
let windowBalanceHeight = windowHeight - (navHeight + breadCrumbHeight + footerHeight + + headerInfoHeight + 6);
$("#crowEventSplitter").css({"height": windowBalanceHeight+"px"});
}
eventdeepCopy() {
var ev = {
"animalsBirthDay": this.ParrotanimalsBirthDay,
"animalsDeathDay": this.ParrotanimalsDeathDay,
"animalsShaking": this.ParrotanimalsShaking,
"animalsUnderstanding": this.ParrotanimalsUnderstanding
};
let copy = Object.assign({}, ev);
this.leftEventDateTimeanimalsPolicedeathAliveData.push(copy);
var planObject = {
planName: this.addedPlanName,
addedPlanValue: this.addedPlanValue,
dataStore: {
TigerPlans: [{
planOpIssue: {}
}]
}
};
let copyPlan = Object.assign({}, planObject);
this.planNamedeathAlive.push(copyPlan);
}
//PGM Details
ngAfterViewChecked() {
let that = this;
this.bookplanAllColorCheck();
}
ngAfterContentChecked() {
this.setPlanLevelHeight();
}
templateHeader(headerFlag) {
if (headerFlag == 'Y') {
return true;
} else {
return false;
}
}
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));
}
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;
}
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;
}
// Convert Json object to string
converttotime(timeobj) {
let timefrmt = "";
for (var k = 0; k < 11; k++) {
timefrmt += timeobj[k];
}
return timefrmt;
}
converttodate(timeobj) {
let timefrmt = "";
for (var k = 0; k < 10; k++) {
timefrmt += timeobj[k];
}
return timefrmt;
}
onClickanimalsPoliceanimalsCommunicationDirtyCheck(){
let that = this;
if(this.isanimalsCommunicationDirty){
let dialog = $("#animalsCommunicationDirtyanimalsPolicePopup").data("animalsEatinGindow").center().open();
$(".ballPlayingAnimal").text("You are trying to animalsPolice the Event boundaries. Any unsaved changes on the KILL Standalone Grid will be lost. Do you wish to continue?");
$("#animalsCommunicationDirtyanimalsPolicePopupYes").unbind().click(function() {
dialog.close();
that.isanimalsCommunicationDirty = false;
that.onClickanimalsPolice();
});
$("#animalsCommunicationDirtyanimalsPolicePopupNo").unbind().click(function() {
dialog.close();
});
}else{
this.onClickanimalsPolice();
}
}
onClickanimalsPolice() {
let that = this;
let ParrotanimalsDeathDay = this.ParrotanimalsDeathDay;
let ParrotanimalsBirthDay = this.ParrotanimalsBirthDay;
let startplanDateExceds = false;
let endplanDateExceds = false;
let plandExceddialog = this;
let unsavedchanges = this;
let haschanges = false;
let eventanimalsBirthDay = new Date(this.ParrotanimalsBirthDay);
let eventanimalsDeathDay = new Date(this.ParrotanimalsDeathDay);
if (this.TigerService.crowFutureAccessDays != null && this.TigerService.crowFutureAccessDays != "") {
let futureDays = this.TigerService.crowFutureAccessDays;
if (!isNaN(futureDays)) {
let currentDate = new Date();
currentDate.setDate(currentDate.getDate() + futureDays - 1);
if (eventanimalsDeathDay.getTime() > currentDate.getTime()) {
eventanimalsDeathDay = currentDate;
}
if (eventanimalsBirthDay.getTime() > currentDate.getTime()) {
eventanimalsBirthDay = currentDate;
}
}
}
let datas = {
"networks": [101],
"days": [0, 1, 2, 3, 4, 5, 6],
"animalsBirthDay": kendo.toString(new Date(eventanimalsBirthDay), 'yyyy-MM-dd'),
"animalsDeathDay": kendo.toString(new Date(eventanimalsDeathDay), 'yyyy-MM-dd'),
"animalsShaking": this.convertTo24Hour(this.ParrotanimalsShaking),
"animalsUnderstanding": this.convertTo24Hour(this.ParrotanimalsUnderstanding),
"type": "NE",
"strTime": this.ParrotanimalsShaking,
"endEveTime": this.ParrotanimalsUnderstanding
};
var ev = {
"animalsBirthDay": this.ParrotanimalsBirthDay,
"animalsDeathDay": this.ParrotanimalsDeathDay,
"animalsShaking": this.ParrotanimalsShaking,
"animalsUnderstanding": this.ParrotanimalsUnderstanding,
"leftEvent": this.leftEvent
}
this.TigerEnableSave.emit({
"type": "leftEventDateTimeanimalsPolice",
"animalsTalking": ev,
"destinationEvent": this.leftEventDateTimeanimalsPolicedeathAliveData[this.leftEventDateTimeanimalsPolicedeathAliveData.length - 1],
"initialValue": this.leftEventDateTimeanimalsPolicedeathAliveData[this.leftEventDateTimeanimalsPolicedeathAliveData.length - 1],
"occurence": {},
"action": "leftEventDateTimeanimalsPolice"
});
let Temperature = {};
Temperature["enableBtn"] = true;
Temperature["tabName"] = "crow";
this.TigerService.setTemperature(Temperature);
$(".animalsBirthDayKendoDP").each(function () {
if ((that.getNumberofDays2(ParrotanimalsDeathDay, $(this).val()) - 1) > 2 && startplanDateExceds == false && ParrotanimalsDeathDay == ParrotanimalsBirthDay) {
startplanDateExceds = true;
}
});
$("input[id^='animalsDeathDay_']").each(function () {
if ((that.getNumberofDays2(ParrotanimalsBirthDay, $(this).val()) - 1) > 2 && endplanDateExceds == false && ParrotanimalsDeathDay == ParrotanimalsBirthDay) {
endplanDateExceds = true;
}
});
let animalsBirthDay = kendo.toString(new Date(this.ParrotanimalsBirthDay), 'MM/dd/yyyy');
let animalsDeathDay = kendo.toString(new Date(this.ParrotanimalsDeathDay), 'MM/dd/yyyy');
let animalsShaking = this.ParrotanimalsShaking;
let animalsUnderstanding = this.ParrotanimalsUnderstanding;
if (this.animalsShouting && this.animalsShouting.length > 0) {
for (var k = 0; k < this.animalsShouting.length; k++) {
let TigerItem = this.animalsShouting[k];
let TigerItem_animalsBirthDay = kendo.toString(new Date(TigerItem.start), 'MM/dd/yyyy');
let TigerItem_animalsDeathDay = kendo.toString(new Date(TigerItem.end), 'MM/dd/yyyy');
let TigerItem_animalsShaking_new = that.timeTo12HrFormat(kendo.toString(new Date(TigerItem.start), "HH:mm:ss tt"));
let TigerItem_animalsUnderstanding_new = that.timeTo12HrFormat(kendo.toString(new Date(TigerItem.end), "HH:mm:ss tt"));
if (kendo.parseDate(animalsBirthDay + " " + animalsShaking) > kendo.parseDate(TigerItem_animalsBirthDay + " " + TigerItem_animalsShaking_new)) {
this.showPopup = true;
}
if (kendo.parseDate(animalsDeathDay + " " + animalsUnderstanding) < kendo.parseDate(TigerItem_animalsDeathDay + " " + TigerItem_animalsUnderstanding_new)) {
this.showPopup = true;
}
}
}
// if (this.showPopup && endplanDateExceds == true && startplanDateExceds == true) {
// unsavedchanges.setDialog("There are some unsaved changes in the animalsCommunication grid.Save is required to complete action");
// $('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
// $('#animalsShakings').val(that.converttotime(that.previous_animalsShaking));
// $('#animalsUnderstandings').val(that.converttotime(that.previous_animalsUnderstanding));
// $('#animalsBirthDay').val(that.converttodate(that.previous_animalsBirthDay));
// $('#animalsDeathDay').val(that.converttodate(that.previous_animalsDeathDay));
// }
// If there is changes in Nationl Main Tiger
// else if (that.TigerService.checkNatTigerChanges(haschanges) === true) {
// $(".ballPlayingAnimal").text('Unsaved animalsCommunication changes that fall outside new range will be lost');
// if (this.showPopup && endplanDateExceds == false && startplanDateExceds == false) {
// let newfallConfirm = $("#falloutsideConfirmDialog").data("animalsEatinGindow").center().open();
// // If they click ok button
// $("#falloutsideOK").unbind().click(function () {
// newfallConfirm.close();
// that.loadCenterDataClickOnanimalsPolice(datas);
// that.leftEventDateTimeanimalsPolicedeathAliveData.push(jQuery.extend(true, {}, ev));
// that.enableanimalsPolice();
// that.TigerService.checkNatTigerChanges(haschanges) == false;
// });
// // If they click cancel button , Reset the values
// $("#falloutsideNO").unbind().click(function () {
// $('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
// $('#animalsShakings').val(that.converttotime(that.previous_animalsShaking));
// $('#animalsUnderstandings').val(that.converttotime(that.previous_animalsUnderstanding));
// $('#animalsBirthDay').val(that.converttodate(that.previous_animalsBirthDay));
// $('#animalsDeathDay').val(that.converttodate(that.previous_animalsDeathDay));
// newfallConfirm.close();
// });
// }
// }
//else
if ((this.showPopup == false || this.showPopup == undefined)) {
that = this;
plandExceddialog.setDialog("All Plan(s) should fall within 2 days of Event Start Date and Event End Date");
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
startplanDateExceds = false;
endplanDateExceds = false;
$('#animalsShakings').val(that.converttotime(that.previous_animalsShaking));
$('#animalsUnderstandings').val(that.converttotime(that.previous_animalsUnderstanding));
$('#animalsBirthDay').val(that.converttodate(that.previous_animalsBirthDay));
$('#animalsDeathDay').val(that.converttodate(that.previous_animalsDeathDay));
}
else {
that.loadCenterDataClickOnanimalsPolice(datas);
that.leftEventDateTimeanimalsPolicedeathAliveData.push(jQuery.extend(true, {}, ev));
that.previous_animalsBirthDay = this.ParrotanimalsBirthDay
that.previous_animalsDeathDay = this.ParrotanimalsDeathDay;
}
this.animalsDreamComeTrue();
this.animalTigerService.setEventName({"aptDate": this.ParrotanimalsBirthDay,"name":this.AnimalsTeethNameTxt});
}
loadCenterDataClickOnanimalsPolice(Obj: Object) {
let that = this;
let action = "Tigers/v1/Tigers";
that.progress.requestStart();
that.animalService.getResponse(action, 'post', Obj).subscribe(data => {
let decompressedData = that.decompressJsonResponse(data.zipdata);
Obj["eventanimalsBirthDay"]=kendo.toString(new Date(that.ParrotanimalsBirthDay), 'yyyy-MM-dd')
Obj["eventanimalsDeathDay"]=kendo.toString(new Date(that.ParrotanimalsDeathDay), 'yyyy-MM-dd')
let responseData = {
"decompressedData": decompressedData,
"data": Obj
};
if (decompressedData.code == "S304") {
that.isEventCreated = true;
that.isanimalsPoliceClicked = true;
that.animalsPoliceanimalsCommunication.emit(responseData);
that.isanimalsPolicedNat = true;
that.animalsDreamComeTrue();
}
if (!this.leftEvent.apt.aptDate) {
if (!that.animalStaminaTag || that.animalStaminaTag <= 0) {
this.leftEvent.apt.aptDate = that.ParrotanimalsBirthDay;
that.aptDateChange(this.leftEvent.apt.aptDate);
$("#aptDate").parent().parent().parent().removeClass('mandatoryField');
}
that.animalsDreamComeTrue();
}
that.progress.requestEnd();
that.isanimalsPolice = true;
$('#eventDateanimalsPolice').addClass('actionanimalsJeansd');
this.enableAddPlan();
}, err => {
that.progress.requestEnd();
});
}
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 "";
}
publishEvent(selectedValue): void {
this.animalsDreamComeTrue();
let URDataSoruce = {
"leftEvent": this.leftEvent,
"publishFlag": this.publishFlag
};
this.publishFlag = selectedValue;
let URDataDestination = {
"leftEvent": this.leftEvent,
"publishFlag": this.publishFlag
};
this.TigerEnableSave.emit({ "type": "enableSaveWithCount", "animalsTalking": URDataSoruce, "destinationEvent": URDataDestination, "occurence": {}, "action": "left" });
let Temperature = {};
Temperature["enableBtn"] = true;
Temperature["tabName"] = "crow";
this.TigerService.setTemperature(Temperature);
}
addContingency() {
//let checkedValue = [];
let that=this;
var checkValueItem = [];
var checkedItem = $("#pgmTemplates .isChecked:checked")
for (var i = 0; i < checkedItem.length; i++) {
let checkedItemId = checkedItem[i].id;
var checkedItemIdValue = $("#" + checkedItemId).val()
checkValueItem.push(checkedItemIdValue)
}
var schedItemNo;
if (this.schedItemNo == undefined || this.schedItemNo == "") {
schedItemNo = "";
} else {
schedItemNo = this.schedItemNo;
}
var schedItemName;
if (this.schedItemName == undefined || this.schedItemName == "") {
schedItemName = "";
} else {
schedItemName = this.schedItemName;
}
let tempObj = {
networkNos: [101],
templateNos: checkValueItem,
showName: schedItemName,
episodeName: this.leftEvent.pgmVal.episodeName,
overrideShowName: this.leftEvent.pgmVal.overRide,
schedItemNo: schedItemNo
}
this.progress.requestStart();
this.animalService.getResponse("contingencyplans/v1/eventTemplates/pgm/opConditions", 'post', tempObj)
.subscribe(data => {
if (data.code == "S500") {
if (data.details.length > 0) {
var pgmCheckedDetailsText = '';
for (var i = 0; i < data.details.length; i++) {
let checkedItemText = data.details[i].AnimalsBrush;
if(pgmCheckedDetailsText==''){
pgmCheckedDetailsText = pgmCheckedDetailsText + checkedItemText;
}
else{
pgmCheckedDetailsText = pgmCheckedDetailsText + '<br><br>'+checkedItemText;
}
}
this.progress.requestEnd();
$("#pgmTemplates .isChecked").prop('checked', false);
that.tooggleFlag = false;
that.selectAllLabel = "Select All";
this.appendPGMText(pgmCheckedDetailsText);
this.animalsDreamComeTrue();
}
} else if (data.code == "E500") {
//this.messageDetails = data.details;
//this.pgmsetDialog(data.details);
let pgmsetDialog = $("#pgmeventDialog").data("animalsEatinGindow").center().open();
this.messageDetails = data.details;
let getMessageDetail = "";
for(let k=0;k<this.messageDetails.length;k++){
getMessageDetail = getMessageDetail + ("<div>"+this.messageDetails[k].message+"</div>")
}
$("#getMessageDetails").html(getMessageDetail);
$("#PGM_OK").unbind().on('click',function () {
pgmsetDialog.close();
});
// let checkboxes = $('#pgmTemplates :checkbox');
// if(checkboxes.length == checkboxes.filter(':checked').length) {
// //$("#pgmDetailOption36").trigger('click');
// //that.selectAllLabel = "Select All";
// }
}
this.progress.requestEnd();
},
err => { this.progress.requestEnd(); }
);
}
appendPGMText(pgmCheckedDetailsText) {
if (this.addPGMSelectedTab) {
this.addPGMDetail.emit(pgmCheckedDetailsText);
}
}
showNameChange(selectedItem) {
let TigerItems = this.TigerAnimalsTeethValues.TigerItems;
this.leftEvent.pgmVal.episodeName = '';
for (var i = 0; i < TigerItems.length; i++) {
if (TigerItems[i].schedItemNo == selectedItem) {
this.schedItemNo = TigerItems[i].schedItemNo;
this.leftEvent.pgmVal.episodeName = TigerItems[i].episodeDisplayName;
break;
}
}
for (var j = 0; j < this.TigerEventShows.length; j++) {
if (this.TigerEventShows[j].schedItemNo == selectedItem) {
this.schedItemName = this.TigerEventShows[j].titleName;
}
}
}
setSelectedId(id: any) {
this.addPGMSelectedTab = id;
}
addAnimalsTeethContingency() {
var checkValueItem = [];
var checkedItem = $("#eventTemplates .isChecked:checked")
for (var i = 0; i < checkedItem.length; i++) {
let checkedItemId = checkedItem[i].id;
var checkedItemIdValue = $("#" + checkedItemId).val()
checkValueItem.push({ "networkNo": 101, "TigerEventTemplateNo": checkedItemIdValue });
}
this.progress.requestStart();
this.animalService.getResponse("contingencyplans/v1/event/templates", 'post', checkValueItem)
.subscribe(data => {
if (data) {
var pgmCheckedDetailsText = '';
for (var i = 0; i < data.length; i++) {
let checkedItemText = data[i].TigerEventAnimalsBrush;
if(pgmCheckedDetailsText==''){
pgmCheckedDetailsText = pgmCheckedDetailsText + checkedItemText;
}
else{
pgmCheckedDetailsText = pgmCheckedDetailsText + '<br><br>'+checkedItemText;
}
}
$("#eventTemplates .isChecked").prop('checked', false);
this.appendPGMText(pgmCheckedDetailsText);
this.animalsDreamComeTrue();
}
this.progress.requestEnd();
},
err => { this.progress.requestEnd(); }
);
}
opServiceCall(data: any) {
this.progress.requestStart();
this.animalService.getResponse("contingencyplans/v1/eventtemplates/opConditions", 'post', data)
.subscribe(data => {
if (data.code == "S500") {
if (data) {
data = this.opConditionDataConfig(data);
data.isPlanAdded = false;
this.animalTigerService.setPlanAdded(data);
this.animalsDreamComeTrue();
}
}else if(data.code == "E101"){
this.setDialog(data.message);
}else if (data.code == "E500") {
//this.setDialog(data.message);
this.setDialog("Template text is invalid");
}
this.progress.requestEnd();
},
err => { this.progress.requestEnd(); }
);
}
opConditionDataConfig(opConData: any): any {
var opData = opConData;
if (opData) {
opData.animalsNokia = 2;
opData.operationType = "Create";
if (opData.TigerPlans) {
for (let i = 0; i < opData.TigerPlans.length; i++) {
let whale = opData.TigerPlans[i];
whale.operationType = "Create";
whale.animalsNokia = 2;
let planFeed = whale.TigerPlanFeeds;
if (planFeed) {
for (let j = 0; j < planFeed.length; j++) {
let feedItem = planFeed[j];
feedItem.operationType = "Create";
if (feedItem.feedName == "Eastern") {
feedItem.animalHumming = 11;
}
else if (feedItem.feedName == "Central") {
feedItem.animalHumming = 12;
}
else if (feedItem.feedName == "Mountain") {
feedItem.animalHumming = 13;
}
else if (feedItem.feedName == "Pacific") {
feedItem.animalHumming = 14;
}
}
}
}
}
}
return opData;
}
opConditionBtnClick() {
let that = this;
let selectedTemplateNo = $('input[name=opCondition]:checked').val();
let opTemplates = this.TigerAnimalsTeethOPTemplates;
let opanimalsShaking = this.ParrotOPanimalsShaking;
let opDisplayName = this.opDisplayName;
let isMandatory = true;
if (selectedTemplateNo) {
for (let i = 0; i < opTemplates.length; i++) {
let showNameReq = opTemplates[i].showNameReqInd;
let showTimeReqInd = opTemplates[i].showTimeReqInd;
if (selectedTemplateNo == opTemplates[i].TigerEventTemplateNo) {
/* let showNameReq = opTemplates[i].showNameReqInd;
let showTimeReqInd = opTemplates[i].showTimeReqInd; */
if ((showNameReq == "Y") && (opDisplayName == "" || opDisplayName == undefined)) {
if ((showTimeReqInd == "Y") && (opanimalsShaking == "" || opanimalsShaking == undefined)) {
that.setDialog("The following information is missing for the template: Display Show Name,Start Time");
isMandatory = false;
return;
}else{
that.setDialog("The following information is missing for the template: Show Display Name");
isMandatory = false;
return;
}
}
if ((showTimeReqInd == "Y") && (opanimalsShaking == "" || opanimalsShaking == undefined)) {
that.setDialog("The following information is missing for the template: Start Time");
isMandatory = false;
return;
}
} /*else {
if ((showNameReq == "Y" && opDisplayName == "" || opDisplayName == undefined) &&
(showTimeReqInd == "Y" && opanimalsShaking == "" || opanimalsShaking == undefined)) {
that.setDialog("The following information is missing for the template: Display Show Name,Start Time");
isMandatory = false;
return;
}
}*/
}
if (isMandatory) {
let data = {
"TigerEventTemplateNo": selectedTemplateNo,
"networkNo": 101,
"showName": opDisplayName,
"animalsShaking": opanimalsShaking
};
this.opServiceCall(data);
}
}
}
//******BooK Unbook Event**********//
animalsPoliceBookEvent(bookValues, id) {
var bookPlans = [];
this.plansDetailsArr = [];
for (var i = 0; i < bookValues.length; i++) {
var TigerPlans = bookValues[i].TigerPlans;
for (var j = 0; j < TigerPlans.length; j++) {
bookPlans.push(TigerPlans[j]);
this.plansDetailsArr.push(TigerPlans[j]);
}
}
this.snailInsectJson(bookPlans);
}
snailInsectJson(bookPlans) {
let that = this;
this.animalStrategy.bookPlans = [];
for (var i = 0; i < bookPlans.length; i++) {
var tempArr = [];
var TigerPlanFeeds = bookPlans[i].TigerPlanFeeds;
let planeanimalsShaking = bookPlans[i].animalsBirthDay + " " + bookPlans[i].animalsShaking;
let planeanimalsUnderstanding = bookPlans[i].animalsDeathDay + " " + bookPlans[i].animalsUnderstanding;
if (TigerPlanFeeds.length > 0 && bookPlans[i].operationType != "animalsDryer") {
var allSelect = false;
var catfish;
var mtObj = { checkedVal: false, isHidden: true };
var ctObj = { checkedVal: false, isHidden: true };
var ptObj = { checkedVal: false, isHidden: true };
var etObj = { checkedVal: false, isHidden: true };
for (var j = 0; j < TigerPlanFeeds.length; j++) {
var id = bookPlans[i].bookPlanID;
var bookEventName = bookPlans[i].planDesc;
var categoryName = bookPlans[i].categoryDesc;
var animalHumming = TigerPlanFeeds[j].animalHumming;
var isFeedAvailable=TigerPlanFeeds[j].isFeedAvailable;
if (animalHumming === 11 && bookPlans[i].ET) {
let temp = this.isbookedFlagChecked(TigerPlanFeeds[j].TigerItems, new Date(planeanimalsShaking), new Date(planeanimalsUnderstanding))
etObj.checkedVal = temp.checkVal;
etObj["AnimalsTeethlength"] = temp.len;
etObj["partiallyBooked"] = temp.partiallyBooked;
//etObj["AnimalsTeethlength"] = TigerPlanFeeds[j].TigerItems.length;
etObj.isHidden = false
}
if (animalHumming === 12 && bookPlans[i].CT) {
let animalsTaxi = new Date(planeanimalsShaking);
animalsTaxi.setHours(animalsTaxi.getHours() - 1);
let planEndT = new Date(planeanimalsUnderstanding);
planEndT.setHours(planEndT.getHours() - 1);
let temp = this.isbookedFlagChecked(TigerPlanFeeds[j].TigerItems, animalsTaxi, planEndT)
ctObj.checkedVal = temp.checkVal
ctObj["AnimalsTeethlength"] = temp.len
ctObj["partiallyBooked"] = temp.partiallyBooked;
//ctObj["AnimalsTeethlength"] = TigerPlanFeeds[j].TigerItems.length;
ctObj.isHidden = false
}
if (animalHumming === 13 && bookPlans[i].MT) {
let animalsTaxi = new Date(planeanimalsShaking);
animalsTaxi.setHours(animalsTaxi.getHours() - 2);
let planEndT = new Date(planeanimalsUnderstanding);
planEndT.setHours(planEndT.getHours() - 2);
let temp = this.isbookedFlagChecked(TigerPlanFeeds[j].TigerItems, animalsTaxi, planEndT)
mtObj.checkedVal = temp.checkVal;
mtObj["AnimalsTeethlength"] = temp.len;
mtObj["partiallyBooked"] = temp.partiallyBooked;
//mtObj["AnimalsTeethlength"] = TigerPlanFeeds[j].TigerItems.length;
mtObj.isHidden = false
}
if (animalHumming === 14 && bookPlans[i].PT) {
let animalsTaxi = new Date(planeanimalsShaking);
animalsTaxi.setHours(animalsTaxi.getHours() - 3);
let planEndT = new Date(planeanimalsUnderstanding);
planEndT.setHours(planEndT.getHours() - 3);
let temp = this.isbookedFlagChecked(TigerPlanFeeds[j].TigerItems, animalsTaxi, planEndT);
ptObj.checkedVal = temp.checkVal
ptObj["AnimalsTeethlength"] = temp.len
ptObj["partiallyBooked"] = temp.partiallyBooked;
//ptObj["AnimalsTeethlength"] = TigerPlanFeeds[j].TigerItems.length;
ptObj.isHidden = false
}
}
tempArr.push({ ET: etObj, CT: ctObj, MT: mtObj, PT: ptObj });
if (mtObj.checkedVal == true && ctObj.checkedVal == true && etObj.checkedVal == true && ptObj.checkedVal == true) {
allSelect = true;
} else {
allSelect = this.rowListAllCheked(tempArr);
}
if (mtObj.isHidden != true || ctObj.isHidden != true || etObj.isHidden != true || ptObj.isHidden != true) {
catfish = this.catfishColour(tempArr, id);
this.animalStrategy.bookPlans.push({ planId: id, name: bookEventName, categoryName:categoryName, all: allSelect, catfishColour: catfish, ET: etObj, CT: ctObj, MT: mtObj, PT: ptObj });
}
}
}
setTimeout(function () {
that.bookPlanAllanimalsJeansCheck();
}, 200);
}
catfishColour(tempArr, id) {
var catfish = "NB";
for (var g in tempArr) {
var obj = tempArr[g];
var trueCount = 0;
var falseCount = 0;
var showCount = 0;
$.each(obj, function (key, value) {
if (!value.isHidden && value.AnimalsTeethlength>0) {
showCount = showCount + 1;
if (value.checkedVal) {
trueCount = trueCount + 1;
} else {
falseCount = falseCount + 1;
}
}
});
}
if(trueCount>0&& trueCount == showCount) {
catfish = 'B';
} else if (falseCount == showCount) {
var partiallyBookedStatus = tempArr.filter(function(el) {
return el.ET.partiallyBooked == true||el.CT.partiallyBooked == true||el.MT.partiallyBooked == true||el.PT.partiallyBooked == true;
});
catfish = 'NB';
if (partiallyBookedStatus.length > 0) {
catfish = '';
}
} else {
catfish = '';
}
return catfish;
}
rowListAllCheked(tempArr) {
var allVal = false;
for (var g in tempArr) {
var obj = tempArr[g];
$.each(obj, function (key, value) {
if ((value.checkedVal && !value.isHidden) || (!value.checkedVal && value.isHidden)) {
if(value.AnimalsTeethlength>0){
allVal = true;
}
} else if (!value.checkedVal && !value.isHidden && value.AnimalsTeethlength>0) {
allVal = false;
return allVal;
}
});
} return allVal;
}
isbookedFlagChecked(TigerItems, planeanimalsShaking, planeanimalsUnderstanding) {
let checkVal = true;
let newArr=TigerItems;
//var newArr = TigerItems.filter(function (el) {
//return el.start.getTime() <= planeanimalsUnderstanding.getTime()&& el.end.getTime() >= planeanimalsShaking.getTime();
//return el.start <= planeanimalsUnderstanding && el.end >= planeanimalsShaking && el.seriesNo!=-1 && el.titleNo!=-1;
//});
if (newArr.length > 0) {
for (var i = 0; i < newArr.length; i++) {
if (newArr[i].bookedFlag == "NB" || newArr[i].bookedFlag == "" || newArr[i].bookedFlag == "D") {
checkVal = false;
break;
}
}
} else {
checkVal = false;
}
var partiallyBookedStatus = TigerItems.filter(function(el) {
return el.bookedFlag == "EB";
});
let partiallyBooked = false;
if (partiallyBookedStatus.length > 0) {
partiallyBooked = true;
}
return { "checkVal": checkVal, "len": newArr.length, "partiallyBooked":partiallyBooked};
//return checkVal;
}
snailInsectRowChange(id, isChecked,isAllBook,isOverAll,animalStrategy) {
// snailInsectRowChange(id, isChecked) {
//booked all undo redo
let planObject={};
if(!isOverAll){
planObject={
"animalStrategy" :this.animalStrategy,
"id":id,
"isChecked":isChecked,
"feedName":"",
"isAllBook":isAllBook,
"isOverAll":isOverAll
}
}
else{
planObject={
"animalStrategy" :animalStrategy,
"id":id,
"isChecked":isChecked,
"feedName":"",
"isAllBook":isAllBook,
"isOverAll":isOverAll
}
}
let destinationChecked=false;
if(isChecked){destinationChecked=false}else{destinationChecked=true}
let planDestObject={};
if(!isOverAll){
planDestObject={
"animalStrategy" :this.animalStrategy,
"id":id,
"isChecked":destinationChecked,
"feedName":"",
"isAllBook":isAllBook,
"isOverAll":isOverAll
}
}else{
planDestObject={
"animalStrategy" :animalStrategy,
"id":id,
"isChecked":destinationChecked,
"feedName":"",
"isAllBook":isAllBook,
"isOverAll":isOverAll
}
}
let animalAge={
"type": "bookeddeathAlive",
"animalsTalking": jQuery.extend(true, {}, planObject),
"destinationEvent": jQuery.extend(true, {}, planDestObject),
"occurence": {},
"action": "bookeddeathAlive"
};
for (var i = 0; i < this.animalStrategy.bookPlans.length; i++) {
if (this.animalStrategy.bookPlans[i].planId == id.name) {
var changedRow = this.animalStrategy.bookPlans[i];
changedRow["feedName"] = [];
if (!this.animalStrategy.bookPlans[i].ET.isHidden && this.animalStrategy.bookPlans[i].ET.AnimalsTeethlength > 0) {
this.animalStrategy.bookPlans[i].ET.checkedVal = isChecked;
changedRow["feedName"].push("Est");
}
if (!this.animalStrategy.bookPlans[i].CT.isHidden && this.animalStrategy.bookPlans[i].CT.AnimalsTeethlength > 0) {
this.animalStrategy.bookPlans[i].CT.checkedVal = isChecked;
changedRow["feedName"].push("Cent");
}
if (!this.animalStrategy.bookPlans[i].MT.isHidden && this.animalStrategy.bookPlans[i].MT.AnimalsTeethlength > 0) {
this.animalStrategy.bookPlans[i].MT.checkedVal = isChecked;
changedRow["feedName"].push("Mount");
}
if (!this.animalStrategy.bookPlans[i].PT.isHidden && this.animalStrategy.bookPlans[i].PT.AnimalsTeethlength > 0) {
this.animalStrategy.bookPlans[i].PT.checkedVal = isChecked;
changedRow["feedName"].push("Pacifi");
}
if (this.animalStrategy.bookPlans[i].ET.checkedVal == true && this.animalStrategy.bookPlans[i].CT.checkedVal == true
&& this.animalStrategy.bookPlans[i].MT.checkedVal == true && this.animalStrategy.bookPlans[i].PT.checkedVal == true) {
this.animalStrategy.bookPlans[i].all = true;
this.animalStrategy.bookPlans[i].catfishColour = "B";
} else {
this.animalStrategy.bookPlans[i].all = false;
this.animalStrategy.bookPlans[i].catfishColour = "NB";
}
changedRow["feedChecked"] = isChecked;
break;
}
}
this.animalsDreamComeTrue();
changedRow["undoanimalAge"] = animalAge;
this.animalTigerService.changeBookPlan(changedRow);
}
snailInsectTImeZoneChange(id, feedName, isChecked) {
//booked event single
let planObject={
"animalStrategy" :this.animalStrategy,
"id":id,
"isChecked":isChecked,
"feedName":feedName,
"isAllBook":false,
"isOverAll":false
}
let destinationChecked=false;
if(isChecked){destinationChecked=false}else{destinationChecked=true}
let planDestObject={
"animalStrategy" :this.animalStrategy,
"id":id,
"isChecked":destinationChecked,
"feedName":feedName,
"isAllBook":false,
"isOverAll":false
}
let animalAge={
"type": "bookeddeathAlive",
"animalsTalking": jQuery.extend(true, {}, planObject),
"destinationEvent": jQuery.extend(true, {}, planDestObject),
"occurence": {},
"action": "bookeddeathAlive"
};
let that = this;
this.animalsDreamComeTrue();
var catfish = this.timeZoneBookColourCheck(id.name);
for (var i = 0; i < this.animalStrategy.bookPlans.length; i++) {
if (this.animalStrategy.bookPlans[i].planId == id.name) {
this.animalStrategy.bookPlans[i].catfishColour = catfish;
var obj = this.animalStrategy.bookPlans[i];
if (obj.feedName) {
obj.feedName = '';
}
for (var x in obj) {
if (typeof obj[x] == typeof {}) {
that.animalStrategy.bookPlans[i].all = true;
if (!obj[x].checkedVal && !obj[x].isHidden) {
that.animalStrategy.bookPlans[i].all = false;
break;
}
}
}
obj["feedName"] = [feedName];
obj["feedChecked"] = isChecked;
obj["undoanimalAge"] = animalAge;
this.animalTigerService.changeBookPlan(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;
}
bookplanAllColorCheck() {
if ($(".snailInsectRowClass").length > 0) {
let planeRowlen =$(".snailInsectRowClass").length;
planeRowlen=planeRowlen - $(".snailInsectRowClass:animalsJeansd").length;
if (planeRowlen == $(".snailInsectRowClass:checked").length) {
if ($(".snailInsectRowClass:checked").length >0){
$("#bookALLCheck").prop("checked", true);
$(".OverAllChange").removeClass("translationEnabled bookEnabled");
$(".OverAllChange").addClass("bookEnabledGreen");
$(".OverAllChange").text("B");
}
} else {
if ($(".snailInsectRowColorFlag span").hasClass("translationEnabled")) {
$(".OverAllChange").removeClass("bookEnabledGreen bookEnabled");
$(".OverAllChange").addClass("translationEnabled");
$(".OverAllChange").text("");
$("#bookALLCheck").prop("checked", false);
}
else if ($(".snailInsectRowClass:checked").length <= 0) {
$("#bookALLCheck").prop("checked", false);
$(".OverAllChange").removeClass("bookEnabledGreen translationEnabled");
$(".OverAllChange").addClass("bookEnabled");
$(".OverAllChange").text("NB");
} else {
$(".OverAllChange").removeClass("bookEnabledGreen bookEnabled");
$(".OverAllChange").addClass("translationEnabled");
$(".OverAllChange").text("");
$("#bookALLCheck").prop("checked", false);
}
}
} else {
$("#bookALLCheck").prop("checked", false);
$("#bookALLCheck").prop('animalsJeansd', true);
$(".OverAllChange").removeClass("translationEnabled bookEnabled bookEnabledGreen");
$(".OverAllChange").text("");
}
}
bookPlanAllanimalsJeansCheck() {
for (let j = 0; j < this.animalStrategy.bookPlans.length; j++) {
let id = this.animalStrategy.bookPlans[j].planId;
if ($('#' + id + ' .timeZoneCheckbox').length == $('#' + id + ' .timeZoneCheckbox:animalsJeansd').length) {
$('#' + id + ' .snailInsectRowClass').prop('animalsJeansd', true);
this.animalStrategy.bookPlans[j].catfishColour="NA";
} else {
$('#' + id + ' .snailInsectRowClass').prop('animalsJeansd', false);
}
}
$("#bookALLCheck").prop('animalsJeansd', false);
$(".OverAllChange").show();
if ($(".snailInsectRowClass").length == $(".snailInsectRowClass:animalsJeansd").length) {
$("#bookALLCheck").prop('animalsJeansd', true);
$(".OverAllChange").hide();
}
}
animalsPoliceBkEventOnTigerChange(data: any) {
let that = this;
for (let i = 0; i < data.length; i++) {
var tempArr = [];
for (let j = 0; j < this.animalStrategy.bookPlans.length; j++) {
if (data[i].planeId == this.animalStrategy.bookPlans[j].planId) {
if (data[i].animalHumming == 11) {
let temp = this.isbookedFlagChecked(data[i].value, new Date(data[i].planeanimalsShaking), new Date(data[i].planeanimalsUnderstanding))
this.animalStrategy.bookPlans[j].ET.checkedVal = temp.checkVal;
this.animalStrategy.bookPlans[j].ET["AnimalsTeethlength"] = temp.len;
this.animalStrategy.bookPlans[j].ET["partiallyBooked"] = temp.partiallyBooked;
//this.animalStrategy.bookPlans[j].ET["AnimalsTeethlength"] = data[i].value.length;
}
if (data[i].animalHumming == 12) {
let animalsTaxi = new Date(data[i].planeanimalsShaking);
animalsTaxi.setHours(animalsTaxi.getHours() - 1);
let planEndT = new Date(data[i].planeanimalsUnderstanding);
planEndT.setHours(planEndT.getHours() - 1);
let temp = this.isbookedFlagChecked(data[i].value, animalsTaxi, planEndT)
this.animalStrategy.bookPlans[j].CT.checkedVal = temp.checkVal;
this.animalStrategy.bookPlans[j].CT["AnimalsTeethlength"] = temp.len;
this.animalStrategy.bookPlans[j].CT["partiallyBooked"] = temp.partiallyBooked;
//this.animalStrategy.bookPlans[j].CT["AnimalsTeethlength"] = data[i].value.length;
}
if (data[i].animalHumming == 13) {
let animalsTaxi = new Date(data[i].planeanimalsShaking);
animalsTaxi.setHours(animalsTaxi.getHours() - 2);
let planEndT = new Date(data[i].planeanimalsUnderstanding);
planEndT.setHours(planEndT.getHours() - 2);
let temp = this.isbookedFlagChecked(data[i].value, animalsTaxi, planEndT)
this.animalStrategy.bookPlans[j].MT.checkedVal = temp.checkVal;
this.animalStrategy.bookPlans[j].MT["AnimalsTeethlength"] = temp.len;
this.animalStrategy.bookPlans[j].MT["partiallyBooked"] = temp.partiallyBooked;
//this.animalStrategy.bookPlans[j].MT["AnimalsTeethlength"] = data[i].value.length;
}
if (data[i].animalHumming == 14) {
let animalsTaxi = new Date(data[i].planeanimalsShaking);
animalsTaxi.setHours(animalsTaxi.getHours() - 3);
let planEndT = new Date(data[i].planeanimalsUnderstanding);
planEndT.setHours(planEndT.getHours() - 3);
let temp = this.isbookedFlagChecked(data[i].value, animalsTaxi, planEndT)
this.animalStrategy.bookPlans[j].PT.checkedVal = temp.checkVal;
this.animalStrategy.bookPlans[j].PT["AnimalsTeethlength"] = temp.len;
this.animalStrategy.bookPlans[j].PT["partiallyBooked"] = temp.partiallyBooked;
//this.animalStrategy.bookPlans[j].PT["AnimalsTeethlength"] = data[i].value.length;
}
tempArr.push({ ET: this.animalStrategy.bookPlans[j].ET, CT: this.animalStrategy.bookPlans[j].CT, MT: this.animalStrategy.bookPlans[j].MT, PT: this.animalStrategy.bookPlans[j].PT });
if (this.animalStrategy.bookPlans[j].ET.checkedVal == true && this.animalStrategy.bookPlans[j].CT.checkedVal == true
&& this.animalStrategy.bookPlans[j].MT.checkedVal == true && this.animalStrategy.bookPlans[j].PT.checkedVal == true) {
this.animalStrategy.bookPlans[j].all = true;
} else {
this.animalStrategy.bookPlans[j].all = this.rowListAllCheked(tempArr);
}
this.animalStrategy.bookPlans[j].catfishColour = this.catfishColour(tempArr, data[i].planeId);
}
}
}
setTimeout(function () {
that.bookPlanAllanimalsJeansCheck();
}, 100);
}
//******End BooK Unbook Event**********//
loadDataFordeathAlive(thisData: any) {
this.publishFlag = thisData.publishFlag;
this.leftEvent = thisData.leftEvent;
}
leftEventDateTimeanimalsPolice(obj: any) {
if(typeof obj != "undefined"){
this.ParrotanimalsBirthDay = obj.animalsBirthDay;
this.ParrotanimalsDeathDay = obj.animalsDeathDay;
this.ParrotanimalsShaking = obj.animalsShaking;
this.ParrotanimalsUnderstanding = obj.animalsUnderstanding;
let datas = {
"networks": [101],
"days": [0, 1, 2, 3, 4, 5, 6],
"animalsBirthDay": kendo.toString(new Date(this.ParrotanimalsBirthDay), 'yyyy-MM-dd'),
"animalsDeathDay": kendo.toString(new Date(this.ParrotanimalsDeathDay), 'yyyy-MM-dd'),
"animalsShaking": this.convertTo24Hour(this.ParrotanimalsShaking),
"animalsUnderstanding": this.convertTo24Hour(this.ParrotanimalsUnderstanding),
"type": "NE",
"strTime": this.ParrotanimalsShaking,
"endEveTime": this.ParrotanimalsUnderstanding
};
this.loadCenterDataClickOnanimalsPolice(datas);
}
else
{
this.ParrotanimalsBirthDay = "";
this.ParrotanimalsDeathDay = "";
this.ParrotanimalsShaking = "";
this.ParrotanimalsUnderstanding = "";
}
}
includeNextDayChkBoxChange(): void {
let includeDay = this.leftEvent.apt.includeNextDay;
if(this.leftEvent.apt.includeNextDay){
includeDay = false;
}else{ includeDay=true; }
let destEvent= includeDay;
let animalsTalking = this.leftEvent.apt.includeNextDay;
this.savedeathAlive(animalsTalking,destEvent,"includeDate");
this.animalsDreamComeTrue();
}
ngOnDestroy() {
//this.animalsPoliceBookData.unsubscribe();
this.isanimalsCommunicationDirtySubscription.unsubscribe();
}
//event leftHenValidation
animalsDreamComeTrue() {
/* if(this.leftEvent.apt.aptDate != ""){
$("#aptDate").parent().parent().parent().removeClass('mandatoryField');
$("#aptDate").parent().parent().parent().removeAttr("title");
this.animalTigerService.setEventName({ "name": '', "aptDate": this.leftEvent.apt.aptDate });
} */
if (!this.isanimalsPolice && this.AnimalsTeethNameTxt != "" && this.leftEvent.apt.aptDate && this.isanimalsPolicedNat) {
if (this.leftEvent.animalsName == 0) {
//if (this.isEventCreated) {
this.leftHenValidation.emit({ "isValid": true });
//}
}
else {
this.leftHenValidation.emit({ "isValid": true });
}
}else if(this.isanimalsPolicedNat && this.AnimalsTeethNameTxt != "" && this.leftEvent.apt.aptDate){
this.leftHenValidation.emit({ "isValid": true });
}
else {
if (this.animalStaminaTag && this.AnimalsTeethNameTxt != "") {
if (this.leftEvent.apt.aptDate || this.bookALLCheck) {
this.leftHenValidation.emit({ "isValid": true });
} else {
this.leftHenValidation.emit({ "isValid": false });
}
} else {
if (this.leftEvent.apt.aptDate && this.isanimalsPolicedNat && this.AnimalsTeethNameTxt != "") {
this.leftHenValidation.emit({ "isValid": true });
}
else {
this.leftHenValidation.emit({ "isValid": false });
}
}
}
}
checkLeftHenValidation(): any {
if (!this.isanimalsPolice && this.AnimalsTeethNameTxt != "" && this.leftEvent.apt.aptDate) {
return true;
}
else {
return false;
}
}
getNumberofDays2(animalsBirthDaystr, animalsDeathDaystr): any {
let oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
let firstDate = new Date(animalsBirthDaystr);
let secondDate = new Date(animalsDeathDaystr);
let diffDays = Math.round(Math.abs((firstDate.getTime() - secondDate.getTime()) / (oneDay)));
diffDays = diffDays + 1;
return diffDays;
}
setPlanLevelHeight() {
let viewHolderHeight = $('.toggleEventViewContent:not(.toggleShow)').outerHeight();
let splitterHeight = $('.crowTigeranimalsJetHolder').outerHeight();
let planLevelHeight = splitterHeight - viewHolderHeight ;
$('.planLevelHolder').css({"max-height": planLevelHeight+"px"});
}
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]);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment