Skip to content

Instantly share code, notes, and snippets.

@texirv0203
Last active September 9, 2017 19:45
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/f4aefb951bbb4eb4d865dca568f91ce9 to your computer and use it in GitHub Desktop.
Save texirv0203/f4aefb951bbb4eb4d865dca568f91ce9 to your computer and use it in GitHub Desktop.
```
<!-- language-all: lang-or-tag-here -->
import {
Component,
Inject,
OnInit,
EventEmitter,
ViewChild,
Input,
Output
}
from '@angular/core';
import {
Router
}
from '@angular/router';
import {
SPORTService
}
from '../../services/SPORT.service';
import {
KendoGridComponent
}
from '../grid/grid.component';
import {
saveService
}
from '../../services/saveService';
import {
tigerService
}
from '../tiger/tigerService';
import {
KendoDialog
}
from '../shared/kendoDialog/kendodialog';
import {
validationService
}
from '../shared/content/validation';
import {
ProgressCircle
}
from '../shared/progress/progress-circle';
declare var $: any;
var record_to_delete = null;
@Component({
selector: 'jumpingplayers',
template: `<div id="windowcontainer"></div>`
})
export class jumpingplayers implements OnInit {
private tigerInfoPopUpWindow;
private airDate;
private airTime;
private showTitle;
private episodeTitle;
private isEditable: boolean;
private MainGrid;
private grid;
private dataSourceVal;
private gridData;
private dynamic_cols = [];
private dynamic_model;
public dancs;
private swimming;
private nail;
private nail2;
private options;
public scrollClicked;
private window;
private isVisible = false;
public encodeBase64: any;
public dragDrop: string;
public clearBtn: string;
public fileSelect: string;
private isDone: boolean = true
public istigerLocked = false;
private filesToUpload: Array < File > ;
private loggedUserFox;
private playerType = '';
public show: string;
public all: string;
public entries: string;
public cancelBtn: string;
public okBtn: string;
public attachBtn: string;
public CAPSBtn: string;
public browseBtn: string;
public attachmentType: string;
private dialogCommand;
private selectedoptions;
public openFlag = false;
private isNavigate = false;
private resolve;
private isOkOnly;
private isDeleteOnly;
private isYesNO;
private isDeleteYesNO;
private delCostAlert;
private _contextmenuCost;
private _contextmenuOption;
private selectedDotRow;
private _contextmenu;
private delWinAlert;
private _contextmenuWindow;
public playersCheck=false;
private activeTab = 'tab-1';
@Input() kendoCommandObj: any;
@ViewChild(ProgressCircle) public progress: ProgressCircle;
@ViewChild('tabs') private tabs;
private futureAirings = [];
private pastAirings = [];
constructor(public validation: validationService, private router: Router, public SPORTService: SPORTService, public saveService: saveService, public tigerService: tigerService) {
//this.Fox = 'simple tabs'
//this.Fox = 'simple tabs';
}
private kendocommand = {
edit: {
createAt: "bottom"
},
group: false,
reorder: true,
disableFreeze: true,
resize: true,
sort: true,
autoBind: true,
filter: false,
pager: {
messages: {
//display: "Showing {0} to {1} of {2} entries"
}
},
model: {},
columns: [],
pagesize: 50,
getComponentUrl: "players",
searchFields: [],
mandatoryFields: [],
saveStatus: false
};
@Output() applyAPTInfo: EventEmitter < any > = new EventEmitter < any > ();
@Output('playerCount') getplayerEvent = new EventEmitter<number>();
ngOnInit() {
this.playerType = 'tiger';
let that = this;
if (!this.istigerLocked) {
this.istigerLocked = this.tigerService.istigerLocked;
}
this.kendocommand.getComponentUrl = 'jumpings/player/' + this.tigerService.selectedtiger + '?includes=players';
let language = this.SPORTService.userLang;
let navHeaderHeight = $('.navHeaderBox').outerHeight();
$('.breadCrumbBox').css('top:' + navHeaderHeight + 'px');
//this.filepath();
this.kendocommand.model = {
id: "ball",
fields: {
contextRow: {
editable: false,
filterable: true
},
ball: {
editable: true,
filterable: false,
sortable: false
},
playerFox: {
editable: false,
nullable: true
},
playerType: {
editable: true,
nullable: true
},
playerData: {
editable: false,
nullable: true
},
notes: {
editable: false,
nullable: true
},
plane: {
validation: {
required: true,
digits: true
}
},
url: {
editable: false,
nullable: true
},
date: {
editable: false,
nullable: true
},
addedByFox: {
editable: false,
nullable: true
},
userID: {
editable: false,
nullable: true
},
operationType: {
editable: true,
filterable: false,
sortable: false
}
}
};
}
@ViewChild(KendoGridComponent) public gridkendo: KendoGridComponent;
@ViewChild(KendoDialog) private kendoDialog: KendoDialog;
girdPagesize(value): void {
this.gridkendo.gridPageSizeChange(value);
}
// addplayer(): any {
// $('.addCAPSplayerForm').show();
// }
getDate(): any {
let cDate = new Date();
let cMonth = cDate.getMonth();
cMonth++;
let date = cMonth + "/" + cDate.getDate() + "/" + cDate.getFullYear(); //+" "+Time;
return date;
}
tabsUL(event): void {
var tab_id = event.target.hash.replace('#', '');
console.log(event);
// alert("tab_id------>" + tab_id);
this.activeTab = tab_id;
console.log(tab_id);
event.preventDefault();
}
cancel(): void {
this.isDone = true;
this.dragDrop = this.clearBtn;
this.playerType = 'tiger';
$("#attachplayerBrowseBtn").val('');
$('.addCAPSplayerForm').hide();
}
/*Encode File*/
readThis(inputValue: any): void {
var that = this;
var file: File = inputValue.files[0];
var myReader: FileReader = new FileReader();
myReader.onloadend = (e) => {
this.encodeBase64 = myReader.result;
that.fileSelect = $("#attachplayerBrowseBtn").val().replace(/^.*\\/, "");
if (that.fileSelect == '') {
that.dragDrop = that.clearBtn;
} else {
that.dragDrop = "";
that.dragDrop = that.fileSelect;
}
}
$('.addCAPSplayerForm').show();
if (inputValue.files.length > 0) {
var fileSize = 0;
fileSize = inputValue.files[0].size / 1048576; //size in mb
if (fileSize > 5) {
$('.sizejumpingplayer').show();
$("#attachplayerBrowseBtn").val('');
this.fileSelect = "";
}
myReader.readAsDataURL(file);
}
}
shirt(evt, dropValue) {
let todayDate = this.todayDate();
let grid = $('#jumpingplayersGrid').data('kendoGrid');
let dancs = grid.dataSource;
let pageSize = dancs.pageSize();
let gridLength = dancs._data.length;
let swimming;
if (this.fileSelect == null || this.fileSelect == "") {
dancs.insert(gridLength, {
"ball": "104",
"playerFox": swimming,
"playerType": this.playerType,
"playerData": "",
"notes": "",
"ground": null,
"plane": "",
"url": "some-url",
"date": todayDate,
"addedByFox": $(".loggedUserFox").text(),
"userID": "",
"operationType": "create"
});
} else {
let temparry = [];
let attributes = this.SPORTService.getSeesionStorageValue();
let lastIndex = this.fileSelect.lastIndexOf(".");
if (lastIndex >= 0) {
swimming = this.fileSelect; //.substring(lastIndex,0);
}
var fileSize = 0;
fileSize = fileSize / 1048576; //size in mb
let k = dancs._data.length;
dancs.insert(k, {
"ball": "105",
"playerFox": swimming,
"playerType": this.playerType,
"playerData": "",
"notes": "",
"ground": null,
"plane": "",
"url": "some-url",
"date": todayDate,
"addedByFox": $(".loggedUserFox").text(),
"userID": "",
"operationType": "create"
});
let data = {
"data": [{
"ball": "106",
"playerFox": swimming,
"playerType": this.playerType,
"playerData": "",
"notes": "",
"ground": null,
"plane": "",
"url": "some-url",
"date": todayDate,
"addedByFox": $(".loggedUserFox").text(),
"userID": "",
"operationType": "create"
}]
};
temparry.push(data)
let playerData = {};
playerData["gridData"] = data;
this.dragDrop = "";
this.dragDrop = this.clearBtn;
$("#attachplayerBrowseBtn").val('');
this.fileSelect = "";
let data_source = dancs.data();
for (let d = 0; d < data_source.length; d++) {
if (data_source[d].isCAPSDoc == true && data_source[d].plane == "") {
//this.gridkendo.enableSaveplayer(false);
}
}
}
$('.addCAPSplayerForm').hide();
let permissionDto = "";
let functionalList = "";
if (true) {
let currentData = dancs._data;
console.log("swimming---->" + swimming);
console.log("this.playerType---->" + this.playerType);
let data = [
{
"id": "35369",
"playerDtos" : [{
"ball": this.dancs._data.length+1,
"playerFox": swimming,
"playerType": this.playerType,
"playerData": this.encodeBase64,
"notes": "",
"ground": 123,
"plane": 123,
"url": "some-url",
"categoryType": "",
"Timestamp": todayDate,
"userID": "876564",
"addedByFox": $(".loggedUserFox").text(),
"operationType": "create",
}]
}
];
for (let i = 0; i < currentData.length; i++) {
if (currentData[i].ball == "") {
//this.dataPush(data, currentData[i], "Create");
//this record is new
// this.dataPush(data, currentData[i], "Create");
}
}
//this data are deleted
for (let i = 0; i < dancs._destroyed.length; i++) {
//this.dataPush(data, dancs._destroyed[i], 'Delete');
//this.dataPush(data, dancs._destroyed[i], 'Delete');
}
//let tigerSearchPostParams = this.prepareSearchObjectParams("SaveSearch");
// let tigerplayerPostParams = this.prepareNewplayerParams("SaveSearch");
this.SPORTService.getResponse("jumpings/player/", "post", data[0])
//this.SPORTService.getResponse("jumpings/jumpings/favorites", 'post', saveSearchParams)
.subscribe(data => {
console.log("data---->" + data);
if (data.code == 'S001') {
// if (this.isNavigate) {
// //this.navigateCheck(false);
// } else {
// }
} else {
//this.navigateCheck(true);
}
},
err => {
//this.navigateCheck(true);
}
);
}
}
browseButtonAdd(): any {
$('#attachplayerBrowseBtn').trigger('click');
}
todayDate(): any {
let date;
let month;
let today = new Date();
let dd = today.getDate();
let mm = today.getMonth() + 1; //January is 0!
let yyyy = today.getFullYear();
if (dd < 10) {
date = dd.toString();
date = '0' + date;
} else {
date = dd.toString();
}
if (mm < 10) {
month = mm.toString();
month = '0' + month;
} else {
month = mm.toString();
}
let todayDay = month + '/' + date + '/' + yyyy;
return todayDay;
}
/* On Change */
changeListener($event): void {
this.readThis($event.target);
}
openPopup(values, source:string): void {
if(source=='title')
{
this.playersCheck=true;
}
$("#windowcontainer").append(`
<div class="record-del-menu">
<div class="record-arrow-left"></div>
<div class="record-del-menu-label">Delete player</div>
</div>
<div id="jumpingplayersPopup" class="kendopobUpBox">
<div id="popup-loading"></div>
<div class="row kendoPopUpHeader">
<div class="kendoPopUpHeaderTitleBox">
<h4 class="kPopUpTitle">VIEW AIRINGS</h4>
</div>
<div class="kendoPopUpHeaderActionsBox">
<a id="forcloseBtn" class="commonLink triggerKPopUpClick" (click)=close()>CLOSE</a>
</div>
</div><div class="clearFloat"></div>
<div class="" style="`+(source == 'tiger' ? 'display:none' : 'display:inherit')+`">
<div>
<h2>Hello {{Fox}}</h2>
<div class="container2">
<ul class="tabs" role="tablist">
<li class="tab-link" [class.active]="activeTab=='tab-1'">
<a (click)="tabsUL($event)" href="#tab-1" role="tab">Tab One</a>
</li>
<li class="tab-link" [class.active]="activeTab=='tab-2'">
<a (click)="tabsUL($event)" href="#tab-2" role="tab">Tab Two</a>
</li>
</ul>
<div id="tab-1" class="tab-content" [class.active]="activeTab=='tab-1'" role="tabpanel">
1 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>
<div id="tab-2" class="tab-content" [class.active]="activeTab=='tab-2'" role="tabpanel">
2 Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div><!-- container -->
</div>
<div class="parrotBox popupSubTab" id="parrotBoxPopup">
<div class="row parrotContainer listSliderContainer">
<div class="scroller scroller-left inactive">
<i class="glyphicon glyphicon-chevron-left"></i>
</div>
<div class="scroller scroller-right inactive">
<i class="glyphicon glyphicon-chevron-right"></i>
</div>
<div class="subTabwrapper listSliderWrapper">
<ul class="nav nav-tabs list sliderList" id="subTabNav">
<li class="active" data-tab="title-tab"><a>title</a></li>
<li data-tab="tiger-tab"><a>tiger</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="manage-players-tabs-container">
<div id="title-tab" class="manage-players-tabs-content active">
<div class="row">
<div class="compBoxGrid financeDocComp">
<div class="pull-left">
<div>
<label class="fileContainer marginBottom0Imp">
<div class="dragDropIcon displayInlineBlock marginTop5px"></div>
<input type="file" id="attachplayerBrowseBtn" [class.disabled]="istigerLocked" (change)="changeListener($event)" />
</label>
<label class="jumpingUploadInfoText">
Drop players here to upload (Maximum player size: 5MB)
</label>
</div>
<div class="pasteLinkHolder">
<div class="pull-left">
<input class="jumpingUploadTextBox" placeholder="Paste link here to upload player." type="text" Fox="pasteLinkTextBox" id="pasteLinkTextBox">
<button type="button" id="saveplayerFromLink" class="clearBtn">Save</button>
</div>
</div>
</div>
<div class="pull-right">
<label class="commonLink cursorPointer lineHeightInputs" (click)="browseButton()" id="forAttachplayerBrowseBtn" >
ADD NEW
</label>
</div><div class="clearFloat"></div>
</div>
<div class="addCAPSplayerForm">
<div class="claps">
<div class="ring">
<div class="mike">Are you sure you want to upload file</div>
</div><div class="clearFloat"></div>
<div class="leather">
<button class="commonBtn" type="button" id ="jumpingplayerOk" (click)="shirt($event,player.value)">OK</button>
<button class="clearBtn" type="button" id ="jumpingplayerCancel" (click)="cancel()">Cancel</button>
</div><div class="clearFloat"></div>
</div>
</div>
<div class="deletejumpingplayer" id="divdeletejumpingplayer">
<div class="claps">
<div class="ring">
<div class="mike">Are you sure you want to delete the selected player</div>
</div><div class="clearFloat"></div>
<div class="leather">
<button class="commonBtn" type="button" id ="deleteplayerYes" (click)="rat()">Yes</button>
<button class="clearBtn" type="button" id ="deleteplayerNo" >No</button>
</div><div class="clearFloat"></div>
</div>
</div>
<div class="saveLinkPopup">
<div class="claps">
<div class="ring">
<div class="mike">Are you sure you want to upload file</div>
</div>
<div class="clearFloat"></div>
<div class="leather">
<button class="commonBtn" type="button" id="saveLinkPopupYes">Ok</button>
<button class="clearBtn" type="button" id="saveLinkPopupNo">Cancel</button>
</div>
<div class="clearFloat"></div>
</div>
</div>
<div class="filePathjumpingplayer">
<div class="claps">
<div class="ring">
<div class="mike">Are you sure you want to upload the selected player</div>
</div><div class="clearFloat"></div>
<div class="leather">
<button class="commonBtn" type="button" id ="filePathjumpingplayerYes" >Yes</button>
<button class="clearBtn" type="button" id ="filePathjumpingplayertNo" >No</button>
</div><div class="clearFloat"></div>
</div>
</div>
<div class="sizejumpingplayer" id="divsizejumpingplayer">
<div class="customOverlayNKendoPopup"></div>
<div class="claps">
<div class="ring">
<div class="mike">The player size exceeds the max limit of 5 MB</div>
</div><div class="clearFloat"></div>
<div class="leather">
<button class="clearBtn" type="button" id ="sizeplayerYes" (click)="dataize()">CANCEL</button>
</div><div class="clearFloat"></div>
</div>
</div>
<div class="col-sm-12 popUpKGrid pad0Imp">
<div id="jumpingplayersGrid"></div>
</div>
</div>
</div>
<div class="" style="`+(source == 'tiger' ? 'display:none' : 'display:inherit')+`">
<div id="tiger-tab" class="manage-players-tabs-content">
<div class="col-sm-12 popUpKGrid pad0Imp">
<div class="padTop10px" id="jumpingTitleGrid">
</div>
</div>
</div>
</div>
</div><!-- container -->
<div class="clearFloat"></div>
<div id="contextMenuItems">
<ul class= "kendu-custom-contextmenu" id="context-menuWindows">
<li id="delWin">Delete Windows</li>
</ul>
</div>
</div>`);
//}
let that = this;
$('#parrotBoxPopup .sliderList li').click(function(){
var tab_id = $(this).attr('data-tab');
$('#parrotBoxPopup .sliderList li').removeClass('active');
$('.manage-players-tabs-content').removeClass('active');
$(this).addClass('active');
$("#"+tab_id).addClass('active');
})
$('#parrotBoxPopup .glyphicon-chevron-left').click(function(){
$('#parrotBoxPopup .sliderList li').eq(0).trigger('click');
$('#parrotBoxPopup .glyphicon-chevron-left').addClass('inactive');
$('#parrotBoxPopup .glyphicon-chevron-right').removeClass('inactive');
})
$('#parrotBoxPopup .glyphicon-chevron-right').click(function(){
$('#parrotBoxPopup .sliderList li').eq(1).trigger('click');
$('#parrotBoxPopup .glyphicon-chevron-left').removeClass('inactive');
$('#parrotBoxPopup .glyphicon-chevron-right').addClass('inactive');
})
$("#attachplayerBrowseBtn").unbind().change(function(e) {
that.changeListener(e);
});
$("#forAttachplayerBrowseBtn").unbind().click(function(e) {
that.browseButtonAdd();
});
// $("#jumpingCAPSplayer").unbind().click(function() {
// that.addplayer();
// });
$("#jumpingplayerCancel").unbind().click(function() {
that.cancel();
});
$("#jumpingplayerOk").unbind().click(function(evt, dropValue) {
that.shirt(evt, dropValue);
});
$("#jumpingplayerSave").unbind().click(function(evt, dropValue) {
that.shirt(evt, dropValue);
});
$("#forcloseBtn").unbind().click(function() {
that.close();
});
$("#deleteplayerYes").unbind().click(function() {
that.rat();
});
$("#sizeplayerYes").unbind().click(function() {
that.dataize();
});
that.tigerInfoPopUpWindow = $("#jumpingplayersPopup");
this.swimming = values.excelswimming;
let dataSourceData = [];
that.dancs = new kendo.data.DataSource({
pageSize: 10
});
$('.saveLinkPopup').hide();
var textBoxPathValue;
$("#saveplayerFromLink").click(function() {
alert("inside saveplayerFromLink");
textBoxPathValue = $("#pasteLinkTextBox").val().replace(/\\/g,"/");
//testingWindowVal = $("#fFox").val();
// Size calculate
var request;
request = $.ajax({
type: "HEAD",
url: $("#pasteLinkTextBox").val(),
success: function () {
//alert("Size is " + request.getResponseHeader("Content-Length"));
// 10485760 -10MB
if(request.getResponseHeader("Content-Length") <= 10485760/2){
//alert(request.getResponseHeader("Content-Length") <= 10485760/2);
//$('.testingConfirmation').show();
$('.saveLinkPopup').show();
}
else{
alert("Your File size is too big");
$('.sizejumpingplayer').show();
}
}
});
if (textBoxPathValue) {
//$('.saveLinkPopup').show();
}
});
$('#saveLinkPopupYes').click(function(){
$('#jumpingplayersGrid').data("kendoGrid").dataSource.add({
"playerFox": textBoxPathValue,
"date": "08/09/2017",
"addedByFox": "Last Fox"
});
$("#pasteLinkTextBox").val('');
textBoxPathValue = null;
$('.saveLinkPopup').hide();
$('.k-pager-numbers li').last().find('a').click();
});
$('#saveLinkPopupNo').click(function(){
textBoxPathValue = null;
$("#pasteLinkTextBox").val('');
$('.saveLinkPopup').hide();
});
that.options = {
excel: {
swimming: "",
allPages: true
},
dataSource: that.dancs,
selectable: "row",
sortable: true,
reorderable: true,
resizable: true,
editable: false,
contextMenuId: "context-menuWindows",
autoBind: false,
pageable: {
messages: {
display: "Showing {0} to {1} of {2} entries"
}
},
model: this.kendocommand.model,
columns: values.columns,
dataBound: function(e) {
let that = this;
//console.log(e.sender);
let grid = e.sender;
let items = grid.items();
let groupingStatus = e.sender.options.groupable;
setTimeout(function() {
}, 5000);
$(".triggerplayerScroll").trigger('click');
if (e.sender.dataSource.view().length === 0) {
let container = e.sender.wrapper.children(".k-grid-content"); // or ".k-virtual-scrollable-wrap"
container.scrollLeft(scrollOffset.left);
}
$("#tiger-tab .contextMenuRow").off("click").on("click", function (){
alert("I am here off");
});
$(".contextMenuRow").bind("click", function(e) {
$(".record-del-menu").blur(function() {
$(this).hide();
record_to_delete = null;
});
$(".record-del-menu").click(function() {
$(this).hide();
if (record_to_delete != null) {
var recordToDelete = record_to_delete;
$('.deletejumpingplayer').show();
$(player).on("click", "#deleteplayerNo", function() {
$('.deletejumpingplayer').hide();
});
}
});
var record_x = e.pageX;
var record_y = e.pageY - $(".navHeaderBox").height() - $(".breadCrumbBox").height() - 20;
$(".record-del-menu").css({
left: record_x,
top: record_y
});
$(".record-del-menu").fadeIn(200);
$(".record-del-menu").show();
$(".record-del-menu").attr('tabindex', -1).focus();
record_to_delete = $(this).parent().parent();
});
$("#unlockNo").click(function() {
$("#unLockWindow").data("kendoWindow").close();
})
}
};
let scrollOffset = {
left: 0,
top: 0
};
if (values.title == "playerS") {
let that = this;
let data = {};
let jumpingMock = [{
"ball": "100",
"playerFox": "http://localhost:3000/assets/js/actualairings.json",
"playerType": "TITLE",
"playerData": "YWZjYXJlZ2Vyamh2dmFyZWdoYnZi",
"notes": "",
"ground": "100",
"plane": "100",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "101",
"playerFox": "example.pdf",
"playerType": "TITLE",
"playerData": "Manish",
"notes": "",
"ground": "101",
"plane": "101",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "102",
"playerFox": "example.ppt",
"playerType": "TITLE",
"playerData": "Manish",
"notes": "",
"ground": "101",
"plane": "101",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "100",
"playerFox": "http://localhost:3000/assets/js/actualairings.json",
"playerType": "TITLE",
"playerData": "YWZjYXJlZ2Vyamh2dmFyZWdoYnZi",
"notes": "",
"ground": "100",
"plane": "100",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "101",
"playerFox": "example.xls",
"playerType": "TITLE",
"playerData": "Manish",
"notes": "",
"ground": "101",
"plane": "101",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "102",
"playerFox": "example.xlsx",
"playerType": "TITLE",
"playerData": "Manish",
"notes": "",
"ground": "101",
"plane": "101",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "100",
"playerFox": "http://localhost:3000/assets/js/actualairings.json",
"playerType": "TITLE",
"playerData": "YWZjYXJlZ2Vyamh2dmFyZWdoYnZi",
"notes": "",
"ground": "100",
"plane": "100",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "101",
"playerFox": "example.doc",
"playerType": "TITLE",
"playerData": "Manish",
"notes": "",
"ground": "101",
"plane": "101",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "102",
"playerFox": "example.docx",
"playerType": "TITLE",
"playerData": "Manish",
"notes": "",
"ground": "101",
"plane": "101",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "100",
"playerFox": "http://localhost:3000/assets/js/actualairings.json",
"playerType": "TITLE",
"playerData": "YWZjYXJlZ2Vyamh2dmFyZWdoYnZi",
"notes": "",
"ground": "100",
"plane": "100",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "101",
"playerFox": "example.newDocIcon",
"playerType": "TITLE",
"playerData": "Manish",
"notes": "",
"ground": "101",
"plane": "101",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "102",
"playerFox": "example.msg",
"playerType": "TITLE",
"playerData": "Manish",
"notes": "",
"ground": "101",
"plane": "101",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "100",
"playerFox": "http://localhost:3000/assets/js/actualairings.json",
"playerType": "TITLE",
"playerData": "YWZjYXJlZ2Vyamh2dmFyZWdoYnZi",
"notes": "",
"ground": "100",
"plane": "100",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}, {
"ball": "101",
"playerFox": "example.pdf",
"playerType": "TITLE",
"playerData": "Manish",
"notes": "",
"ground": "101",
"plane": "101",
"url": "some-url",
"date": "06/27/2017",
"addedByFox": "Kamal",
"userID": "206509786",
"operationType": "create"
}];
this.futureAirings = [];
this.pastAirings = [];
this.SPORTService.getResponse(link.code, 'get', null)
.subscribe(data => {
this.gridData = data.playerDtos;
//that.dancs.data(jumpingMock);
that.dancs.data(this.gridData);
},
err => {
}
);
}
that.window = $("#jumpingplayersPopup");
that.window.kendoWindow({
width: "60%",
title: false,
visible: false,
resizable: false,
actions: [],
draggable: false,
modal: true,
open: function() {
$("html, body").css("overflow", "hidden");
that.isVisible = true;
$('.kPopUpTitle').html(values.title);
that.nail = $('#jumpingplayersGrid').kendoGrid(that.options);
that.nail2 = $('#jumpingTitleGrid').kendoGrid(that.options);
that.setscroll('jumpingplayersGrid');
that.setscroll('jumpingTitleGrid');
},
deactivate: function() {
this.destroy();
}
});
$("#jumpingplayersPopup").prev().find(".k-window-title").text(values.title);
that.window.data("kendoWindow").center();
that.window.data("kendoWindow").open();
}
// rat()
// {
// var grid = $('#jumpingplayersGrid').data('kendoGrid');
// var finger = grid.finger(grid.select());
// grid.dataSource.remove(finger);
// $('#divdeletejumpingplayer').hide();
// }
rat()
{
var grid = $('#jumpingplayersGrid').data('kendoGrid');
var finger = grid.finger(grid.select());
grid.dataSource.remove(finger);
$('#divdeletejumpingplayer').hide();
let dancs = grid.dataSource;
let currentData = dancs._data;
let swimming;
let todayDate = this.todayDate();
console.log("finger---->" + finger);
console.log("finger.ball---->" + finger.ball);
console.log(" finger.swimming---->" + finger.swimming);
console.log(" values---->" );
let data = [
{
"id": "35369",
"playerDtos" : [{
"ball":finger.ball,
"playerFox": finger.playerFox,
"playerType": this.playerType,
"playerData": this.encodeBase64,
"notes": "",
"ground": 123,
"plane": 123,
"url": "some-url",
"categoryType": "",
"Timestamp": todayDate,
"userID": "876564",
"addedByFox": $(".loggedUserFox").text(),
"operationType": "delete",
}]
}
];
this.SPORTService.getResponse("jumpings/player/", "post", data[0])
.subscribe(data => {
//console.log("DeleteData---->" + data);
if (data.code == 'S001') {
} else {
}
},
err => {
}
);
}
dataize() {
$('.sizejumpingplayer').hide();
$('.addCAPSplayerForm').hide();
}
close(): void {
let that = this;
let grid = $('#jumpingplayersGrid').data('kendoGrid');
let datasource = grid.dataSource;
let t= datasource.data().length
that.window.data("kendoWindow").close();
let dialog = this.window.data("kendoWindow");
dialog.destroy();
this.getplayerEvent.emit(this.dancs._data.length);
//$("window").css("overflow-y","scroll");
// $(".compassBox").css("overflow-y","scroll");
// $(".slideShrinkBox").css("overflow-y","scroll");
//$(".compassBox").scroll();
//$("#titlesDIV").scroll();
//$(window).scrollTop();
// $(window).css("overflow", "scroll");
// $(window).css("background", "red");
// $(window).animate({
// scrollTop: 5,
// });
// $(player).scrollTop();
// $(player).css("overflow", "scroll");
// $(player).css("background", "red");
// $(player).animate({
// scrollTop: 5,
// });
// $(".showHideInputBox").scrollTop();
// $(".showHideInputBox").css("overflow", "scroll");
// $(".showHideInputBox").css("background", "red");
// //$("#jumpingplayersGrid").css("background", "red");
// $(".showHideInputBox").animate({
// scrollTop: 5,
// });
}
gridPageSizeChange(target): void {
let grid = $('#jumpingplayersGrid').data('kendoGrid');
let datasource = grid.dataSource;
let value = target.value;
if (value == 4) {
value = datasource.data().length;
}
datasource.pageSize(parseInt(value));
//console.log(datasource.pageSize());
}
setscroll(kGridId): void {
$('<div class="gridScrollIconsBox"><i class="fa fa-chevron-left previousGridColumns"></i><i class="fa fa-chevron-right nextGridColumns"></i></div>').insertBefore('#' + kGridId + ' .k-grid-header');
let that = this;
let kGridHeight = $('#' + kGridId + '.k-grid').outerHeight(true);
}
ImageType(model): any {
let docImageIcon = "playerIconDiplay";
let extensionType = {
".pdf": "pdfIcon",
".ppt": "pptIcon",
".xls": "xlsIcon",
".xlsx": "xlsIcon",
".doc": "playerIcon",
".docx": "playerIcon",
"newDocIcon": "doc",
".msg": "mailIcon"
};
let lastIndex = model.playerFox.lastIndexOf(".");
docImageIcon = extensionType[model.playerFox.slice(lastIndex).toLowerCase()];
if (typeof model.playerIcon != "undefined" && model.playerIcon != "") {
docImageIcon = model.playerIcon;
}
if (typeof docImageIcon == "undefined") {
docImageIcon = "newDocIcon";
}
let kendotxtMenu = "";
if (model.isCAPSDoc == true) //isCAPSDocUploaded
{
kendotxtMenu = "playerIconDiplay";
}
if (model.isCAPSDoc == true && model.plane <= 0) //isCAPSDocUploaded
{
}
return "<span onclick=\"window.open('" + model.playerFox + "', 'popup', 'width=800,height=600,scrollbars=yes,resizable=no')\" class='" + docImageIcon + " displayInlineBlock " + kendotxtMenu + "'></span> <ul class='fileTypeHolder' id='fileTypeIcons' style='display: none;'><li class='fileTypeHolderTitle'>CAPS player Type</li><li><span class='playerIcon displayInlineBlock' (click)='browseFileType(doc)'></span></li> <li><span class='xlsIcon displayInlineBlock' (click)='browseFileType('xls')'></span></li> <li><span class='pptIcon displayInlineBlock'(click)='browseFileType('ppt')'></span></li> <li><span class='pdfIcon displayInlineBlock' (click)='browseFileType('pdf')'></span></li><li><span class='newDocIcon displayInlineBlock' (click)='browseFileType('newdoc')'></span></li><li><span class='mailIcon displayInlineBlock' (click)='browseFileType('mail')'></span></li><li class='fileTypeHolderCloseBtn'> <button id='CloseBtn' class='commonBtn'>Close</button></ul>";
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment