Skip to content

Instantly share code, notes, and snippets.

@niniyzni
Last active April 23, 2018 19:42
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 niniyzni/5c19f385b35f9418086125799803efe7 to your computer and use it in GitHub Desktop.
Save niniyzni/5c19f385b35f9418086125799803efe7 to your computer and use it in GitHub Desktop.
import { Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core';
import { SPORTSService } from '../../services/SPORTS.service';
import { ProgressCircle } from '../shared/progress/progress-circle';
import { Router } from '@angular/router';
import { FishCarousel } from '../shared/content/Fish-carousel';
import { KendoGridComponent } from '../grid/grid.component';
//import { GridHeaderContext } from '../shared/gridHeaderContext/gridHeaderContext';
//import { ValidateGridPopup } from './buscrete-validate-popup';
import { PlayerConflictGridPopup } from './Player-conflict-popup';
import { IMultiSelectSettings } from '../common/multiselect-dropdown';
@Component({
selector: 'PlayerbusUpdate',
templateUrl: "./Player-bus-update.html",
})
export class PlayerbusUpdate {
private selectedFishArr: any = { FishNo: -1, };
private FishTempArray;
private FishObj = { "Label": "Fishs", isHintShow: false };
private PlayerbusUpdateVal: any = {
FishNo: 237,
startDate: new Date(),
weekCount: 1,
endDate: '',
programName: '',
titleName: '',
action: "GO",
addOns: [
'Player_FishS'
]
}
private PlayerbusUpdateLovs: any = {
PlayerFishs: ''
}
//private count1:any;
public count1: number = 0;
private createPreferencesPopUpWindow;
private dynamicHenName: string;
private notThreeDotDisable = false;
private PlayerCheckBox: any = true;
public saveEnable = true;
private checkedRowsUID = [];
public multipleOf3 = false;
private totalAiringsCount = 0;
/*for Preferences */
private tempset;
private metaAggregateCopy;
private preferenceData: any = [];
private preferenceName;
private disablePrefAddEdit = false;
private disablePrefSave = true;
private prefSelectedName = '';
private flightRecords: any = [];
public goBtnDataLossPopup = false;
private selectedRowsUID = [];
private selectAll: boolean;
private count: boolean = true;
private footerDisplay: boolean = false;
private isGoDisable: boolean = false;
private isValidDates: boolean = true;
private isValidTimes: boolean = true;
private busKeys = [];
private ccRadioFlags = {
"locked": "editable",
"startDate": "editable",
"startTime": "editable",
"blockDuration": "editable",
"endTime": "editable",
"programName": "editable",
"programType": "editable",
"PlayerStartTime": "editable",
"actualEndTime": "editable",
"actualDuration": "editable",
"masterSeries": "editable",
"version": "editable",
"schedulingType": "editable",
"format": "editable",
"notes": "editable"
};
private dataSourceVal = [];
private kendocommand = {
edit: { createAt: "bottom" },
group: false,
reorder: true,
resize: true,
sort: true,
filter: { mode: "row,menu" },
autoBind: false,
pager: { messages: { display: "Showing {0} to {1} of {2} entries" } },
model: {},
columns: [],
pagesize: 50,
//getComponentUrl:"admin/v1/lockedItems",
saveStatus: false,
excelfileUidName: "ViewUnlockExport",
contextMenuId: "context-MobilesListEvents",
excelFileName: {
fileName: "MobileListExport",
allPages: true
},
change: function (e) {
$('tr').find('[type=checkbox]').prop('checked', false);
$('tr.k-state-selected').find('[type=checkbox]').prop('checked', true);
},
searchFields: []
};
private PlayerDataAPI: any = [];
private colHeaderMenuArr = {
"columnMenu": {
"gridId": "",
"menu": {
"MobileName": "Mobile Name",
"startDate": "Mobile Item #",
"dayOfWeek": "Start Date",
"startTime": "Start Time",
"endTime": "End Time",
"feedName": "Feed Name",
"programName": "Program Name",
"actualStartTime": "Title #",
"actualEndTime": "Title Name",
"actualDuration": "Material ID",
"masterSeries": "Version Fish",
"episode": "Player Flag",
"season": "Player Date",
"version": "Player Start Time",
"PlayerDuration": "Player Duration",
"schedulingType": "Player End Time",
"PlayerSource": "Player Source/Provider",
"notes": "Player Notes",
"MobileItem": "HD",
"title": "Record",
"Signal": "Signal",
"ticker": "Ticker",
"userAdded": "User Added",
"dateAdded": "Date Added",
"userUpdated": "User Updated",
"dateUpdated": "Date Updated"
}
}
};
private timeInterval = 15;
private busCreateVal: any = {
FishNo: -1,
feeds: [],
MobileIds: [],
masterSeries: '',
programName: '',
programTypeObj: { baseType: 'E' },
startDate: new Date(),
weekCount: 1,
endDate: '',
startTime: '',
blockDuration: '',
endTime: '',
days: [0, 1, 2, 3, 4, 5, 6],
closedCaptioning: false,
des: false,
marketBlackOut: false,
actualStartTime: '',
actualDuration: '',
actualEndTime: '',
MobileType: '',
tveStatus: '',
PlayerStartTime: '',
PlayerEndTime: '',
PlayerDuration: '',
PlayerDate: '',
PlayerSource: '',
PlayerFlag: false,
Signal: '',
ticker: '',
desFishObj: '',
sdDelivery: '',
HdDelivery: '',
Dbs: '',
action: "GO",
unlockMobiles: [],
FishStartSeconds: ""
}
private multiSettings: IMultiSelectSettings = {
checkedStyle: 'glyphicon',
showCheckAll: true,
showUncheckAll: true,
dynamicTitleMaxItems: 1000,
isAll: false
};
private MobileSelect = {
data: [],
texts: { defaultTitle: '' },
selectSettings: this.multiSettings
};
// private busCreateValPlayer: any = {
// FishNo: 241,
// startDate: "04/10/2018",
// endDate: "04/24/2018",
// addOns: [
// "Player_FishS"
// ]
// }
private busCreateValPlayer: any = {
//FishNo: 241,
FishNo: 237,
startDate: new Date(),
endDate: '',
addOns: [
'Player_FishS'
]
}
private busGridData;
private saveBtnEnableDisable = true;
private totalUpdates = 0;
private totalDeletes = 0;
private disableNoAirings = true;
private resetPreferenceContext;
private goBtnEnableDisable: any = true;
// public setInstance(historyPopup : any,gridkendo : any,FishCarousel : any,router : any,financialAmortMobileDetails :any,kendoDialog : any,cableHistoryPopup : any, gridHeaderMenu? : any){
public setInstance(gridHeaderMenu?: any) {
// this.historyPopup = historyPopup;
// this.gridkendo = gridkendo;
// this.historyPopup.gridkendo = gridkendo;
// this.FishCarousel = FishCarousel;
// this.router = router;
// this.financialAmortMobileDetails = financialAmortMobileDetails;
// this.financialAmortMobileDetails.gridkendo = gridkendo;
// this.cableHistoryPopup = cableHistoryPopup;
// this.gridHeaderMenu = gridHeaderMenu;
}
@ViewChild(KendoGridComponent) private gridkendo: KendoGridComponent;
@ViewChild(ProgressCircle) private progress: ProgressCircle;
@ViewChild(FishCarousel) private FishCarousel: FishCarousel;
//@ViewChild(GridHeaderContext) public gridHeaderMenu: GridHeaderContext;
//@ViewChild(ValidateGridPopup) private validateGridPopup: ValidateGridPopup;
@ViewChild(PlayerConflictGridPopup) private PlayerConflictGridPopup: PlayerConflictGridPopup;
constructor(private elementRef: ElementRef, private router: Router, private SPORTSService: SPORTSService, ) { }
public columns = [
{ airingHen: "Locked", airingHenParms: "locked", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true },
{ airingHen: "Mobile Name", airingHenParms: "MobileName", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true },
{ airingHen: "Feed Name", airingHenParms: "feedNo", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true },
{ airingHen: "Start Date", airingHenParms: "startDate", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true },
{ airingHen: "Day Of Week", airingHenParms: "dayOfWeekNo", readOnly: true, editable: false, editableDisabled: true, default: false, visible: true },
// { airingHen: "Start Time", airingHenParms: "startTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Block Duration", airingHenParms: "blockDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "End Time", airingHenParms: "endTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual Start Time", airingHenParms: "actualStartTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual Duration", airingHenParms: "actualDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual End Time", airingHenParms: "actualEndTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Name", airingHenParms: "programName", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Flag", airingHenParms: "PlayerFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Date", airingHenParms: "PlayerDate", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Start Time", airingHenParms: "PlayerStartTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Duration", airingHenParms: "PlayerDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player End Time", airingHenParms: "PlayerEndTime", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Player Source/Provider", airingHenParms: "PlayerSource", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Notes", airingHenParms: "PlayerNotes", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "HD", airingHenParms: "PlayerHDFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Record", airingHenParms: "PlayerRecordFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Signal", airingHenParms: "Signal", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Ticker", airingHenParms: "ticker", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Fish", airingHenParms: "desFish", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "SD Delivery", airingHenParms: "sddelivery", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "HD Delivery", airingHenParms: "hddelivery", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "DBS Spotbeam", airingHenParms: "dbsspotbeam", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "TVE Status", airingHenParms: "tvestatus", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Type", airingHenParms: "programType", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Master Series", airingHenParms: "seriesNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Code", airingHenParms: "programCode", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Alternate Color", airingHenParms: "alternateColor", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Title Name", airingHenParms: "titleName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Title Owner Fish", airingHenParms: "titleOwnerFish", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Episode #", airingHenParms: "distEpisodeID", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Season", airingHenParms: "seasonName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Version", airingHenParms: "houseNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Scheduling Type", airingHenParms: "MobileTypeNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Closed Captioning", airingHenParms: "closedCaptioning", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "VOD", airingHenParms: "vod", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "DES", airingHenParms: "des", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Scheduling Category", airingHenParms: "schedCategory", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Definition", airingHenParms: "MobileDefinitionNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Format", airingHenParms: "formatNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Format Description", airingHenParms: "formatName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Notes", airingHenParms: "commentText", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Mobile Item #", airingHenParms: "schedItemNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Title #", airingHenParms: "titleNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "User Added", airingHenParms: "userAddedName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Date Added", airingHenParms: "dateAdded", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "User Updated", airingHenParms: "userUpdatedName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Date Updated", airingHenParms: "dateUpdated", readOnly: true, editable: false, editableDisabled: true }
];
ngOnInit() {
// this.gridHeaderMenu.gridkendo = this.gridkendo;//assign kendo obj to gridHeaderMenu component
//this.setInstance(this.historyPopup,this.gridkendo,this.FishCarousel,this.router,this.financialAmortMobileDetails,this.kendoDialog,this.cableHistoryPopup, this.gridHeaderMenu);
// this.setInstance(this.gridHeaderMenu);
let that = this;
this.loadView();
this.busContextMenu();
/*---Load Default Aggregators----*/
this.loadAggregators(this.selectedFishArr.FishNo);
that.busKeys = ["MobileName", "startDate", "dayOfWeek", "startTime", "blockDuration", "endTime", "programName", "programType", "actualStartTime", "actualEndTime", "actualDuration", "masterSeries", "titleName", "episode", "season", "version", "schedulingType", "format", "notes", "MobileItem", "title", "userAdded", "dateAdded", "userUpdated", "dateUpdated"];
$('kendo-grid-template').on('change', '.unlockCheckbox', function () {
let rowStat = $(this).prop('checked');
if (rowStat) {
that.selectedRowsUID.push($(this).closest('tr').attr('data-uid'));
$(this).closest('tr').addClass("k-state-selected");
} else {
$(this).closest('tr').removeClass("k-state-selected");
let currentUid = that.selectedRowsUID.indexOf($(this).closest('tr').attr('data-uid'));
that.selectedRowsUID.splice(currentUid, 1);
}
});
$("#KendoGridView").on('change', '#unlockCheck', function () {
that.selectAll = $('#unlockCheck').prop('checked');
if (that.selectAll) {
$('.unlockCheckbox').prop('checked', 'checked');
let grid = that.gridkendo.getGrid();
let gridlen = grid.dataSource.data();
for (let i = 0; i < gridlen.length; i++) {
that.selectedRowsUID.push(gridlen[i].uid);
}
that.selectedRowsUID.length != 0;
} else {
$('.unlockCheckbox').removeAttr('checked');
$('tr').removeClass("k-state-selected");
that.selectAll = false;
that.selectedRowsUID = [];
}
});
$("#PlayerStartTime").kendoTimePicker({
format: "h:mm:ss tt",
interval: that.timeInterval,
parseFormats: ["HH:mm:ss"],
min: new Date(2000, 0, 1, 5, 0, 0),
max: new Date(2000, 0, 1, 5, 0, 0),
open: function () {
that.onTimeWidth('PlayerStartTime', that.timeInterval);
},
change: function () {
}
});
let getGridColumn: any = {
selectedRowIndex: null,
getColumns: [],
selectedRow: null
};
// row col context menu
$("#context-menu").kendoContextMenu({
target: "#KendoGridView",
filter: ".k-grid-content tbody tr[role='row']",
select: function (e) {
// handle event
},
activate: function (e) { },
open: function (e) {
if (getGridColumn.getColumns.length && getGridColumn.getColumns[getGridColumn.selectedRowIndex + 1] && getGridColumn.getColumns[getGridColumn.selectedRowIndex + 1].title) {
that.dynamicHenName = getGridColumn.getColumns[getGridColumn.selectedRowIndex + 1].title;
that.notThreeDotDisable = true;
} else {
}
}
});
$("#KendoGridView tr.rowDisabled").on("mousedown contextmenu", function (e) {
e.stopPropagation();
var contextMenu1 = $("#context-menu").data("kendoContextMenu");
if (contextMenu1) {
contextMenu1.close($("#context-menu"));
}
return true;
});
// setTimeout(function () {
// $("#bus-context-menu").kendoContextMenu({
// target: "#KendoGridView .k-grid-header thead tr:nth-child(1)",
// animation: {
// open: {
// effects: "fadeIn"
// }
// }
// });
// $('#bus-context-menu').on('click', '.hideShowColumn', function (e) {
// e.stopPropagation();
// });
// }, 100);
setTimeout(function () {
$('#startTime_timeview li,#endTime_timeview li,#actualStartTime_timeview li,#actualEndTime_timeview li,#PlayerStartTime_timeview li,#PlayerEndTime_timeview li').css({ "float": "left", "width": 76, "font-size": "12px" });
/*if(that.timeInterval==30){
$('#startTime_timeview,#endTime_timeview,#actualStartTime_timeview,#actualEndTime_timeview,#PlayerStartTime_timeview,#PlayerEndTime_timeview').parent().css({"width":200});
} else if(that.timeInterval==15){
$('#startTime_timeview,#endTime_timeview,#actualStartTime_timeview,#actualEndTime_timeview,#PlayerStartTime_timeview,#PlayerEndTime_timeview').parent().css({"width":386});
}else{
}*/
}, 100)
$("#KendoGridView tr.rowDisabled").on("mousedown contextmenu", function (e) {
e.stopPropagation();
var contextMenu1 = $("#context-menu").data("kendoContextMenu");
if (contextMenu1) {
contextMenu1.close($("#context-menu"));
}
return true;
});
//PlayerFlagCheck
$(document).on('change', '#PlayerFlagCheck', function () {
//$(document).on('change', '#imageHD', function () {
alert("I am inside change");
//$(this).parents('tr').find('td').eq(1).addClass("gridUpdateIcon");
//$('#imageEditLast').addClass("gridUpdateIcon");
$('#editIconPlayer').addClass("gridUpdateIcon");
//editIconPlayer
//imageEditLast
});
$(document).on('load', '.unlockCheckbox', function () {
//alert("querySelectorAlle--->" + document.querySelectorAll('.unlockCheckbox').length);
//alert("I am inside change");
//$(this).parents('tr').find('td').eq(1).addClass("gridUpdateIcon");
});
}
loadAggregators(FishNo) {
let data = {};
this.progress.requestStart();
this.SPORTSService.getResponse('Mobiles/v1/Playerbusupdate/', 'get', data)
.subscribe(response => {
this.PlayerbusUpdateLovs = response.data
this.setFishs(response.data);
this.progress.requestEnd();
},
err => {
this.progress.requestEnd();
});
}
clearBtnClick() {
this.loadAggregators(-1);
//let response={"code":"S001","message":"Success","data":{"added":7,"updated":0,"deleted":7,"conflicts":[{"weekDay":"Wednesday","date":"04/11/2018","time":"10:00:00 AM","programName":"LAW & ORDER: SVU ","titleName":"ROCKABYE","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Thursday","date":"04/12/2018","time":"10:00:00 AM","programName":"CHICAGO P.D.","titleName":"WRONG SIDE OF THE BARS","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Friday","date":"04/13/2018","time":"10:00:00 AM","programName":"NCIS: LOS ANGELES (F)","titleName":"PURITY","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Saturday","date":"04/14/2018","time":"10:00:00 AM","programName":"NCIS (LUCKY DUCKY MARATHON)","titleName":"BLOWBACK","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Sunday","date":"04/15/2018","time":"10:00:00 AM","programName":"LAW & ORDER: SVU (NOTORIOUS S.V.U. MARATHON)","titleName":"ROOFTOP","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Monday","date":"04/16/2018","time":"10:00:00 AM","programName":"NCIS","titleName":"ENEMY COMBATANT","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Tuesday","date":"04/10/2018","time":"10:00:00 AM","programName":"NCIS ","titleName":"DEJA VU","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"}]}}
}
goBtnPayload() {
let reqPayload;
reqPayload = jQuery.extend(true, {}, this.PlayerbusUpdateVal);
reqPayload.startDate = kendo.toString(reqPayload.startDate, 'MM/dd/yyyy');
reqPayload.endDate = kendo.toString(reqPayload.endDate, 'MM/dd/yyyy');
return reqPayload;
}
goBtnClick() {
this.goBtnServiceCall();
// let that = this;
// //if (that.busGridData.length > 0) {
// if (true) {
// let strMessage = 'Do you want to continue and loss existing changes?';
// $('#commonPopup .kPopUpTitle').text('SKY');
// $("#commonPopup .kendoContent").text(strMessage);
// let dialogConfirm = $("#commonPopup").data("kendoWindow").center().open();
// $("#popupOK").unbind().click(function () {
// that.goBtnServiceCall();
// dialogConfirm.close();
// });
// $("#popupCancel").unbind().click(function () {
// dialogConfirm.close();
// });
// } else {
// that.goBtnServiceCall();
// }
}
ObjectKeyChange(key1: any, key2: any, object: any): any {
return object != null ? object.map(function (obj) {
obj["id"] = obj[key1];
obj["name"] = obj[key2];
delete obj[key1];
delete obj[key2];
return obj;
}) : [];
}
getDeafultMobile(Mobiles) {
let filterMobiles = Mobiles.filter(MobileObj => MobileObj.default === true);
let mapMobiles = filterMobiles.map((Mobile) => {
return Mobile.MobileNo;
})
this.MobileSelect.data = this.ObjectKeyChange("MobileNo", "MobileName", Mobiles);
this.busCreateVal.MobileIds = mapMobiles;
}
goBtnServiceCall() {
let that = this;
this.progress.requestStart();
let reqPayload = this.goBtnPayload();
// that.resetPreferenceContext = jQuery.extend(true, {}, this.busCreateLovs.changeColumns);
//console.log("reqPayload--->", reqPayload);
this.SPORTSService.getResponse("Mobiles/v1/Playerbusupdate/", "post", reqPayload).subscribe(response => {
console.log("data--->" + response);
this.PlayerDataAPI = response.data.records;
this.gridDataLoad();
this.lockedMobileMsgShow(response.data.properties);
this.progress.requestEnd();
}, err => { this.progress.requestEnd(); });
}
gridDataLoad() {
let that = this;
that.checkedRowsUID = [];
let grid = this.gridkendo.getGrid();
grid.setOptions({
dataBound: function (e) {
that.onDataBound(e);
},
columnReorder: function (e) {
console.log(e.newIndex, e.oldIndex, e.column)
}
});
this.gridkendo.reloadDataSource(this.PlayerDataAPI);
this.gridkendo.setContextMenu();
//this.gridHeaderMenu.addDummyHeader();
that.totalAiringsCount = that.getGridLength("Added");
// that.totalDeletes = that.getGridLength("Delete");
// that.disableBtn = false;
/* Start - Open context menu on right click */
// setTimeout(function () {
// $("#bus-context-menu").kendoContextMenu({
// target: "#KendoGridView .k-grid-header thead tr:nth-child(1) ",
// animation: {
// open: {
// effects: "fadeIn"
// }
// }
// });
// $('#bus-context-menu').on('click', '.hideShowColumn', function (e) {
// e.stopPropagation();
// });
// }, 100);
that.busContextMenu();
that.busKeys = ["MobileName", "startDate", "day", "startTime", "blockDuration", "endTime", "programName", "programType", "actualStartTime", "actualEndTime", "actualDuration", "seriesName", "titleName", "episodeNote", "seasonName", "versionName", "schedulingType", "formatName", "notes", "MobileItem", "title", "userAddedName", "dateAdded", "userUpdated", "dateUpdated"];
}
getGridLength(type) {
let that = this;
var totalRecords = 0;
var gridrecords = that.gridkendo.getGrid();
var gridData = gridrecords.dataSource.data();
if (type == 'Added') {
$.each(gridData, function (i, item) {
if (item.action == "Added") {
totalRecords = totalRecords + 1;
}
});
} else {
$.each(gridData, function (i, item) {
if (item.action == "Delete") {
totalRecords = totalRecords + 1;
}
});
}
return totalRecords;
}
private gridCancel() {
let that = this;
let strMessage = 'Do you want to continue and loss existing changes?';
$('#commonPopup .kPopUpTitle').text('SKY');
$("#commonPopup .kendoContent").text(strMessage);
let dialogConfirm = $("#commonPopup").data("kendoWindow").center().open();
$("#popupOK").unbind().click(function () {
let grid = that.gridkendo.getGrid();
that.busGridData = [];
grid.dataSource.data([]);
that.totalAiringsCount = 0;
that.totalDeletes = 0;
dialogConfirm.close();
});
$("#popupCancel").unbind().click(function () {
dialogConfirm.close();
});
}
loadPreference(FishNo) {
let data = {};
//this.progress.requestStart();
// this.SPORTSService.getResponse('authorization/v1/loadPreferences?FishNo=1', 'get', data).subscribe(data => {
// //this.SPORTSService.getlocalResponse("bus-create-pref", "get", prefData).subscribe(data => {
// this.preferenceData = data;
// this.progress.requestEnd();
// },
// err => { this.progress.requestEnd(); });
}
ngAfterContentInit() {
$('.triggerGridScrollFunctions').trigger('click');
// $("#context-menuAspect").kendoContextMenu({
// target: ".contextMenuRow",
// showOn: "click",
// select: function (e) {
// let selectedMenuItem = $(e.item).children(".k-link").text();
// }
// });
//create preferences Popup
function onClosePop() {
$("html, body").css("overflow", "");
}
// this.createPreferencesPopUpWindow = $("#createPreferencesPopUpWindow");
// this.createPreferencesPopUpWindow.kendoWindow({
// width: "350px",
// title: false,
// visible: false,
// actions: [],
// draggable: false,
// close: onClosePop,
// modal: true,
// open: function(e) { $("html, body").css("overflow", "hidden"); }
// }).data("kendoWindow").center();
this.createDialog("#createPreferencesPopup");
this.createDialog("#commonPopup");
this.lockedMobilePopup("#lockedMobilePopup");
}
loadView() {
let that = this;
$("#overlaps0").prop("checked", true);
let navHeaderHeight = $('.navHeaderBox').outerHeight();
$('.breadCrumbBox').css('top', navHeaderHeight + 'px');
this.PlayerbusUpdateVal.endDate = that.calculateEndDate(this.PlayerbusUpdateVal.startDate, this.PlayerbusUpdateVal.weekCount);
// start datepicker
$("#startDate").kendoDatePicker({
min: new Date(1000, 0, 1),
max: new Date(3000, 11, 31),
formatName: "MM/dd/yyyy",
parseformatNames: ["MM/dd/yyyy"],
value: that.PlayerbusUpdateVal.startDate,
open: function (e) { },
change: function () {
let dateEntered = $("#startDate").val();
if (this.value() !== null && dateEntered.length > 0) {
that.PlayerbusUpdateVal.startDate = this.value();
that.PlayerbusUpdateVal.endDate = that.calculateEndDate(this.value(), that.PlayerbusUpdateVal.weekCount);
let endDatePicker = $("#endDate").data("kendoDatePicker");
endDatePicker.value(that.PlayerbusUpdateVal.endDate);
}
that.validateSearch();
}
});
// end datepicker
$("#endDate").kendoDatePicker({
min: new Date(1000, 0, 1),
max: new Date(3000, 11, 31),
formatName: "MM/dd/yyyy",
parseformatNames: ["MM/dd/yyyy"],
value: that.PlayerbusUpdateVal.endDate,
change: function () {
let dateEntered = $("#endDate").val();
if (this.value() !== null && dateEntered.length > 0) {
that.PlayerbusUpdateVal.endDate = this.value();
}
let end;
let start = $("#startDate").data("kendoDatePicker").value();
end = this.value() ? this.value() : new Date();
start = start ? start : new Date();
let startDate = new Date(start);
let endDate = new Date(end);
startDate.setHours(0, 0, 0);
endDate.setHours(0, 0, 0);
if (endDate === undefined && (startDate.toString() === endDate.toString()) || (startDate < endDate)) {
let timeDiff = Math.abs(end.getTime() - start.getTime());
let diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
let weekDiff = Math.floor(diffDays / 7) + 1;
that.PlayerbusUpdateVal.weekCount = weekDiff;
}
that.validateSearch();
}
});
$('#startDate').on('dblclick', function () {
let currentDate = new Date();
$("#startDate").data("kendoDatePicker").value(currentDate);
$("#startDate").data("kendoDatePicker").trigger("change");
});
$('#endDate').on('dblclick', function () {
let currentDate = new Date();
$("#endDate").data("kendoDatePicker").value(currentDate);
$("#endDate").data("kendoDatePicker").trigger("change");
});
this.kendocommand.model = {
id: "isSelected",
fields: {
contextRow: { editable: false },
gridCheck: { type: "boolean", editable: false, filterable: false },
gridType: { type: "boolean", editable: false, filterable: false },
MobileName: { type: "string", editable: false },
MobileItem: { type: "string", editable: false },
MobileStartDate: { type: "string", filterable: true, editable: false, },
MobileStartTime: { type: "string", editable: false },
MobileEndTime: { type: "string", editable: false },
feedName: { type: "string", editable: false },
programName: { type: "string", editable: true },
title: { type: "string", editable: false },
titleName: { type: "string", editable: false },
matId: { type: "string", editable: false },
versionFish: { type: "string", editable: false },
PlayerFlag: { type: "string", editable: true },
PlayerDate: { type: "string", editable: true },
PlayerStartTime: { type: "dateTime", editable: true },
PlayerDuration: { editable: true },
PlayerEndTime: { type: "string", editable: false },
PlayerSource: { type: "string", editable: true },
PlayerNotes: { type: "string", editable: true },
Signal: { type: "string", editable: true },
ticker: { type: "string", editable: true },
userAdded: { type: "string", editable: false },
dateAdded: { type: "string", editable: false },
userUpdated: { type: "string", editable: false },
dateUpdated: { type: "string", editable: false }
}
}
this.kendocommand.columns = [
{
field: "contextRow",
template: "<span class='contextMenuRow'></span>",
width: 25,
}, {
filterable: false,
width: 30,
headerTemplate: '<span class="displayBlock"><input type="checkbox" id="unlockCheck" /></span>',
resizable: false,
sortable: false,
field: "gridCheck",
editable: false,
title: "Is Selected ",
//template:function(container){ return that.checkboxchecker(container,"isSelected")},
template: "<input type='checkbox' class='gridCheckBox' checked='true'>",
attributes: {
style: "padding: 0 8px 0 12px;"
}
}, {
filterable: false,
width: 30,
resizable: false,
sortable: false,
field: "gridType",
editable: false,
title: " ",
template: "<span class='eventType newEvent text-succcess'><span id='editIconPlayer' class='displayBlock'></span></span> "
//template: "<span class='eventType newEvent text-succcess'><span id='editIconPlayer' class='gridUNLockIcon displayBlock'></span></span> "
}, {
field: "MobileName",
title: "Mobile Name",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
},
}, {
field: "MobileItem",
title: "Mobile Item #",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
},
}, {
field: "MobileStartDate",
title: "Start Date",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
}, {
field: "MobileStartTime",
title: "Start Time",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
}, {
field: "MobileEndTime",
title: "End Time",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
}, {
field: "feedName",
title: "Feed Name",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},{
field: "programName",
title: "Program Name",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
}, {
field: "titleNo",
title: "Title #",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
}, {
field: "titleName",
title: "Title Name",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "matId",
title: "Material ID",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "versionFish",
title: "Version Fish",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "PlayerFlag",
title: "Player Flag",
filterable: false,
width: 30,
resizable: false,
sortable: false,
template: "<input id = 'PlayerFlagCheck' type='checkbox'>"
},
{
field: "PlayerDate",
title: "Player Date",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
template: function fromDatefunction(startDate) {
return that.fromDateTemplate(startDate, that);
},
editor: function (container, options) {
that.dateEditor(container, options, that);
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "PlayerStartTime",
title: "Player Start Time",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
template: function timefunction(startTime) {
return that.startTimeTemplate(startTime, that);
},
editor: function (container, options) {
return that.startTimeEditor(container, options, that);
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "PlayerDuration",
title: "Player Duration",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "PlayerEndTime",
title: "Player End Time",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
// {
// field: "PlayerSourceProvider",
// title: "Player Source Provider",
// width: 200,
// filterable: that.gridkendo.getAutoFilter("contains"),
// template: function productfunction(programType) {
// return that.productTemplate(programType, that);
// },
// editor: function (container, options) {
// return that.productEditor(container, options, that);
// },
// headerAttributes: {
// class: "multiCheckboxFilterEnabled"
// }
// },
{
field: "PlayerSource",
title: "Player Source/Provider",
width: 200,
filterable: false,
sortable: false,
template: function sourcefunction(PlayerSource) {
return that.PlayerSourceTemplate(PlayerSource, that);
},
editor: function (container, options) {
return that.PlayerSourceEditor(container, options, that);
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "PlayerNotes",
title: "Player Notes",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "hd",
title: "HD",
filterable: false,
width: 30,
resizable: false,
sortable: false,
template: "<input id='imageHD' type='checkbox' checked=true class=''>"
},
{
field: "record",
title: "Record",
filterable: false,
width: 30,
resizable: false,
sortable: false,
template: "<input type='checkbox' checked=true class=''>"
},
// {
// field: "Signal",
// title: "Signal",
// width: 200,
// filterable: that.gridkendo.getAutoFilter("contains"),
// template: function productfunction(programType) {
// return that.productTemplate(programType, that);
// },
// editor: function (container, options) {
// return that.productEditor(container, options, that);
// },
// headerAttributes: {
// class: "multiCheckboxFilterEnabled"
// }
// },
// {
// field: "Signal",
// title: "Signal",
// width: 200,
// filterable: that.gridkendo.getAutoFilter("contains"),
// template: function productfunction(programType) {
// return that.SignalTemplate(programType, that);
// },
// editor: function (container, options) {
// return that.SignalEditor(container, options, that);
// },
// headerAttributes: {
// class: "multiCheckboxFilterEnabled"
// }
// },
{
field: "Signal",
title: "Signal",
width: 200,
filterable: false,
sortable: false,
// editable: true,
template: function Signalfunction(Signal) {
return that.SignalTemplate(Signal, that);
},
editor: function (container, options) {
return that.SignalEditor(container, options, that);
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
// {
// field: "ticker",
// title: "Ticker",
// width: 200,
// filterable: that.gridkendo.getAutoFilter("contains"),
// template: function productfunction(programType) {
// return that.productTemplate(programType, that);
// },
// editor: function (container, options) {
// return that.productEditor(container, options, that);
// },
// headerAttributes: {
// class: "multiCheckboxFilterEnabled"
// }
// },
{
field: "ticker",
title: "Ticker",
width: 200,
filterable: false,
sortable: false,
template: function tickerfunction(ticker) {
return that.tickerTemplate(ticker, that);
},
editor: function (container, options) {
return that.tickerEditor(container, options, that);
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "userAdded",
title: "User Added",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "dateAdded",
title: "Date Added",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "userUpdated",
title: "User Updated",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "dateUpdated",
title: "Date Updated",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
}
];
$('<div class="gridScrollIconsBox"><i class="fa fa-chevron-left previousGridColumns"></i><i class="fa fa-chevron-right nextGridColumns" ></i></div>').insertBefore('.k-grid-header');
}
getDefault(data: any) {
for (var i = 0; i < data.length; i++) {
if (data[i].hasOwnHen("isDefault")) {
if (data[i].isDefault)
return data[i];
break;
}
}
}
setFishs(data: any) {
// var Playermoons =[{Lion: 237, birds: "Animal Sports Bay Area", fish: 1, isDefault: true, wire: ""},
// {Lion: 238, birds: "Animal Sports California", fish: 1, wire: ""},
// {Lion: 239, birds: "Animal Sports Washington", fish: 1, wire: ""},
// {Lion: 240, birds: "Animal Sports Philadelphia", fish: 1, wire: ""}];
// function getDefault(Playermoons){
// for(var i=0; i<Playermoons.length; i++){
// if(Playermoons[i].hasOwnHen("isDefault"))
// {
// if(Playermoons[i].isDefault)
// return Playermoons[i];
// break;
// }
// }
// }
// for(var i=0; i<data.length; i++){
// if(data[i].hasOwnHen("isDefault"))
// {
// if(data[i].isDefault)
// return data[i];
// break;
// }
// }
//console.log(getDefault(Playermoons))
let that = this;
let tempObj = {};
//tempObj['FishNo'] = 237;
//tempObj['Lion'] = getDefault(Playermoons).Lion
//tempObj['FishNo'] = this.getDefault(data).FishNo;
console.log("data outside if---->", data);
//console.log("after data check---->" + tempObj['FishNo'));
console.log(data instanceof Array);
// if(data && data.length > 0){
console.log(" inside if---->" + data);
let defauktFishNOData = data.PlayerFishs.find((elem) => { return elem.isDefault; });
//that.flightRecords.find((elem) => { return elem.isDefault; });
tempObj['FishNo'] = defauktFishNOData.FishNo;
//}
// tempObj['FishNo'] = data.PlayerFishs[0].FishNo;
//tempObj['FishName'] = 'NBC Sports Bay Area';
// tempObj['FishNo'] = data.selectedFishNo;
tempObj['FishName'] = defauktFishNOData.FishName;
this.FishTempArray = [];
this.FishTempArray.push(tempObj);
let Fishsdata = data.PlayerFishs;
let FishsDataList = this.FishTempArray;
//let selectedFish = Fishsdata.find(elem => elem.FishNo == 237);
this.PlayerbusUpdateVal.FishNo = defauktFishNOData.FishNo;
let selectedFish = Fishsdata.find(elem => elem.FishNo == defauktFishNOData.FishNo);
// this.busCreateVal.FishNo = defauktFishNOData.FishNo;
this.selectedFishArr = selectedFish;
//this.FishCarousel.setFishData(Fishsdata, FishsDataList, 237);
this.FishCarousel.setFishData(Fishsdata, FishsDataList, defauktFishNOData.FishNo);
$("#FishCarouselLabel .FishHint").css("display", "none");
setTimeout(function () {
$("#unSelectedFishsLogoBox1 .currentNwLogo").bind("click", function (e) {
e.stopPropagation();
that.singleSelection(data, e);
});
}, 100);
}
FishsEvent(data: any) {
let Fish = this.FishCarousel.getselectedFishID();
let selectedFishId = data.FishData;
//this.FishCarousel.clearFishsearch(data);
}
singleSelection(data, e: any) {
this.FishCarousel.getClearFishs();
this.FishCarousel.FishLogoClick(e);
var getSelect = this.FishCarousel.getselectedFish();
let Fishsdata = data.PlayerFishs;
let selectedFish = Fishsdata.find(elem => elem.FishNo == getSelect[0].FishNo);
this.PlayerbusUpdateVal.FishNo = getSelect[0].FishNo;
this.selectedFishArr = selectedFish;
//this.loadAggregators(this.selectedFishArr.FishNo);
}
validateSearch() {
let that = this;
let isValidDate = true;
let isValidTime = true;
this.isValidDates = false;
let startDate = $('#startDate').data("kendoDatePicker").value();
let endDate = $('#endDate').data("kendoDatePicker").value();
if (!startDate || !endDate) {
this.isValidDates = false;
}
else {
startDate.setHours(0, 0, 0);
endDate.setHours(0, 0, 0);
if (startDate.toString() == endDate.toString()) {
this.isValidDates = true;
$('#endDate').closest('.formRow').removeClass('mandatoryField');
$('#endDate').closest('.formRow').attr({ "title": "" });
//that.MobileService.datevalidate(false);
}
else {
if (startDate < endDate) {
this.isValidDates = true;
$('#endDate').closest('.formRow').removeClass('mandatoryField');
$('#endDate').closest('.formRow').attr({ "title": "" });
//that.MobileService.datevalidate(false);
}
else {
$('#endDate').closest('.formRow').addClass('mandatoryField');
$('#endDate').closest('.formRow').attr({ "title": "Start date can't be grater than end date " });
//that.MobileService.datevalidate(true);
this.isValidDates = false;
}
}
}
if (isValidDate && isValidTime && this.busCreateVal.days.length > 0 && !this.feedMandatoryClass) {
return this.goBtnEnableDisable = false;
} else { return this.goBtnEnableDisable = true; }
// this.goBtnEnableDisable();
}
// clear_fields() {
// }
// goBtnEnableDisable() {
// }
setDate(date: any) {
let setDate = "";
let numberOnly = /^[0-9]*$/;
if (numberOnly.test(date) && date.length == 8) {
let dateSplit = date.split("");
let dateFormat = ""
for (var i = 0; i < dateSplit.length; i++) {
if (i == 2 || i == 4)
dateFormat = dateFormat + '/';
dateFormat = dateFormat + dateSplit[i];
}
var parsedDate = Date.parse(dateFormat);
if (!isNaN(parsedDate)) {
setDate = kendo.toString(new Date(parsedDate), "MM/dd/yyyy");
}
else {
setDate = kendo.toString(new Date(), "MM/dd/yyyy");
}
}
else if (date.length != 0) {
setDate = kendo.toString(new Date(), "MM/dd/yyyy");
}
return setDate;
}
// checkboxchecker(container, options, fieldName: any): any {
// if ((this.selectedRowsUID.indexOf(container.uid) != -1) || this.selectAll) {
// container.isSelected = true;
// return '<input type="checkbox" checked="checked" style="display:block;" class="textAligncenter unlockCheckbox" #= ' + fieldName + ' ? \'checked="checked"\' : "false" #= ' + fieldName + '/>';
// } else {
// this.count = true;
// container.isSelected = false;
// return '<input type="checkbox" style="display:block;" class="textAligncenter unlockCheckbox" #= ' + fieldName + ' ? \'checked="checked"\' : "false" #= ' + fieldName + '/>';
// }
// }
checkboxchecker(container, fieldName: any): any {
if ((this.selectedRowsUID.indexOf(container.uid) != -1) || this.selectAll) {
container.isSelected = true;
return '<input type="checkbox" checked="checked" style="display:block;" class="textAligncenter unlockCheckbox" #= fieldName ? \'checked="checked"\' : "false" #= fieldName/>';
} else {
this.count = true;
container.isSelected = false;
return '<input type="checkbox" style="display:block;" class="textAligncenter unlockCheckbox" #= fieldName ? \'checked="checked"\' : "false" #= fieldName/>';
}
}
checkboxcheckerLocker(container, fieldName: any): any {
if ((this.selectedRowsUID.indexOf(container.uid) != -1) || this.selectAll) {
container.isSelected = true;
return '<input type="checkbox" checked="checked" style="display:block;" class="textAligncenter lockCheckbox" #= ' + fieldName + ' ? \'checked="checked"\' : "false" #= ' + fieldName + '/>';
} else {
this.count = true;
container.isSelected = false;
return '<input type="checkbox" style="display:block;" class="textAligncenter lockCheckbox" #= ' + fieldName + ' ? \'checked="checked"\' : "false" #= ' + fieldName + '/>';
}
}
private gridPageSize(value): void {
this.gridkendo.gridPageSizeChange(value);
}
private gridTemplate(options: any, fieldName: any, mandatory: any) {
let value = options[fieldName];
if (options[fieldName] == null || options[fieldName] == undefined) {
value = "";
options[fieldName] = " ";
}
options[fieldName + "FilterRowId"] = value;
return value;
}
/*====================================================================
=================== kendo grid template editor========================
======================================================================*/
/* From Date Template */
private fromDateTemplate(fromDate: any, that: any): any {
let dateValue = "";
fromDate.currentTab = "airFormatList";
fromDate.categoryDescription = "Format";
if (fromDate.startDate == undefined || fromDate.startDate == null || fromDate.startDate == "") {
dateValue = "<i></i>"
return dateValue;
}
if (fromDate.startDate != null && fromDate.startDate != undefined && fromDate.startDate != "") {
let myDate = new Date(fromDate.startDate);
dateValue = (myDate.getMonth() + 1) + "/" + myDate.getDate() + "/" + myDate.getFullYear();
return dateValue;
}
}
/* Date Editor for grid */
dateEditor(container, options, that): any {
if (options.model.archiveFlag == "Y") {
switch (options.field) {
case "startDate":
$('<label>' + options.model.startDate + '</label>').appendTo(container);
break;
case "to":
$('<label>' + options.model.to + '</label>').appendTo(container);
break;
}
} else {
var input = $('<input data-bind="value:' + options.field + '"/>');
input.appendTo(container)
.kendoDatePicker({
format: "MM/dd/yyyy",
parseFormats: "MM/dd/yyyy",
open: function (e) {
switch (options.field) {
case "startDate":
if (options.model.to) {
datePicker.max(options.model.to);
}
break;
case "to":
if (options.model.startDate) {
datePicker.min(options.model.startDate);
}
break;
}
},
change: function (e) {
let grid = that.gridkendo.getGrid();
let gridrow = grid.dataItem(grid.select());
let setDate = "";
switch (options.field) {
case "startDate":
if (options.model.startDate) {
setDate = kendo.toString(new Date(options.model.startDate), "MM/dd/yyyy");
if (options.model.to) {
if (new Date(options.model.startDate) > new Date(options.model.to)) {
setDate = "";
}
}
}
break;
case "to":
if (options.model.to) {
setDate = kendo.toString(new Date(options.model.to), "MM/dd/yyyy");
if (options.model.startDate) {
if (new Date(options.model.startDate) > new Date(options.model.to)) {
setDate = "";
}
}
}
break;
}
that.setValue(setDate, "", options.field);
that.enableSave();
}
});
var datePicker = input.data("kendoDatePicker");
}
}
/* kendo grid for start date: Adding Date and Time pickers methods */
private startTimeTemplate(time: any, that: any): any {
if (time.startTime == undefined || time.startTime == null || time.startTime == "") {
time.startTime = "05:00:00 AM";
return "05:00:00 AM";
} else {
return time.startTime;
}
}
/* Start Time Editor */
private startTimeEditor(container, options, that) {
if (options.model.archiveFlag == "Y") {
$('<label>' + options.model.startTime + '</label>').appendTo(container);
} else {
$('<input name="' + options.field + '"/>').appendTo(container).kendoTimePicker({
format: "hh:mm:ss tt", parseFormats: ["hh:mm:ss tt"], value: new Date(),
change: function (e) {
let grid = that.gridkendo.getGrid();
let gridrow = grid.dataItem(grid.select());//that.gridkendo.getGridselectedRow();
let setTime = "";
if (this.value() != null) {
setTime = kendo.toString(new Date(this.value()), "hh:mm:ss tt");
}
gridrow.set("startTime", setTime);
gridrow.trigger("change");
that.enableSave();
}
});
}
}
/* kendo grid for end date: Adding Date and Time pickers methods */
private endTimeTemplate(time: any, that: any): any {
if (time.endTime == undefined || time.endTime == null || time.endTime == "") {
time.endTime = "05:00:00 AM";
return "05:00:00 AM";
} else {
return time.endTime;
}
}
/* End Time Editor */
private endTimeEditor(container, options, that) {
if (options.model.archiveFlag == "Y") {
$('<label>' + options.model.endTime + '</label>').appendTo(container);
} else {
$('<input name="' + options.field + '"/>').appendTo(container).kendoTimePicker({
format: "hh:mm:ss tt", parseFormats: ["hh:mm:ss tt"], value: new Date(2011, 0, 1, 5, 0, 0, 0),
change: function (e) {
let grid = that.gridkendo.getGrid();
let gridrow = grid.dataItem(grid.select());
let setTime = "";
if (this.value() != null) {
setTime = kendo.toString(new Date(this.value()), "hh:mm:ss tt");
}
gridrow.set("endTime", setTime);
gridrow.trigger("change");
that.enableSave();
}
});
}
}
/* product template method:For displaying and editing days field */
private productTemplate(proType: any, that: any): any {
if (that.programList) {
for (let i = 0; i < that.programList.length; i++) {
if (proType.programType == undefined || proType.programType == null || proType.programType == "") {
proType.programType = "product1";
return "product1";
} else if (that.programList[i].program == proType.programType) {
let data = that.programList[i].name;
console.log("data--->" + data);
let value = "<i>" + data + "</i>";
return value;
}
}
}
}
/* productEditor method:For displaying and editing product field */
private productEditor(container, options, that) {
console.log("options--->" + options);
this.rowDotMenuClick("true");
if (options.model.archiveFlag == "Y") {
console.log("options.model.programType--->" + options.model.programType);
$('<label>' + options.model.programType + '</label>').appendTo(container);
} else {
console.log("options.field--->" + options.field);
let input = $('<input name="' + options.field + '" class="k-input" />').appendTo(container);
input.kendoComboBox(that.kendoComboBoxOptionProgramEditor).appendTo(container);
$('.k-input-readonly').prop('readonly', true);
}
}
// private feedTemplate(type: any, that: any): any {
// let dateValue = "";
// if (type.Signal == undefined || type.Signal == null || type.Signal == "") {
// type.Signal = ""
// return type.Signal;
// } else {
// console.log("that.flightRecords--->" + that.flightRecords);
// // console.log("that.flightRecords--->" + that.flightRecords);
// var sType = that.flightRecords.feeds == undefined ? [] : that.flightRecords.feeds;
// var sValue = '';
// var sTypeFeed = sType.find(elem => elem.Signal == type.Signal);
// if (sTypeFeed) {
// return sValue = sTypeFeed.feedName;
// }
// }
// }
/*Feed Name editor */
// private feedEditor(container, options, that) {
// let grid = this.gridkendo.getGrid();
// console.log("feedEditor--->" + grid);
// let gridIndex = grid.select().index();
// //let editable = grid.dataSource.options.schema.model.fields[options.field].editable;
// let editable = true;
// let MobileList: any = [];
// let MobileListNo = '';
// let MobileFeed = '';
// // if (editable == false) {
// if (!editable) {
// $('<span>' + options.model.Signal + '</span>').appendTo(container);
// } else {
// this.rowDotMenuClick("true");
// console.log("that.flightRecords feedEditor--->" + that.flightRecords);
// var sType = that.flightRecords.Signal;
// var input = $('<input data-bind="value:' + options.field + '"/>');
// input.appendTo(container)
// .kendoComboBox({
// dataSource: sType,
// dataTextField: "feedName",
// dataValueField: "Signal",
// change: function (e) {
// var value = this.value();
// var sTypeFeed = sType.find(elem => elem.Signal == value);
// if (sTypeFeed) {
// MobileFeed = sTypeFeed.feedName;
// MobileList = sTypeFeed.Mobiles;
// }
// if (MobileList != null) {
// MobileList = MobileList[0].MobileName;
// MobileListNo = MobileList[0].MobileNo;
// } else {
// MobileList = MobileFeed;
// }
// that.setValue(MobileList, "", 'MobileName');
// }
// });
// }
// }
//PlayerSourceTemplate
/* Signal template */
private PlayerSourceTemplate(type: any, that: any): any {
if (type.PlayerSource == undefined || type.PlayerSource == null || type.PlayerSource == "") {
type.PlayerSource = "";
return type.PlayerSource;
} else {
console.log("flightRecords SignalTemplate--->", that.flightRecords);
//var sType = that.busCreateLovs.Signal == undefined ? [] : that.busCreateLovs.Signal;
that.flightRecords["Player Source/Provider"]
//var sType = that.flightRecords.Signal == undefined ? [] : that.flightRecords.Signal;
var sType = that.flightRecords["Player Source/Provider"] == undefined ? [] : that.flightRecords["Player Source/Provider"];
var sValue = '';
var sTypeSignal = sType.find(elem => elem.HenListValueID == type.PlayerSource);
if (sTypeSignal) {
return sValue = sTypeSignal.HenListValue;
}
}
}
// /* Signal template editor */
private PlayerSourceEditor(container, options, that) {
this.rowDotMenuClick("true");
let grid = this.gridkendo.getGrid();
//let editable = grid.dataSource.options.schema.model.fields[options.field].editable;
let editable = true;
if (!editable) {
$('<span>' + options.model.PlayerSource + '</span>').appendTo(container);
} else {
console.log("flightRecords SignalEditor--->", that.flightRecords);
var sType = that.flightRecords["Player Source/Provider"];
var input = $('<input data-text-field="HenListValue" data-value-field="HenListValueID" data-bind="value:' + options.field + '"/>');
input.appendTo(container)
.kendoComboBox({
dataSource: sType,
dataTextField: "HenListValue",
dataValueField: "HenListValueID",
valuePrimitive: true
});
}
}
/* Signal template */
private SignalTemplate(type: any, that: any): any {
if (type.Signal == undefined || type.Signal == null || type.Signal == "") {
type.Signal = "";
return type.Signal;
} else {
console.log("flightRecords SignalTemplate--->", that.flightRecords);
//var sType = that.busCreateLovs.Signal == undefined ? [] : that.busCreateLovs.Signal;
var sType = that.flightRecords.Signal == undefined ? [] : that.flightRecords.Signal;
var sValue = '';
var sTypeSignal = sType.find(elem => elem.HenListValueID == type.Signal);
if (sTypeSignal) {
return sValue = sTypeSignal.HenListValue;
}
}
}
/* Signal template editor */
private SignalEditor(container, options, that) {
this.rowDotMenuClick("true");
let grid = this.gridkendo.getGrid();
//let editable = grid.dataSource.options.schema.model.fields[options.field].editable;
let editable = true;
if (!editable) {
$('<span>' + options.model.Signal + '</span>').appendTo(container);
} else {
console.log("flightRecords SignalEditor--->", that.flightRecords);
var sType = that.flightRecords.Signal;
var input = $('<input data-text-field="HenListValue" data-value-field="HenListValueID" data-bind="value:' + options.field + '"/>');
input.appendTo(container)
.kendoComboBox({
dataSource: sType,
dataTextField: "HenListValue",
dataValueField: "HenListValueID",
valuePrimitive: true
});
}
}
/* ticker template */
private tickerTemplate(type: any, that: any): any {
if (type.ticker == undefined || type.ticker == null || type.ticker == "") {
type.ticker = "";
return type.ticker;
} else {
console.log("flightRecords tickerTemplate--->", that.flightRecords);
var sType = that.flightRecords.Ticker == undefined ? [] : that.flightRecords.Ticker;
var sValue = '';
var sTypeTicker = sType.find(elem => elem.HenListValueID == type.ticker);
if (sTypeTicker) {
return sValue = sTypeTicker.HenListValue;
}
}
}
/* ticker template editor */
private tickerEditor(container, options, that) {
this.rowDotMenuClick("true");
let grid = this.gridkendo.getGrid();
//let editable = grid.dataSource.options.schema.model.fields[options.field].editable;
let editable = true;
if (!editable) {
//if (editable == false) {
$('<span>' + options.model.ticker + '</span>').appendTo(container);
} else {
console.log("flightRecords tickerEditor--->", that.flightRecords);
var sType = that.flightRecords.Ticker;
var input = $('<input data-text-field="HenListValue" data-value-field="HenListValueID" data-bind="value:' + options.field + '"/>');
input.appendTo(container)
.kendoComboBox({
dataSource: sType,
dataTextField: "HenListValue",
dataValueField: "HenListValueID"
});
}
}
/* For displaying and editing days field */
private dayTemplate(day: any, that: any): any {
if (that.dayList) {
for (let i = 0; i < that.dayList.length; i++) {
if (day.dayOfWeek == undefined || day.dayOfWeek == null || day.dayOfWeek == "") {
day.dayOfWeek = "Monday";
return "Monday";
}
else if (that.dayList[i].day == day.dayOfWeek) {
let data = that.dayList[i].name;
let value = "<i>" + data + "</i>";
return value;
}
}
}
}
/* dayEditor method:For displaying and editing days field */
private dayEditor(container, options, that) {
this.rowDotMenuClick("true");
if (options.model.archiveFlag == "Y") {
$('<label>' + options.model.dayOfWeek + '</label>').appendTo(container);
} else {
let input = $('<input name="' + options.field + '" class="k-input" />').appendTo(container);
input.kendoComboBox(that.kendoComboBoxOptionDayEditor).appendTo(container);
$('.k-input-readonly').prop('readonly', true);
//that.enableSave();
}
}
MobileNotesEditor(container: any, options: any, that: any) {
let activeRow = that.gridkendo.selectedDotRow;
if (options.model.archiveFlag === "Y" || activeRow.statusName === "Approved") {
$("<label class='notesToolTip'><span title='" + options.model.description + "'>" + options.model.description + "</span></label>").appendTo(container);
} else {
$('<input name="' + options.field + '" class="k-input-readonly"/>').appendTo(container);
$("#notesDialogFeed").kendoWindow({
title: false,
width: "650px",
visible: false,
resizable: false,
draggable: false,
actions: false,
modal: true,
open: function (e) { $("html, body").css("overflow", "hidden"); },
close: function (e) { $("html, body").css("overflow", ""); },
activate: function () {
$('#notesData').focus();
}
});
let dialog = $("#notesDialogFeed").data("kendoWindow").center().open();
let notes = options.model.description;
if (options.model.description != null) {
notes = options.model.description
} else {
notes = "";
}
$(".notesDatacls").val(notes);
$(".notestOkCls").unbind().click(function () {
dialog.close();
let grid = that.gridkendo.getGrid();
let selectedRow = that.gridkendo.getGridselectedRow();
let notesVal = $(".notesDatacls").val()
if (selectedRow) {
let currentcell = grid.tbody.find(".k-edit-cell");
selectedRow.set("description", $.trim(notesVal));
grid.editCell(currentcell.next());
grid.closeCell(currentcell);
if (selectedRow.dirty == true) {
that.enableSave();
that.disableSavebutton = false;
that.disableOpenbutton = true;
}
}
$(".notesToolTip").kendoTooltip({ filter: "span[title]" });
});
$("#notesCancel").unbind().click(function () {
dialog.close();
let grid = that.gridkendo.getGrid();
let currentcell = grid.tbody.find(".k-edit-cell");
grid.editCell(currentcell.next());
grid.closeCell(currentcell);
$(".notesToolTip").kendoTooltip({ filter: "span[title]" });
//that.enableSave();
});
}
}
rowDotMenuClick(values: any): void {
let that = this;
if (values.selectedMenuItem == 'Delete') {
let strMessage = 'Are you sure you want to delete the selected Mobile?';
this.gridkendo.gridDeleteRow(values.Selectedrow, strMessage);
}
}
onTimeWidth(id, interval) {
setTimeout(function () {
let split = 1;
if (interval == 30) {
split = 2;
} else if (interval == 15) {
split = 4;
}
$('.k-animation-container').find('.k-list-container ul#' + id + '_timeview').parent().addClass('timeSplit' + split);
$('.k-animation-container').find('.k-list-container ul#' + id + '_timeview').parent().parent().addClass('timeSplit' + split);
$('#' + id + '_timeview li').css({ "float": "left", "width": 76, "font-size": "12px" });
}, 200);
}
/* Calculates week count based on start and end date */
calculateEndDate(givenDate, weekCount) {
let weekDaysCount = parseInt(weekCount) * 7;
weekDaysCount = weekDaysCount - 1;
let newDate = new Date(givenDate.getFullYear(), givenDate.getMonth(), givenDate.getDate() + weekDaysCount);
return newDate;
}
// handleWeek(newValue) {
// let SelectedStartDate = $('#startDate').data("kendoDatePicker").value();
// if (SelectedStartDate == undefined || SelectedStartDate == null) {
// SelectedStartDate = new Date();
// }
// let weekDays = this.calculateEndDate(SelectedStartDate, this.PlayerbusUpdateVal.weekCount);
// $('#endDate').data("kendoDatePicker").value(weekDays);
// this.validateSearch();
// }
handleWeek(newValue) {
if (newValue) {
let SelectedStartDate = this.PlayerbusUpdateVal.startDate;
if (SelectedStartDate === undefined || SelectedStartDate === null) {
SelectedStartDate = new Date();
}
this.PlayerbusUpdateVal.endDate = this.calculateEndDate(SelectedStartDate, this.PlayerbusUpdateVal.weekCount);
$("#endDate").data("kendoDatePicker").value(this.PlayerbusUpdateVal.endDate);
this.validateSearch();
}
}
updateEditOrReadonly(changeEditOrRead: any): void {
let that = this;
this.ccRadioFlags = {
"locked": changeEditOrRead.locked,
"startDate": changeEditOrRead.startDate,
"startTime": changeEditOrRead.startTime,
"blockDuration": changeEditOrRead.blockDuration,
"endTime": changeEditOrRead.endTime,
"programName": "false",
"programType": changeEditOrRead.programType,
"PlayerStartTime": "false",
"actualEndTime": changeEditOrRead.actualEndTime,
"actualDuration": changeEditOrRead.actualDuration,
"masterSeries": changeEditOrRead.masterSeries,
"version": changeEditOrRead.version,
"schedulingType": changeEditOrRead.schedulingType,
"format": changeEditOrRead.format,
"notes": changeEditOrRead.notes
};
let grid = that.gridkendo.getGrid();
let data = grid.dataSource.at(0);
data.fields["startDate"].editable = this.ccRadioFlags.startDate == "editable" ? true : false;
data.fields["startTime"].editable = this.ccRadioFlags.startTime == "editable" ? true : false;
data.fields["blockDuration"].editable = this.ccRadioFlags.blockDuration == "editable" ? true : false;
data.fields["endTime"].editable = this.ccRadioFlags.endTime == "editable" ? true : false;
data.fields["programName"].editable = this.ccRadioFlags.programName == "editable" ? true : false;
data.fields["programType"].editable = this.ccRadioFlags.programType == "editable" ? true : false;
data.fields["PlayerStartTime"].editable = this.ccRadioFlags.PlayerStartTime == "editable" ? true : false;
data.fields["actualEndTime"].editable = this.ccRadioFlags.actualEndTime == "editable" ? true : false;
data.fields["actualDuration"].editable = this.ccRadioFlags.actualDuration == "editable" ? true : false;
data.fields["masterSeries"].editable = this.ccRadioFlags.masterSeries == "editable" ? true : false;
data.fields["version"].editable = this.ccRadioFlags.version == "editable" ? true : false;
data.fields["schedulingType"].editable = this.ccRadioFlags.schedulingType == "editable" ? true : false;
data.fields["format"].editable = this.ccRadioFlags.format == "editable" ? true : false;
data.fields["notes"].editable = this.ccRadioFlags.notes == "editable" ? true : false;
}
// createPreferences() {
// this.createPreferencesPopUpWindow.data("kendoWindow").open();
// }
// cancelPreferences(): void {
// this.createPreferencesPopUpWindow.data("kendoWindow").close();
// }
// okPreferences(): void {
// this.createPreferencesPopUpWindow.data("kendoWindow").close();
// }
openCheck() {
//console.log('openCheck--->');
}
PlayerCheckBoxClick(e) {
// console.log('PlayerCheckBoxClick--->', e);
// this.count1 = this.count1 + 1;
// console.log('count 4--->' + this.count1);
// if (this.count1 % 3 == 0) {
// // apply new style
// console.log('multiple of 4--->' + this.count1);
// this.multipleOf3 = true;
// } else {
// this.multipleOf3 = false;
// }
}
// public threeState(event) {
// // attach event to button
// this.count1 = this.count1 + 1;
// //console.log('this.count--->' + this.count);
// if (this.count1 % 3 == 0) {
// // apply new style
// //console.log('multiple of 3--->' + this.count);
// this.multipleOf3 = true;
// } else {
// this.multipleOf3 = false;
// }
// }
public PlayerExport(): void {
//console.log("PlayerExport--->" + this.busGridData);
//this.busGridData;
let grid = this.gridkendo.getGrid();
//console.log("PlayerExport--->" + grid);
grid.hideColumn(1);
//console.log("datasource---->", datasource);
this.gridkendo.exportExcel();
//console.log("exportExcel--->", this.gridkendo.exportExcel());
grid.showColumn(1);
//console.log("PlayerExport---->");
this.gridkendo.setContextMenu();
//console.log("PlayerExport--->", this.gridkendo.setContextMenu());
}
private gridValidate() {
let that = this;
var rowData = [];
var grid = that.gridkendo.getGrid();
var gridData = grid.dataSource.data();
$.each(gridData, function (k, v) {
if (gridData[k].duplicateRow == true) {
rowData.push(gridData[k]);
}
});
if (rowData.length == 0) {
that.enableSave(false);
this.gridkendo.setdialog('No validation errors or warnings', "ok", null);
}
else {
that.enableSave(true);
//that.validateGridPopup.validateGrid(rowData);
}
}
// enableSave(action) {
// let that = this;
// that.saveEnable = action;
// }
public threeState(event) {
// attach event to button
this.count1 = this.count1 + 1;
//console.log('this.count--->' + this.count);
if (this.count1 % 3 == 0) {
// apply new style
//console.log('multiple of 3--->' + this.count);
this.multipleOf3 = true;
} else {
this.multipleOf3 = false;
}
}
// changePreference(event) {
// let that = this;
// let value = event.target.value;
// let grid = this.gridkendo.getGrid();
// if (value != '') {
// that.preferenceName = value;
// that.disablePrefAddEdit = true;
// /* selected pref details */
// let prefData = that.preferenceData;
// /* end */
// for (var k = 0; k < prefData.length; k++) {
// if (prefData[k].preferenceName == value) {
// let prefList = prefData[k].preferenceList;
// that.preferenceSetting(prefList);
// }
// }
// } else {
// that.disablePrefAddEdit = false;
// that.resetColumns(grid);
// this.gridCustomization();
// }
// }
changePreference(event) {
let that = this;
let value = event.target.value;
let grid = this.gridkendo.getGrid();
if (value != '') {
that.preferenceName = value;
that.disablePrefAddEdit = true;
/* selected pref details */
let prefData = that.preferenceData;
/* end */
let getPrefList = prefData.find(elem => elem.preferenceName == value);
if (getPrefList) {
that.preferenceSetting(getPrefList.preferenceList);
}
} else {
that.disablePrefAddEdit = false;
that.resetColumns(grid);
that.columns = Object.keys(this.resetPreferenceContext).map(i => this.resetPreferenceContext[i]);
// this.metaAggregateCopy.changeColumns = Object.keys(this.resetPreferenceContext).map(i => this.resetPreferenceContext[i]);
this.gridCustomization();
}
}
resetColumns(grid) {
for (var i = 0; i < grid.options.columns.length; i++) {
var field = grid.options.columns[i].field;
for (var j = 0; j < grid.columns.length; j++) {
if (grid.columns[j].field == field) {
grid.reorderColumn(i, grid.columns[j]);
}
}
}
}
gridCustomization() {
let that = this;
let columnData = that.columns;
// let columnData = [
// {
// airingHen: "Mobile Name",
// airingHenParms: "MobileName",
// readOnly: false,
// editable: true,
// default: true,
// visible: false
// }
// ];
that.changeColsHen();
let grid = this.gridkendo.getGrid();
let gridLen = grid.dataSource.data().length
let colLen = columnData.length;
for (let j = 3; j < grid.columns.length; j++) {
grid.hideColumn(grid.columns[j].field);
}
for (var i = 0; i < colLen; i++) {
//Default ->true AND Visible -> true
//show in grid and hide in right click
if (columnData[i].default == true && columnData[i].visible == true) {
grid.showColumn(columnData[i].airingHenParms);
}
//Default ->true AND Visible -> False
//hide both grid and right click
if (columnData[i].default == true && columnData[i].visible == false) {
grid.hideColumn(columnData[i].airingHenParms);
}
//Default ->false AND Visible -> true
//show in grid and show in right click with checked items
if (columnData[i].default == false && columnData[i].visible == true) {
grid.showColumn(columnData[i].airingHenParms);
}
//Default ->false AND Visible -> False
//hide in grid, show in right click with unchecked items
if (columnData[i].default == false && columnData[i].visible == false) {
grid.hideColumn(columnData[i].airingHenParms);
}
}
}
changeColsHen() {
let props = this.tempset;
let grid = this.gridkendo.getGrid();
if (props) {
for (var i = 0; i < props.length; i++) {
var fName = props[i].airingHenParms;
if (grid.dataSource.options.schema.model.fields[fName]) {
grid.dataSource.options.schema.model.fields[fName].editable = props[i].editable;
}
}
}
console.log(grid)
}
private preferenceSetting(list) {
let gridCol;
let grid = this.gridkendo.getGrid();
for (let j = 0; j < grid.columns.length; j++) {
grid.hideColumn(grid.columns[j].field);
}
for (let i = 0; i < list.length; i++) {
let position = parseInt(list[i].visiblePosition + "");
if (list[i].columnName == 'day') { list[i].columnName = 'dayOfWeekNo'; }
if (list[i].visibleState) {
grid.showColumn(list[i].columnName);
}
gridCol = grid.columns.find(function (m, n) { return grid.columns[n].field == list[i].columnName; })
grid.reorderColumn(position, gridCol);
}
}
createPreferences() {
let that = this;
$('#createPreferencesPopup .kPopUpTitle').text('Add Preferences');
$('.preferenceName').val('');
let dialogConfirm = $("#createPreferencesPopup").data("kendoWindow").center().open();
$("#okPreferences").unbind().click(function () {
that.createUpdatePreference('create');
dialogConfirm.close();
});
$("#cancelPreferences").unbind().click(function () {
dialogConfirm.close();
});
}
editPreferences() {
let that = this;
$('#createPreferencesPopup .kPopUpTitle').text('Edit Preferences');
//let dialogConfirm = $("#createPreferencesPopUpWindow").data("kendoWindow").center().open();
let dialogConfirm = $("#createPreferencesPopup").data("kendoWindow").center().open();
$('.preferenceName').val(that.preferenceName);
$('.okPreferences').attr('disabled', 'disabled');
$("#okPreferences").unbind().click(function () {
that.createUpdatePreference('update');
dialogConfirm.close();
});
$("#cancelPreferences").unbind().click(function () {
dialogConfirm.close();
});
}
checkPrefName(event) {
let that = this;
let value = event.target.value;
if ($.trim(value) != '') {
$('.okPreferences').removeAttr('disabled');
} else {
$('.okPreferences').attr('disabled', 'disabled');
}
}
createUpdatePreference(type) {
let that = this;
let prefValue = $('.preferenceName').val();
console.log(" createUpdatePreference prefValue--->" + prefValue);
let len = that.preferenceData.length;
let checkExist = false;
for (let i = 0; i < len; i++) {
// if (that.preferenceData[i].preferenceName.toLowerCase() == prefValue.toLowerCase()) {
if (true) {
checkExist = true;
break;
}
}
if (type == 'create') {
if (checkExist) {
let strMessage = 'Preferences name already exist.';
that.gridkendo.setdialog(strMessage, "ok", null);
} else {
let preferenceData = this.getPreference();
let createPref: any = {
//"FishNo": this.busCreateVal.FishNo,
//busCreateValPlayer
"FishNo": this.busCreateValPlayer.FishNo,
"operationType": "Create",
"preferenceName": prefValue,
"preferenceNo": "",
"preferenceList": preferenceData
};
that.preferenceData.push(createPref);
that.preferenceName = prefValue;
console.log(" that.preferenceName--->" , that.preferenceName);
// that.prefSelectedName = prefValue;
}
} else {
for (let i = 0; i < len; i++) {
if (that.preferenceData[i].preferenceName == that.preferenceName) {
that.preferenceData[i].preferenceName = prefValue;
console.log(" that.preferenceData[i].preferenceName--->" , that.preferenceData[i].preferenceName);
that.preferenceData[i].operationType = 'update';
break;
}
}
}
that.disablePrefSave = false;
}
clearPreferences() {
let that = this;
let prefValue = $('.preferenceName').val();
console.log(" clearPreferences prefValue--->" + prefValue);
let len = that.preferenceData.length;
let checkExist = that.preferenceData.includes(prefValue);
let strMessage = 'Are you sure you want to delete the selected preferences?';
let getPrefNo;
$('#commonPopup .kPopUpTitle').text('SKY');
$("#commonPopup .kendoContent").text(strMessage);
let dialogConfirm = $("#commonPopup").data("kendoWindow").center().open();
$("#popupOK").unbind().click(function () {
// that.progress.requestStart();
for (let i = 0; i < len; i++) {
if (that.preferenceData[i].preferenceName == that.preferenceName) {
getPrefNo = that.preferenceData[i].preferenceNo;
that.preferenceData.splice(i, 1);
break;
}
}
that.SPORTSService.getResponse('authorization/v1/deletePreferences?preferenceNo=' + getPrefNo, 'delete', {}).subscribe(data => {
that.disablePrefSave = true;
that.disablePrefAddEdit = false;
// that.progress.requestEnd();
}, err => {
console.log("clearPreferences error");
// that.progress.requestEnd();
});
dialogConfirm.close();
});
$("#popupCancel").unbind().click(function () {
dialogConfirm.close();
});
}
cancelPreferences() {
$("#createPreferencesPopup").data("kendoWindow").close();
}
// private savePreferences() {
// let that = this;
// let preferenceData = this.getPreference();
// // console.log(preferenceData);
// let data = {
// "FishNo": this.busCreateVal.FishNo,
// "operationType": "Create",
// "preferenceName": this.preferenceName,
// "preferenceNo": "",
// "preferenceList": preferenceData
// };
// for (var i = 0; i < this.preferenceData.length; i++) {
// if (that.preferenceData[i].preferenceName == that.preferenceName) {
// that.preferenceData[i].preferenceList = [];
// that.preferenceData[i].preferenceList = preferenceData;
// break;
// }
// }
// // this.preferenceData.push(data);
// //this.progress.requestStart();
// console.log(preferenceData);
// this.SPORTSService.getResponse('authorization/v1/savePreferences', 'post', data).subscribe(
// data => {
// console.log(data);
// this.disablePrefSave = true;
// // this.progress.requestEnd();
// },
// err => {
// console.log("error");
// // this.progress.requestEnd();
// });
// }
private savePreferences() {
let that = this;
let preferenceData = this.getPreference();
// console.log(preferenceData);
let data = {
"FishNo": this.busCreateVal.FishNo,
"operationType": "Create",
"preferenceName": this.preferenceName,
"preferenceNo": "",
"preferenceList": preferenceData
};
for (var i = 0; i < this.preferenceData.length; i++) {
if (that.preferenceData[i].preferenceName == that.preferenceName) {
that.preferenceData[i].preferenceList = [];
that.preferenceData[i].preferenceList = preferenceData;
break;
}
}
// this.preferenceData.push(data);
//this.progress.requestStart();
console.log(preferenceData);
this.SPORTSService.getResponse('authorization/v1/savePreferences', 'post', data).subscribe(
data => {
console.log(data);
this.disablePrefSave = true;
// this.progress.requestEnd();
},
err => {
console.log("error");
// this.progress.requestEnd();
});
}
private getPreference(): any {
let savePreference = [];
//let columns=this.metaAggregateCopy.changeColumns;
// let columns = [{}];
let that = this;
let columns = that.columns;
let grid = this.gridkendo.getGrid();
for (let i = 0; i < grid.columns.length; i++) {
let visibleState = false;
if (grid.columns[i].hidden) {
visibleState = false
} else {
visibleState = true;
}
let preferenceValue = {
"columnName": grid.columns[i].field,
"visiblePosition": i,
"visibleState": visibleState
}
savePreference.push(preferenceValue);
}
return savePreference;
}
lockedMobileMsgShow(responseData) {
let that = this;
//let lockedMobileMsg = responseData.msg;
let lockedMobileMsg = ["Mobile April 2018 old 2.13.18 (packet) for USA N…cked out by Thirukumaran Palani (SSO: 206492110)."]
let getMessageDetail = "";
for (let k = 0; k < lockedMobileMsg.length; k++) {
getMessageDetail = getMessageDetail + ("<div style='margin: 15px 0px;'>" + lockedMobileMsg[k] + "</div>");
}
$('#lockedMobilePopup .kPopUpTitle').text('Scheduling');
$("#lockedMobilePopup .kendoContent").html(getMessageDetail);
let confirm = $("#lockedMobilePopup").data("kendoWindow").center().open();
$("#lockedMobilePopupOK").unbind().click(function () {
confirm.close();
that.callGridLoadData(responseData);
});
$("#lockedMobilePopupCancel").unbind().click(function () {
confirm.close();
});
}
callGridLoadData(responseData) {
let that = this;
//if (responseData.schedItems.length > 0) {
// if (responseData > 0) {
// response.data.properties
this.busGridData = responseData;
this.flightRecords = responseData;
console.log("callGridLoadData this.flightRecords--->", that.flightRecords);
this.gridDataLoad();
//this.loadPreference(this.busCreateVal.FishNo);
//}
}
showMobilesDaterangePopup(responseData) {
let that = this;
$("#airingsDatarangePopup .kendoContent").html("Airings are created only for the selected Mobile(s) date range");
let warningMsg = $("#airingsDatarangePopup").data("kendoWindow").center().open();
$("#airingsDatarangePopupOk").unbind().click(function () {
warningMsg.close();
if (responseData.msg.length > 0) {
that.lockedMobileMsgShow(responseData);
} else {
that.callGridLoadData(responseData);
}
});
}
lockedMobilePopup(dialogId) {
$(dialogId).kendoWindow({
title: false,
width: "700px",
visible: false,
resizable: false,
draggable: false,
modal: true,
actions: {},
open: function (e) { $("html, body").css("overflow", "hidden"); },
close: function (e) { $("html, body").css("overflow", ""); }
});
}
reloadGridDataSource() {
this.gridkendo.reloadDataSource(this.busGridData);
}
saveGrid() {
let that = this;
let grid = that.gridkendo.getGrid();
// this.progress.requestStart();
//let gridData = { "FishStartSeconds": this.busCreateVal.FishStartSeconds, "schedItems": grid.dataSource.data() };
let gridData = {
"FishStartSeconds": 21600,
"schedItems": [{
"duplicateRow": false,
"gridCheck": true,
"removeType": false,
"overlap": null,
"schedItemNo": 0,
"dayOfWeekNo": 2,
"day": "Wednesday",
"seqNo": 1,
"MobileNo": 89833,
"MobileName": "NBC Sports Bay Area",
"titleNo": null,
"seriesNo": "",
"titleVersionNo": null,
"houseNo": "",
"versionName": null,
"versionLength": null,
"formatName": null,
"calPeriodNo": null,
"schedCategoryNo": null,
"schedProgTypeNo": null,
"startTime": "08:00 AM",
"endTime": "08:30 AM",
"actualStartTime": "08:00 AM",
"actualDuration": "00:30",
"actualEndTime": "06:00 AM",
"programStartTime": null,
"programEndTime": null,
"startDate": "04/18/2018",
"endDate": "04/18/2018",
"programName": "",
"programLength": null,
"programType": "",
"noOfGridBlocks": null,
"notableEventFlag": null,
"specialEventFlag": null,
"subnetBlock": null,
"locked": null,
"promoRun": null,
"userAdded": null,
"dateAdded": null,
"userUpdated": null,
"dateUpdated": null,
"seasonNo": null,
"feedNo": 37,
"formatNo": "",
"FishNo": 237,
"manualChangeFlag": null,
"crossPlatform": null,
"translation": null,
"longFormEventFlag": null,
"nrcstitleNo": null,
"listValue01": null,
"listValue02": "",
"listValue03": null,
"listValue04": null,
"listValue05": null,
"dateTimeValue01": null,
"textValue01": null,
"listValue06": null,
"isLockedFlag": null,
"customFormatDescription": null,
"PlayerFlag": false,
"PlayerDate": "",
"PlayerStartTime": "",
"PlayerDuration": "",
"PlayerEndTime": "",
"PlayerSource": "",
"PlayerNotes": null,
"PlayerHDFlag": null,
"PlayerRecordFlag": null,
"Signal": "",
"ticker": "",
"Fish": null,
"sddelivery": "",
"hddelivery": "",
"dbsspotbeam": "",
"tvestatus": "",
"titleName": null,
"action": "Added",
"seriesName": "",
"contractName": null,
"MobileTypeNo": "",
"distEpisodeID": null,
"stereoFlag": null,
"closeCaptionFlag": null,
"commentSeq": null,
"titleType": null,
"desFish": "",
"userAddedName": null,
"userUpdatedName": null,
"titleOwnerFish": "",
"tveRightHenNo": null,
"multipleSelectedID": null,
"seasonName": null,
"commentNo": null,
"commentText": "",
"schedCategory": "",
"schedProgType": "",
"blockDuration": "00:30",
"contractNo": null,
"programCode": "",
"MobileDefinitionNo": "",
"pgrating": null,
"readyFlag": null,
"alternateColor": null,
"des": null,
"vod": null,
"closedCaptioning": null,
"id": ""
}]
};
console.log(gridData);
//let response={"code":"S001","message":"Success","data":{"added":7,"updated":0,"deleted":7,"conflicts":[{"weekDay":"Wednesday","date":"04/11/2018","time":"10:00:00 AM","programName":"LAW & ORDER: SVU ","titleName":"ROCKABYE","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Thursday","date":"04/12/2018","time":"10:00:00 AM","programName":"CHICAGO P.D.","titleName":"WRONG SIDE OF THE BARS","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Friday","date":"04/13/2018","time":"10:00:00 AM","programName":"NCIS: LOS ANGELES (F)","titleName":"PURITY","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Saturday","date":"04/14/2018","time":"10:00:00 AM","programName":"NCIS (LUCKY DUCKY MARATHON)","titleName":"BLOWBACK","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Sunday","date":"04/15/2018","time":"10:00:00 AM","programName":"LAW & ORDER: SVU (NOTORIOUS S.V.U. MARATHON)","titleName":"ROOFTOP","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Monday","date":"04/16/2018","time":"10:00:00 AM","programName":"NCIS","titleName":"ENEMY COMBATANT","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"},{"weekDay":"Tuesday","date":"04/10/2018","time":"10:00:00 AM","programName":"NCIS ","titleName":"DEJA VU","prevUpdatedBy":"Brian Marquis","prevUpdatedDate":"2018-03-27 17:59:22.0","action":"Overlaps deleted","MobileName":"April 2018 old as of 3.23.18"}]}}
this.SPORTSService.getResponse("Mobiles/v1/buscreate/save/", "post", gridData).subscribe(response => {
console.log(response);
this.totalAiringsCount = response.data.added;
this.totalUpdates = response.data.updated;
this.totalDeletes = response.data.deleted;
this.saveResponseNotify(response.data);
// this.progress.requestEnd();
}, err => {
//this.progress.requestEnd();
});
}
saveResponseNotify(savedResponse) {
let that = this;
this.createDialog("#saveWarningPopup");
let dialogConfirm = $("#saveWarningPopup").data("kendoWindow").center().open();
$("#saveWarningPopupOk").unbind().click(function () {
dialogConfirm.close();
if (savedResponse.conflicts.length > 0) {
//that.buscreateConflictGridPopup.conflictGridOpen(savedResponse.conflicts);
that.PlayerConflictGridPopup.conflictGridOpen(savedResponse.conflicts);
} else {
that.busGridData = [];
that.reloadGridDataSource();
that.enableSave(true);
}
});
}
closeConflictGrid() {
this.busGridData = [];
this.gridkendo.reloadDataSource(this.busGridData);
this.enableSave(true);
}
enableSave(action) {
let that = this;
that.saveBtnEnableDisable = action;
}
createDialog(dialogId) {
$(dialogId).kendoWindow({
title: false,
width: "350px",
visible: false,
resizable: false,
draggable: false,
modal: true,
actions: {},
open: function (e) { $("html, body").css("overflow", "hidden"); },
close: function (e) { $("html, body").css("overflow", ""); }
});
}
onDataBound(e) {
let that = this;
let grid = that.gridkendo.getGrid();
var gridData = e.sender.dataSource.data();
//console.log(e)
for (var i = 0; i < gridData.length; i++) {
if (gridData[i].gridCheck == true) {
e.sender.tbody.find("tr[data-uid='" + gridData[i].uid + "'] td .gridCheckBox").attr('checked', true);
} else {
e.sender.tbody.find("tr[data-uid='" + gridData[i].uid + "'] td .gridCheckBox").removeAttr('checked');
}
if (gridData[i].duplicateRow == true) {
$('.busCreateGrid .k-grid-content tbody').find("tr[data-uid='" + gridData[i].uid + "']").addClass('duplicateRows');
console.log('called exist highlight')
}
// if (that.showOverlap == false) {
// if (gridData[i].action == 'Delete') {
// e.sender.tbody.find("tr[data-uid='" + gridData[i].uid + "']").hide();
// $('.busCreateGrid .k-grid-content-locked tbody').find("tr[data-uid='" + gridData[i].uid + "']").hide();
// }
// } else {
// if (gridData[i].action == 'Delete') {
// e.sender.tbody.find("tr[data-uid='" + gridData[i].uid + "']").show();
// $('.busCreateGrid .k-grid-content-locked tbody').find("tr[data-uid='" + gridData[i].uid + "']").show();
// e.sender.tbody.find("tr[data-uid='" + gridData[i].uid + "']").addClass("rowDisabled");
// $('.busCreateGrid .k-grid-content-locked tbody').find("tr[data-uid='" + gridData[i].uid + "']").addClass("rowDisabled");
// }
// }
}
$(".gridCheckBox").unbind().bind("click", function (e) {
var myItem = grid.dataItem($(this).closest("tr"));
myItem.gridCheck = (myItem.gridCheck) ? false : true;
if (myItem.gridCheck == false) {
that.totalAiringsCount -= 1;
} else {
that.totalAiringsCount += 1;
}
if (that.totalAiringsCount == 0) {
that.disableNoAirings = true;
} else {
that.disableNoAirings = false;
}
});
}
busContextMenu() {
let that = this;
//var contextMenu = $("#bus-context-menu").kendoContextMenu().data("kendoContextMenu");
setTimeout(function () {
$("#bus-context-menu").kendoContextMenu({
target: "#KendoGridView .k-grid-header thead tr:nth-child(1)",
animation: {
open: {
effects: "fadeIn"
}
//,
//closeOnClick: false
},
open: function (e) {
that.busKeys = [];
let contextRow = '';
var columns = that.columns;
//var columns = that.metaAggregateCopy.changeColumns;
// var columns = [
// { airingHen: "Locked", airingHenParms: "locked", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Mobile Name", airingHenParms: "MobileName", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Feed Name", airingHenParms: "feedNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Start Date", airingHenParms: "startDate", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Day Of Week", airingHenParms: "dayOfWeekNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Start Time", airingHenParms: "startTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Block Duration", airingHenParms: "blockDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "End Time", airingHenParms: "endTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual Start Time", airingHenParms: "actualStartTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual Duration", airingHenParms: "actualDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual End Time", airingHenParms: "actualEndTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Name", airingHenParms: "programName", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Flag", airingHenParms: "PlayerFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Date", airingHenParms: "PlayerDate", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Start Time", airingHenParms: "PlayerStartTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Duration", airingHenParms: "PlayerDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player End Time", airingHenParms: "PlayerEndTime", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Player Source/Provider", airingHenParms: "PlayerSource", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Notes", airingHenParms: "PlayerNotes", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "HD", airingHenParms: "PlayerHDFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Record", airingHenParms: "PlayerRecordFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Signal", airingHenParms: "Signal", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Ticker", airingHenParms: "ticker", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Fish", airingHenParms: "desFish", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "SD Delivery", airingHenParms: "sddelivery", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "HD Delivery", airingHenParms: "hddelivery", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "DBS Spotbeam", airingHenParms: "dbsspotbeam", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "TVE Status", airingHenParms: "tvestatus", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Type", airingHenParms: "programType", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Master Series", airingHenParms: "seriesNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Code", airingHenParms: "programCode", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Alternate Color", airingHenParms: "alternateColor", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Title Name", airingHenParms: "titleName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Title Owner Fish", airingHenParms: "titleOwnerFish", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Episode #", airingHenParms: "distEpisodeID", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Season", airingHenParms: "seasonName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Version", airingHenParms: "houseNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Scheduling Type", airingHenParms: "MobileTypeNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Closed Captioning", airingHenParms: "closedCaptioning", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "VOD", airingHenParms: "vod", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "DES", airingHenParms: "des", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Scheduling Category", airingHenParms: "schedCategory", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Definition", airingHenParms: "MobileDefinitionNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Format", airingHenParms: "formatNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Format Description", airingHenParms: "formatName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Notes", airingHenParms: "commentText", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Mobile Item #", airingHenParms: "schedItemNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Title #", airingHenParms: "titleNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "User Added", airingHenParms: "userAddedName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Date Added", airingHenParms: "dateAdded", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "User Updated", airingHenParms: "userUpdatedName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Date Updated", airingHenParms: "dateUpdated", readOnly: true, editable: false, editableDisabled: true }
// ]
$('.busSpan').html('');
var windowHeight = $(window).height();
let cols = [];
let grid = $("#KendoGridView").data("kendoGrid");
var gridColumns = grid.columns;
if (gridColumns.length > 0) {
for (var i = 3; i < gridColumns.length; i++) {
var colx = gridColumns[i];
if (colx.field != undefined) {
//cols.push(col.field);
var index = -1;
var val = colx.field;
var filteredObj = columns.find(function (item, k) {
if (item.airingHenParms === val) {
index = k;
return k;
}
});
var col = columns[index];
if (col != undefined) {
//Default ->true AND Visible -> true
//show in grid and hide in right click
if (col.default == true && col.visible == true) {
contextRow += '';
}
//Default ->true AND Visible -> False
//hide both grid and right click
if (col.default == true && col.visible == false) {
contextRow += '';
}
//Default ->false AND Visible -> true
//show in grid and show in right click with checked items
if (col.default == false && col.visible == true) {
if (grid.columns[i].hidden) {
contextRow += '<li><label><input type="checkbox" id="' + col.airingHenParms + '" class="hideShowColumn"> ' + col.airingHen + '</label></li>'
} else {
contextRow += '<li><label><input type="checkbox" checked="checked" id="' + col.airingHenParms + '" class="hideShowColumn"> ' + col.airingHen + '</label></li>'
}
}
//Default ->false AND Visible -> False
//hide in grid, show in right click with unchecked items
if (col.default == false && col.visible == false) {
//if (true) {
if (grid.columns[i].hidden) {
contextRow += '<li><label><input type="checkbox" id="' + col.airingHenParms + '" class="hideShowColumn" > ' + col.airingHen + '</label></li>'
} else {
contextRow += '<li><label><input type="checkbox" id="' + col.airingHenParms + '" class="hideShowColumn" > ' + col.airingHen + '</label></li>'
}
}
}
}
}
}
//
// if (columns.length > 0) {
// for (var i = 0; i < columns.length; i++) {
// var col = columns[i];
// if (col.airingHenParms != undefined) {
// if (col.airingHenParms == 'userAdded') {
// col.airingHenParms = 'userAddedName';
// }
// if (col.airingHenParms == 'userUpdated') {
// col.airingHenParms = 'userUpdatedName';
// }
// //Default ->true AND Visible -> true
// //show in grid and hide in right click
// if (col.default == true && col.visible == true) {
// contextRow += '';
// }
// //Default ->true AND Visible -> False
// //hide both grid and right click
// if (col.default == true && col.visible == false) {
// contextRow += '';
// }
// //Default ->false AND Visible -> true
// //show in grid and show in right click with checked items
// if (col.default == false && col.visible == true) {
// contextRow += '<li><label><input type="checkbox" checked="checked" id="' + col.airingHenParms + '" class="hideShowColumn" data-value="' + i + '"> ' + col.airingHen + '</label></li>'
// // contextRowArr.push(col.airingHenParms)
// }
// //Default ->false AND Visible -> False
// //hide in grid, show in right click with unchecked items
// if (col.default == false && col.visible == false) {
// contextRow += '<li><label><input type="checkbox" id="' + col.airingHenParms + '" class="hideShowColumn" data-value="' + i + '"> ' + col.airingHen + '</label></li>'
// //contextRowArr.push(col.airingHenParms);
// }
// }
// }
// }
//contextRow=contextRow.move(0,3);
var gridStates = that.getPreference();
//console.log(gridStates)
//console.log(contextRowArr)
//that.contextmenuReorder(contextRowArr,0,3)
$('.busSpan').append(contextRow);
$('.busSpan').parent().parent().css({ "height": (windowHeight - 100), "overflow": "auto", "width": "auto !important" })
$('.busSpan').parent().css({ "height": (windowHeight - 100), "overflow": "auto", "width": "auto !important" })
}
});
}, 10);
$('#bus-context-menu').on('mousedown', function (e) {
e.stopImmediatePropagation();
});
$('#bus-context-menu').on('change', '.hideShowColumn', function (e) {
e.stopImmediatePropagation();
let grid = that.gridkendo.getGrid();
let val = $(this).attr("id");
let columns = that.columns;
// let columns = that.metaAggregateCopy.changeColumns;
// let columns = [
// { airingHen: "Locked", airingHenParms: "locked", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Mobile Name", airingHenParms: "MobileName", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Feed Name", airingHenParms: "feedNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Start Date", airingHenParms: "startDate", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Day Of Week", airingHenParms: "dayOfWeekNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Start Time", airingHenParms: "startTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Block Duration", airingHenParms: "blockDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "End Time", airingHenParms: "endTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual Start Time", airingHenParms: "actualStartTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual Duration", airingHenParms: "actualDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual End Time", airingHenParms: "actualEndTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Name", airingHenParms: "programName", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Flag", airingHenParms: "PlayerFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Date", airingHenParms: "PlayerDate", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Start Time", airingHenParms: "PlayerStartTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Duration", airingHenParms: "PlayerDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player End Time", airingHenParms: "PlayerEndTime", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Player Source/Provider", airingHenParms: "PlayerSource", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Notes", airingHenParms: "PlayerNotes", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "HD", airingHenParms: "PlayerHDFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Record", airingHenParms: "PlayerRecordFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Signal", airingHenParms: "Signal", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Ticker", airingHenParms: "ticker", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Fish", airingHenParms: "desFish", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "SD Delivery", airingHenParms: "sddelivery", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "HD Delivery", airingHenParms: "hddelivery", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "DBS Spotbeam", airingHenParms: "dbsspotbeam", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "TVE Status", airingHenParms: "tvestatus", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Type", airingHenParms: "programType", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Master Series", airingHenParms: "seriesNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Code", airingHenParms: "programCode", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Alternate Color", airingHenParms: "alternateColor", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Title Name", airingHenParms: "titleName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Title Owner Fish", airingHenParms: "titleOwnerFish", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Episode #", airingHenParms: "distEpisodeID", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Season", airingHenParms: "seasonName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Version", airingHenParms: "houseNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Scheduling Type", airingHenParms: "MobileTypeNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Closed Captioning", airingHenParms: "closedCaptioning", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "VOD", airingHenParms: "vod", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "DES", airingHenParms: "des", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Scheduling Category", airingHenParms: "schedCategory", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Definition", airingHenParms: "MobileDefinitionNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Format", airingHenParms: "formatNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Format Description", airingHenParms: "formatName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Notes", airingHenParms: "commentText", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Mobile Item #", airingHenParms: "schedItemNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Title #", airingHenParms: "titleNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "User Added", airingHenParms: "userAddedName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Date Added", airingHenParms: "dateAdded", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "User Updated", airingHenParms: "userUpdatedName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Date Updated", airingHenParms: "dateUpdated", readOnly: true, editable: false, editableDisabled: true }
// ];
var index = -1;
var filteredObj = columns.find(function (item, k) {
if (item.airingHenParms === 'userAddedName') {
item.airingHenParms = 'userAdded';
}
if (item.airingHenParms === 'userUpdatedName') {
item.airingHenParms = 'userUpdate'
}
if (item.airingHenParms === val) {
index = k;
return k;
}
});
let dataVal = index;
// that.metaAggregateCopy.changeColumns = [
// { airingHen: "Locked", airingHenParms: "locked", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Mobile Name", airingHenParms: "MobileName", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Feed Name", airingHenParms: "feedNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Start Date", airingHenParms: "startDate", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Day Of Week", airingHenParms: "dayOfWeekNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Start Time", airingHenParms: "startTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Block Duration", airingHenParms: "blockDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "End Time", airingHenParms: "endTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual Start Time", airingHenParms: "actualStartTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual Duration", airingHenParms: "actualDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Actual End Time", airingHenParms: "actualEndTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Name", airingHenParms: "programName", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Flag", airingHenParms: "PlayerFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Date", airingHenParms: "PlayerDate", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Start Time", airingHenParms: "PlayerStartTime", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Duration", airingHenParms: "PlayerDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player End Time", airingHenParms: "PlayerEndTime", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Player Source/Provider", airingHenParms: "PlayerSource", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Player Notes", airingHenParms: "PlayerNotes", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "HD", airingHenParms: "PlayerHDFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Record", airingHenParms: "PlayerRecordFlag", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Signal", airingHenParms: "Signal", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Ticker", airingHenParms: "ticker", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Fish", airingHenParms: "desFish", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "SD Delivery", airingHenParms: "sddelivery", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "HD Delivery", airingHenParms: "hddelivery", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "DBS Spotbeam", airingHenParms: "dbsspotbeam", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "TVE Status", airingHenParms: "tvestatus", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Type", airingHenParms: "programType", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Master Series", airingHenParms: "seriesNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Program Code", airingHenParms: "programCode", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Alternate Color", airingHenParms: "alternateColor", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Title Name", airingHenParms: "titleName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Title Owner Fish", airingHenParms: "titleOwnerFish", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Episode #", airingHenParms: "distEpisodeID", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Season", airingHenParms: "seasonName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Version", airingHenParms: "houseNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Scheduling Type", airingHenParms: "MobileTypeNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Closed Captioning", airingHenParms: "closedCaptioning", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "VOD", airingHenParms: "vod", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "DES", airingHenParms: "des", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Scheduling Category", airingHenParms: "schedCategory", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Definition", airingHenParms: "MobileDefinitionNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Format", airingHenParms: "formatNo", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Format Description", airingHenParms: "formatName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Notes", airingHenParms: "commentText", readOnly: false, editable: true, editableDisabled: false },
// { airingHen: "Mobile Item #", airingHenParms: "schedItemNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Title #", airingHenParms: "titleNo", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "User Added", airingHenParms: "userAddedName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Date Added", airingHenParms: "dateAdded", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "User Updated", airingHenParms: "userUpdatedName", readOnly: true, editable: false, editableDisabled: true },
// { airingHen: "Date Updated", airingHenParms: "dateUpdated", readOnly: true, editable: false, editableDisabled: true }
// ];
/*if(val=="dayOfWeek"){that.metaAggregateCopy.changeColumns[dataVal].airingHenParms="day";}*/
if (val == "userAdded") { that.columns[dataVal].airingHenParms = "userAddedName"; }
if (val == "userUpdated") { that.columns[dataVal].airingHenParms = "userUpdatedName"; }
//that.metaAggregateCopy.changeColumns[dataVal].visible = false;
that.columns[dataVal].visible = (that.columns[dataVal].visible == true) ? false : true;
// that.metaAggregateCopy.changeColumns[dataVal].visible = (that.metaAggregateCopy.changeColumns[dataVal].visible == true) ? false : true;
if ($(this).is(':checked')) {
//grid.showColumn(that.metaAggregateCopy.changeColumns[dataVal].airingHenParms);
// grid.showColumn("MobileName");
grid.showColumn(that.columns[dataVal].airingHenParms);
}
else {
// setTimeout(function(){
// grid.hideColumn(that.metaAggregateCopy.changeColumns[dataVal].airingHenParms);
// grid.hideColumn("MobileName");
grid.hideColumn(that.columns[dataVal].airingHenParms);
// },100)
}
});
}
// gridSave() {
// let rowData = [];
// this.validateGridPopup.validateGrid(rowData);
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment