Skip to content

Instantly share code, notes, and snippets.

@niniyzni niniyzni/column.ts
Created Apr 27, 2018

Embed
What would you like to do?
import { Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core';
import { ballUService } from '../../services/ballu.service';
import { ProgressCircle } from '../shared/progress/progress-circle';
import { Router } from '@angular/router';
import { NetworkCarousel } from '../shared/content/network-carousel';
import { KendoGridComponent } from '../grid/grid.component';
//import { GridHeaderContext } from '../shared/gridHeaderContext/gridHeaderContext';
//import { ValidateGridPopup } from './papercrete-validate-popup';
import { wireConflictGridPopup } from './wire-conflict-popup';
import { IMultiSelectSettings } from '../common/multiselect-dropdown';
@Component({
selector: 'sportsPlayers',
templateUrl: "./wire-paper-update.html",
})
export class sportsPlayers {
private selectedNetworkArr: any = { networkNo: -1, };
private networkTempArray;
private networkObj = { "Label": "Networks", isHintShow: false };
private sportsPlayersVal: any = {
networkNo: 237,
startDate: new Date(),
weekCount: 1,
endDate: '',
programName: '',
titleName: '',
wire: '',
action: "GO",
addOns: [
'wire_NETWORKS'
]
}
private sportsPlayersLovs: any = {
wireNetworks: ''
}
//private count1:any;
public count1: number = 0;
private createSKYhighsPopUpWindow;
private dynamicPropertyName: string;
private notThreeDotDisable = false;
private wireCheckBox: any = true;
public saveEnable = true;
private checkedRowsUID = [];
public multipleOf3 = false;
private totalAiringsCount = 0;
private isDisplayEdit = false;
private contextTitleBtn = false;
public contextDisableAllOpt = false;
public columnEditableOpt = false;
/*for SKYhighs */
private tempset;
private metaAggregateCopy;
private SKYhighData: any = [];
private SKYhighName;
private disablePrefAddEdit = false;
private disablePrefSave = true;
private prefSelectedName: any = '';
private gridDataAll: 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 paperKeys = [];
private ccRadioFlags = {
"locked": "editable",
"startDate": "editable",
"startTime": "editable",
"blockDuration": "editable",
"endTime": "editable",
"programName": "editable",
"programType": "editable",
"wireStartTime": "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-SchedulesListEvents",
excelFileName: {
fileName: "ScheduleListExport",
allPages: true
},
change: function (e) {
$('tr').find('[type=checkbox]').prop('checked', false);
$('tr.k-state-selected').find('[type=checkbox]').prop('checked', true);
},
searchFields: []
};
private wireDataAPI: any = [];
private colHeaderMenuArr = {
"columnMenu": {
"gridId": "",
"menu": {
"scheduleName": "Schedule Name",
"schedItemNo": "Schedule Item",
"startDate": "Schedule 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 Network",
"episode": "wire Flag",
"season": "wire Date",
"wireStartTime": "wire Start Time",
"wireDuration": "wire Duration",
"wireEndTime": "wire End Time",
"wireSource": "wire Source/Provider",
"notes": "wire Notes",
"hd": "HD",
"record": "Record",
"bug": "Bug",
"ticker": "Ticker",
"addedUser": "User Added",
"dateAdded": "Date Added",
"updatedUser": "User Updated",
"dateUpdated": "Date Updated"
}
}
};
private timeInterval = 15;
private paperCreateVal: any = {
networkNo: -1,
feeds: [],
scheduleIds: [],
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: '',
scheduleType: '',
tveStatus: '',
wireStartTime: '',
wireEndTime: '',
wireDuration: '',
wireDate: '',
wireSource: '',
wire: false,
bug: '',
ticker: '',
desNetworkObj: '',
sdDelivery: '',
HdDelivery: '',
Dbs: '',
action: "GO",
unlockSchedules: [],
networkStartSeconds: ""
}
private multiSettings: IMultiSelectSettings = {
checkedStyle: 'glyphicon',
showCheckAll: true,
showUncheckAll: true,
dynamicTitleMaxItems: 1000,
isAll: false
};
private scheduleSelect = {
data: [],
texts: { defaultTitle: '' },
selectSettings: this.multiSettings
};
private getGridColumn: any = {
selectedRowId: null,
selectedRowIndex: null,
getColumns: [],
selectedRow: null
};
// private paperCreateValwire: any = {
// networkNo: 241,
// startDate: "04/10/2018",
// endDate: "04/24/2018",
// addOns: [
// "wire_NETWORKS"
// ]
// }
private paperCreateValwire: any = {
//networkNo: 241,
networkNo: 237,
startDate: new Date(),
endDate: '',
addOns: [
'wire_NETWORKS'
],
unlockSchedules: []
}
private paperGridData;
private saveBtnEnableDisable = true;
private totalUpdates = 0;
private totalDeletes = 0;
private disableNoAirings = true;
private resetSKYhighContext;
private goBtnEnableDisable: any = true;
// public setInstance(historyPopup : any,gridkendo : any,networkCarousel : any,router : any,financialAmortScheduleDetails :any,kendoDialog : any,cableHistoryPopup : any, gridHeaderMenu? : any){
public setInstance(gridHeaderMenu?: any) {
// this.historyPopup = historyPopup;
// this.gridkendo = gridkendo;
// this.historyPopup.gridkendo = gridkendo;
// this.networkCarousel = networkCarousel;
// this.router = router;
// this.financialAmortScheduleDetails = financialAmortScheduleDetails;
// this.financialAmortScheduleDetails.gridkendo = gridkendo;
// this.cableHistoryPopup = cableHistoryPopup;
// this.gridHeaderMenu = gridHeaderMenu;
}
@ViewChild(KendoGridComponent) private gridkendo: KendoGridComponent;
@ViewChild(ProgressCircle) private progress: ProgressCircle;
@ViewChild(NetworkCarousel) private networkCarousel: NetworkCarousel;
//@ViewChild(GridHeaderContext) public gridHeaderMenu: GridHeaderContext;
//@ViewChild(ValidateGridPopup) private validateGridPopup: ValidateGridPopup;
@ViewChild(wireConflictGridPopup) private wireConflictGridPopup: wireConflictGridPopup;
constructor(private elementRef: ElementRef, private router: Router, private balluService: ballUService, ) { }
public columns = [
{ airingProperty: "Context Row", airingPropertyParms: "contextRow", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true },
{ airingProperty: "gridCheck", airingPropertyParms: "gridCheck", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true },
{ airingProperty: "gridType", airingPropertyParms: "gridType", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true },
{ airingProperty: "Schedule Name", airingPropertyParms: "scheduleName", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true },
{ airingProperty: "Schedule Item #", airingPropertyParms: "schedItemNo", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true },
{ airingProperty: "Start Date", airingPropertyParms: "scheduleStartDate", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }
//,
// { airingProperty: "Start Time", airingPropertyParms: "scheduleStartTime", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "End Time", airingPropertyParms: "scheduleEndTime", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "Feed Name", airingPropertyParms: "feedName", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "Program Name", airingPropertyParms: "programName", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "Title #", airingPropertyParms: "titleNo", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "Title Name", airingPropertyParms: "titleName", readOnly: true, editable: false, editableDisabled: true },
// { airingProperty: "Material ID", airingPropertyParms: "matId", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "Version Network", airingPropertyParms: "versionNetwork", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "wire Flag", airingPropertyParms: "wire", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "wire Date", airingPropertyParms: "wireDate", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "wire Start Time", airingPropertyParms: "wireStartTime", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "wire Duration", airingPropertyParms: "wireDuration", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "wire End Time", airingPropertyParms: "wireEndTime", readOnly: true, editable: false, editableDisabled: true },
// { airingProperty: "wire Source/Provider", airingPropertyParms: "wireSource", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "wire Notes", airingPropertyParms: "wireNotes", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "HD", airingPropertyParms: "hd", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "Record", airingPropertyParms: "record", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "Bug", airingPropertyParms: "bug", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "Ticker", airingPropertyParms: "ticker", readOnly: false, editable: true, editableDisabled: false },
// { airingProperty: "User Added", airingPropertyParms: "addedUser", readOnly: true, editable: false, editableDisabled: true },
// { airingProperty: "Date Added", airingPropertyParms: "dateAdded", readOnly: true, editable: false, editableDisabled: true },
// { airingProperty: "User Updated", airingPropertyParms: "updatedUser", readOnly: true, editable: false, editableDisabled: true },
// { airingProperty: "Date Updated", airingPropertyParms: "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.networkCarousel,this.router,this.financialAmortScheduleDetails,this.kendoDialog,this.cableHistoryPopup, this.gridHeaderMenu);
// this.setInstance(this.gridHeaderMenu);
let that = this;
this.loadView();
this.resetSKYhighContext = jQuery.extend(true, {}, this.columns);
this.paperContextMenu();
/*---Load Default Aggregators----*/
this.loadAggregators(this.selectedNetworkArr.networkNo);
that.paperKeys = ["scheduleName", "schedItemNo", "startDate", "dayOfWeek", "startTime", "blockDuration", "endTime", "programName", "programType", "actualStartTime", "actualEndTime", "actualDuration", "masterSeries", "titleName", "episode", "season", "version", "schedulingType", "format", "notes", "hd", "record", "scheduleItem", "title", "addedUser", "dateAdded", "updatedUser", "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");
$(this).closest('tr').attr('checked', "true");
} else {
//$(this).closest('tr').removeClass("k-state-selected");
$(this).closest('tr').attr('checked', "false");
let currentUid = that.selectedRowsUID.indexOf($(this).closest('tr').attr('data-uid'));
that.selectedRowsUID.splice(currentUid, 1);
}
});
$("#KendoGridView").on('change', '#unlockCheck', function () {
console.log(" unlockCheck checkbox here--->");
that.selectAll = $('#unlockCheck').prop('checked');
var checkboxes: any = document.getElementsByClassName('gridCheckBox');
let grid = that.gridkendo.getGrid();
var gridData = grid.dataSource.data();
if (that.selectAll) {
for (var i = 0; i < gridData.length; i++) {
gridData[i].gridCheck = true;
}
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = true;
}
$('.unlockCheckbox').prop('checked', 'checked');
let grid = that.gridkendo.getGrid();
let gridlen = grid.dataSource.data();
that.totalAiringsCount = gridlen.length;
for (let i = 0; i < gridlen.length; i++) {
that.selectedRowsUID.push(gridlen[i].uid);
}
that.selectedRowsUID.length != 0;
} else {
for (var i = 0; i < gridData.length; i++) {
gridData[i].gridCheck = false;
}
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = false;
}
that.totalAiringsCount = 0;
$('.unlockCheckbox').removeAttr('checked');
$('tr').removeClass("k-state-selected");
that.selectAll = false;
that.selectedRowsUID = [];
}
});
$("#wireStartTime").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('wireStartTime', that.timeInterval);
},
change: function () {
}
});
$("#kgrid").on("mousedown", ".k-grid-content tbody tr[role='row']:not(.rowDisabled)", function (e: any) {
e.stopPropagation();
if (e.which === 3) {
let cellIndex = e.target.cellIndex;
if (cellIndex == undefined) {
cellIndex = $('#KendoGridView .k-grid-content td.k-edit-cell').index();
}
let gview = that.gridkendo.getGrid();
$("tr").removeClass("k-state-selected");
$(this).addClass("k-state-selected");
let selectedRow = gview.dataItem($(this));
let selectRow = gview.select();
let gridrow = gview.dataItem(selectRow);
that.getGridColumn.getColumns = gview.columns;
//that.getGridColumn.selectedRowIndex = cellIndex + 1;
that.getGridColumn.selectedRowIndex = cellIndex;
that.getGridColumn.selectedRow = selectedRow;
that.getGridColumn.selectedRowId = gridrow;
}
});
$("#context-menu").kendoContextMenu({
target: "#KendoGridView",
filter: ".k-grid-content tbody tr[role='row']",
select: function (e) {
// handle event
console.log(e)
let selectedMenuItem = $(e.item).children(".k-link").text();
console.log(selectedMenuItem);
console.log($(e.item).innetrText);
if (selectedMenuItem == "Apply Episodes") {
// that.openEpisode(that.getGridColumn.selectedRowId);
} else if (selectedMenuItem == "Apply Versions") {
// that.paperApplyVersion(that.getGridColumn.selectedRowId);
} else if (selectedMenuItem == "Add New") {
// that.addNewRows(that.getGridColumn.selectedRowId);
} else if (selectedMenuItem == "Remove") {
// that.removeRows("Remove");
} else if (selectedMenuItem == "Unscheduled Title") {
// that.unScheduleTitle("Unscheduled Title");
} else if (selectedMenuItem == "Open Title") {
// that.openTitle(that.getGridColumn.selectedRowId);
} else {
let selectedColumn = that.getGridColumn.getColumns[that.getGridColumn.selectedRowIndex];
let field = selectedColumn.field;
let value = that.getGridColumn.selectedRow[selectedColumn.field];
that.applyValueToAllRow(field, value);
}
},
activate: function (e) { },
open: function (e) {
//setTimeout(function(){
if (that.getGridColumn.getColumns.length && that.getGridColumn.getColumns[that.getGridColumn.selectedRowIndex] && that.getGridColumn.getColumns[that.getGridColumn.selectedRowIndex].title) {
that.dynamicPropertyName = that.getGridColumn.getColumns[that.getGridColumn.selectedRowIndex].title;
let columnField = that.getGridColumn.getColumns[that.getGridColumn.selectedRowIndex].field;
if (columnField == 'userAddedName') {
columnField = 'userAdded'
}
if (columnField == 'userUpdatedName') {
columnField = 'userUpdated'
}
let grid = that.gridkendo.getGrid();
let editable = grid.dataSource.options.schema.model.fields[columnField].editable;
if (editable == true) {
that.columnEditableOpt = false;
} else {
that.columnEditableOpt = true;
}
} else {
that.dynamicPropertyName = '';
that.contextDisableAllOpt = true;
}
if (that.getGridColumn.selectedRowId != undefined && (that.getGridColumn.selectedRowId.titleNo == null || that.getGridColumn.selectedRowId.titleNo == "")) {
that.contextTitleBtn = true;
} else {
that.contextTitleBtn = false;
}
that.hideContext();
$(".context-menu").parent().css({ 'width': 'auto !important' })
// },100);
}
});
// let getGridColumn: any = {
// selectedRowIndex: null,
// getColumns: [],
// selectedRow: null
// };
$("#KendoGridView tr.rowDisabled").on("mousedown contextmenu", function (e) {
e.stopPropagation();
var contextMenu1 = $("#context-menu").data("kendoContextMenu");
if (contextMenu1) {
contextMenu1.close($("#context-menu"));
}
return true;
});
// 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.dynamicPropertyName = 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 () {
// $("#paper-context-menu").kendoContextMenu({
// target: "#KendoGridView .k-grid-header thead tr:nth-child(1)",
// animation: {
// open: {
// effects: "fadeIn"
// }
// }
// });
// $('#paper-context-menu').on('click', '.hideShowColumn', function (e) {
// e.stopPropagation();
// });
// }, 100);
setTimeout(function () {
$('#startTime_timeview li,#endTime_timeview li,#actualStartTime_timeview li,#actualEndTime_timeview li,#wireStartTime_timeview li,#wireEndTime_timeview li').css({ "float": "left", "width": 76, "font-size": "12px" });
/*if(that.timeInterval==30){
$('#startTime_timeview,#endTime_timeview,#actualStartTime_timeview,#actualEndTime_timeview,#wireStartTime_timeview,#wireEndTime_timeview').parent().css({"width":200});
} else if(that.timeInterval==15){
$('#startTime_timeview,#endTime_timeview,#actualStartTime_timeview,#actualEndTime_timeview,#wireStartTime_timeview,#wireEndTime_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;
});
//wireFlagCheck
$(document).on('change', '#wireFlagCheck', function () {
//$(document).on('change', '#imageHD', function () {
alert("I am inside change");
//$(this).parents('tr').find('td').eq(1).addClass("gridUpdateIcon");
$('#editIconwire').addClass("gridUpdateIcon");
/// $('#editIconwire').addClass("gridUpdateIcon");
//editIconwire
//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(networkNo) {
let data = {};
this.progress.requestStart();
this.balluService.getResponse('schedules/v1/sportsPlayers/', 'get', data)
.subscribe(response => {
this.sportsPlayersLovs = response.data
this.setNetworks(response.data);
this.checkboxwireFlag(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","scheduleName":"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","scheduleName":"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","scheduleName":"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","scheduleName":"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","scheduleName":"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","scheduleName":"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","scheduleName":"April 2018 old as of 3.23.18"}]}}
}
goBtnPayload() {
let reqPayload;
reqPayload = jQuery.extend(true, {}, this.sportsPlayersVal);
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.paperGridData.length > 0) {
// if (true) {
// let strMessage = 'Do you want to continue and loss existing changes?';
// $('#commonPopup .kPopUpTitle').text('ant');
// $("#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;
}) : [];
}
getDeafultSchedule(schedules) {
let filterSchedules = schedules.filter(scheduleObj => scheduleObj.default === true);
let mapSchedules = filterSchedules.map((schedule) => {
return schedule.scheduleNo;
})
this.scheduleSelect.data = this.ObjectKeyChange("schedItemNo", "scheduleName", schedules);
this.paperCreateVal.scheduleIds = mapSchedules;
}
goBtnServiceCall() {
let that = this;
this.progress.requestStart();
let reqPayload = this.goBtnPayload();
// that.resetSKYhighContext = jQuery.extend(true, {}, this.paperCreateLovs.changeColumns);
//that.resetSKYhighContext = jQuery.extend(true, {}, this.columns);
//console.log("reqPayload--->", reqPayload);
this.balluService.getResponse("schedules/v1/sportsPlayers/", "post", reqPayload).subscribe(response => {
this.paperCreateValwire.unlockSchedules = jQuery.extend(true, [], this.paperCreateVal.scheduleIds);
console.log("data--->" + response);
this.wireDataAPI = response.data.records;
this.gridDataLoad();
this.lockedScheduleMsgShow(response.data.wireProps);
this.progress.requestEnd();
}, err => { this.progress.requestEnd(); });
}
gridDataLoad() {
let that = this;
that.checkedRowsUID = [];
let grid = this.gridkendo.getGrid();
grid.setOptions({
dataBound: function (e) {
var gridData = e.sender.dataSource.data();
that.onDataBound(e);
},
columnReorder: function (e) {
console.log(e.newIndex, e.oldIndex, e.column)
}
});
this.gridkendo.reloadDataSource(this.wireDataAPI);
this.gridkendo.setContextMenu();
//this.gridHeaderMenu.addDummyHeader();
//that.totalAiringsCount = grid.data.length;
that.totalAiringsCount = grid.dataSource.data().length
// that.totalAiringsCount = that.getGridLength("Added");
// that.totalDeletes = that.getGridLength("Delete");
// that.disableBtn = false;
/* Start - Open context menu on right click */
// setTimeout(function () {
// $("#paper-context-menu").kendoContextMenu({
// target: "#KendoGridView .k-grid-header thead tr:nth-child(1) ",
// animation: {
// open: {
// effects: "fadeIn"
// }
// }
// });
// $('#paper-context-menu').on('click', '.hideShowColumn', function (e) {
// e.stopPropagation();
// });
// }, 100);
that.paperContextMenu();
that.paperKeys = ["scheduleName", "schedItemNo", "startDate", "day", "startTime", "blockDuration", "endTime", "programName", "programType", "actualStartTime", "actualEndTime", "actualDuration", "seriesName", "titleName", "episodeNote", "seasonName", "versionName", "schedulingType", "formatName", "notes", "scheduleItem", "record", "hd", "title", "wireStartTime", "addedUser", "dateAdded", "updatedUser", "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('ant');
$("#commonPopup .kendoContent").text(strMessage);
let dialogConfirm = $("#commonPopup").data("kendoWindow").center().open();
$("#popupOK").unbind().click(function () {
let grid = that.gridkendo.getGrid();
that.paperGridData = [];
grid.dataSource.data([]);
that.totalAiringsCount = 0;
that.totalDeletes = 0;
dialogConfirm.close();
});
$("#popupCancel").unbind().click(function () {
dialogConfirm.close();
});
}
// loadSKYhigh(networkNo) {
// let data = {};
// //this.progress.requestStart();
// // this.balluService.getResponse('authorization/v1/loadSKYhighs?networkNo=1', 'get', data).subscribe(data => {
// // //this.balluService.getlocalResponse("paper-create-pref", "get", prefData).subscribe(data => {
// // this.SKYhighData = data;
// // this.progress.requestEnd();
// // },
// // err => { this.progress.requestEnd(); });
// }
loadSKYhigh(networkNo) {
let data = {};
this.progress.requestStart();
// this.balluService.getResponse('authorization/v1/loadSKYhighs?networkNo=' + this.paperCreateVal.networkNo, 'get', data).subscribe(data => {
this.balluService.getResponse('authorization/v1/loadSKYhighs?networkNo=' + this.paperCreateValwire.networkNo, 'get', data).subscribe(data => {
// paperCreateValwire
//this.balluService.getlocalResponse("paper-create-pref", "get", data).subscribe(data => {
this.SKYhighData = data;
console.log(this.SKYhighData)
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 SKYhighs Popup
function onClosePop() {
$("html, body").css("overflow", "");
}
// this.createSKYhighsPopUpWindow = $("#createSKYhighsPopUpWindow");
// this.createSKYhighsPopUpWindow.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("#createSKYhighsPopup");
this.createDialog("#commonPopup");
this.lockedSchedulePopup("#lockedSchedulePopup");
}
loadView() {
let that = this;
$("#overlaps0").prop("checked", true);
let navHeaderHeight = $('.navHeaderBox').outerHeight();
$('.breadCrumbBox').css('top', navHeaderHeight + 'px');
this.sportsPlayersVal.endDate = that.calculateEndDate(this.sportsPlayersVal.startDate, this.sportsPlayersVal.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.sportsPlayersVal.startDate,
open: function (e) { },
change: function () {
let dateEntered = $("#startDate").val();
if (this.value() !== null && dateEntered.length > 0) {
that.sportsPlayersVal.startDate = this.value();
that.sportsPlayersVal.endDate = that.calculateEndDate(this.value(), that.sportsPlayersVal.weekCount);
let endDatePicker = $("#endDate").data("kendoDatePicker");
endDatePicker.value(that.sportsPlayersVal.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.sportsPlayersVal.endDate,
change: function () {
let dateEntered = $("#endDate").val();
if (this.value() !== null && dateEntered.length > 0) {
that.sportsPlayersVal.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.sportsPlayersVal.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 },
scheduleName: { type: "string", editable: false },
schedItemNo: { type: "string", editable: false },
scheduleStartDate: { type: "string", filterable: true, editable: false, },
scheduleStartTime: { type: "string", editable: false },
scheduleEndTime: { type: "string", editable: false },
feedName: { type: "string", editable: false },
programName: { type: "string", editable: false },
title: { type: "string", editable: false },
titleName: { type: "string", editable: false },
matId: { type: "string", editable: false },
versionNetwork: { type: "string", editable: false },
wire: { type: "string", editable: true },
wireDate: { type: "string", editable: true },
wireStartTime: { type: "dateTime", editable: true },
wireDuration: { editable: true },
wireEndTime: { type: "string", editable: false },
wireSource: { type: "string", editable: true },
wireNotes: { type: "string", editable: true },
bug: { type: "string", editable: true },
ticker: { type: "string", editable: true },
hd: { type: "string", editable: true },
record: { type: "string", editable: true },
addedUser: { type: "string", editable: false },
dateAdded: { type: "string", editable: false },
updatedUser: { 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,
//<input type="checkbox" checked="checked" class="checkBox" />
headerTemplate: '<span class="displayBlock"><input type="checkbox" checked="checked" id="unlockCheck" (click) = "masterCheckboxClick($event)" /></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'>",
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='editIconwire' class='displayBlock'></span></span> "
template: "<span *ngIf = 'isDisplayEdit' class='eventType newEvent text-succcess'><span id='editIconwire' *ngIf = 'isDisplayEdit' class=' displayBlock'></span></span> "
}, {
field: "scheduleName",
title: "Schedule Name",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
},
}, {
field: "schedItemNo",
title: "Schedule Item #",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
},
}, {
field: "scheduleStartDate",
title: "Start Date",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
}, {
field: "scheduleStartTime",
title: "Start Time",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
}, {
field: "scheduleEndTime",
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,
editable: false,
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: "versionNetwork",
title: "Version Network",
width: 200,
editable: false,
filterable: that.gridkendo.getAutoFilter("contains"),
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "wire",
title: "wire Flag",
filterable: that.gridkendo.getAutoFilter("contains"),
width: 30,
resizable: false,
sortable: false,
editable: true,
editor: function () {
//this.isDisplayEdit = true;
},
template: function wireFunc(wire) {
return that.wireCheckBox(wire, that);
},
},
//template: function () { return that.checkboxwireFlag("") },
// template: function () {
// var tem = "";
// if(this.wire=="N"){
// tem = '<input type="checkbox" class="checkBox" />',
// }else{
// '<input type="checkbox" checked="checked" class="checkBox" />',
// }
// // return that.actualEndTimeTemplate(actualEndTime, that);
// },
// {
// field: "wireFlag",
// title: "wire Flag",
// width: 150,
// filterable: that.gridkendo.getAutoFilter("contains"),
// sortable: false,
// template: '<input type="checkbox" #= (wireFlag!=undefined || wireFlag!=null || wireFlag!="" || wireFlag==false) ? "" : \'checked="checked"\' # class="checkBox" />',
// // template: function wireFunc(wireFlag) {
// // return that.wireCheckBox(wireFlag, that);
// // },
// headerAttributes: {
// class: "multiCheckboxFilterEnabled"
// }
// },
// {
// field: "wireDate",
// title: "wire Date",
// width: 200,
// filterable: that.gridkendo.getAutoFilter("contains"),
// template: function fromDatefunction(startDate) {
// return that.wireDateTemplate(startDate, that);
// },
// editor: function (container, options) {
// that.dateEditor(container, options, that);
// },
// headerAttributes: {
// class: "multiCheckboxFilterEnabled"
// }
// },
{
field: "wireDate",
title: "wire Date",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
sortable: false,
template: function datefunction(wireDate) {
return that.wireDateTemplate(wireDate, that);
},
editor: function (container, options) {
that.wireDateEditor(container, options, that);
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
// {
// field: "wireStartTime",
// title: "wire 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: "wireStartTime",
title: "wire Start Time",
width: 200,
filterable: false,
sortable: false,
template: function wireStartTime(wireStartTime) {
return that.wireStartTimeTemplate(wireStartTime, that);
},
editor: function (container, options) {
return that.wireTimeEditor(container, options, that, "wireStartTime");
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "wireDuration",
title: "wire Duration",
width: 200,
filterable: false,
sortable: false,
template: function wireDuration(wireDuration) {
return that.wireDurationTemplate(wireDuration, that);
},
editor: function (container, options) {
return that.wireDurationEditor(container, options, that);
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
}, {
field: "wireEndTime",
title: "wire End Time",
width: 200,
filterable: false,
sortable: false,
template: function wireEndTime(wireEndTime) {
return that.wireEndTimeTemplate(wireEndTime, that);
},
editor: function (container, options) {
return that.wireTimeEditor(container, options, that, "wireEndTime");
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
// {
// field: "wireDuration",
// title: "wire Duration",
// width: 200,
// filterable: that.gridkendo.getAutoFilter("contains"),
// headerAttributes: {
// class: "multiCheckboxFilterEnabled"
// }
// },
// {
// field: "wireEndTime",
// title: "wire End Time",
// width: 200,
// filterable: that.gridkendo.getAutoFilter("contains"),
// headerAttributes: {
// class: "multiCheckboxFilterEnabled"
// }
// },
// {
// field: "wireSourceProvider",
// title: "wire 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: "wireSource",
title: "wire Source/Provider",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
sortable: false,
template: function sourcefunction(wireSource) {
return that.wireSourceTemplate(wireSource, that);
},
editor: function (container, options) {
return that.wireSourceEditor(container, options, that);
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
// {
// field: "wireNotes",
// title: "wire Notes",
// width: 200,
// filterable: that.gridkendo.getAutoFilter("contains"),
// headerAttributes: {
// class: "multiCheckboxFilterEnabled"
// }
// },
{
field: "wireNotes",
title: "wire Notes",
width: 200,
filterable: false,
sortable: false,
template: function inputFunc(wireNotes) {
return that.textboxTemplate(wireNotes, that, "wireNotes");
},
editor: function (container, options) {
return that.textboxEditor(container, options, that, "wireNotes");
},
headerAttributes: {
class: "multiCheckboxFilterEnabled"
}
},
{
field: "hd",
title: "HD",
filterable: that.gridkendo.getAutoFilter("contains"),
width: 30,
resizable: false,
sortable: false,
editable: true,
editor: function () {
// this.isDisplayEdit = true;
},
template: function hdFunc(hd) {
return that.hdCheckBox(hd, that);
},
},
{
field: "record",
title: "Record",
filterable: that.gridkendo.getAutoFilter("contains"),
width: 30,
resizable: false,
sortable: false,
editable: true,
editor: function () {
// this.isDisplayEdit = true;
},
template: function recordFunc(record) {
return that.recordCheckBox(record, that);
},
},
{
field: "bug",
title: "Bug",
width: 200,
filterable: that.gridkendo.getAutoFilter("contains"),
sortable: false,
// editable: true,
template: function bugfunction(bug) {
return that.bugTemplate(bug, that);
},
editor: function (container, options) {
return that.bugEditor(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: that.gridkendo.getAutoFilter("contains"),
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: "addedUser",
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: "updatedUser",
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].hasOwnProperty("isDefault")) {
if (data[i].isDefault)
return data[i];
break;
}
}
}
/* wire checkbox template */
private wireCheckBox(type: any, that: any) {
let value;
if (type.wire == "N" || type.wire == null) {
value = '<input type="checkbox" id = "wireFlagCheck" class="checkBox" />';
} else if (type.wire == "Y") {
value = '<input type="checkbox" id = "wireFlagCheck" checked="checked" class="checkBox" />';
}
return value;
}
/* hd checkbox template */
private hdCheckBox(type: any, that: any) {
let value;
if (type.hd == "N" || type.hd == null) {
value = '<input type="checkbox" class="checkBox" />';
} else if (type.hd == "Y") {
value = '<input type="checkbox" checked="checked" class="checkBox" />';
}
return value;
}
/* record checkbox template */
private recordCheckBox(type: any, that: any) {
let value;
if (type.record == "N" || type.record == null) {
value = '<input type="checkbox" class="checkBox" />';
} else if (type.record == "Y") {
value = '<input type="checkbox" checked="checked" class="checkBox" />';
}
return value;
}
private masterCheckboxClick(event: any) {
console.log("masterCheckboxClick--->");
if (event.target.checked) {
}
}
/* notes template column */
private textboxTemplate(note: any, that: any, field: any): any {
// if(field=='programName'){
// if (note.programName == undefined || note.programName == null || note.programName == "") {
// note.programName = "";
// return note.programName;
// } else {
// return note.programName;
// }
// }
if (field == 'wireNotes') {
if (note.wireNotes == undefined || note.wireNotes == null || note.wireNotes == "") {
note.wireNotes = "";
return note.wireNotes;
} else {
return note.wireNotes;
}
}
// else if(field=='commentText'){
// if (note.commentText == undefined || note.commentText == null || note.commentText == "") {
// note.commentText = "";
// return note.commentText;
// } else {
// return note.commentText;
// }
// }
// else if(field=='userAddedName'){
// if (note.userAddedName == undefined || note.userAddedName == null || note.userAddedName == "") {
// note.userAddedName = "";
// return note.userAddedName;
// } else {
// return note.userAddedName;
// }
// }
// else if(field=='userUpdatedName'){
// if (note.userUpdatedName == undefined || note.userUpdatedName == null || note.userUpdatedName == "") {
// note.userUpdatedName = "";
// return note.userUpdatedName;
// } else {
// return note.userUpdatedName;
// }
// }
// else{
// }
}
/* notes template editor column */
private textboxEditor(container, options, that, field): any {
this.rowDotMenuClick("true");
let grid = this.gridkendo.getGrid();
if (options.field == 'userAddedName') { options.field = 'userAdded'; }
if (options.field == 'userUpdatedName') { options.field = 'userUpdated'; }
let editable = grid.dataSource.options.schema.model.fields[options.field].editable;
// if(field=='programName'){
// if (editable == false) {
// $('<span>' + options.model.programName + '</span>' + '</span>').appendTo(container);
// } else {
// var input = $('<input type="text" class="commentText" data-bind="value:' + options.field + '"/>');
// input.appendTo(container);
// }
// }
if (field == 'wireNotes') {
if (editable == false) {
$('<span>' + options.model.wireNotes + '</span>' + '</span>').appendTo(container);
} else {
var input = $('<input type="text" class="commentText" data-bind="value:' + options.field + '"/>');
input.appendTo(container);
}
}
// else if(field=='commentText'){
// if (editable == false) {
// $('<span>' + options.model.commentText + '</span>' + '</span>').appendTo(container);
// } else {
// var input = $('<input type="text" class="commentText" data-bind="value:' + options.field + '"/>');
// input.appendTo(container);
// }
// }
// else if(field=='userAddedName'){
// if (editable == false) {
// $('<span>' + options.model.commentText + '</span>' + '</span>').appendTo(container);
// }
// }
// else if(field=='userUpdatedName'){
// if (editable == false) {
// $('<span>' + options.model.commentText + '</span>' + '</span>').appendTo(container);
// }
// }
}
checkboxwireFlag(data: any) {
let that = this;
console.log("gridDataAll checkboxwireFlag--->", data.records);
// var tem = "";
// if(that.wire=="N"){
// tem = '<input type="checkbox" class="checkBox" />',
// }else{
// '<input type="checkbox" checked="checked" class="checkBox" />',
// }
// // return that.actualEndTimeTemplate(actualEndTime, that);
// 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/>';
// }
}
setNetworks(data: any) {
// var wiremoons =[{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(wiremoons){
// for(var i=0; i<wiremoons.length; i++){
// if(wiremoons[i].hasOwnProperty("isDefault"))
// {
// if(wiremoons[i].isDefault)
// return wiremoons[i];
// break;
// }
// }
// }
// for(var i=0; i<data.length; i++){
// if(data[i].hasOwnProperty("isDefault"))
// {
// if(data[i].isDefault)
// return data[i];
// break;
// }
// }
//console.log(getDefault(wiremoons))
let that = this;
let tempObj = {};
//tempObj['networkNo'] = 237;
//tempObj['Lion'] = getDefault(wiremoons).Lion
//tempObj['networkNo'] = this.getDefault(data).networkNo;
console.log("data outside if---->", data);
//console.log("after data check---->" + tempObj['networkNo'));
console.log(data instanceof Array);
// if(data && data.length > 0){
console.log(" inside if---->" + data);
let defauktNetworkNOData = data.wireNetworks.find((elem) => { return elem.isDefault; });
//that.gridDataAll.find((elem) => { return elem.isDefault; });
tempObj['networkNo'] = defauktNetworkNOData.networkNo;
//}
// tempObj['networkNo'] = data.wireNetworks[0].networkNo;
//tempObj['networkName'] = 'ball Sports Bay Area';
// tempObj['networkNo'] = data.selectedNetworkNo;
tempObj['networkName'] = defauktNetworkNOData.networkName;
this.networkTempArray = [];
this.networkTempArray.push(tempObj);
let networksdata = data.wireNetworks;
let networksDataList = this.networkTempArray;
//let selectedNetwork = networksdata.find(elem => elem.networkNo == 237);
this.sportsPlayersVal.networkNo = defauktNetworkNOData.networkNo;
let selectedNetwork = networksdata.find(elem => elem.networkNo == defauktNetworkNOData.networkNo);
// this.paperCreateVal.networkNo = defauktNetworkNOData.networkNo;
this.selectedNetworkArr = selectedNetwork;
//this.networkCarousel.setNetworkData(networksdata, networksDataList, 237);
this.networkCarousel.setNetworkData(networksdata, networksDataList, defauktNetworkNOData.networkNo);
$("#networkCarouselLabel .networkHint").css("display", "none");
setTimeout(function () {
$("#unSelectedNetworksLogoBox1 .currentNwLogo").bind("click", function (e) {
e.stopPropagation();
that.singleSelection(data, e);
});
}, 100);
}
networksEvent(data: any) {
let network = this.networkCarousel.getselectedNetworkID();
let selectedNetworkId = data.networkData;
//this.networkCarousel.clearnetworksearch(data);
}
singleSelection(data, e: any) {
this.networkCarousel.getClearNetworks();
this.networkCarousel.networkLogoClick(e);
var getSelect = this.networkCarousel.getselectedNetwork();
let networksdata = data.wireNetworks;
let selectedNetwork = networksdata.find(elem => elem.networkNo == getSelect[0].networkNo);
this.sportsPlayersVal.networkNo = getSelect[0].networkNo;
this.selectedNetworkArr = selectedNetwork;
//this.loadAggregators(this.selectedNetworkArr.networkNo);
}
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.scheduleService.datevalidate(false);
}
else {
if (startDate < endDate) {
this.isValidDates = true;
$('#endDate').closest('.formRow').removeClass('mandatoryField');
$('#endDate').closest('.formRow').attr({ "title": "" });
//that.scheduleService.datevalidate(false);
}
else {
$('#endDate').closest('.formRow').addClass('mandatoryField');
$('#endDate').closest('.formRow').attr({ "title": "Start date can't be grater than end date " });
//that.scheduleService.datevalidate(true);
this.isValidDates = false;
}
}
}
if (isValidDate && isValidTime && this.paperCreateVal.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>"
dateValue = ""
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;
}
}
private wireDateTemplate(type: any, that: any): any {
let dateValue = "";
if (type.wireDate == undefined || type.wireDate == null || type.wireDate == "") {
type.wireDate = ""
return type.wireDate;
} else {
let myDate = new Date(type.wireDate);
dateValue = (myDate.getMonth() + 1) + "/" + myDate.getDate() + "/" + myDate.getFullYear();
return dateValue;
}
}
/* wire date Editor */
private wireDateEditor(container, options, that): any {
let grid = this.gridkendo.getGrid();
let editable = grid.dataSource.options.schema.model.fields[options.field].editable;
if (editable == false) {
$('<span>' + options.model.wireDate + '</span>').appendTo(container);
} else {
var input = $('<input data-bind="value:' + options.field + '"/>');
input.appendTo(container)
.kendoDatePicker({
formatName: "MM/dd/yyyy",
parseformatNames: "MM/dd/yyyy",
open: function (e) {
},
change: function (e) {
let grid = that.gridkendo.getGrid();
let selectRow = grid.select();
let gridrow = grid.dataItem(selectRow);
let setDate = "";
if (options.model.wireDate) {
setDate = kendo.toString(new Date(options.model.wireDate), "MM/dd/yyyy");
}
that.setValue(setDate, "", options.field);
// that.validateOverlap(setDate, selectRow, 'wireDate');
}
});
var datePicker = input.data("kendoDatePicker");
}
}
/* Date Editor for grid */
dateEditor(container, options, that): any {
this.isDisplayEdit = true;
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 = "";
return time.startTime;
}
// else {
// return time.startTime;
// }
else {
console.log("gridDataAll bugTemplate--->", that.gridDataAll);
//var sType = that.paperCreateLovs.bug == undefined ? [] : that.paperCreateLovs.bug;
// var sType = that.gridDataAll.startTime == undefined ? [] : that.gridDataAll.startTime;
// var sValue = '';
// var sTypeBug = sType.find(elem => elem.startTime == time.startTime);
// if (sTypeBug) {
// return sValue = sTypeBug.propertyListValue;
// }
}
}
/* 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();
}
});
}
}
/* wire duration template */
private wireDurationTemplate(type: any, that: any): any {
if (type.wireDuration == undefined || type.wireDuration == null || type.wireDuration == "" || type.wireDuration == "-1") {
type.wireDuration = "";
return "00:00";
}
else {
return type.wireDuration;
}
}
/* wire end time template*/
private wireEndTimeTemplate(type: any, that: any): any {
if (type.wireEndTime == undefined || type.wireEndTime == null || type.wireEndTime == "") {
type.wireEndTime = "";
return "";
}
else {
return type.wireEndTime;
}
}
/* wire Duration Editor*/
private wireDurationEditor(container, options, that) {
let grid = this.gridkendo.getGrid();
let editable = grid.dataSource.options.schema.model.fields[options.field].editable;
if (editable == false) {
$('<span>' + options.model.wireDuration + '</span>').appendTo(container);
} else {
$('<input name="' + options.field + '"/>').appendTo(container).kendoMaskedTextBox({
mask: "00:00",
promptChar: "0",
value: options.model.wireDuration,
change: function (e) {
}
}).on("keyup", function (e) {
let grid = that.gridkendo.getGrid();
let gridrow = grid.dataItem(grid.select());
let wireEndTimeInx: number = 0;
grid.columns.find(function (v, i) {
if (grid.columns[i].field == 'wireDuration') {
wireEndTimeInx = i - 1;
}
});
if (!that.validateDurationError($(this).val())) {
grid.tbody.find("tr[data-uid='" + gridrow.uid + "']").find("td:eq( " + wireEndTimeInx + " )").removeClass('mandatoryField');
let wirestartTime = that.convertTo24Hour(gridrow.wireStartTime);
let endTimeDuration = that.addTimes(wirestartTime, $(this).val());
gridrow.set("wireEndTime", endTimeDuration);
if ($(this).val() == "") {
gridrow.set("wireDuration", "00:00");
}
} else {
grid.tbody.find("tr[data-uid='" + gridrow.uid + "']").find("td:eq( " + wireEndTimeInx + " )").addClass('mandatoryField');
}
gridrow.trigger("change");
});
}
}
/* 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.bug == undefined || type.bug == null || type.bug == "") {
// type.bug = ""
// return type.bug;
// } else {
// console.log("that.gridDataAll--->" + that.gridDataAll);
// // console.log("that.gridDataAll--->" + that.gridDataAll);
// var sType = that.gridDataAll.feeds == undefined ? [] : that.gridDataAll.feeds;
// var sValue = '';
// var sTypeFeed = sType.find(elem => elem.bug == type.bug);
// 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 scheduleList: any = [];
// let scheduleListNo = '';
// let scheduleFeed = '';
// // if (editable == false) {
// if (!editable) {
// $('<span>' + options.model.bug + '</span>').appendTo(container);
// } else {
// this.rowDotMenuClick("true");
// console.log("that.gridDataAll feedEditor--->" + that.gridDataAll);
// var sType = that.gridDataAll.Bug;
// var input = $('<input data-bind="value:' + options.field + '"/>');
// input.appendTo(container)
// .kendoComboBox({
// dataSource: sType,
// dataTextField: "feedName",
// dataValueField: "bug",
// change: function (e) {
// var value = this.value();
// var sTypeFeed = sType.find(elem => elem.bug == value);
// if (sTypeFeed) {
// scheduleFeed = sTypeFeed.feedName;
// scheduleList = sTypeFeed.schedules;
// }
// if (scheduleList != null) {
// scheduleList = scheduleList[0].scheduleName;
// scheduleListNo = scheduleList[0].scheduleNo;
// } else {
// scheduleList = scheduleFeed;
// }
// that.setValue(scheduleList, "", 'scheduleName');
// }
// });
// }
// }
//wireSourceTemplate
/* Bug template */
private wireSourceTemplate(type: any, that: any): any {
if (type.wireSource == undefined || type.wireSource == null || type.wireSource == "") {
type.wireSource = "";
return type.wireSource;
} else {
// console.log("gridDataAll wireSourceTemplate--->", that.gridDataAll);
//var sType = that.paperCreateLovs.bug == undefined ? [] : that.paperCreateLovs.bug;
//that.gridDataAll["wire Source/Provider"]
var sType = that.gridDataAll.wire_SOURCE == undefined ? [] : that.gridDataAll.wire_SOURCE;
// var sType = that.gridDataAll["wire Source/Provider"] == undefined ? [] : that.gridDataAll["wire Source/Provider"];
var sValue = '';
var sTypeBug = sType.find(elem => elem.propertyListValueID == type.wireSource);
if (sTypeBug) {
return sValue = sTypeBug.propertyListValue;
}
}
}
// /* Bug template editor */
private wireSourceEditor(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.wireSource + '</span>').appendTo(container);
} else {
//console.log("gridDataAll bugEditor--->", that.gridDataAll);
//var sType = that.gridDataAll["wire Source/Provider"];
var sType = that.gridDataAll.wire_SOURCE == undefined ? [] : that.gridDataAll.wire_SOURCE;
var input = $('<input data-text-field="propertyListValue" data-value-field="propertyListValueID" data-bind="value:' + options.field + '"/>');
input.appendTo(container)
.kendoComboBox({
dataSource: sType,
dataTextField: "propertyListValue",
dataValueField: "propertyListValueID",
valuePrimitive: true
});
}
}
/* Bug template */
private bugTemplate(type: any, that: any): any {
if (type.bug == undefined || type.bug == null || type.bug == "") {
type.bug = "";
return type.bug;
} else {
//console.log("gridDataAll bugTemplate--->", that.gridDataAll);
//var sType = that.paperCreateLovs.bug == undefined ? [] : that.paperCreateLovs.bug;
var sType = that.gridDataAll.BUG == undefined ? [] : that.gridDataAll.BUG;
var sValue = '';
var sTypeBug = sType.find(elem => elem.propertyListValueID == type.bug);
if (sTypeBug) {
return sValue = sTypeBug.propertyListValue;
}
}
}
/* Bug template editor */
private bugEditor(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.bug + '</span>').appendTo(container);
} else {
// console.log("gridDataAll bugEditor--->", that.gridDataAll);
var sType = that.gridDataAll.BUG;
var input = $('<input data-text-field="propertyListValue" data-value-field="propertyListValueID" data-bind="value:' + options.field + '"/>');
input.appendTo(container)
.kendoComboBox({
dataSource: sType,
dataTextField: "propertyListValue",
dataValueField: "propertyListValueID",
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("gridDataAll tickerTemplate--->", that.gridDataAll);
var sType = that.gridDataAll.TICKER == undefined ? [] : that.gridDataAll.TICKER;
var sValue = '';
var sTypeTicker = sType.find(elem => elem.propertyListValueID == type.ticker);
if (sTypeTicker) {
return sValue = sTypeTicker.propertyListValue;
}
}
}
/* 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("gridDataAll tickerEditor--->", that.gridDataAll);
var sType = that.gridDataAll.TICKER;
var input = $('<input data-text-field="propertyListValue" data-value-field="propertyListValueID" data-bind="value:' + options.field + '"/>');
input.appendTo(container)
.kendoComboBox({
dataSource: sType,
dataTextField: "propertyListValue",
dataValueField: "propertyListValueID"
});
}
}
/* 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();
}
}
/* wire start time template */
private wireStartTimeTemplate(type: any, that: any): any {
if (type.wireStartTime == undefined || type.wireStartTime == null || type.wireStartTime == "") {
type.wireStartTime = "";
return "";
}
else {
return type.wireStartTime;
}
}
private wireTimeEditor(container, options, that, timeType) {
let grid = this.gridkendo.getGrid();
let editable = grid.dataSource.options.schema.model.fields[options.field].editable;
if (editable == false) {
if (timeType == "wireStartTime") {
$('<span>' + options.model.wireStartTime + '</span>').appendTo(container);
} else {
$('<span>' + options.model.wireEndTime + '</span>').appendTo(container);
}
} else {
if (timeType == "wireStartTime") {
var defaultVal = options.model.wireStartTime;
} else {
var defaultVal = options.model.wireEndTime;
}
var blockSnapTimeInterval = that.blockSnapTimeInterval;
$('<input name="' + options.field + '"/>').appendTo(container).kendoTimePicker({
format: "hh:mm tt", parseFormats: ["hh:mm tt"], value: defaultVal, min: new Date(2000, 0, 1, 6, 0, 0),
max: new Date(2000, 0, 1, 6, 0, 0), interval: blockSnapTimeInterval,
change: function (e) {
let grid = that.gridkendo.getGrid();
let gridrow = grid.dataItem(grid.select());
let setTime = "";
let wireEndTimeInx: number = 0;
grid.columns.find(function (v, i) {
if (grid.columns[i].field == 'wireEndTime') {
wireEndTimeInx = i - 1;
}
});
if (this.value() != null) {
setTime = kendo.toString(new Date(this.value()), "hh:mm tt");
}
if (timeType == "wireStartTime") {
let wireDuration = "";
if (gridrow.wireDuration == "") {
wireDuration = gridrow.blockDuration;
gridrow.set("wireDuration", gridrow.blockDuration);
}
gridrow.set("wireStartTime", setTime);
let wireStartTime = that.convertTo24Hour(setTime);
let endTime = that.addTimes(wireStartTime, gridrow.wireDuration);
gridrow.set("wireEndTime", endTime);
} /* else {
gridrow.set("wireEndTime", setTime);
let startval = that.convertTo24Hour(gridrow.wireStartTime);
let endval = that.convertTo24Hour(gridrow.wireEndTime);
let differ = that.TimeDifference(endval, startval);
if (parseInt(startval) < parseInt(endval)) {
grid.tbody.find("tr[data-uid='" + gridrow.uid + "']").find("td:eq( " + wireEndTimeInx + " )").removeClass('mandatoryField');
gridrow.set("wireDuration", differ);
} else {
grid.tbody.find("tr[data-uid='" + gridrow.uid + "']").find("td:eq( " + wireEndTimeInx + " )").addClass('mandatoryField');
}
} */
gridrow.trigger("change");
}
});
}
}
scheduleNotesEditor(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 schedule?';
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.sportsPlayersVal.weekCount);
// $('#endDate').data("kendoDatePicker").value(weekDays);
// this.validateSearch();
// }
handleWeek(newValue) {
if (newValue) {
let SelectedStartDate = this.sportsPlayersVal.startDate;
if (SelectedStartDate === undefined || SelectedStartDate === null) {
SelectedStartDate = new Date();
}
this.sportsPlayersVal.endDate = this.calculateEndDate(SelectedStartDate, this.sportsPlayersVal.weekCount);
$("#endDate").data("kendoDatePicker").value(this.sportsPlayersVal.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,
"wireStartTime": "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["wireStartTime"].editable = this.ccRadioFlags.wireStartTime == "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;
}
// createSKYhighs() {
// this.createSKYhighsPopUpWindow.data("kendoWindow").open();
// }
// cancelSKYhighs(): void {
// this.createSKYhighsPopUpWindow.data("kendoWindow").close();
// }
// okSKYhighs(): void {
// this.createSKYhighsPopUpWindow.data("kendoWindow").close();
// }
openCheck() {
//console.log('openCheck--->');
}
wireCheckBoxClick(e) {
// console.log('wireCheckBoxClick--->', 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;
// }
// }
/* wire checkbox template */
// private wireCheckBox(type: any, that: any) {
// let value;
// if (type.fieldName == undefined || type.fieldName == null || type.fieldName == "") {
// value = "<input type='checkbox' class='checkBox wireFlagBtn' id='wireFlagBtn' />";
// } else {
// value = "<input type='checkbox' checked class='checkBox wireFlagBtn' id='wireFlagBtn' />";
// }
// return value;
// }
public wireExport(): void {
//console.log("wireExport--->" + this.paperGridData);
//this.paperGridData;
let grid = this.gridkendo.getGrid();
//console.log("wireExport--->" + grid);
grid.hideColumn(1);
//console.log("datasource---->", datasource);
this.gridkendo.exportExcel();
//console.log("exportExcel--->", this.gridkendo.exportExcel());
grid.showColumn(1);
//console.log("wireExport---->");
this.gridkendo.setContextMenu();
//console.log("wireExport--->", 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) {
console.log("event--->" + event);
if (event.target.checked) {
this.sportsPlayersVal.wire = true;
} else {
this.sportsPlayersVal.wire = false;
}
// attach event to button
this.count1 = this.count1 + 1;
console.log('this.count--->' + this.count);
if (this.count1 % 3 == 0) {
// apply new style
this.sportsPlayersVal.wire = "";
console.log('multiple of 3--->' + this.count);
this.multipleOf3 = true;
} else {
this.multipleOf3 = false;
}
}
// changeSKYhigh(event) {
// let that = this;
// let value = event.target.value;
// let grid = this.gridkendo.getGrid();
// if (value != '') {
// that.SKYhighName = value;
// that.disablePrefAddEdit = true;
// /* selected pref details */
// let prefData = that.SKYhighData;
// /* end */
// for (var k = 0; k < prefData.length; k++) {
// if (prefData[k].SKYhighName == value) {
// let prefList = prefData[k].SKYhighList;
// that.SKYhighSetting(prefList);
// }
// }
// } else {
// that.disablePrefAddEdit = false;
// that.resetColumns(grid);
// this.totalDataDisplay();
// }
// }
// changeSKYhigh(event) {
// let that = this;
// let value = event.target.value;
// let grid = this.gridkendo.getGrid();
// if (value != '') {
// that.SKYhighName = value;
// that.disablePrefAddEdit = true;
// /* selected pref details */
// let prefData = that.SKYhighData;
// /* end */
// let getPrefList = prefData.find(elem => elem.SKYhighName == value);
// if (getPrefList) {
// that.SKYhighSetting(getPrefList.SKYhighList);
// }
// } else {
// that.disablePrefAddEdit = false;
// that.resetColumns(grid);
// that.columns = Object.keys(this.resetSKYhighContext).map(i => this.resetSKYhighContext[i]);
// this.metaAggregateCopy.changeColumns = Object.keys(this.resetSKYhighContext).map(i => this.resetSKYhighContext[i]);
// this.totalDataDisplay();
// }
// }
changeSKYhigh(event) {
let that = this;
let value = event.target.value;
let grid = this.gridkendo.getGrid();
if (value != '') {
that.SKYhighName = value;
that.disablePrefAddEdit = true;
/* selected pref details */
let prefData = that.SKYhighData;
/* end */
let getPrefList = prefData.find(elem => elem.SKYhighName == value);
if (getPrefList) {
that.SKYhighSetting(getPrefList.SKYhighList);
}
} else {
that.disablePrefAddEdit = false;
that.resetColumns(grid);
that.columns = Object.keys(this.resetSKYhighContext).map(i => this.resetSKYhighContext[i]);
//this.metaAggregateCopy.changeColumns = Object.keys(this.resetSKYhighContext).map(i => this.resetSKYhighContext[i]);
this.totalDataDisplay();
}
}
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]);
}
}
}
}
totalDataDisplay() {
let that = this;
let columnData = that.columns;
// let columnData = [
// {
// airingProperty: "Schedule Name",
// airingPropertyParms: "scheduleName",
// readOnly: false,
// editable: true,
// default: true,
// visible: false
// }
// ];
that.changeColsProperty();
let grid = this.gridkendo.getGrid();
let gridLen = grid.dataSource.data().length
let colLen = columnData.length;
for (let j = 3; j < grid.columns.length; j++) {
console.log("(totalDataDisplay grid.columns[j]---->", grid.columns[j]);
console.log("(totalDataDisplay grid.columns[j].field);---->", grid.columns[j].field);
console.log("totalDataDisplay grid.hideColumn(grid.columns[j].field);---->", grid.hideColumn(grid.columns[j].field));
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].airingPropertyParms);
}
//Default ->true AND Visible -> False
//hide both grid and right click
if (columnData[i].default == true && columnData[i].visible == false) {
grid.hideColumn(columnData[i].airingPropertyParms);
}
//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].airingPropertyParms);
}
//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].airingPropertyParms);
}
}
}
changeColsProperty() {
let props = this.tempset;
let grid = this.gridkendo.getGrid();
if (props) {
for (var i = 0; i < props.length; i++) {
var fName = props[i].airingPropertyParms;
if (grid.dataSource.options.schema.model.fields[fName]) {
grid.dataSource.options.schema.model.fields[fName].editable = props[i].editable;
}
}
}
console.log(grid)
}
private SKYhighSetting(list) {
let gridCol;
let grid = this.gridkendo.getGrid();
for (let j = 0; j < grid.columns.length; j++) {
console.log("(SKYhighSetting grid.columns[j]---->", grid.columns[j]);
console.log("(SKYhighSetting grid.columns[j].field);---->", grid.columns[j].field);
console.log("SKYhighSetting grid.hideColumn(grid.columns[j].field);---->", grid.hideColumn(grid.columns[j].field));
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);
}
}
createSKYhighs() {
let that = this;
$('#createSKYhighsPopup .kPopUpTitle').text('Add SKYhighs');
$('.SKYhighName').val('');
let dialogConfirm = $("#createSKYhighsPopup").data("kendoWindow").center().open();
$("#okSKYhighs").unbind().click(function () {
that.createUpdateSKYhigh('create');
dialogConfirm.close();
});
$("#cancelSKYhighs").unbind().click(function () {
dialogConfirm.close();
});
}
editSKYhighs() {
let that = this;
$('#createSKYhighsPopup .kPopUpTitle').text('Edit SKYhighs');
//let dialogConfirm = $("#createSKYhighsPopUpWindow").data("kendoWindow").center().open();
let dialogConfirm = $("#createSKYhighsPopup").data("kendoWindow").center().open();
$('.SKYhighName').val(that.SKYhighName);
$('.okSKYhighs').attr('disabled', 'disabled');
$("#okSKYhighs").unbind().click(function () {
that.createUpdateSKYhigh('update');
dialogConfirm.close();
});
$("#cancelSKYhighs").unbind().click(function () {
dialogConfirm.close();
});
}
checkPrefName(event) {
let that = this;
let value = event.target.value;
if ($.trim(value) != '') {
$('.okSKYhighs').removeAttr('disabled');
} else {
$('.okSKYhighs').