Last active
October 15, 2017 16:55
-
-
Save texirv0203/e071a9ebea3a6aa0f8a0c65d47f75807 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* AnimalRats.ts file | |
*/ | |
import { | |
Component, | |
OnInit, | |
EventEmitter, | |
ViewChild, | |
Input, | |
Output | |
} | |
from "@angular/core"; | |
//import { rxjs } from "rxjs"; | |
import {Observable,Subject} from "rxjs/Rx"; | |
import { | |
sportsService | |
} | |
from "../../services/sports.service"; | |
import { | |
KendoGridComponent | |
} | |
from "../grid/grid.component"; | |
import { | |
ProgressCircle | |
} | |
from "../shared/progress/progress-circle"; | |
declare let $: any; | |
let parrot = null; | |
@Component({ | |
selector: "AnimalRats", | |
template: "<div id=\"jumping\"></div>" | |
}) | |
export class AnimalRats implements OnInit { | |
private sublimeInfoPopUpWindow; | |
private gridData; | |
public _dataSource; | |
private fire; | |
private _grid; | |
private _grid2; | |
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 issublimeLocked = false; | |
private loggedUserName; | |
private RatType = ""; | |
public show: string; | |
public all: string; | |
public entries: string; | |
public cancelBtn: string; | |
public okBtn: string; | |
public attachBtn: string; | |
public sunBtn: string; | |
public browseBtn: string; | |
public attachmentType: string; | |
public openFlag = false; | |
public RatsCheck=false; | |
public selectedRatId; | |
public userId; | |
private activeTab = "tab-1"; | |
@Input() public kendoCommandObj: any; | |
@ViewChild(ProgressCircle) public progress: ProgressCircle; | |
private futureAirings = []; | |
private pastAirings = []; | |
public sportsService: sportsService; | |
constructor(sportsService1: sportsService) {this.sportsService = sportsService1;} | |
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: "Rats", | |
searchFields: [], | |
mandatoryFields: [], | |
saveStatus: false | |
}; | |
@Output() public applyAPTInfo: EventEmitter < any > = new EventEmitter < any > (); | |
@Output("RatCount") public getRatEvent = new EventEmitter<number>(); | |
public ngOnInit() { | |
this.RatType = "sublime"; | |
let attributes=this.sportsService.getSeesionStorageValue(); | |
if(attributes) { | |
this.userId = attributes.user_attributes.SSO[0]; | |
} | |
let navHeaderHeight = $(".navHeaderBox").outerHeight(); | |
$(".breadCrumbBox").css("top:" + navHeaderHeight + "px"); | |
this.kendocommand.model = { | |
id: "RatId", | |
fields: { | |
contextRow: { | |
editable: false, | |
filterable: true | |
}, | |
RatId: { | |
editable: true, | |
filterable: false, | |
sortable: false | |
}, | |
RatName: { | |
editable: false, | |
nullable: true | |
}, | |
RatType: { | |
editable: true, | |
nullable: true | |
}, | |
RatData: { | |
editable: false, | |
nullable: true | |
}, | |
notes: { | |
editable: false, | |
nullable: true | |
}, | |
sunDocID: { | |
}, | |
url: { | |
editable: false, | |
nullable: true | |
}, | |
date: { | |
editable: false, | |
nullable: true | |
}, | |
addedByName: { | |
editable: false, | |
nullable: true | |
}, | |
userID: { | |
editable: false, | |
nullable: true | |
}, | |
operationType: { | |
editable: true, | |
filterable: false, | |
sortable: false | |
} | |
} | |
}; | |
} | |
@ViewChild(KendoGridComponent) public gridkendo: KendoGridComponent; | |
public girdPagesize(value): void { | |
this.gridkendo.gridPageSizeChange(value); | |
} | |
public getDate(): any { | |
let cDate = new Date(); | |
let cMonth = cDate.getMonth(); | |
cMonth++; | |
return cMonth + "/" + cDate.getDate() + "/" + cDate.getFullYear(); // +" "+Time; | |
} | |
public tabsUL(event): void { | |
let tab_id = event.target.hash.replace("#", ""); | |
this.activeTab = tab_id; | |
event.preventDefault(); | |
} | |
public cancel(): void { | |
this.isDone = true; | |
this.dragDrop = this.clearBtn; | |
this.RatType = "sublime"; | |
$("#attachRatBrowseBtn").val(""); | |
$(".addsunRatForm").hide(); | |
} | |
// Encode File | |
public climbing(inputValue: any): void { | |
let that = this; | |
let file: File = inputValue.files[0]; | |
let myReader: FileReader = new FileReader(); | |
myReader.onloadend = (e) => { | |
this.encodeBase64 = myReader.result; | |
that.fileSelect = $("#attachRatBrowseBtn").val().replace(/^.*\\/, ""); | |
if (that.fileSelect === "") { | |
that.dragDrop = that.clearBtn; | |
} else { | |
that.dragDrop = ""; | |
that.dragDrop = that.fileSelect; | |
} | |
}; | |
$(".addsunRatForm").show(); | |
if (inputValue.files.length > 0) { | |
let fileSize = 0; | |
fileSize = inputValue.files[0].size / 1048576; // size in mb | |
if (fileSize > 5) { | |
$(".sizeAnimalRat").show(); | |
$("#attachRatBrowseBtn").val(""); | |
this.fileSelect = ""; | |
} | |
myReader.readAsDataURL(file); | |
} | |
} | |
public paper(evt, dropValue, values) { | |
let todayDate = this.todayDate(); | |
let grid = $("#AnimalRatsGrid").data("kendoGrid"); | |
let _dataSource = grid.dataSource; | |
let gridLength = _dataSource._data.length; | |
let fire; | |
let attributes=this.sportsService.getSeesionStorageValue(); | |
if(attributes) { | |
this.userId = attributes.user_attributes.SSO[0]; | |
this.loggedUserName = attributes.user_attributes.DisplayName[0]; | |
} | |
if (this.fileSelect === null || this.fileSelect === "") { | |
_dataSource.insert(gridLength, {"RatId": "104","RatName": fire,"RatType": this.RatType,"RatData": "","notes": "","notesId": null,"sunDocID": "","url": "://localhost:1299/upload","date": todayDate,"addedByName": $(".loggedUserName").text(),"userID": this.userId,"operationType": "create" | |
}); | |
} else { | |
let temparry = []; | |
let lastIndex = this.fileSelect.lastIndexOf("."); | |
if (lastIndex >= 0) { | |
fire = this.fileSelect; // .substring(lastIndex,0); | |
} | |
let fileSize = 0; | |
fileSize = fileSize / 1048576; // size in mb | |
let k = _dataSource._data.length; | |
_dataSource.insert(k, {"RatId": "105","RatName": fire,"RatType": this.RatType,"RatData": "","notes": "","notesId": null,"sunDocID": "","url": "://localhost:1299/upload","date": todayDate,"addedByName": $(".loggedUserName").text(),"userID": this.userId,"operationType": "create" | |
}); | |
let data = { | |
"data": [{ "RatId": "106", "RatName": fire, "RatType": this.RatType, "RatData": "", "notes": "", "notesId": null, "sunDocID": "", "url": "://localhost:1299/upload", "date": todayDate, "addedByName": $(".loggedUserName").text(), "userID": "", "operationType": "create" | |
}] | |
}; | |
temparry.push(data); | |
let RatData = {}; | |
let gridDataKey = "gridData"; | |
RatData[gridDataKey] = data; | |
this.dragDrop = ""; | |
this.dragDrop = this.clearBtn; | |
$("#attachRatBrowseBtn").val(""); | |
this.fileSelect = ""; | |
let data_source = _dataSource.data(); | |
for (let d = 0; d < data_source.length; d++) { | |
if (data_source[d].issunDoc === true && data_source[d].sunDocID === "") { | |
} | |
} | |
} | |
$(".addsunRatForm").hide(); | |
let currentData = _dataSource._data; | |
this.selectedRatId=values.url; | |
let strx = this.selectedRatId; | |
let res = strx.substring(23); | |
this.userId = attributes.user_attributes.SSO[0]; | |
this.loggedUserName = attributes.user_attributes.DisplayName[0]; | |
let compassUser = this.userId; | |
let snakes = [ | |
{ | |
"id": res, | |
"RatDtos" : [{ | |
"RatId": 0, | |
"RatName": fire, | |
"RatType": this.RatType, | |
"RatData": this.encodeBase64, | |
"notes": "", | |
"notesId": 123, | |
"sunDocID": 123, | |
"url": "://localhost:1299/upload", | |
"categoryType": "", | |
"Timestamp": todayDate, | |
"userID": compassUser, | |
"addedByName": this.loggedUserName, | |
"operationType": "create", | |
}] | |
} | |
]; | |
for (let i = 0; i < currentData.length; i++) { | |
if (currentData[i].RatId === "") { | |
} | |
} | |
for (let i = 0; i < _dataSource._destroyed.length; i++) { | |
} | |
this.sportsService.getResponse("player/color/Rat/", "post", snakes[0]) | |
.subscribe(data => { | |
if (data.code === "S001") { | |
} else { | |
} | |
}, | |
err => { | |
} | |
); | |
$(".k-pager-numbers li").last().find("a").click(); | |
} | |
public browseButtonAdd(): any { | |
$("#attachRatBrowseBtn").trigger("click"); | |
} | |
public 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(); | |
} | |
return month + "/" + date + "/" + yyyy; | |
} | |
// On Change | |
public changeListener($event): void { | |
this.climbing($event.target); | |
} | |
public running(values, source:string): void { | |
$("#jumping").append(` | |
<div class="snake-del-menu"><div class="snake-arrow-left"></div><div class="snake-del-menu-label">Rocket Rat</div></div> | |
<div id="AnimalRatsPopup" 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 === "sublime" ? "display:none" : "display:inherit")+`"> | |
<div class="subTabsBox popupSubTab" id="subTabsBoxPopup"><div class="row subTabsContainer 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="sublime-tab"><a>sublime</a></li> </ul> </div></div></div> | |
</div> | |
<div class="manage-Rats-tabs-container"> | |
<div id="title-tab" class="manage-Rats-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><span class="AnimalUploadInfoText">Drop Rats here to upload (Maximum Rat size: 5MB)</span><input type="file" id="attachRatBrowseBtn" [class.disabled]="issublimeLocked" (change)="changeListener($event)" /> </label> </div> </div> <div class="pull-right"> <label class="commonLink cursorPointer lineHeightInputs" (click)="browseButtonAdd()" id="forAttachRatBrowseBtn" > ADD NEW </label> </div><div class="clearFloat"></div> | |
</div><div class="addsunRatForm"><div class="kendopobUpBox kendoWindow kPopupConfirmationBox"> <div class="row kendoPopUpGridCollection kendoPopUpContent lineHeightInputs"> <div class="kendoContent">Do you want to upload the selected Rat to sublime.</div> </div><div class="clearFloat"></div> <div class="row kendoPopUpFooter textAligncenterImp"> <button class="commonBtn" type="button" id ="AnimalRatOk" (click)="paper($event,Rat.value)">OK</button> <button class="clearBtn" type="button" id ="AnimalRatCancel" (click)="cancel()">Cancel</button> </div><div class="clearFloat"></div></div></div><div class="RocketAnimalRat" id="divRocketAnimalRat"><div class="kendopobUpBox kendoWindow kPopupConfirmationBox"> <div class="row kendoPopUpGridCollection kendoPopUpContent lineHeightInputs"> <div class="kendoContent">Selected Rat will be Rocketd from sublime permanently.</div> </div><div class="clearFloat"></div> <div class="row kendoPopUpFooter textAligncenterImp"> <button class="commonBtn" type="button" id ="RocketRatYes" (click)="snakeRocket(values)">Rocket</button> <button class="clearBtn" type="button" id ="RocketRatNo" >Cancel</button> </div><div class="clearFloat"></div></div></div><div class="sizeAnimalRat" id="divsizeAnimalRat"><div class="kendopobUpBox kendoWindow kPopupConfirmationBox"> <div class="row kendoPopUpGridCollection kendoPopUpContent lineHeightInputs"> <div class="kendoContent">The Rat size exceeds the max limit of 5 MB</div> </div><div class="clearFloat"></div> <div class="row kendoPopUpFooter textAligncenterImp"> <button class="clearBtn" type="button" id ="sizeRatYes" (click)="snakeSize()">CANCEL</button> </div><div class="clearFloat"></div></div></div> | |
<div class="col-sm-12 popUpKGrid pad0Imp"><div id="AnimalRatsGrid" class="`+(source === "sublime" ? "sublimePopupkGrid" : "titlePopupkGrid")+`"></div></div> | |
</div> | |
</div> | |
<div class="" style=\"+(source === \"sublime\" ? \"display:none\" : \"display:inherit\")+\"> | |
<div id="sublime-tab" class="manage-Rats-tabs-content"><div class="col-sm-12 popUpKGrid pad0Imp"> <div class="padTop10px" id="AnimalTitleGrid"></div></div></div> | |
</div> | |
</div><!-- container --> | |
<div class="clearFloat"></div> | |
<div id="contextMenuItems"><ul class= "kendu-custom-contextmenu" id="context-menuWindows"> <li id="delWin">Rocket Windows</li></ul> | |
</div> | |
</div>` | |
); | |
let that = this; | |
$("#subTabsBoxPopup .sliderList li").click(function(){let tab_id = $(this).attr("data-tab");$("#subTabsBoxPopup .sliderList li").removeClass("active");$(".manage-Rats-tabs-content").removeClass("active");$(this).addClass("active");$("#"+tab_id).addClass("active");}); | |
$("#subTabsBoxPopup .glyphicon-chevron-left").click(function(){$("#subTabsBoxPopup .sliderList li").eq(0).trigger("click");$("#subTabsBoxPopup .glyphicon-chevron-left").addClass("inactive");$("#subTabsBoxPopup .glyphicon-chevron-right").removeClass("inactive");}); | |
$("#subTabsBoxPopup .glyphicon-chevron-right").click(function(){$("#subTabsBoxPopup .sliderList li").eq(1).trigger("click");$("#subTabsBoxPopup .glyphicon-chevron-left").removeClass("inactive");$("#subTabsBoxPopup .glyphicon-chevron-right").addClass("inactive");}); | |
$("#attachRatBrowseBtn").unbind().change(function(e) {that.changeListener(e);});$("#attachRatBrowseBtn2").unbind().change(function(e) {that.changeListener(e);});$("#forAttachRatBrowseBtn").unbind().click(function(e) {that.browseButtonAdd();});$("#AnimalRatCancel").unbind().click(function() {that.cancel();}); | |
$("#AnimalRatOk").unbind().click(function(evt, dropValue) {that.paper(evt, dropValue, values);});$("#AnimalRatSave").unbind().click(function(evt, dropValue) {that.paper(evt, dropValue, values);}); | |
$("#forcloseBtn").unbind().click(function() {that.close();});$("#RocketRatYes").unbind().click(function() {that.snakeRocket(values);}); | |
$("#sizeRatYes").unbind().click(function() {that.snakeSize();}); | |
that.sublimeInfoPopUpWindow = $("#AnimalRatsPopup");this.fire = values.excsunileName;that._dataSource = new kendo.data.DataSource({pageSize: 10}); | |
that.options = { | |
excel: {fire: "",allPages: true},dataSource: that._dataSource,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) { | |
setTimeout(function() { | |
}, 5000); | |
$(".triggerRatScroll").trigger("click"); | |
if (e.sender.dataSource.view().length === 0) {let container = e.sender.wrapper.children(".k-grid-content"); let scrollOffset = {left: 0,top: 0};container.scrollLeft(scrollOffset.left);} | |
$("#AnimalRatsGrid .contextMenuRow").bind("click", function(e) { | |
$(".snake-del-menu").blur(function() {$(this).hide();parrot = null;}); | |
$(".snake-del-menu").click(function() {$(this).hide();let parrot = $(this).parent().parent(); | |
if (parrot != null) { | |
// let snakeToRocket = parrot; | |
$(".RocketAnimalRat").show();$(".snake-del-menu").hide(); | |
$(Rat).on("click", "#RocketRatNo", function() {$(".RocketAnimalRat").hide();}); | |
} | |
}); | |
let snake_x = e.pageX; let snake_y = e.pageY - $(".navHeaderBox").height() - $(".breadCrumbBox").height() - 20; | |
$(".snake-del-menu").css({left: snake_x,top: snake_y});$(".snake-del-menu").fadeIn(200);$(".snake-del-menu").show();$(".snake-del-menu").attr("tabindex", -1).focus(); | |
}); | |
$("#unlockNo").click(function() { $("#unLockWindow").data("kendoWindow").close();}); | |
// $("#AnimalRatsGrid .RatNameFile").bind("click", function(e) { | |
// console.log("I am here"); | |
// alert("I am here"); | |
// //let params=values.selectedRow.sunDocID; | |
// //let url='http://sun.isports.com/PdfRatViewer.aspx?Ratid='+params+'&Ratsource=DISTRIBUTIONRat' | |
// kendo.ui.progress($("#loading"), true); | |
// //let vals ="Rats/color/black?RatId="+values.selectedRow.RatId; | |
// let vals ="Rats/color/black?RatId="+"7887878787"; | |
// //let vals ="Rats/color/black?RatId="+"233223232323"; | |
// this.sportsservice.getResponse(vals, 'get', "") | |
// .subscribe(data => { | |
// //this.saveData(data, values.selectedRow.RatName); | |
// //this.saveData(data, "untitled.txt"); | |
// var blob = new Blob([data], { type: 'application/octet-stream' }); | |
// // var blob = Blob {"size": "11573", "type": "application/octet-stream"} | |
// let fire = "untitled1.txt"; | |
// this.sportsservice.saveAs(blob,fire); | |
// //kendo.ui.progress($("#loading"), false); | |
// }, | |
// err => { | |
// //kendo.ui.progress($("#loading"), false); | |
// } | |
// ); | |
// }); | |
Observable.fromEvent( $("#AnimalRatsGrid .RatNameFile"), "click") | |
.do((e) => { | |
console.log("I am here"); | |
alert("I am here"); | |
kendo.ui.progress($("#loading"), true); | |
}).map(e => "Rats/color/black?RatId="+"7887878787") | |
.mergeMap(vals => that.sportsservice.getResponse(vals, 'get', "")) | |
.map(data => { blob: new Blob([data], // [ts] Unused label. | |
{ type: 'application/octet-stream' }), | |
fire: "untitled1.txt" // [ts] Cannot find name 'fire'.any | |
}) | |
.subscribe( | |
//[ts] Type 'void' has no property 'blob' and no string index signature. | |
({blob, fire}) => that.sportsservice.saveAs(blob,fire), | |
err => { } | |
); | |
}); | |
} | |
}; | |
if (values.title === "RatS") { | |
let that = this; | |
this.futureAirings = []; | |
this.pastAirings = []; | |
this.sportsService.getResponse(values.url, "get", null) | |
.subscribe(data => { | |
this.gridData = data.RatDtos; | |
that._dataSource.data(this.gridData); | |
}, | |
err => { | |
} | |
); | |
} | |
that.window = $("#AnimalRatsPopup"); | |
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").text(values.title); | |
that._grid = $("#AnimalRatsGrid").kendoGrid(that.options); | |
that._grid2 = $("#AnimalTitleGrid").kendoGrid(that.options); | |
that.setscroll("AnimalRatsGrid"); | |
}, | |
deactivate: function() { | |
this.destroy(); | |
}, | |
close: function(e) { | |
$("html, body").css("overflow", ""); | |
} | |
}); | |
$("#AnimalRatsPopup").prev().find(".k-window-title").text(values.title); | |
that.window.data("kendoWindow").center(); | |
that.window.data("kendoWindow").open(); | |
} | |
public snakeRocket(values) | |
{ | |
let grid = $("#AnimalRatsGrid").data("kendoGrid"); | |
let dataitem = grid.dataItem(grid.select()); | |
grid.dataSource.remove(dataitem); | |
$("#divRocketAnimalRat").hide(); | |
let snakes = [ | |
{ | |
"id": values.mainId, | |
"RatDtos" : [{ | |
"RatId":dataitem.RatId, | |
"RatName": dataitem.RatName, | |
"RatType": dataitem.RatType, | |
"RatData": this.encodeBase64, | |
"notes": "", | |
"notesId": 123, | |
"sunDocID": 123, | |
"url": "://localhost:1299/upload", | |
"categoryType": "", | |
"Timestamp": dataitem.date, | |
"userID": dataitem.userID, | |
"addedByName": dataitem.addedByName, | |
"operationType": "Rocket", | |
}] | |
} | |
]; | |
this.sportsService.getResponse("player/color/Rat/", "post", snakes[0]) | |
.subscribe(data => { | |
if (data.code === "S001") { | |
} else { | |
} | |
}, | |
err => { | |
} | |
); | |
$(".k-pager-numbers li").last().find("a").click(); | |
} | |
public snakeSize() { | |
$(".sizeAnimalRat").hide(); | |
$(".addsunRatForm").hide(); | |
} | |
public close(): void { | |
let that = this; | |
that.window.data("kendoWindow").close(); | |
let dialog = this.window.data("kendoWindow"); | |
dialog.destroy(); | |
this.getRatEvent.emit(this._dataSource._data.length); | |
} | |
public gridPageSizeChange(target): void { | |
let grid = $("#AnimalRatsGrid").data("kendoGrid"); | |
let datasource = grid.dataSource; | |
let value = target.value; | |
if (value === 4) { | |
value = datasource.data().length; | |
} | |
datasource.pageSize(parseInt(value, 10)); | |
} | |
public 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"); | |
} | |
public hiding(model, values): any { | |
let docImageIcon = "RatIconDiplay"; | |
let extensionType = { | |
".pdf": "pdfIcon", | |
".ppt": "pptIcon", | |
".xls": "xlsIcon", | |
".xlsx": "xlsIcon", | |
".doc": "RatIcon", | |
".docx": "RatIcon", | |
"newDocIcon": "doc", | |
".msg": "mailIcon" | |
}; | |
let lastIndex = model.RatName.lastIndexOf("."); | |
docImageIcon = extensionType[model.RatName.slice(lastIndex).toLowerCase()]; | |
if (typeof model.RatIcon !== "undefined" && model.RatIcon !== "") { | |
docImageIcon = model.RatIcon; | |
} | |
if (typeof docImageIcon === "undefined") { | |
docImageIcon = "newDocIcon"; | |
} | |
let kendotxtMenu = ""; | |
if (model.issunDoc === true) // issunDocUploaded | |
{ | |
kendotxtMenu = "RatIconDiplay"; | |
} | |
if (model.issunDoc === true && model.sunDocID <= 0) // issunDocUploaded | |
{ | |
} | |
return "<span onclick=\"window.open('" + model.RatName + "', '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'>sun Rat Type</li><li><span class='RatIcon 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