Last active
June 29, 2018 18:42
-
-
Save niniyzni/db26769b82d1759f0acee2b0732ac5cc to your computer and use it in GitHub Desktop.
check.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { mobileCarousel } from '../shared/content/mobile-carousel'; | |
import { KendoGridComponent } from '../grid/grid.component'; | |
import { playerConflictGridPopup } from './player-conflict-popup'; | |
import { IMultiSelectSettings } from '../common/multiselect-dropdown'; | |
import { schedulingCablesService } from "./scheduling-cables-service"; | |
@Component({ | |
selector: 'playerScore', | |
templateUrl: "./player-bulk-update.html", | |
}) | |
export class playerScore { | |
private selectedmobileArr: any = { mobileNo: -1, }; | |
private mobileTempArray; | |
private mobileObj = { "Label": "mobiles", isHintShow: false }; | |
private playerScoreVal: any = { | |
mobileNo: 237, | |
startDate: new Date(), | |
weekCount: 1, | |
endDate: '', | |
programName: '', | |
titleName: '', | |
player: '', | |
action: "GO", | |
addOns: [ | |
'player_mobileS' | |
], | |
playerStartTime: '', | |
playerEndTime: '', | |
playerDuration: '' | |
} | |
private playerScoreLovs: any = { | |
playermobiles: '' | |
} | |
public count1: number = 0; | |
private createPreferencesPopUpWindow; | |
private dynamicPropertyName: string; | |
private notThreeDotDisable = false; | |
private playerCheckBox: 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 Preferences */ | |
private tempset; | |
private metaAggregateCopy; | |
private preferenceData: any = []; | |
private preferenceName; | |
private disablePrefAddEdit = false; | |
private disablePrefSave = true; | |
private prefSelectedName: any = ''; | |
private gridDataAll: any = []; | |
private disablePrefAdd: any = false; | |
private disablePrefEdit: any = true; | |
private disablePrefClear: any = true; | |
private schedItemNo; | |
private scheduleName; | |
private allowEdit = false; | |
private isEditable = true; | |
public goBtnDataLossPopup = false; | |
private commonCastStaffData = {}; | |
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 startDateMandatoryClass: boolean = false; | |
private endDateMandatoryClass: boolean = false; | |
private goBtnEnableDisable: boolean = false; | |
private bulkKeys = []; | |
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: "playerUpdateExport", | |
contextMenuId: "context-SchedulesListEvents", | |
excelFileName: { | |
fileName: "ScheduleListExport", | |
allPages: true | |
}, | |
aggregate: [], | |
change: function (e) { | |
$('tr').find('[type=checkbox]').prop('checked', false); | |
$('tr.k-state-selected').find('[type=checkbox]').prop('checked', true); | |
}, | |
// getComponentUrl: "scheduling-Cables", | |
searchFields: [] | |
}; | |
private playerDataAPI: any = []; | |
private originalDataSource: 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 mobile", | |
"episode": "player Flag", | |
"season": "player Date", | |
"playerStartTime": "player Start Time", | |
"playerDuration": "player Duration", | |
"playerEndTime": "player End Time", | |
"playerSource": "player Source/Provider", | |
"notes": "player Notes", | |
"foul": "foul", | |
"record": "Record", | |
"bug": "Bug", | |
"ticker": "Ticker", | |
"addedUser": "User Added", | |
"dateAdded": "Date Added", | |
"updatedUser": "User Updated", | |
"dateUpdated": "Date Updated" | |
} | |
} | |
}; | |
private timeInterval = 15; | |
private playerCombinedVal: any = { | |
mobileNo: -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: '', | |
playerStartTime: '', | |
playerEndTime: '', | |
playerDuration: '', | |
playerDate: '', | |
playerSource: '', | |
player: false, | |
bug: '', | |
ticker: '', | |
desmobileObj: '', | |
sdDelivery: '', | |
foulDelivery: '', | |
Dbs: '', | |
action: "GO", | |
unlockSchedules: [], | |
mobileStartSeconds: "" | |
} | |
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 bulkCreateValplayer: any = { | |
mobileNo: 240, | |
preferenceType: "DLScore", | |
startDate: new Date(), | |
endDate: '', | |
addOns: [ | |
'player_mobileS' | |
], | |
defaultfoulOnplayer: 'N', | |
unlockSchedules: [] | |
} | |
private bulkGridData; | |
private saveBtnEnableDisable = true; | |
private totalUpdates = 0; | |
private totalDeletes = 0; | |
private disableNoAirings = true; | |
private resetPreferenceContext; | |
public setInstance(gridHeaderMenu?: any) { | |
} | |
private goBtnReqPayload: any; | |
@ViewChild(KendoGridComponent) private gridkendo: KendoGridComponent; | |
@ViewChild(ProgressCircle) private progress: ProgressCircle; | |
@ViewChild(mobileCarousel) private mobileCarousel: mobileCarousel; | |
@ViewChild(playerConflictGridPopup) private playerConflictGridPopup: playerConflictGridPopup; | |
columns: any = []; | |
isSaveDisableGrid: boolean; | |
isDisableApplyToAll: boolean; | |
isCancelDisableGrid: boolean; | |
constructor(private elementRef: ElementRef, private router: Router, private SPORTSService: SPORTSService, private scheduleCablesService: schedulingCablesService) { | |
this.isSaveDisableGrid = true; | |
this.isCancelDisableGrid = true; | |
this.isDisableApplyToAll = true; | |
this.columnsData.forEach((v) => { | |
this.columns.push(v); | |
}) | |
} | |
public columnsData = [ | |
{ airingProperty: "Context Row", airingPropertyParms: "contextRow", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "gridCheck", airingPropertyParms: "gridCheck", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "gridType", airingPropertyParms: "gridType", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Schedule Name", airingPropertyParms: "scheduleName", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Schedule Item #", airingPropertyParms: "schedItemNo", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Start Date", airingPropertyParms: "scheduleStartDate", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Start Time", airingPropertyParms: "scheduleStartTime", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "End Time", airingPropertyParms: "scheduleEndTime", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Feed Name", airingPropertyParms: "feedName", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Program Name", airingPropertyParms: "programName", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Title #", airingPropertyParms: "titleNo", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Title Name", airingPropertyParms: "titleName", readOnly: true, editable: false, editableDisabled: true, default: false, visible: true }, | |
{ airingProperty: "Material ID", airingPropertyParms: "matId", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Version mobile", airingPropertyParms: "versionmobile", readOnly: false, editable: false, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "player Flag", airingPropertyParms: "player", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "player Date", airingPropertyParms: "playerDate", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "player Start Time", airingPropertyParms: "playerStartTime", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "player Duration", airingPropertyParms: "playerDuration", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "player End Time", airingPropertyParms: "playerEndTime", readOnly: true, editable: false, editableDisabled: true, default: false, visible: true }, | |
// { airingProperty: "player Source/Provider", airingPropertyParms: "playerSource", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "player Source/Provider", airingPropertyParms: "playerSourcePropertyListValue", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "player Notes", airingPropertyParms: "playerNotes", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "foul", airingPropertyParms: "foul", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Record", airingPropertyParms: "record", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Bug", airingPropertyParms: "propertyListValue", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
// { airingProperty: "Bug", airingPropertyParms: "bug", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "Ticker", airingPropertyParms: "tickerPropertyListValue", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
// { airingProperty: "Ticker", airingPropertyParms: "ticker", readOnly: false, editable: true, editableDisabled: false, default: false, visible: true }, | |
{ airingProperty: "User Added", airingPropertyParms: "addedUser", readOnly: true, editable: false, editableDisabled: true, default: false, visible: true }, | |
{ airingProperty: "Date Added", airingPropertyParms: "dateAdded", readOnly: true, editable: false, editableDisabled: true, default: false, visible: true }, | |
{ airingProperty: "User Updated", airingPropertyParms: "updatedUser", readOnly: true, editable: false, editableDisabled: true, default: false, visible: true }, | |
{ airingProperty: "Date Updated", airingPropertyParms: "dateUpdated", readOnly: true, editable: false, editableDisabled: true, default: false, visible: true } | |
]; | |
ngOnInit() { | |
this.disablePrefAdd = true; | |
let that = this; | |
$('body').css({ "padding-bottom": "80px" }); | |
this.loadView(); | |
this.resetPreferenceContext = jQuery.extend(true, {}, this.columns); | |
this.bulkContextMenu(); | |
if (window.sessionStorage.getItem('playerSessionSearch')) { | |
window.sessionStorage.getItem('playerSessionSearch'); | |
} | |
/*---Load Default Aggregators----*/ | |
this.loadAggregators(this.selectedmobileArr.mobileNo); | |
$('<div class="gridScrollIconsBox"><i class="fa fa-chevron-left previousGridColumns"></i><i class="fa fa-chevron-right nextGridColumns" ></i></div>').insertBefore('#titleSearchResults .k-grid-header'); | |
// search advanced toggle | |
let navHeaderHeight = $('.navHeaderBox').outerHeight(); | |
$('.breadCrumbBox').css('top', navHeaderHeight + 'px'); | |
$(document).ready(function () { | |
let curDocHeight = $(document).outerHeight(); | |
let navHeaderHeight = $('.navHeaderBox').outerHeight(true); | |
let breadCrumbHeight = $('.breadCrumbBox').outerHeight(true); | |
let showHideTopPos = breadCrumbHeight + navHeaderHeight; | |
$('.leftSlider').css({ 'top': (showHideTopPos + 6) + 'px' }); | |
$(".showHideIcon").click(function () { | |
$(".showHideInputBox").slideToggle(); | |
$('.showHideIcon').toggleClass('toggleShow'); | |
$('.leftSlider .leftSliderBox').css({ 'min-height': '' }); | |
setTimeout(function () { | |
let shrinkBoxHeight = $('.slideShrinkBox').outerHeight(true); | |
let kGridFooterHeight = $('.k-pager-wrap').outerHeight(true); | |
}, 500); | |
}); | |
$(".showHideLeftSliderBtn").click(function () { | |
let showHideTopPos = $('.breadCrumbBox').outerHeight() + $('.navHeaderBox').outerHeight(); | |
$('.leftSlider').css({ 'top': (showHideTopPos + 6) + 'px' }); | |
let winWidth = $(window).innerWidth(); | |
if (winWidth < 1025) { | |
$('.leftSlider').toggleClass('toggleShow'); | |
} else { | |
$('.leftSlider').toggleClass('shoHideMenuActive'); | |
} | |
$('.slideShrinkBox').toggleClass('active'); | |
}); | |
$(".leftSlider .panel-body > ul > li").click(function () { | |
$(".leftSlider .panel-body > ul > li").removeClass('active'); | |
$(this).addClass('active'); | |
}); | |
setTimeout(() => { }, 100); | |
}); | |
that.bulkKeys = ["scheduleName", "schedItemNo", "startDate", "dayOfWeek", "startTime", "blockDuration", "endTime", "programName", "programType", "actualStartTime", "actualEndTime", "actualDuration", "masterSeries", "titleName", "episode", "season", "version", "schedulingType", "format", "notes", "foul", "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 () { | |
that.selectAll = $('#unlockCheck').prop('checked'); | |
var checkboxes: any = document.getElementsByClassName('gridCheckBox'); | |
let grid = that.gridkendo.getGrid(); | |
var gridData = grid.dataSource.data(); | |
if (that.selectAll) { | |
that.getTotalAiringCount(); | |
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 = []; | |
} | |
}); | |
$("#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 () { | |
} | |
}); | |
$("#kgrid").on("mousedown", ".k-grid-content tbody tr[role='row']:not(.rowDisabled), .k-grid-content-locked tbody tr[role='row']:not(.rowDisabled)", function (e) { | |
e.stopPropagation(); | |
if (e.which === 3) { | |
let cellIndex = e.target.cellIndex; | |
let isLockedContainer = $(e.target).closest("div")[0].className; | |
if (cellIndex == undefined) { | |
cellIndex = $('#KendoGridView td#KendoGridView_active_cell').index(); | |
if (cellIndex == -1) { | |
cellIndex = $('#KendoGridView td.k-edit-cell').index(); | |
} | |
} | |
if (cellIndex != -1) { | |
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; | |
if (isLockedContainer == 'k-grid-content-locked') { | |
that.getGridColumn.selectedRowIndex = cellIndex; | |
} | |
else { | |
that.getGridColumn.selectedRowIndex = cellIndex + ($("#KendoGridView .k-grid-content-locked colgroup col").length); | |
} | |
that.getGridColumn.selectedRow = selectedRow; | |
that.getGridColumn.selectedRowId = gridrow; | |
} | |
} | |
}); | |
// $("#kgrid").on("mousedown", ".k-grid-content tbody tr[role='row']:not(.rowDisabled), .k-grid-content-locked 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#KendoGridView_active_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); | |
// if (e.target.id == "playerFlagCheck") { | |
// cellIndex = 14; | |
// } | |
// if (e.target.id == "foulFlagCheck") { | |
// cellIndex = 21; | |
// } | |
// if (e.target.id == "recordFlagCheck") { | |
// cellIndex = 22; | |
// } | |
// if (e.target.id == "playerBugDropdown") { | |
// cellIndex = 23; | |
// } | |
// if (e.target.id == "playerTickerDropdown") { | |
// cellIndex = 24; | |
// } | |
// if (e.target.id == "playerSourceProvideDropdown") { | |
// cellIndex = 19; | |
// } | |
// that.getGridColumn.getColumns = gview.columns; | |
// that.getGridColumn.selectedRowIndex = cellIndex + 1; | |
// that.getGridColumn.selectedRow = selectedRow; | |
// that.getGridColumn.selectedRowId = gridrow; | |
// } | |
// }); | |
// row col context menu | |
// $("#context-menu-player").kendoContextMenu({ | |
// target: "#KendoGridView", | |
// filter: ".k-grid-content tbody tr[role='row']", | |
// select: function (e) { | |
// // handle event | |
// let selectedMenuItem = $(e.item).children(".k-link").text(); | |
// if (selectedMenuItem == "Apply Episodes") { | |
// //that.openEpisode(that.getGridColumn.selectedRowId); | |
// } else if (selectedMenuItem == "Apply Versions") { | |
// //that.bulkApplyVersion(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); | |
// } | |
// }); | |
$("#context-menu-player").kendoContextMenu({ | |
target: "#KendoGridView", | |
filter: ".k-grid-content tbody tr[role='row'],.k-grid-content-locked tbody tr[role='row']", | |
select: function (e) { | |
let selectedMenuItem = $(e.item).children(".k-link").text(); | |
if (selectedMenuItem == "Apply Episodes") { | |
// that.openEpisode(that.getGridColumn.selectedRowId); | |
} else if (selectedMenuItem == "Apply Versions") { | |
// that.bulkApplyVersion(that.getGridColumn.selectedRowId); | |
} else if (selectedMenuItem == "Add New") { | |
//console.time("concatenation"); | |
// that.addNewRows(that.getGridColumn.selectedRowId); | |
// console.timeEnd("concatenation"); | |
} 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]; | |
console.time("concatenation"); | |
that.applyValueToAllRow(field, value, that.getGridColumn.selectedRow); | |
console.timeEnd("concatenation"); | |
} | |
}, | |
activate: function (e) { }, | |
open: function (e) { | |
that.hideContext(); | |
//$('body #context-menu:not(.k-animation-container #context-menu)').remove(); | |
setTimeout(function () { | |
//console.log(e) | |
if (($('#context-menu').parent()[0]) && ($('#context-menu').parent()[0].className) && $('#context-menu').parent()[0].className == 'k-animation-container') { | |
$('#context-menu').parent().css({ "width": "320px" }) | |
$('#context-menu').css({ "width": "320px" }) | |
} | |
}); | |
//setTimeout(function(){ | |
that.columnEditableOpt = false; | |
that.contextDisableAllOpt = false; | |
that.contextTitleBtn = false; | |
if (that.getGridColumn.getColumns.length && that.getGridColumn.getColumns[that.getGridColumn.selectedRowIndex] && $.trim(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(); | |
if (grid.dataSource.options.schema.model.fields[columnField]) { | |
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; | |
} | |
} | |
}); | |
$("#KendoGridView tr.rowDisabled").on("mousedown contextmenu", function (e) { | |
e.stopPropagation(); | |
var contextMenu1 = $("#context-menu-player").data("kendoContextMenu"); | |
if (contextMenu1) { | |
contextMenu1.close($("#context-menu-player")); | |
} | |
return true; | |
}); | |
// row col context menu | |
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-player").data("kendoContextMenu"); | |
if (contextMenu1) { | |
contextMenu1.close($("#context-menu-player")); | |
} | |
return true; | |
}); | |
//; | |
$('#kgrid').on('click', '#playerFlagCheck', function () { | |
that.isSaveDisableGrid = false; | |
var checked = $(this).is(':checked'); | |
// $('#editIconplayer').addClass("gridUpdateIcon"); | |
let grid = that.gridkendo.getGrid(); | |
var dataItem = grid.dataItem($(this).closest('tr')); | |
dataItem.dirty = true; | |
dataItem.set("dirty", true); | |
dataItem.set('checkedOutUserId', ""); | |
grid.lockedTable.find("tr[data-uid='" + dataItem.uid + "'] td #playerFlagCheck").attr('checked', checked); | |
grid.table.find("tr[data-uid='" + dataItem.uid + "'] td #playerFlagCheck").attr('checked', checked); | |
dataItem.operationType = "Update"; | |
if (checked) { | |
dataItem.isDataUpdated = true; | |
dataItem.player = "Y"; | |
} | |
else { | |
dataItem.isDataUpdated = false; | |
dataItem.player = "N"; | |
} | |
if (!(dataItem.updateflag != undefined && dataItem.updateflag == true)) { | |
dataItem.updateflag = true; | |
//that.totalUpdates++; | |
} | |
that.countingUpdates(); | |
}); | |
$('#kgrid').on('click', '#foulFlagCheck', function () { | |
that.isSaveDisableGrid = false; | |
var checked = $(this).is(':checked'); | |
let grid = that.gridkendo.getGrid(); | |
var dataItem = grid.dataItem($(this).closest('tr')); | |
dataItem.dirty = true; | |
dataItem.set("dirty", true); | |
//dataItem.set('checkedOutUserId', ""); | |
dataItem.checkedOutUserId = null; | |
grid.lockedTable.find("tr[data-uid='" + dataItem.uid + "'] td #foulFlagCheck").attr('checked', checked); | |
grid.table.find("tr[data-uid='" + dataItem.uid + "'] td #foulFlagCheck").attr('checked', checked); | |
dataItem.operationType = "Update"; | |
if (checked) { | |
dataItem.isDataUpdated = true; | |
dataItem.foul = "Y"; | |
} | |
else { | |
dataItem.isDataUpdated = false; | |
dataItem.foul = "N"; | |
} | |
if (!(dataItem.updateflag != undefined && dataItem.updateflag == true)) { | |
dataItem.updateflag = true; | |
//that.totalUpdates++; | |
} | |
that.countingUpdates(); | |
}); | |
$('#kgrid').on('click', '#recordFlagCheck', function () { | |
that.isSaveDisableGrid = false; | |
var checked = $(this).is(':checked'); | |
let grid = that.gridkendo.getGrid(); | |
var dataItem = grid.dataItem($(this).closest('tr')); | |
dataItem.dirty = true; | |
dataItem.set("dirty", true); | |
dataItem.set('checkedOutUserId', ""); | |
grid.lockedTable.find("tr[data-uid='" + dataItem.uid + "'] td #recordFlagCheck").attr('checked', checked); | |
grid.table.find("tr[data-uid='" + dataItem.uid + "'] td #recordFlagCheck").attr('checked', checked); | |
dataItem.operationType = "Update"; | |
if (checked) { | |
dataItem.isDataUpdated = true; | |
dataItem.record = "Y"; | |
} | |
else { | |
dataItem.isDataUpdated = false; | |
dataItem.record = "N"; | |
} | |
if (!(dataItem.updateflag != undefined && dataItem.updateflag == true)) { | |
dataItem.updateflag = true; | |
//that.totalUpdates++; | |
} | |
that.countingUpdates(); | |
}); | |
this.playerScoreVal.player = ""; | |
this.multipleOf3 = true; | |
this.count1 = 0; | |
} | |
loadAggregators(mobileNo) { | |
let data = {}; | |
this.progress.requestStart(); | |
this.SPORTSService.getResponse('schedules/v1/playerScore/', 'get', data) | |
.subscribe(response => { | |
this.playerScoreLovs = response.data | |
//this.setmobiles(response.data); | |
this.checkboxplayerFlag(response.data); | |
let playerSessionStorageValue = JSON.parse(window.sessionStorage.getItem('playerSessionSearch')); | |
if (window.sessionStorage.getItem('playerSessionSearch')) { | |
this.setmobilesSession(playerSessionStorageValue.mobileNo, response.data); | |
this.playerDataLoad(playerSessionStorageValue); | |
$("#startDate").val(playerSessionStorageValue.startDate); | |
$("#endDate").val(playerSessionStorageValue.endDate); | |
$("#weekNumber").val(playerSessionStorageValue.weekCount); | |
this.playerScoreVal.programName = playerSessionStorageValue.programName; | |
this.playerScoreVal.titleName = playerSessionStorageValue.titleName; | |
this.playerScoreVal.player = playerSessionStorageValue.player; | |
this.bulkCreateValplayer.mobileNo = playerSessionStorageValue.mobileNo; | |
if (playerSessionStorageValue.player === false) { | |
$("#buttonId").attr('checked', false); | |
this.count1 = 1; | |
this.multipleOf3 = false; | |
} else if (playerSessionStorageValue.player === true) { | |
$("#buttonId").attr('checked', true); | |
this.multipleOf3 = false; | |
this.count1 = 2; | |
} else { | |
this.count1 = 3; | |
this.multipleOf3 = true; | |
} | |
window.sessionStorage.getItem('playerSessionSearch'); | |
// if (this.scheduleCablesService.bulkCreateMetaVal) { | |
//this.bulkCreateVal = this.scheduleCablesService.bulkCreateMetaVal; | |
//this.scheduleCablesService.bulkCreateMetaVal = ''; | |
// this.goBtnServiceCall(); | |
} | |
else { | |
this.setmobiles(response.data); | |
} | |
this.progress.requestEnd(); | |
}, | |
err => { | |
this.progress.requestEnd(); | |
}); | |
} | |
clearBtnClick() { | |
this.loadAggregators(-1); | |
this.playerScoreVal.programName = ''; | |
this.playerScoreVal.titleName = ''; | |
this.playerScoreVal.weekCount = 1; | |
this.loadView(); | |
} | |
goBtnPayload() { | |
let reqPayload; | |
reqPayload = jQuery.extend(true, {}, this.playerScoreVal); | |
reqPayload.startDate = kendo.toString(reqPayload.startDate, 'MM/dd/yyyy'); | |
reqPayload.endDate = kendo.toString(reqPayload.endDate, 'MM/dd/yyyy'); | |
this.goBtnReqPayload = jQuery.extend(true, {}, reqPayload); | |
return reqPayload; | |
} | |
goBtnClick() { | |
this.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.playerCombinedVal.scheduleIds = mapSchedules; | |
} | |
dataLoadplayerService() { | |
let that = this; | |
let grid = $("#KendoGridView").data("kendoGrid"); | |
that.gridCustomization(); | |
that.resetColumns(grid); | |
that.totalUpdates = 0; | |
if ($('.preferenceName').val() == "") { | |
$('.okPreferencesplayer').attr('disabled', 'disabled'); | |
} | |
that.disablePrefAdd = false; | |
that.isCancelDisableGrid = false; | |
let weekcount = that.playerScoreVal.weekCount; | |
if (weekcount === undefined || weekcount === '' || true === isNaN(weekcount) || weekcount == 0 || weekcount === null) { | |
$("#weekNumber").val(1); | |
that.playerScoreVal.weekCount = 1; | |
} | |
that.progress.requestStart(); | |
let reqPayload = that.goBtnPayload(); | |
that.SPORTSService.getResponse("schedules/v1/playerScore/", "post", reqPayload).subscribe(response => { | |
// that.bulkCreateValplayer.unlockSchedules = jQuery.extend(true, [], this.playerCombinedVal.scheduleIds); | |
that.playerDataAPI = response.data.players; | |
that.originalDataSource = response.data.players; | |
// that.gridDataLoad(); | |
that.lockedScheduleMsgShow(response.data.playerProps); | |
// that.originalValueMethod(response.data.players); | |
that.prefSelectedName = ''; | |
that.gridkendo.setscroll(); | |
that.progress.requestEnd(); | |
}, err => { that.progress.requestEnd(); }); | |
} | |
goBtnServiceCall() { | |
let that = this; | |
if (this.totalUpdates > 0) { | |
let strMessage = 'Do you want to continue and lose existing changes?'; | |
$('#commonPopup .kPopUpTitle').text('lightWork'); | |
$("#commonPopup .kendoContent").text(strMessage); | |
let dialogConfirm = $("#commonPopup").data("kendoWindow").center().open(); | |
$("#popupOK").unbind().click(function () { | |
that.dataLoadplayerService(); | |
that.isSaveDisableGrid = true; | |
dialogConfirm.close(); | |
}); | |
$("#popupCancel").unbind().click(function () { | |
// that.totalUpdates = 0; | |
dialogConfirm.close(); | |
}); | |
} else { | |
that.dataLoadplayerService(); | |
} | |
} | |
playerDataLoad(reqPayload) { | |
let that = this; | |
// this.progress.requestStart(); | |
this.SPORTSService.getResponse("schedules/v1/playerScore/", "post", reqPayload).subscribe(response => { | |
this.bulkCreateValplayer.unlockSchedules = jQuery.extend(true, [], this.playerCombinedVal.scheduleIds); | |
this.playerDataAPI = response.data.players; | |
this.originalDataSource = response.data.players; | |
this.gridDataLoad(); | |
this.lockedScheduleMsgShow(response.data.playerProps); | |
this.originalValueMethod(response.data.players); | |
this.prefSelectedName = ''; | |
this.gridkendo.setscroll(); | |
// this.progress.requestEnd(); | |
this.isCancelDisableGrid = false; | |
this.disablePrefAdd = false; | |
}, err => { this.progress.requestEnd(); }); | |
} | |
originalValueMethod(data) { | |
return data; | |
} | |
saveGrid() { | |
this.isSaveDisableGrid = false; | |
let that = this; | |
this.progress.requestStart(); | |
let grid = that.gridkendo.getGrid(); | |
let tempData = grid.dataSource.data(); | |
let updatedData = tempData.filter((item) => { | |
return item.dirty; | |
}); | |
let gridData = { | |
"mobileNo": this.bulkCreateValplayer.mobileNo, | |
"updates": updatedData, | |
"originals": this.originalDataSource | |
}; | |
this.SPORTSService.getResponse("schedules/v1/playerScore/", "put", gridData).subscribe(response => { | |
this.saveResponseNotify(response.data); | |
this.progress.requestEnd(); | |
}, err => { | |
this.progress.requestEnd(); | |
}); | |
} | |
gridDataLoad() { | |
let that = this; | |
//this.progress.requestStart(); | |
that.checkedRowsUID = []; | |
let grid = this.gridkendo.getGrid(); | |
grid.setOptions({ | |
dataBound: function (e) { | |
var gridData = e.sender.dataSource.data(); | |
that.onDataBound(e); | |
}, | |
columnReorder: function (e) { | |
if ($.trim(that.preferenceName) != undefined && $.trim(that.preferenceName) != "") { | |
that.disablePrefSave = false; | |
} | |
else { | |
that.disablePrefSave = true; | |
} | |
} | |
}); | |
this.gridkendo.reloadDataSource(this.playerDataAPI); | |
this.gridkendo.setContextMenu(); | |
//that.totalAiringsCount = grid.dataSource.data().length | |
that.bulkContextMenu(); | |
that.bulkKeys = ["scheduleName", "schedItemNo", "startDate", "day", "startTime", "blockDuration", "endTime", "programName", "programType", "actualStartTime", "actualEndTime", "actualDuration", "seriesName", "titleName", "episodeNote", "seasonName", "versionName", "schedulingType", "formatName", "notes", "scheduleItem", "record", "foul", "title", "playerStartTime", "addedUser", "dateAdded", "updatedUser", "dateUpdated"]; | |
//this.progress.requestEnd(); | |
} | |
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 grid = that.gridkendo.getGrid(); | |
let tempData = grid.dataSource.data(); | |
for (let i = 0; i < tempData.length; i++) { | |
if (tempData[i].dirty === true) { | |
let strMessage = 'Do you want to continue and lose existing changes?'; | |
$('#commonPopup .kPopUpTitle').text('lightWork'); | |
$("#commonPopup .kendoContent").text(strMessage); | |
let dialogConfirm = $("#commonPopup").data("kendoWindow").center().open(); | |
$("#popupOK").unbind().click(function () { | |
that.isSaveDisableGrid = true; | |
that.isCancelDisableGrid = true; | |
let grid = that.gridkendo.getGrid(); | |
that.bulkGridData = []; | |
grid.dataSource.data([]); | |
that.totalAiringsCount = 0; | |
that.totalDeletes = 0; | |
that.totalUpdates = 0; | |
dialogConfirm.close(); | |
}); | |
$("#popupCancel").unbind().click(function () { | |
that.totalUpdates = 0; | |
dialogConfirm.close(); | |
}); | |
} | |
else { | |
let grid = that.gridkendo.getGrid(); | |
that.bulkGridData = []; | |
grid.dataSource.data([]); | |
that.isCancelDisableGrid = true; | |
} | |
} | |
} | |
loadPreference(mobileNo) { | |
let data = {}; | |
this.progress.requestStart(); | |
let viewLoadPref = "DLScore"; | |
this.SPORTSService.getResponse('authorization/v1/loadPreferences?mobileNo=' + this.bulkCreateValplayer.mobileNo + "&preferenceType=" + viewLoadPref, 'get', data).subscribe(data => { | |
this.preferenceData = data; | |
this.progress.requestEnd(); | |
}, | |
err => { this.progress.requestEnd(); }); | |
} | |
ngAfterContentInit() { | |
$('.triggerGridScrollFunctions').trigger('click'); | |
//create preferences Popup | |
function onClosePop() { | |
$("html, body").css("overflow", ""); | |
} | |
this.createDialog("#createPreferencesPopupplayer"); | |
this.createDialog("#commonPopup"); | |
this.createDialog("#unsavedDataDialogplayer"); | |
this.lockedSchedulePopup("#lockedSchedulePopup"); | |
} | |
loadView() { | |
let that = this; | |
this.isSaveDisableGrid = true; | |
that.playerScoreVal.startDate = new Date(); | |
$("#overlaps0").prop("checked", true); | |
let navHeaderHeight = $('.navHeaderBox').outerHeight(); | |
$('.breadCrumbBox').css('top', navHeaderHeight + 'px'); | |
this.playerScoreVal.endDate = that.calculateEndDate(this.playerScoreVal.startDate, this.playerScoreVal.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.playerScoreVal.startDate, | |
open: function (e) { }, | |
change: function () { | |
let dateEntered = $("#startDate").val(); | |
if (this.value() !== null && dateEntered.length > 0) { | |
that.playerScoreVal.startDate = this.value(); | |
that.playerScoreVal.endDate = that.calculateEndDate(this.value(), that.playerScoreVal.weekCount); | |
let endDatePicker = $("#endDate").data("kendoDatePicker"); | |
endDatePicker.value(that.playerScoreVal.endDate); | |
} | |
that.playervalidateSearch(); | |
} | |
}).on("keyup", function (e) { | |
that.startDateMandatoryClass = false; | |
that.goBtnEnableDisable = false; | |
if (!that.scheduleCablesService.isValidDate($(this).val())) { | |
that.startDateMandatoryClass = true; | |
that.goBtnEnableDisable = true; | |
that.playervalidateSearch(); | |
} | |
}).on("focusout", function (e) { | |
if (that.scheduleCablesService.isValidDate($(this).val())) { | |
let tempDate = that.scheduleCablesService.setDate($(this).val()) | |
if (Date.parse(that.playerCombinedVal.startDate) !== Date.parse(tempDate)) { | |
let startDatePicker = $("#startDate").data("kendoDatePicker"); | |
that.playerCombinedVal.startDate = tempDate; | |
startDatePicker.value(tempDate); | |
// that.feedChange(); | |
that.playervalidateSearch(); | |
} | |
} | |
}); | |
// 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.playerScoreVal.endDate, | |
change: function () { | |
let dateEntered = $("#endDate").val(); | |
if (this.value() !== null && dateEntered.length > 0) { | |
that.playerScoreVal.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.playerScoreVal.weekCount = weekDiff; | |
} | |
that.playervalidateSearch(); | |
} | |
}).on("keyup", function (e) { | |
that.endDateMandatoryClass = false; | |
that.goBtnEnableDisable = false; | |
if (!that.scheduleCablesService.isValidDate($(this).val())) { | |
that.endDateMandatoryClass = true; | |
that.goBtnEnableDisable = true; | |
that.playervalidateSearch(); | |
} | |
}).on("focusout", function (e) { | |
if (that.scheduleCablesService.isValidDate($(this).val())) { | |
let tempDate = that.scheduleCablesService.setDate($(this).val()) | |
if (Date.parse(that.playerCombinedVal.endDate) !== Date.parse(tempDate)) { | |
let eDatePicker = $("#endDate").data("kendoDatePicker"); | |
that.playerCombinedVal.endDate = tempDate; | |
eDatePicker.value(tempDate); | |
//that.feedChange(); | |
that.playervalidateSearch(); | |
} | |
} | |
}); | |
//; | |
$('#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"); | |
}); | |
$('#kgrid').on('click', '.checkBox', function () { | |
var checked = $(this).is(':checked'); | |
var grid = that.gridkendo.getGrid(); | |
var sel = grid.select(); | |
var cellIndex = $('#KendoGridView .k-grid-content td#KendoGridView_active_cell').index(); | |
var selItem = grid.columns[cellIndex + 1]; | |
var item = grid.dataItem(sel); | |
if (selItem.field == 'player') { | |
//if(selItem.field=='playerFlag'){ | |
if (checked) { | |
item["player"] = checked; | |
item["foul"] = checked; | |
item.set("record", checked); | |
} else { | |
item["player"] = ''; | |
if (that.bulkCreateValplayer.defaultfoulOnplayer == 'N') { | |
//if (that.bulkCreateLovs.defaultfoulOnplayer == 'N') { | |
item["foul"] = ''; | |
} | |
item.set("record", ''); | |
} | |
that.changeplayerAndScheduleType(item); | |
} | |
else { | |
if (checked) { | |
item.set(selItem.field, checked); | |
} else { | |
item.set(selItem.field, ''); | |
} | |
} | |
}); | |
this.playerScoreVal.player = ""; | |
this.multipleOf3 = true; | |
this.count1 = 0; | |
this.kendocommand.model = { | |
id: "isSelected", | |
fields: { | |
contextRow: { editable: false }, | |
gridCheck: { type: "boolean", editable: false, filterable: false }, | |
iconUpdate: { 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 }, | |
titleNo: { type: "string", editable: false }, | |
titleName: { type: "string", editable: false }, | |
matId: { type: "string", editable: false }, | |
versionmobile: { type: "string", editable: false }, | |
player: { type: "string", editable: true }, | |
playerDate: { type: "string", editable: true }, | |
playerStartTime: { type: "dateTime", editable: true }, | |
playerDuration: { editable: true }, | |
playerEndTime: { type: "string", editable: true }, | |
playerSource: { type: "string", editable: true }, | |
playerSourcePropertyListValue: { type: "string", editable: true }, | |
playerNotes: { type: "string", editable: true }, | |
bug: { type: "string", editable: true }, | |
tickerPropertyListValue: { type: "string", editable: true }, | |
propertyListValue: { type: "string", editable: true }, | |
ticker: { type: "string", editable: true }, | |
foul: { 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.aggregate = [ | |
{ field: "contextRow", aggregate: "count" }, | |
{ field: "gridCheck", aggregate: "count" }, | |
{ field: "iconUpdate", aggregate: "count" }, | |
{ field: "scheduleName", aggregate: "count" }, | |
{ field: "schedItemNo", aggregate: "count" }, | |
{ field: "scheduleStartDate", aggregate: "count" }, | |
{ field: "scheduleStartTime", aggregate: "count" }, | |
{ field: "scheduleEndTime", aggregate: "count" }, | |
{ field: "feedName", aggregate: "count" }, | |
{ field: "programName", aggregate: "count" }, | |
{ field: "title", aggregate: "count" }, | |
{ field: "titleName", aggregate: "count" }, | |
{ field: "matId", aggregate: "count" }, | |
{ field: "versionmobile", aggregate: "count" }, | |
{ field: "player", aggregate: "count" }, | |
{ field: "playerDate", aggregate: "count" }, | |
{ field: "playerStartTime", aggregate: "count" }, | |
{ field: "playerDuration", aggregate: "count" }, | |
{ field: "playerEndTime", aggregate: "count" }, | |
// { field: "playerSource", aggregate: "count" }, | |
{ field: "playerNotes", aggregate: "count" }, | |
// { field: "bug", aggregate: "count" }, | |
// { field: "ticker", aggregate: "count" }, | |
{ field: "foul", aggregate: "count" }, | |
{ field: "record", aggregate: "count" }, | |
{ field: "addedUser", aggregate: "count" }, | |
{ field: "dateAdded", aggregate: "count" }, | |
{ field: "updatedUser", aggregate: "count" }, | |
{ field: "dateUpdated", aggregate: "count" } | |
]; | |
this.kendocommand.columns = [ | |
{ | |
field: "contextRow", | |
title: ' ', | |
template: "<span></span>", | |
locked: true, | |
// hidden: true, | |
//template: "<span class='contextMenuRow'></span>", | |
width: 25, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
} | |
}, | |
// {field:"contextRow",groupable:false,locked: true, editable:true, lockable: false, resizable:false, template: '<span class="contextMenuRow"></span>', width: 25 } | |
{ | |
filterable: false, | |
width: 50, | |
//<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: " ", | |
//template:function(container){ return that.checkboxchecker(container,"isSelected")}, | |
//gridLockIcon | |
//template: "<input type='checkbox' class='gridCheckBox'>", | |
template: "# if (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== ''){ #<input type='checkbox'># }# #if(checkedOutUserId === undefined || checkedOutUserId === null || checkedOutUserId === ''){#<input type='checkbox' class='gridCheckBox'>#}#", | |
attributes: { | |
style: "padding: 0 8px 0 12px;", | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
} | |
}, { | |
filterable: false, | |
width: 25, | |
resizable: false, | |
sortable: false, | |
field: "iconUpdate", | |
editable: false, | |
title: ' ', | |
template: "# if (dirty) { # <span class='eventType newEvent text-succcess'><span class='displayBlock gridUpdateIcon'></span></span> # }# #if(checkedOutUserId){# <span class='eventType newEvent text-succcess'><span class='displayBlock gridLockIcon'></span></span> # } #", | |
attributes: { | |
class: "pad0Imp #: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
} | |
// template: "# if (checkedOutUserId) { # <span class='eventType newEvent text-succcess'><span class='displayBlock gridLockIcon'></span></span> # } #", | |
// attributes: { | |
// class: "#: dirty ? 'displayBlock gridUpdateIcon' : ''#" | |
// }, | |
}, | |
{ | |
field: "scheduleName", title: "Schedule Name", width: 200, aggregates: ["count"], groupHeaderTemplate: "Schedule Name: #= value # (#= count# item(s))", | |
filterable: that.gridkendo.getAutoFilter("contains"), | |
editable: false, | |
//filterable: that.gridkendo.getAutoFilter("contains", "scheduleName"), | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "schedItemNo", title: "Schedule Item No.", aggregates: ["count"], groupHeaderTemplate: "Schedule Item: #= value # (#= count# item(s))", resizable: false, filterable: that.gridkendo.getAutoFilter("eq"), width: 170 | |
, editable: false, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "scheduleStartDate", title: "Start Date", width: 120, aggregates: ["count"], groupHeaderTemplate: "Start Date: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains"), | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "scheduleStartTime", title: "Start Time", width: 115, aggregates: ["count"], groupHeaderTemplate: "Start Time: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "textAlignRight #: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "scheduleEndTime", title: "End Time", width: 105, aggregates: ["count"], groupHeaderTemplate: "End Time: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "textAlignRight #: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "feedName", title: "Feed Name", width: 115, aggregates: ["count"], groupHeaderTemplate: "Feed Name: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "programName", title: "Program Name", width: 160, aggregates: ["count"], groupHeaderTemplate: "Program Name: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "titleNo", title: "Title #", aggregates: ["count"], groupHeaderTemplate: "Title: #= value # (#= count# item(s))", resizable: false, filterable: that.gridkendo.getAutoFilter("eq"), width: 90 | |
, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "titleName", title: "Title Name", width: 200, aggregates: ["count"], groupHeaderTemplate: "Title Name: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "matId", title: "Material ID", width: 120, aggregates: ["count"], groupHeaderTemplate: "Material ID: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "versionmobile", title: "Version mobile", width: 165, aggregates: ["count"], groupHeaderTemplate: "Version mobile: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
// { | |
// field: "player", | |
// title: "player Flag", | |
// width: 145, aggregates: ["count"], | |
// groupHeaderTemplate: "player Flag: #= value # (#= count# item(s))", | |
// //filterable: that.gridkendo.getAutoFilter("contains"), | |
// filterable: false, | |
// editable: true, | |
// template: function playerFunc(player) { | |
// return that.playerCheckBox(player, that); | |
// } | |
// , | |
// attributes: { | |
// class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
// } | |
// }, | |
{ | |
field: "isLockedFlag", | |
title: "Locked", | |
width: 150, | |
filterable: false, | |
sortable: false, | |
// template: "<input type='checkbox' name='locked' class='checkBox' #= (locked=='Y') ? 'checked=checked' : '' #></input>", | |
template: function dynamicFunc(isLockedFlag) { | |
return that.dynamicCheckBox(isLockedFlag, that, 'isLockedFlag'); | |
}, | |
editor: function (container, options) { | |
return that.dynamicCheckBoxEditor(container, options, that, "isLockedFlag"); | |
}, | |
// attributes: { | |
// class: "#: action == 'Delete' || disableFlag == true || (isLockedFlag == true && userLockedFlag == false) ? 'rowDisabled' : ''#" + " #:duplicateRow == true?'duplicateRows':''#", | |
// }, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "playerDate", title: "player Date", width: 145, aggregates: ["count"], groupHeaderTemplate: "player Date: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains"), | |
template: function datefunction(playerDate) { | |
return that.playerDateTemplate(playerDate, that); | |
}, | |
editor: function (container, options) { | |
that.playerDateEditor(container, options, that); | |
}, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "playerStartTime", title: "player Start Time", width: 185, aggregates: ["count"], groupHeaderTemplate: "player Start Time: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains"), | |
template: function playerStartTime(playerStartTime) { | |
return that.playerStartTimeTemplate(playerStartTime, that); | |
}, | |
editor: function (container, options) { | |
return that.playerTimeEditor(container, options, that, "playerStartTime"); | |
}, | |
attributes: { | |
class: "textAlignRight #: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "playerDuration", title: "player Duration", width: 175, aggregates: ["count"], groupHeaderTemplate: "player Duration: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains"), | |
template: function playerDuration(playerDuration) { | |
return that.playerDurationTemplate(playerDuration, that); | |
}, | |
editor: function (container, options) { | |
return that.playerDurationEditor(container, options, that); | |
}, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "playerEndTime", title: "player End Time", width: 172, aggregates: ["count"], groupHeaderTemplate: "player End Time: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains"), | |
template: function playerEndTime(playerEndTime) { | |
return that.playerEndTimeTemplate(playerEndTime, that); | |
}, | |
// editor: function (container, options) { | |
// return that.playerTimeEditor(container, options, that, "playerEndTime"); | |
// }, | |
editor: function (container, options) { | |
that.gridkendo.getGrid().closeCell(container); | |
}, | |
attributes: { | |
class: "textAlignRight #: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "playerSourcePropertyListValue", | |
title: "player Source/Provider", | |
width: 230, | |
groupHeaderTemplate: "player Source/Provider: #= value # (#= count# item(s))", | |
aggregates: ["count"], | |
template: function playerSourcefunction(playerSource) { | |
return that.playerSourceTemplate(playerSource, that); | |
}, | |
editor: function (container, options) { | |
return that.playerSourceEditor(container, options, that); | |
}, | |
attributes: { | |
class: "#: ((checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '')) ? 'rowDisabled' : ''#" | |
}, | |
filterable: that.gridkendo.getAutoFilterName("contains", "playerSourcePropertyListValue"), | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "playerNotes", title: "player Notes", width: 200, aggregates: ["count"], groupHeaderTemplate: "player Notes: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains"), | |
template: function inputFunc(playerNotes) { | |
return that.textboxTemplate(playerNotes, that, "playerNotes"); | |
}, | |
editor: function (container, options) { | |
return that.textboxEditor(container, options, that, "playerNotes"); | |
}, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "foul", title: "foul", editable: true, width: 65, aggregates: ["count"], groupHeaderTemplate: "foul: #= value # (#= count# item(s))", | |
//filterable: that.gridkendo.getAutoFilter("contains"), | |
template: function foulFunc(foul) { | |
return that.foulCheckBox(foul, that); | |
}, | |
filterable: false, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
} | |
}, | |
{ | |
field: "record", title: "Record", editable: true, width: 97, aggregates: ["count"], groupHeaderTemplate: "Record: #= value # (#= count# item(s))", | |
//filterable: that.gridkendo.getAutoFilter("contains"), | |
template: function recordFunc(record) { | |
return that.recordCheckBox(record, that); | |
}, | |
filterable: false, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
} | |
}, | |
{ | |
field: "propertyListValue", | |
title: "Bug", | |
width: 115, | |
groupHeaderTemplate: "Bug: #= value # (#= count# item(s))", | |
aggregates: ["count"], | |
template: function bugfunction(bug) { | |
return that.bugTemplate(bug, that); | |
}, | |
editor: function (container, options) { | |
return that.bugEditor(container, options, that); | |
}, | |
attributes: { | |
class: "#: ((checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ) ? 'rowDisabled' : ''#" | |
}, | |
filterable: that.gridkendo.getAutoFilterName("contains", "propertyListValue"), | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "tickerPropertyListValue", | |
title: "Ticker", | |
width: 120, | |
groupHeaderTemplate: "Ticker: #= value # (#= count# item(s))", | |
aggregates: ["count"], | |
template: function tickerfunction(ticker) { | |
return that.tickerTemplate(ticker, that); | |
}, | |
editor: function (container, options) { | |
return that.tickerEditor(container, options, that); | |
}, | |
attributes: { | |
class: "#: ((checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ) ? 'rowDisabled' : ''#" | |
}, | |
filterable: that.gridkendo.getAutoFilterName("contains", "tickerPropertyListValue"), | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "addedUser", title: "User Added", width: 125, aggregates: ["count"], groupHeaderTemplate: "User Added: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "dateAdded", title: "Date Added", width: 148, aggregates: ["count"], groupHeaderTemplate: "Date Added: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "updatedUser", title: "User Updated", width: 137, aggregates: ["count"], groupHeaderTemplate: "User Updated: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
}, | |
{ | |
field: "dateUpdated", title: "Date Updated", width: 180, aggregates: ["count"], groupHeaderTemplate: "Date Updated: #= value # (#= count# item(s))", filterable: that.gridkendo.getAutoFilter("contains") | |
, | |
attributes: { | |
class: "#: (checkedOutUserId !== undefined && checkedOutUserId !== null && checkedOutUserId !== '') ? 'rowDisabled' : ''#" | |
}, | |
template: function dateUpdatedFunction(dateUpdated) { | |
return that.dateUpdatedField(dateUpdated, that); | |
}, | |
headerAttributes: { | |
class: "multiCheckboxFilterEnabled" | |
} | |
} | |
]; | |
} | |
changeplayerAndScheduleType(item) { | |
let that = this; | |
if (item["playerFlag"] && (item["schedProgTypeNo"] != null && item["schedProgTypeNo"] != '')) { | |
item["playerDate"] = item["startDate"]; | |
item["playerStartTime"] = item["startTime"]; | |
item["playerDuration"] = item["blockDuration"]; | |
item["playerEndTime"] = item["endTime"]; | |
item.set("playerDate", item["startDate"]); | |
$('#KendoGridView').data('kendoGrid').refresh(); | |
} | |
} | |
scheduleNameTemplate(scheduleName: any, that: any) { | |
let schName: any; | |
if (scheduleName.scheduleName != null && scheduleName.scheduleName != undefined) { | |
if (scheduleName.scheduleName == "") { | |
schName = "<i></i>"; | |
} else { | |
schName = "<i>" + scheduleName.scheduleName + "</i>"; | |
} | |
} else { | |
schName = "<i></i>"; | |
} | |
return schName; | |
} | |
scheduleNameEditor(container: any, options: any, that: any) { | |
let activeRow = that.gridkendo.selectedDotRow; | |
// let activeRow = that.gridkendo.getGridselectedRow(); | |
if (options.model.archiveFlag === "Y" || activeRow.statusName === "Approved") { | |
$("<label>" + options.model.scheduleName + "</label>").appendTo(container); | |
} else { | |
let input = $("<input name='name' class='scheduleNameField k-dirty-cell' maxLength='100' id='name'/>"); | |
input.appendTo(container); | |
$(".scheduleNameField").bind("input", function (e) { | |
let scheduleInputName = $(this).val(); | |
if (scheduleInputName != "") { | |
that.scheduleGridEmptyValidation(); | |
} else { | |
// $("ul.topBredcrumMenu > li:last-child > a").addClass("disabled"); | |
that.disableSavebutton = true; | |
} | |
//that.disableSavebutton = false; | |
that.disableOpenbutton = true; | |
$('#openButton').addClass('disabled'); | |
}); | |
} | |
} | |
getDefault(data: any) { | |
for (var i = 0; i < data.length; i++) { | |
if (data[i].hasOwnProperty("isDefault")) { | |
if (data[i].isDefault) | |
return data[i]; | |
break; | |
} | |
} | |
} | |
private dateUpdatedField(type: any, that: any) { | |
return type.dateUpdated.replace(/\.\d*/, ''); | |
} | |
/* player checkbox template */ | |
private playerCheckBox(type: any, that: any) { | |
let value; | |
if (type.player == "N" || type.player == null || type.player == undefined || type.player == " " || type.player == "") { | |
value = '<input type="checkbox" id = "playerFlagCheck" class="checkBox" />'; | |
} else if (type.player == "Y") { | |
value = '<input type="checkbox" id = "playerFlagCheck" checked="checked" class="checkBox" />'; | |
} | |
return value; | |
} | |
private dynamicCheckBox(type: any, that: any, field: any): any { | |
var tempSet = that.tempset; | |
var checkEditable = true; | |
var tempSource = { airingProperty: "Locked", airingPropertyParms: "isLockedFlag", readOnly: false, editable: true, visible: false }; | |
// var tempSource = tempSet.find(elem => elem.airingPropertyParms == field); | |
if (tempSource) { | |
checkEditable = tempSource.editable; | |
} | |
var disabled = (checkEditable == false) ? 'disabled' : ''; | |
var chked = (type[field] == undefined || type[field] == null || type[field] == "" || type[field] == false || type[field] == "N") ? '' : 'checked'; | |
var val = (type[field] == undefined || type[field] == null || type[field] == "" || type[field] == false || type[field] == "N") ? false : true; | |
return "<input type='checkbox' name='" + field + "' id='" + field + "' " + chked + " " + disabled + " value='" + val + "' class='checkBox' />"; | |
} | |
private dynamicCheckBoxEditor(container, options, that, field) { | |
let grid = this.gridkendo.getGrid(); | |
let gridrow = grid.dataItem(grid.select()); | |
let editable = grid.dataSource.options.schema.model.fields[options.field].editable; | |
var disabled = (editable == false) ? 'disabled' : ''; | |
$("<input type='checkbox' " + disabled + " name='" + field + "' id='" + field + "' class='checkBox' />").appendTo(container); | |
} | |
private isDataUpdated(type: any, that: any) { | |
let value; | |
if (type.isDataUpdated != null) { | |
value = '<span id="editIconplayer" class="displayBlock gridUpdateIcon"></span>'; | |
} | |
return value; | |
} | |
/* foul checkbox template */ | |
private foulCheckBox(type: any, that: any) { | |
let value; | |
if (type.foul == "N" || type.foul == null || type.foul == undefined || type.foul == " " || type.foul == "") { | |
value = '<input type="checkbox" id ="foulFlagCheck" class="checkBox" />'; | |
} else if (type.foul == "Y") { | |
value = '<input type="checkbox" id ="foulFlagCheck" checked="checked" class="checkBox" />'; | |
} | |
return value; | |
} | |
/* record checkbox template */ | |
private recordCheckBox(type: any, that: any) { | |
let value; | |
if (type.record == "N" || type.record == null || type.record == undefined || type.record == " " || type.record == "") { | |
value = '<input type="checkbox" id ="recordFlagCheck" class="checkBox" />'; | |
} else if (type.record == "Y") { | |
value = '<input type="checkbox" id ="recordFlagCheck" checked="checked" class="checkBox" />'; | |
} | |
return value; | |
} | |
private masterCheckboxClick(event: any) { | |
if (event.target.checked) { | |
} | |
} | |
/* notes template column */ | |
private textboxTemplate(note: any, that: any, field: any): any { | |
if (field == 'playerNotes') { | |
if (note.playerNotes == undefined || note.playerNotes == null || note.playerNotes == "") { | |
note.playerNotes = ""; | |
return note.playerNotes; | |
} else { | |
return note.playerNotes; | |
} | |
} | |
} | |
/* notes template editor column */ | |
private textboxEditor(container, options, that, field): any { | |
this.isSaveDisableGrid = false; | |
let grid = that.gridkendo.getGrid(); | |
let selectRow = grid.select(); | |
let gridrow = grid.dataItem(selectRow); | |
gridrow.dirty = true; | |
gridrow.set("dirty", true); | |
gridrow.set('checkedOutUserId', ""); | |
//that.totalUpdates++; | |
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 == 'playerNotes') { | |
if (editable == false) { | |
$('<span>' + options.model.playerNotes + '</span>' + '</span>').appendTo(container); | |
} else { | |
var input = $('<input type="text" class="commentText" data-bind="value:' + options.field + '"/>'); | |
input.appendTo(container); | |
} | |
} | |
that.countingUpdates(); | |
} | |
checkboxplayerFlag(data: any) { | |
let that = this; | |
} | |
setmobiles(data: any) { | |
let that = this; | |
let tempObj = {}; | |
let defauktmobileNOData = data.playermobiles.find((elem) => { return elem.isDefault; }); | |
tempObj['mobileNo'] = defauktmobileNOData.mobileNo; | |
tempObj['mobileName'] = defauktmobileNOData.mobileName; | |
this.mobileTempArray = []; | |
this.mobileTempArray.push(tempObj); | |
let mobilesdata = data.playermobiles; | |
let mobilesDataList = this.mobileTempArray; | |
this.playerScoreVal.mobileNo = defauktmobileNOData.mobileNo; | |
let selectedmobile = mobilesdata.find(elem => elem.mobileNo == defauktmobileNOData.mobileNo); | |
this.selectedmobileArr = selectedmobile; | |
this.mobileCarousel.setmobileData(mobilesdata, mobilesDataList, defauktmobileNOData.mobileNo); | |
$("#mobileCarouselLabel .mobileHint").css("display", "none"); | |
setTimeout(function () { | |
$("#unSelectedmobilesLogoBox1 .currentNwLogo").bind("click", function (e) { | |
e.stopPropagation(); | |
that.singleSelection(data, e); | |
}); | |
}, 100); | |
} | |
setmobilesSession(mobileNo: any, data: any) { | |
let that = this; | |
let tempObj = {}; | |
let defauktmobileNOData; | |
if (mobileNo) { | |
defauktmobileNOData = data.playermobiles.find((elem) => { return elem.mobileNo === +mobileNo; }); | |
} else { | |
defauktmobileNOData = data.playermobiles.find((elem) => { return elem.isDefault; }); | |
} | |
tempObj['mobileNo'] = defauktmobileNOData.mobileNo; | |
tempObj['mobileName'] = defauktmobileNOData.mobileName; | |
this.mobileTempArray = []; | |
this.mobileTempArray.push(tempObj); | |
let mobilesdata = data.playermobiles; | |
let mobilesDataList = this.mobileTempArray; | |
this.playerScoreVal.mobileNo = defauktmobileNOData.mobileNo; | |
let selectedmobile = mobilesdata.find(elem => elem.mobileNo == defauktmobileNOData.mobileNo); | |
this.selectedmobileArr = selectedmobile; | |
this.mobileCarousel.setmobileData(mobilesdata, mobilesDataList, defauktmobileNOData.mobileNo); | |
$("#mobileCarouselLabel .mobileHint").css("display", "none"); | |
setTimeout(function () { | |
$("#unSelectedmobilesLogoBox1 .currentNwLogo").bind("click", function (e) { | |
e.stopPropagation(); | |
that.singleSelection(data, e); | |
}); | |
}, 100); | |
} | |
mobilesEvent(data: any) { | |
let mobile = this.mobileCarousel.getselectedmobileID(); | |
let selectedmobileId = data.mobileData; | |
} | |
singleSelection(data, e: any) { | |
this.mobileCarousel.getClearmobiles(); | |
this.mobileCarousel.mobileLogoClick(e); | |
var getSelect = this.mobileCarousel.getselectedmobile(); | |
let mobilesdata = data.playermobiles; | |
let selectedmobile = mobilesdata.find(elem => elem.mobileNo == getSelect[0].mobileNo); | |
this.playerScoreVal.mobileNo = getSelect[0].mobileNo; | |
this.selectedmobileArr = selectedmobile; | |
} | |
playervalidateSearch() { | |
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.playerCombinedVal.days.length > 0) { | |
return this.goBtnEnableDisable = false; | |
} else { return this.goBtnEnableDisable = true; } | |
// this.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, 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; | |
} | |
} | |
/*Set Value*/ | |
setValue(event, options, netName): void { | |
let value = event; | |
let selGrid = this.gridkendo.getGridselectedRow(); | |
if (!value) { | |
selGrid.set("dirty", true); | |
} | |
selGrid.set(netName, value); | |
} | |
/* player Date Template */ | |
private playerDateTemplate(type: any, that: any): any { | |
let dateValue = ""; | |
if (type.playerDate == undefined || type.playerDate == null || type.playerDate == "") { | |
type.playerDate = "" | |
return type.playerDate; | |
} else { | |
let myDate = new Date(type.playerDate); | |
dateValue = (myDate.getMonth() + 1) + "/" + myDate.getDate() + "/" + myDate.getFullYear(); | |
return dateValue; | |
} | |
} | |
/* player date Editor */ | |
private playerDateEditor(container, options, that): any { | |
this.isSaveDisableGrid = false; | |
let grid = that.gridkendo.getGrid(); | |
let selectRow = grid.select(); | |
let gridrow = grid.dataItem(selectRow); | |
gridrow.dirty = true; | |
gridrow.set("dirty", true); | |
gridrow.set('checkedOutUserId', ""); | |
// let grid = that.gridkendo.getGrid(); | |
// var dataItem = grid.dataItem($(this).closest('tr')); | |
// dataItem["dirty"] = true; | |
// //dataItem.dirty = true; | |
// dataItem.operationType = "Update"; | |
gridrow.dirty = true; | |
//let grid = this.gridkendo.getGrid(); | |
let editable = grid.dataSource.options.schema.model.fields[options.field].editable; | |
if (editable == false) { | |
// dataItem.isDataUpdated = false; | |
$('<span>' + options.model.playerDate + '</span>').appendTo(container); | |
} else { | |
// dataItem.isDataUpdated = true; | |
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 that = this; | |
let grid = that.gridkendo.getGrid(); | |
let selectRow = grid.select(); | |
let gridrow = grid.dataItem(selectRow); | |
let setDate = ""; | |
if (options.model.playerDate) { | |
setDate = kendo.toString(new Date(options.model.playerDate), "MM/dd/yyyy"); | |
} | |
that.setValue(setDate, "", options.field); | |
if (!(gridrow.updateflag != undefined && gridrow.updateflag == true)) { | |
gridrow.updateflag = true; | |
//that.totalUpdates++; | |
} | |
that.countingUpdates(); | |
// that.validateOverlap(setDate, selectRow, 'playerDate'); | |
} | |
}); | |
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 { | |
// console.log("gridDataAll bugTemplate--->", that.gridDataAll); | |
// } | |
} | |
/* Start Time Editor */ | |
private startTimeEditor(container, options, that) { | |
let grid = that.gridkendo.getGrid(); | |
let selectRow = grid.select(); | |
let gridrow = grid.dataItem(selectRow); | |
gridrow.dirty = true; | |
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) { | |
let grid = that.gridkendo.getGrid(); | |
let selectRow = grid.select(); | |
let gridrow = grid.dataItem(selectRow); | |
gridrow.dirty = true; | |
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(); | |
} | |
}); | |
} | |
} | |
/* player duration template */ | |
private playerDurationTemplate(type: any, that: any): any { | |
if (type.playerDuration == undefined || type.playerDuration == null || type.playerDuration == "" || type.playerDuration == "-1") { | |
type.playerDuration = ""; | |
if ((type.playerStartTime === "" || type.playerStartTime == null) || (type.playerEndTime == "" || type.playerEndTime == null)) { | |
return ""; | |
} else { | |
return "00:00"; | |
} | |
} | |
else { | |
return type.playerDuration; | |
} | |
} | |
/* player end time template*/ | |
private playerEndTimeTemplate(type: any, that: any): any { | |
if (type.playerEndTime == undefined || type.playerEndTime == null || type.playerEndTime == "") { | |
type.playerEndTime = ""; | |
return ""; | |
} | |
else { | |
return type.playerEndTime; | |
} | |
} | |
/* player Duration Editor*/ | |
private playerDurationEditor(container, options, that) { | |
this.isSaveDisableGrid = false; | |
let grid = that.gridkendo.getGrid(); | |
let selectRow = grid.select(); | |
let gridrow = grid.dataItem(selectRow); | |
gridrow.dirty = true; | |
gridrow.set("dirty", true); | |
gridrow.set('checkedOutUserId', ""); | |
//let grid = this.gridkendo.getGrid(); | |
let editable = grid.dataSource.options.schema.model.fields[options.field].editable; | |
if (editable == false) { | |
$('<span>' + options.model.playerDuration + '</span>').appendTo(container); | |
} else { | |
$('<input name="' + options.field + '"/>').appendTo(container).kendoMaskedTextBox({ | |
mask: "00:00", | |
promptChar: "0", | |
value: options.model.playerDuration, | |
change: function (e) { | |
} | |
}).on("keyup", function (e) { | |
let grid = that.gridkendo.getGrid(); | |
let gridrow = grid.dataItem(grid.select()); | |
let playerEndTimeInx: number = 0; | |
grid.columns.find(function (v, i) { | |
if (grid.columns[i].field == 'playerDuration') { | |
playerEndTimeInx = i - 1; | |
} | |
}); | |
if (!that.validateDurationError($(this).val())) { | |
grid.tbody.find("tr[data-uid='" + gridrow.uid + "']").find("td:eq( " + playerEndTimeInx + " )").removeClass('mandatoryField'); | |
let playerstartTime = that.convertTo24Hour(gridrow.playerStartTime); | |
let endTimeDuration = that.addTimes(playerstartTime, $(this).val()); | |
gridrow.set("playerEndTime", endTimeDuration); | |
if ($(this).val() == "") { | |
gridrow.set("playerDuration", "00:00"); | |
} | |
} else { | |
grid.tbody.find("tr[data-uid='" + gridrow.uid + "']").find("td:eq( " + playerEndTimeInx + " )").addClass('mandatoryField'); | |
} | |
gridrow.trigger("change"); | |
if (!(gridrow.updateflag != undefined && gridrow.updateflag == true)) { | |
gridrow.updateflag = true; | |
//that.totalUpdates++; | |
} | |
that.countingUpdates(); | |
}); | |
} | |
} | |
validateDurationError(value) { | |
if ("00:00" !== value) { | |
let checkVal = value.split(":"); | |
let chkVal = 23; | |
let isError = (parseInt(checkVal[0]) > chkVal) ? true : (parseInt(checkVal[1]) > 59) ? true : false; | |
// if (isError) { | |
// console.log("add error class"); | |
// } | |
return isError; | |
} | |
} | |
/* 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; | |
let value = "<i>" + data + "</i>"; | |
return value; | |
} | |
} | |
} | |
} | |
/* productEditor method:For displaying and editing product field */ | |
private productEditor(container, options, that) { | |
this.rowDotMenuClick("true"); | |
if (options.model.archiveFlag == "Y") { | |
$('<label>' + options.model.programType + '</label>').appendTo(container); | |
} else { | |
let input = $('<input name="' + options.field + '" class="k-input" />').appendTo(container); | |
input.kendoComboBox(that.kendoComboBoxOptionProgramEditor).appendTo(container); | |
$('.k-input-readonly').prop('readonly', true); | |
} | |
} | |
//playerSourceTemplate | |
/* Bug template */ | |
// private playerSourceTemplate(type: any, that: any): any { | |
// if (type.schedItemNo === null && type.titleOwnermobile != null) { | |
// for (let i = 0; i < that.playerDataAPI.length; i++) { | |
// if (that.playerDataAPI[i].schedItemNo === null && that.playerDataAPI[i].titleOwnermobile != null) { | |
// //return type.bug; | |
// // var sType = that.gridDataAll.player_SOURCE == undefined ? [] : that.gridDataAll.player_SOURCE; | |
// var sValue = ''; | |
// // var sTypeBug = sType.find(elem => elem.mobileNo == 225); | |
// // if (sTypeBug) { | |
// // return sValue = sTypeBug.propertyListValue; | |
// // } | |
// return sValue; | |
// } | |
// } | |
// } | |
// if (type.playerSource == undefined || type.playerSource == null || type.playerSource == "") { | |
// type.playerSource = ""; | |
// return type.playerSource; | |
// } else { | |
// var sType = that.gridDataAll.player_SOURCE == undefined ? [] : that.gridDataAll.player_SOURCE; | |
// var sValue = ''; | |
// var sTypeBug = sType.find(elem => elem.propertyListValueID == type.playerSource); | |
// if (sTypeBug) { | |
// return sValue = sTypeBug.propertyListValue; | |
// } else { | |
// sValue = ''; | |
// } | |
// } | |
// } | |
// // /* Bug template editor */ | |
// private playerSourceEditor(container, options, that) { | |
// this.isSaveDisableGrid = false; | |
// let grid = that.gridkendo.getGrid(); | |
// let selectRow = grid.select(); | |
// let gridrow = grid.dataItem(selectRow); | |
// gridrow.dirty = true; | |
// gridrow.set("dirty", true); | |
// gridrow.set('checkedOutUserId', ""); | |
// this.rowDotMenuClick("true"); | |
// let editable = false; | |
// if (gridrow.schedItemNo === null && gridrow.titleOwnermobile != null) { | |
// // let editable = true; | |
// //if (!editable) { | |
// $('<span id="playerSourceProvideDropdown">' + options.model.playerSource + '</span>').appendTo(container); | |
// } else { | |
// var sValue = ''; | |
// if (!(gridrow.updateflag != undefined && gridrow.updateflag == true)) { | |
// gridrow.updateflag = true; | |
// //that.totalUpdates++; | |
// } | |
// that.countingUpdates(); | |
// var sType = that.gridDataAll.player_SOURCE == undefined ? [] : that.gridDataAll.player_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 | |
// }); | |
// var widget = input.getKendoComboBox(); | |
// widget.input.on("focus keyup keydown", function () { | |
// // return false; | |
// if (true) { | |
// return false; | |
// } | |
// else { | |
// return false; | |
// } | |
// }); | |
// } | |
// } | |
/* Bug template */ | |
// private bugTemplate(type: any, that: any): any { | |
// if (type.schedItemNo === null && type.titleOwnermobile != null) { | |
// for (let i = 0; i < that.playerDataAPI.length; i++) { | |
// if (that.playerDataAPI[i].schedItemNo === null && that.playerDataAPI[i].titleOwnermobile != null) { | |
// var sValue = ''; | |
// return sValue; | |
// } | |
// } | |
// } | |
// if (type.bug == undefined || type.bug == null || type.bug == "") { | |
// type.bug = ""; | |
// return type.bug; | |
// } else { | |
// type.bug = String(type.bug); | |
// var sType = that.gridDataAll.BUG == undefined ? [] : that.gridDataAll.BUG; | |
// var sValue = ''; | |
// var sTypeBug = sType.find(elem => elem.propertyListValueID == type.propertyListValueID); | |
// if (sTypeBug) { | |
// type.bug = sTypeBug.propertyListValueID; | |
// return sValue = type.propertyListValue; | |
// } else { | |
// return sValue; | |
// } | |
// } | |
// } | |
/* Bug template */ | |
private bugTemplate(type: any, that: any): any { | |
// if (type.schedItemNo === null && type.titleOwnermobile != null) { | |
// for (let i = 0; i < that.playerDataAPI.length; i++) { | |
// if (that.playerDataAPI[i].schedItemNo === null && that.playerDataAPI[i].titleOwnermobile != null) { | |
// var sValue = ''; | |
// return sValue; | |
// } | |
// } | |
// } | |
if (type.propertyListValueID == undefined || type.propertyListValueID == null || type.propertyListValueID == "") { | |
type.bug = null; | |
type.propertyListValueID = null; | |
type.propertyListValue = ""; | |
return ""; | |
} else { | |
type.bug = String(type.bug); | |
var sType = that.gridDataAll.BUG == undefined ? [] : that.gridDataAll.BUG; | |
var sValue = ''; | |
var sTypeBug = sType.find(elem => elem.propertyListValueID == type.propertyListValueID); | |
if (sTypeBug) { | |
type.bug = sTypeBug.propertyListValueID; | |
return sValue = type.propertyListValue; | |
} else { | |
return sValue; | |
} | |
} | |
} | |
/* Bug template editor */ | |
private bugEditor(container, options, that) { | |
this.isSaveDisableGrid = false; | |
let grid = that.gridkendo.getGrid(); | |
let selectRow = grid.select(); | |
let gridrow = grid.dataItem(selectRow); | |
gridrow.dirty = true; | |
gridrow.set("dirty", true); | |
gridrow.set('checkedOutUserId', ""); | |
this.rowDotMenuClick("true"); | |
let editable = true; | |
if (!editable) { | |
$('<span id="playerBugDropdown">' + options.model.propertyListValue + '</span>').appendTo(container); | |
} else { | |
var sValue = ''; | |
if (!(gridrow.updateflag != undefined && gridrow.updateflag == true)) { | |
gridrow.updateflag = true; | |
} | |
that.countingUpdates(); | |
var sTypeplayer = that.gridDataAll.BUG; | |
let sType = that.gridDataAll.BUG; | |
if (gridrow.schedItemNo === null && gridrow.titleOwnermobile != null) { | |
sType = sTypeplayer.filter(map => (map.mobileNo == gridrow.titleOwnermobile || map.mobileNo == -1)); | |
} else if (gridrow.schedItemNo != null) { | |
//To DO add key | |
sType = sTypeplayer.filter(map => (map.mobileNo == this.playerScoreVal.mobileNo || map.mobileNo == -1)); | |
} | |
// var sType = that.gridDataAll.BUG; | |
// if (gridrow.schedItemNo === null && gridrow.titleOwnermobile != null) { | |
// console.log(" gridrow.titleOwnermobile -->", gridrow.titleOwnermobile) | |
// sType = sType.filter(map => map.mobileNo == gridrow.titleOwnermobile); | |
// // currently drop down values are not coming because mobile no of player source values not matching with titleowner mobile of data | |
// // if scheduleItem no is null and title owner mobile is not equal to null I applied filter on player source values based on mobile no equal to data of titleowner mobile no, values are not coming after filter | |
// } | |
// if(gridrow.schedItemNo =! null){ | |
// sType = sType.filter(map => map.mobileNo == gridrow.selectedmobileNo || -1 ); | |
// } | |
var input = $('<input data-text-field="propertyListValue" data-value-field="propertyListValue" data-bind="value:' + options.field + '"/>'); | |
input.appendTo(container) | |
.kendoComboBox({ | |
dataSource: sType, | |
dataTextField: "propertyListValue", | |
dataValueField: "propertyListValueID", | |
valuePrimitive: true, | |
change(e) { | |
if (e.sender.element[0].value != "") { | |
var sTypeBug = sType.find(elem => elem.propertyListValue == gridrow.propertyListValue); | |
if (sTypeBug) { | |
gridrow.propertyListValueID = sTypeBug.propertyListValueID; | |
gridrow.bug = sTypeBug.propertyListValueID; | |
} | |
} else { | |
gridrow.propertyListValueID = null; | |
gridrow.bug = null; | |
} | |
} | |
}); | |
var widget = input.getKendoComboBox(); | |
widget.input.on("focus keyup keydown", function () { | |
return false; | |
}); | |
} | |
} | |
/* Bug template */ | |
private tickerTemplate(type: any, that: any): any { | |
that.playerDataAPI.map(res => { | |
}); | |
type.ticker = type.tickerPropertyListValueID; | |
// if (type.schedItemNo === null && type.titleOwnermobile != null) { | |
// for (let i = 0; i < that.playerDataAPI.length; i++) { | |
// if (that.playerDataAPI[i].schedItemNo === null && that.playerDataAPI[i].titleOwnermobile != null) { | |
// let sValue = ''; | |
// return sValue; | |
// } | |
// } | |
// } | |
if (type.tickerPropertyListValueID == undefined || type.tickerPropertyListValueID == null || type.tickerPropertyListValueID == "") { | |
type.ticker = null; | |
type.tickerPropertyListValueID = null; | |
return ""; | |
} else { | |
let sTypeTickerData = that.gridDataAll.TICKER == undefined ? [] : that.gridDataAll.TICKER; | |
let sValue = ''; | |
let sTypeTicker = sTypeTickerData.find(elem => elem.propertyListValue == type.tickerPropertyListValue); | |
if (sTypeTicker) { | |
type.ticker = sTypeTicker.propertyListValueID; | |
sValue = type.tickerPropertyListValue; | |
return sValue; | |
//return type.tickerPropertyListValue; | |
} else { | |
return sValue; | |
} | |
} | |
} | |
private tickerEditor(container, options, that) { | |
this.isSaveDisableGrid = false; | |
let grid = that.gridkendo.getGrid(); | |
let selectRow = grid.select(); | |
let gridrow = grid.dataItem(selectRow); | |
gridrow.dirty = true; | |
gridrow.set("dirty", true); | |
gridrow.set('checkedOutUserId', ""); | |
this.rowDotMenuClick("true"); | |
let editable = true; | |
if (!editable) { | |
$('<span id="playerBugDropdown">' + options.model.propertyListValue + '</span>').appendTo(container); | |
} else { | |
var sValue = ''; | |
if (!(gridrow.updateflag != undefined && gridrow.updateflag == true)) { | |
gridrow.updateflag = true; | |
} | |
that.countingUpdates(); | |
// var sType = that.gridDataAll.TICKER; | |
// if (gridrow.schedItemNo === null && gridrow.titleOwnermobile != null) { | |
// sType = sType.filter(map => map.mobileNo == gridrow.titleOwnermobile); | |
// } | |
var sTypeplayer = that.gridDataAll.TICKER; | |
let sType = that.gridDataAll.TICKER; | |
if (gridrow.schedItemNo === null && gridrow.titleOwnermobile != null) { | |
sType = sTypeplayer.filter(map => (map.mobileNo == gridrow.titleOwnermobile || map.mobileNo == -1)); | |
} else if (gridrow.schedItemNo != null) { | |
//To DO add key | |
sType = sTypeplayer.filter(map => (map.mobileNo == this.playerScoreVal.mobileNo || map.mobileNo == -1)); | |
} | |
var input = $('<input data-text-field="propertyListValue" data-value-field="propertyListValue" data-bind="value:' + options.field + '"/>'); | |
input.appendTo(container) | |
.kendoComboBox({ | |
dataSource: sType, | |
dataTextField: "propertyListValue", | |
dataValueField: "propertyListValueID", | |
valuePrimitive: true, | |
change(e) { | |
if (e.sender.element[0].value != "") { | |
var sTypeEditor = sType.find(elem => elem.propertyListValue == gridrow.tickerPropertyListValue); | |
console.log("stypeEditor", sType.find(elem => elem.propertyListValue == gridrow.tickerPropertyListValue)); | |
if (sTypeEditor) { | |
gridrow.tickerPropertyListValueID = sTypeEditor.propertyListValueID; | |
gridrow.ticker = sTypeEditor.propertyListValueID; | |
} | |
} else { | |
gridrow.tickerPropertyListValueID = null; | |
gridrow.ticker = null; | |
} | |
} | |
}); | |
var widget = input.getKendoComboBox(); | |
widget.input.on("focus keyup keydown", function () { | |
return false; | |
}); | |
} | |
} | |
/* Bug template */ | |
private playerSourceTemplate(type: any, that: any): any { | |
type.playerSource = type.playerSourcePropertyListValueID; | |
// if (type.schedItemNo === null && type.titleOwnermobile != null) { | |
// for (let i = 0; i < that.playerDataAPI.length; i++) { | |
// if (that.playerDataAPI[i].schedItemNo === null && that.playerDataAPI[i].titleOwnermobile != null) { | |
// let sValue = ''; | |
// return sValue; | |
// } | |
// } | |
// } | |
if (type.playerSourcePropertyListValueID == undefined || type.playerSourcePropertyListValueID == null || type.playerSourcePropertyListValueID == "") { | |
type.playerSource = null; | |
type.playerSourcePropertyListValueID = null; | |
return ""; | |
} else { | |
let sTypeTickerData = that.gridDataAll.player_SOURCE == undefined ? [] : that.gridDataAll.player_SOURCE; | |
let sValue = ''; | |
let sTypeTicker = sTypeTickerData.find(elem => elem.propertyListValue == type.playerSourcePropertyListValue); | |
if (sTypeTicker) { | |
type.playerSource = sTypeTicker.propertyListValueID; | |
sValue = type.playerSourcePropertyListValue; | |
return sValue; | |
//return type.playerSourcePropertyListValue; | |
} else { | |
return sValue; | |
} | |
} | |
} | |
/* Bug template editor */ | |
private playerSourceEditor(container, options, that) { | |
this.isSaveDisableGrid = false; | |
let grid = that.gridkendo.getGrid(); | |
let selectRow = grid.select(); | |
let gridrow = grid.dataItem(selectRow); | |
gridrow.dirty = true; | |
gridrow.set("dirty", true); | |
gridrow.set('checkedOutUserId', ""); | |
this.rowDotMenuClick("true"); | |
let editable = true; | |
if (!editable) { | |
$('<span id="playerBugDropdown">' + options.model.propertyListValue + '</span>').appendTo(container); | |
} else { | |
var sValue = ''; | |
if (!(gridrow.updateflag != undefined && gridrow.updateflag == true)) { | |
gridrow.updateflag = true; | |
} | |
that.countingUpdates(); | |
var sTypeplayer = that.gridDataAll.player_SOURCE; | |
let sType = that.gridDataAll.player_SOURCE; | |
if (gridrow.schedItemNo === null && gridrow.titleOwnermobile != null) { | |
sType = sTypeplayer.filter(map => (map.mobileNo == gridrow.titleOwnermobile || map.mobileNo == -1)); | |
} else if (gridrow.schedItemNo != null) { | |
//To DO add key | |
sType = sTypeplayer.filter(map => (map.mobileNo == this.playerScoreVal.mobileNo || map.mobileNo == -1)); | |
} | |
var input = $('<input data-text-field="propertyListValue" data-value-field="propertyListValue" data-bind="value:' + options.field + '"/>'); | |
input.appendTo(container) | |
.kendoComboBox({ | |
dataSource: sType, | |
dataTextField: "propertyListValue", | |
dataValueField: "propertyListValueID", | |
valuePrimitive: true, | |
change(e) { | |
if (e.sender.element[0].value != "") { | |
var sTypeEditor = sType.find(elem => elem.propertyListValue == gridrow.playerSourcePropertyListValue); | |
console.log("stypeEditor", sType.find(elem => elem.propertyListValue == gridrow.playerSourcePropertyListValue)); | |
if (sTypeEditor) { | |
gridrow.playerSourcePropertyListValueID = sTypeEditor.propertyListValueID; | |
gridrow.playerSource = sTypeEditor.propertyListValueID; | |
} | |
} else { | |
gridrow.playerSourcePropertyListValueID = null; | |
gridrow.playerSource = null; | |
} | |
} | |
}); | |
var widget = input.getKendoComboBox(); | |
widget.input.on("focus keyup keydown", function () { | |
return false; | |
}); | |
} | |
} | |
/* 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(); | |
} | |
} | |
/* player start time template */ | |
private playerStartTimeTemplate(type: any, that: any): any { | |
if (type.playerStartTime == undefined || type.playerStartTime == null || type.playerStartTime == "") { | |
type.playerStartTime = ""; | |
return ""; | |
} | |
else { | |
return type.playerStartTime; | |
} | |
} | |
private playerTimeEditor(container, options, that, timeType) { | |
this.isSaveDisableGrid = false; | |
let grid = that.gridkendo.getGrid(); | |
let selectRow = grid.select(); | |
let gridrow = grid.dataItem(selectRow); | |
gridrow.dirty = true; | |
gridrow.set("dirty", true); | |
gridrow.set('checkedOutUserId', ""); | |
let editable = grid.dataSource.options.schema.model.fields[options.field].editable; | |
if (editable == false) { | |
if (timeType == "playerStartTime") { | |
$('<span>' + options.model.playerStartTime + '</span>').appendTo(container); | |
} else { | |
$('<span>' + options.model.playerEndTime + '</span>').appendTo(container); | |
} | |
} else { | |
if (timeType == "playerStartTime") { | |
var defaultVal = options.model.playerStartTime; | |
} else { | |
var defaultVal = options.model.playerEndTime; | |
} | |
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 playerEndTimeInx: number = 0; | |
grid.columns.find(function (v, i) { | |
if (grid.columns[i].field == 'playerEndTime') { | |
playerEndTimeInx = i - 1; | |
} | |
}); | |
if (this.value() != null) { | |
setTime = kendo.toString(new Date(this.value()), "hh:mm tt"); | |
} | |
if (timeType == "playerStartTime") { | |
let playerDuration = ""; | |
if (gridrow.playerDuration == "") { | |
playerDuration = gridrow.blockDuration; | |
gridrow.set("playerDuration", gridrow.blockDuration); | |
} | |
gridrow.set("playerStartTime", setTime); | |
let playerStartTime = that.convertTo24Hour(setTime); | |
let endTime = that.addTimes(playerStartTime, gridrow.playerDuration); | |
gridrow.set("playerEndTime", endTime); | |
} | |
gridrow.trigger("change"); | |
if (!(gridrow.updateflag != undefined && gridrow.updateflag == true)) { | |
gridrow.updateflag = true; | |
} | |
that.countingUpdates(); | |
} | |
}); | |
} | |
} | |
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); | |
// } | |
// let grid = that.gridkendo.getGrid(); | |
// var myItem = grid.dataItem($(this).closest("tr")); | |
// if (myItem.gridCheck == false) { | |
// that.totalAiringsCount -= 1; | |
// $('#unlockCheck').prop('checked', false); | |
// } else { | |
// var checkboxes: any = document.getElementsByClassName('gridCheckBox'); | |
// $('#unlockCheck').prop('checked', true); | |
// for (var i = 0; i < checkboxes.length; i++) { | |
// if (!checkboxes[i].checked) { | |
// $('#unlockCheck').prop('checked', false); | |
// break; | |
// } | |
// } | |
// // that.totalAiringsCount += 1; | |
// } | |
} | |
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) { | |
// if (newValue) { | |
// let SelectedStartDate = this.playerScoreVal.startDate; | |
// if (SelectedStartDate === undefined || SelectedStartDate === null) { | |
// SelectedStartDate = new Date(); | |
// } | |
// this.playerScoreVal.endDate = this.calculateEndDate(SelectedStartDate, this.playerScoreVal.weekCount); | |
// $("#endDate").data("kendoDatePicker").value(this.playerScoreVal.endDate); | |
// this.validateSearch(); | |
// } | |
// } | |
handleWeek(e) { | |
let newValue: any = $("#weekNumber").val(); | |
if (newValue == null || newValue === undefined || true === isNaN(newValue) || newValue.trim() === "") { | |
$("#weekNumber").val(1); | |
newValue = 1; | |
this.playerScoreVal.weekCount = 1; | |
} | |
let SelectedStartDate = this.playerScoreVal.startDate; | |
if (SelectedStartDate === undefined || SelectedStartDate === null) { | |
SelectedStartDate = new Date(); | |
} | |
this.playerScoreVal.endDate = this.calculateEndDate(SelectedStartDate, this.playerScoreVal.weekCount); | |
$("#endDate").data("kendoDatePicker").value(this.playerScoreVal.endDate); | |
// this.validateSearch(); | |
} | |
private generateUUID(): any { | |
let d = new Date().getTime(); | |
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { | |
let r = (d + Math.random() * 16) % 16 | 0; | |
d = Math.floor(d / 16); | |
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16); | |
}); | |
return uuid; | |
}; | |
private exportFile(): void { | |
let fileNameUID = this.kendocommand.excelfileUidName + "_" + this.generateUUID() + ".xls"; | |
let gridData = this.gridkendo._dataSource._data; | |
let gridColumns = this.gridkendo.getGrid().columns; | |
let showExcelColums: string[] = []; | |
for (let i = 3; i < gridColumns.length; i++) { | |
if (gridColumns[i].hidden != true) { | |
showExcelColums.push(gridColumns[i].field); | |
} | |
} | |
let columns = [ | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true }, | |
{ autoWidth: true } | |
]; | |
let cells: any[] = []; | |
let rows: any[] = []; | |
for (let i = 0; i < showExcelColums.length; i++) { | |
cells.push( | |
{ value: showExcelColums[i], hAlign: "left", color: "#FFFFFF", background: "#808080" } | |
); | |
} | |
rows.push({ cells: cells }); | |
let gridDataValue = this.gridkendo._dataSource._data; | |
let gridDataLength = this.gridkendo._dataSource._data.length; | |
for (let i = 0; i < gridDataLength; i++) { | |
let gridDataLevel2Value = gridDataValue[i].licenseDTO; | |
if ((gridDataLevel2Value == null) || (gridDataLevel2Value.length == 0)) { | |
cells = []; | |
for (let k = 0; k < showExcelColums.length; k++) { | |
cells.push( | |
{ value: gridDataValue[i][showExcelColums[k]], hAlign: "left", color: "", background: "" } | |
); | |
} | |
rows.push({ cells: cells }); | |
} | |
else { | |
let gridDataLevel2Length = gridDataValue[i].licenseDTO.length; | |
for (let j = 0; j < gridDataLevel2Length; j++) { | |
let gridDataLevel3Value = gridDataLevel2Value[j].amortizationDTO; | |
let gridDataLevel3Length = gridDataLevel2Value[j].amortizationDTO.length; | |
for (let k = 0; k < gridDataLevel3Length; k++) { | |
let tempa = (gridDataLevel2Value[j].licenseFeeType == "License Fee") ? gridDataLevel3Value[k].amortizationTemplate : ""; | |
let tempameth = (gridDataLevel2Value[j].licenseFeeType === "License Fee") ? "" : gridDataLevel3Value[k].amortizationMethod; | |
let efDate = (parseFloat(gridDataLevel2Value[j].licenseFee) != 0) ? gridDataLevel3Value[k].effectiveDate : ""; | |
rows.push({ | |
cells: [ | |
{ value: this.scheduleName, hAlign: "left", color: "", background: "" }, | |
{ value: this.schedItemNo, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataValue[i].titleName, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataValue[i].titleId, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataValue[i].titleType, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataLevel2Value[j].licenseFee, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataLevel2Value[j].licenseFeeType, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataLevel2Value[j].notes, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataLevel2Value[j].licenseFeeNo, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataLevel3Value[k].mobile, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataLevel3Value[k].allocation, hAlign: "left", color: "", background: "" }, | |
{ value: tempameth, hAlign: "left", color: "", background: "" },//gridDataLevel3Value[k].amortizationMethod | |
{ value: (tempa == null) ? "" : tempa, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataLevel3Value[k].notes, hAlign: "left", color: "", background: "" }, | |
{ value: gridDataLevel3Value[k].effectiveDate, hAlign: "left", color: "", background: "" } | |
] | |
}) | |
} | |
} | |
} | |
} | |
let workbook = new kendo.ooxml.Workbook({ | |
sheets: [ | |
{ | |
freezePane: { | |
rowSplit: 1 | |
}, | |
columns: columns, | |
rows: rows | |
} | |
] | |
}); | |
kendo.saveAs({ dataURI: workbook.toDataURL(), fileName: fileNameUID }); | |
//this.progress.requestEnd(); | |
} | |
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); | |
} | |
} | |
public threeState(event) { | |
if (event.target.checked) { | |
this.playerScoreVal.player = true; | |
} else { | |
this.playerScoreVal.player = false; | |
} | |
this.count1 = this.count1 + 1; | |
if (this.count1 % 3 == 0) { | |
this.playerScoreVal.player = ""; | |
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.disablePrefAdd = true; | |
that.disablePrefEdit = false; | |
that.disablePrefClear = false; | |
//that.disablePrefSave = false; | |
/* selected pref details */ | |
let prefData = that.preferenceData; | |
/* end */ | |
let getPrefList = prefData.find(elem => elem.preferenceName == value); | |
if (getPrefList) { | |
that.preferenceSetting(getPrefList.preferenceList); | |
} | |
} else { | |
that.disablePrefAdd = false; | |
that.disablePrefEdit = true; | |
that.disablePrefClear = true; | |
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) { | |
let columnData = this.columns; | |
for (var i = 0; i < grid.options.columns.length; i++) { | |
var field = grid.options.columns[i].field; | |
grid.columns[i].sortable = false; | |
if (i >= 3) { | |
columnData[i].visible = true; | |
grid.options.columns[i].visible = true; | |
grid.options.columns[i].hidden = false; | |
grid.options.columns[i].sortable = true; | |
grid.columns[i].sortable = true; | |
grid.showColumn(columnData[i].airingPropertyParms); | |
} | |
for (var j = 0; j < grid.columns.length; j++) { | |
//grid.columns[j].visible = true; | |
if (grid.columns[j].field == field) { | |
grid.reorderColumn(i, grid.columns[j]); | |
} | |
break; | |
} | |
} | |
} | |
gridCustomization() { | |
let that = this; | |
let columnData = that.columns; | |
//let columnData = this.metaAggregateCopy.changeColumns; | |
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++) { | |
if (grid.columns[j].field != undefined) { | |
grid.hideColumn(grid.columns[j].field); | |
} | |
} | |
// show and hide | |
for (var i = 0; i < colLen; i++) { | |
/* if(columnData[i].airingPropertyParms=='programType'){ | |
columnData[i].airingPropertyParms='programTypeNo'; | |
} | |
if(columnData[i].airingPropertyParms=='scheduleTypeNo'){ | |
columnData[i].airingPropertyParms='schedProgTypeNo'; | |
} | |
if(columnData[i].airingPropertyParms=='userAdded'){ | |
columnData[i].airingPropertyParms='userAddedName'; | |
} | |
if(columnData[i].airingPropertyParms=='userUpdated'){ | |
columnData[i].airingPropertyParms='userUpdatedName'; | |
} | |
console.log('cols => '+columnData[i].airingPropertyParms);*/ | |
//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); | |
} | |
var index = -1; | |
var filteredObj = columnData.find(function (item, k) { | |
if (item.airingPropertyParms === columnData[i].airingPropertyParms) { | |
index = k; | |
return k; | |
} | |
}); | |
let gridCol = grid.columns.find(function (m, n) { return grid.columns[n].field == columnData[i].airingPropertyParms; }); | |
if (gridCol != undefined) { | |
//26 + 3 = 29 | |
//max 8 | |
// grid.reorderColumn((index), gridCol); | |
grid.reorderColumn((index), gridCol); | |
} | |
} | |
} | |
changeColsProperty() { | |
//let props = this.tempset; | |
let props = this.columnsData; | |
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; | |
} | |
} | |
} | |
} | |
private preferenceSetting(list) { | |
let gridCol; | |
let grid = this.gridkendo.getGrid(); | |
for (let j = 0; j < grid.columns.length; j++) { | |
//if(){} | |
if (grid.columns[j].field != undefined) { | |
grid.hideColumn(grid.columns[j].field); | |
} | |
} | |
for (let i = 0; i < list.length; i++) { | |
let position = parseInt(list[i].visiblePosition + ""); | |
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; | |
$('#createPreferencesPopupplayer .kPopUpTitle').text('Add Preferences'); | |
$('.preferenceName').val(''); | |
if ($('.preferenceName').val() == "") { | |
$('.okPreferencesplayer').attr('disabled', 'disabled'); | |
} | |
let dialogConfirm = $("#createPreferencesPopupplayer").data("kendoWindow").center().open(); | |
$("#okPreferencesplayer").unbind().click(function () { | |
that.createUpdatePreference('create'); | |
dialogConfirm.close(); | |
}); | |
$("#cancelPreferencesplayer").unbind().click(function () { | |
dialogConfirm.close(); | |
}); | |
} | |
editPreferences() { | |
let that = this; | |
$('#createPreferencesPopupplayer .kPopUpTitle').text('Edit Preferences'); | |
//let dialogConfirm = $("#createPreferencesPopUpWindow").data("kendoWindow").center().open(); | |
let dialogConfirm = $("#createPreferencesPopupplayer").data("kendoWindow").center().open(); | |
$('.preferenceName').val(that.preferenceName); | |
//$('.okPreferencesplayer').attr('disabled', 'disabled'); | |
// $('#okPreferencesplayer').removeAttr('disabled'); | |
$("#okPreferencesplayer").unbind().click(function () { | |
that.createUpdatePreference('update'); | |
dialogConfirm.close(); | |
}); | |
$("#cancelPreferencesplayer").unbind().click(function () { | |
dialogConfirm.close(); | |
}); | |
} | |
checkPrefName(event) { | |
let that = this; | |
let value = event.target.value; | |
if ($.trim(value) != '') { | |
$('.okPreferencesplayer').removeAttr('disabled'); | |
} else { | |
$('.okPreferencesplayer').attr('disabled', 'disabled'); | |
} | |
} | |
createUpdatePreference(type) { | |
let that = this; | |
let prefValue = $('.preferenceName').val(); | |
if ($.trim(prefValue) != '') { | |
let len = that.preferenceData.length; | |
let checkExist = false; | |
for (let i = 0; i < len; i++) { | |
if ($.trim(that.preferenceData[i].preferenceName.toLowerCase()) == $.trim(prefValue.toLowerCase())) { | |
checkExist = true; | |
break; | |
} | |
} | |
if (checkExist && type == 'create') { | |
let strMessage = 'Preferences name already exist.'; | |
that.gridkendo.setdialog(strMessage, "ok", null); | |
} else { | |
if (type == 'create') { | |
//let preferenceData = this.getPreference(); | |
let createPref: any = { | |
"mobileNo": this.bulkCreateValplayer.mobileNo, | |
"operationType": "Create", | |
"preferenceName": $.trim(prefValue), | |
"preferenceNo": "", | |
"preferenceList": "" | |
//, | |
//"preferenceList": preferenceData | |
}; | |
that.preferenceData.push(createPref); | |
that.preferenceName = prefValue; | |
that.prefSelectedName = prefValue; | |
that.disablePrefAdd = true; | |
that.disablePrefSave = false; | |
} else { | |
let updatePref = that.preferenceData.find(elem => elem.preferenceName == that.preferenceName); | |
if (updatePref != undefined) { | |
updatePref.preferenceName = prefValue; | |
that.prefSelectedName = prefValue; | |
that.preferenceName = prefValue; | |
updatePref.operationType = 'update'; | |
that.disablePrefSave = false; | |
that.disablePrefClear = true; | |
} | |
} | |
} | |
} | |
} | |
clearPreferences() { | |
let that = this; | |
that.disablePrefClear = true; | |
that.disablePrefAdd = false; | |
let prefValue = $('.preferenceName').val(); | |
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('lightWork'); | |
$("#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.disablePrefEdit = true; | |
// that.progress.requestEnd(); | |
// that.disablePrefClear = true; | |
// that.disablePrefAdd = false; | |
that.prefSelectedName = ''; | |
let grid = that.gridkendo.getGrid(); | |
that.resetColumns(grid); | |
that.gridCustomization(); | |
that.progress.requestEnd(); | |
}, err => { | |
that.progress.requestEnd(); | |
}); | |
dialogConfirm.close(); | |
}); | |
$("#popupCancel").unbind().click(function () { | |
dialogConfirm.close(); | |
}); | |
} | |
cancelPreferencesplayer() { | |
$("#createPreferencesPopupplayer").data("kendoWindow").close(); | |
} | |
private savePreferences() { | |
let that = this; | |
let preferenceData = this.getPreference(); | |
let data = { | |
"mobileNo": this.bulkCreateValplayer.mobileNo, | |
"operationType": "Create", | |
"preferenceName": $.trim(this.preferenceName), | |
"preferenceNo": "", | |
"preferenceList": preferenceData, | |
"preferenceType": "DLScore" | |
}; | |
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(); | |
this.SPORTSService.getResponse('authorization/v1/savePreferences', 'post', data).subscribe( | |
data => { | |
this.disablePrefSave = true; | |
that.disablePrefAdd = true; | |
that.disablePrefEdit = false; | |
that.disablePrefClear = false; | |
this.progress.requestEnd(); | |
}, | |
err => { | |
this.progress.requestEnd(); | |
}); | |
} | |
private getPreference(): any { | |
let savePreference = []; | |
let that = this; | |
let columns = that.columns; | |
//let columns = this.metaAggregateCopy.changeColumns; | |
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; | |
} | |
lockedScheduleMsgShow(responseData) { | |
let that = this; | |
that.callGridLoadData(responseData); | |
} | |
callGridLoadData(responseData) { | |
let that = this; | |
this.bulkGridData = responseData; | |
this.gridDataAll = responseData; | |
var sType = that.gridDataAll.BUG == undefined ? [] : that.gridDataAll.BUG; | |
that.playerDataAPI.map(map => { | |
map.propertyListValueID = map.bug; | |
var sTypeBug = sType.find(elem => elem.propertyListValueID == String(map.bug)); | |
// if (map.schedItemNo === null && map.titleOwnermobile != null) { | |
// map.propertyListValue = ""; | |
// } else { | |
if (sTypeBug) { | |
map.propertyListValue = sTypeBug.propertyListValue; | |
} else { | |
map.propertyListValue = ""; | |
} | |
// } | |
}); | |
var sTypeTickerData = that.gridDataAll.TICKER == undefined ? [] : that.gridDataAll.TICKER; | |
that.playerDataAPI.map(map => { | |
map.tickerPropertyListValueID = map.ticker; | |
var sTypeTicker = sTypeTickerData.find(elem => elem.propertyListValueID == String(map.ticker)); | |
// if (map.schedItemNo === null && map.titleOwnermobile != null) { | |
// map.tickerPropertyListValue = ""; | |
// } else { | |
if (sTypeTicker) { | |
map.tickerPropertyListValue = String(sTypeTicker.propertyListValue); | |
} else { | |
map.tickerPropertyListValue = ""; | |
} | |
// } | |
}); | |
var sTypeplayerSourceData = that.gridDataAll.player_SOURCE == undefined ? [] : that.gridDataAll.player_SOURCE; | |
that.playerDataAPI.map(map => { | |
map.playerSourcePropertyListValueID = map.playerSource; | |
var sTypeplayerSource = sTypeplayerSourceData.find(elem => elem.propertyListValueID == String(map.playerSource)); | |
// if (map.schedItemNo === null && map.titleOwnermobile != null) { | |
// map.playerSourcePropertyListValue = ""; | |
// } else { | |
if (sTypeplayerSource) { | |
map.playerSourcePropertyListValue = String(sTypeplayerSource.propertyListValue); | |
} else { | |
map.playerSourcePropertyListValue = ""; | |
} | |
//} | |
}); | |
this.gridDataLoad(); | |
let mobileNo = this.playerScoreVal.mobileNo; | |
//bulkCreateValplayer | |
//this.loadPreference(this.playerCombinedVal.mobileNo); | |
this.loadPreference(this.bulkCreateValplayer.mobileNo); | |
this.gridDataAll.player_SOURCE = this.gridDataAll.player_SOURCE.filter(player => { | |
//return player.mobileNo === mobileNo; | |
return (player.mobileNo === mobileNo || player.mobileNo === -1); | |
}); | |
this.gridDataAll.player_SOURCE.unshift({ | |
"delFlag": "", | |
"groupNo": "", | |
"level": "", | |
"mobileNo": -1, | |
"propertyID": "", | |
"propertyListID": null, | |
"propertyListValue": "", | |
"propertyListValueID": "", | |
"propertyName": "", | |
"showNonmobileGameInSL": "", | |
"targetDefaultPropertyListValueID": "" | |
}); | |
this.gridDataAll.BUG = this.gridDataAll.BUG.filter(player => { | |
//return player.mobileNo === mobileNo; | |
return (player.mobileNo === mobileNo || player.mobileNo === -1); | |
}); | |
// this.gridDataAll.BUG.unshift({ | |
// "delFlag": "null", | |
// "groupNo": "null", | |
// "level": "null", | |
// "mobileNo": "null", | |
// "propertyID": "null", | |
// "propertyListID": "null", | |
// "propertyListValue": "", | |
// "propertyListValueID": "null", | |
// "propertyName": "null", | |
// "showNonmobileGameInSL": "null", | |
// "targetDefaultPropertyListValueID": "null" | |
// }); | |
this.gridDataAll.BUG.unshift({ | |
"delFlag": "", | |
"groupNo": "", | |
"level": "", | |
"mobileNo": -1, | |
"propertyID": "", | |
"propertyListID": null, | |
"propertyListValue": "", | |
"propertyListValueID": "", | |
"propertyName": "", | |
"showNonmobileGameInSL": "", | |
"targetDefaultPropertyListValueID": "" | |
}); | |
this.gridDataAll.TICKER = this.gridDataAll.TICKER.filter(player => { | |
//return player.mobileNo === mobileNo; | |
return (player.mobileNo === mobileNo || player.mobileNo === -1); | |
}); | |
this.gridDataAll.TICKER.unshift({ | |
"delFlag": "", | |
"groupNo": "", | |
"level": "", | |
"mobileNo": -1, | |
"propertyID": "", | |
"propertyListID": null, | |
"propertyListValue": "", | |
"propertyListValueID": "", | |
"propertyName": "", | |
"showNonmobileGameInSL": "", | |
"targetDefaultPropertyListValueID": "" | |
}); | |
//} | |
} | |
showSchedulesDaterangePopup(responseData) { | |
let that = this; | |
$("#airingsDatarangePopup .kendoContent").html("Airings are created only for the selected schedule(s) date range"); | |
let warningMsg = $("#airingsDatarangePopup").data("kendoWindow").center().open(); | |
$("#airingsDatarangePopupOk").unbind().click(function () { | |
warningMsg.close(); | |
if (responseData.msg.length > 0) { | |
that.lockedScheduleMsgShow(responseData); | |
} else { | |
that.callGridLoadData(responseData); | |
} | |
}); | |
} | |
lockedSchedulePopup(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.bulkGridData); | |
} | |
hideContext() { | |
var contextMenu1 = $("#context-menu-player").data("kendoContextMenu"); | |
if (contextMenu1) | |
// contextMenu1.close(); | |
var contextMenu2 = $("#bulk-context-menu-player").data("kendoContextMenu"); | |
if (contextMenu2) | |
// contextMenu2.close(); | |
return true; | |
} | |
saveResponseNotify(savedResponse) { | |
let that = this; | |
this.createDialog("#saveWarningPopupplayer"); | |
let dialogConfirm = $("#saveWarningPopupplayer").data("kendoWindow").center().open(); | |
$("#saveWarningPopupplayerOk").unbind().click(function () { | |
dialogConfirm.close(); | |
if (savedResponse.conflicts.length > 0) { | |
// that.playerConflictGridPopup.conflictGridOpen(savedResponse); | |
//that.bulkcreateConflictGridPopup.conflictGridOpen(savedResponse.conflicts); | |
that.playerConflictGridPopup.conflictGridOpen(savedResponse.conflicts); | |
that.isSaveDisableGrid = true; | |
that.isCancelDisableGrid = true; | |
that.totalUpdates = 0; | |
} | |
else { | |
that.bulkGridData = []; | |
that.reloadGridDataSource(); | |
that.enableSave(true); | |
that.isSaveDisableGrid = true; | |
that.isCancelDisableGrid = true; | |
that.totalUpdates = 0 | |
} | |
}); | |
} | |
closeConflictGrid() { | |
this.bulkGridData = []; | |
this.gridkendo.reloadDataSource(this.bulkGridData); | |
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(); | |
that.totalAiringsCount = 0; | |
// that.totalAiringsCount = gridData.length; | |
for (var i = 0; i < gridData.length; i++) { | |
//if (gridData[i].gridCheck == true) { | |
gridData[i].gridCheck = true; | |
if (gridData[i].checkedOutUserId !== undefined && gridData[i].checkedOutUserId !== null && gridData[i].checkedOutUserId !== '') { | |
//if (gridData[i].checkedOutUserId == null && gridData[i].titleNo == 1023643) { | |
e.sender.tbody.find("tr[data-uid='" + gridData[i].uid + "'] td .gridCheckBox").attr('checked', false); | |
grid.lockedTable.find("tr[data-uid='" + gridData[i].uid + "'] td .gridCheckBox").attr('checked', false); | |
} | |
else { | |
e.sender.tbody.find("tr[data-uid='" + gridData[i].uid + "'] td .gridCheckBox").attr('checked', true); | |
grid.lockedTable.find("tr[data-uid='" + gridData[i].uid + "'] td .gridCheckBox").attr('checked', true); | |
that.totalAiringsCount++; | |
} | |
// 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) { | |
$('.bulkCreateGrid .k-grid-content tbody').find("tr[data-uid='" + gridData[i].uid + "']").addClass('duplicateRows'); | |
} | |
// if (that.showOverlap == false) { | |
// if (gridData[i].action == 'Delete') { | |
// e.sender.tbody.find("tr[data-uid='" + gridData[i].uid + "']").hide(); | |
// $('.bulkCreateGrid .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(); | |
// $('.bulkCreateGrid .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"); | |
// $('.bulkCreateGrid .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 (that.totalAiringsCount == 0) { | |
that.disableNoAirings = true; | |
} else { | |
that.disableNoAirings = false; | |
} | |
if (myItem.gridCheck == false) { | |
that.totalAiringsCount -= 1; | |
$('#unlockCheck').prop('checked', false); | |
} else { | |
var checkboxes: any = document.getElementsByClassName('gridCheckBox'); | |
$('#unlockCheck').prop('checked', true); | |
for (var i = 0; i < checkboxes.length; i++) { | |
if (!checkboxes[i].checked) { | |
$('#unlockCheck').prop('checked', false); | |
break; | |
} | |
} | |
that.totalAiringsCount += 1; | |
} | |
}); | |
} | |
bulkContextMenu() { | |
let that = this; | |
//var contextMenu = $("#bulk-context-menu-player").kendoContextMenu().data("kendoContextMenu"); | |
setTimeout(function () { | |
$("#bulk-context-menu-player").kendoContextMenu({ | |
target: "#KendoGridView .k-grid-header thead tr:nth-child(1)", | |
animation: { | |
open: { | |
effects: "fadeIn" | |
}, | |
closeOnClick: false | |
}, | |
open: function (e) { | |
that.bulkKeys = []; | |
let contextRow = ''; | |
var columns = that.columns; | |
//var columns = that.metaAggregateCopy.changeColumns; | |
$('.bulkSpan').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) { | |
var index = -1; | |
var val = colx.field; | |
var filteredObj = columns.find(function (item, k) { | |
if (item.airingPropertyParms === 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) { | |
// grid.columns[i].sortable = false; | |
contextRow += '<li><label><input type="checkbox" id="' + col.airingPropertyParms + '" class="hideShowColumn"> ' + col.airingProperty + '</label></li>' | |
} else { | |
// grid.columns[i].sortable = true; | |
contextRow += '<li><label><input type="checkbox" checked="checked" id="' + col.airingPropertyParms + '" class="hideShowColumn"> ' + col.airingProperty + '</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 (grid.columns[i].hidden) { | |
//grid.columns[i].sortable = false; | |
contextRow += '<li><label><input type="checkbox" id="' + col.airingPropertyParms + '" class="hideShowColumn" > ' + col.airingProperty + '</label></li>' | |
} else { | |
// grid.columns[i].sortable = false; | |
contextRow += '<li><label><input type="checkbox" id="' + col.airingPropertyParms + '" class="hideShowColumn" > ' + col.airingProperty + '</label></li>' | |
} | |
} | |
} | |
} | |
} | |
} | |
var gridStates = that.getPreference(); | |
$('.bulkSpan').append(contextRow); | |
// $('.bulkSpan').parent().parent().css({ "max-height": (windowHeight - 100), "overflow": "auto", "width": "auto !important" }) | |
$('.bulkSpan').parent().css({ "max-height": (windowHeight - 100), "overflow": "auto", "width": "auto !important" }) | |
} | |
}); | |
}, 10); | |
$('#bulk-context-menu-player').on('mousedown', function (e) { | |
e.stopImmediatePropagation(); | |
}); | |
$('#bulk-context-menu-player').unbind().on('click', '.hideShowColumn', function (e) { | |
e.stopImmediatePropagation(); | |
let grid = that.gridkendo.getGrid(); | |
let val = $(this).attr("id"); | |
if ($(this).is(':checked')) { | |
grid.showColumn(val); | |
} else { | |
grid.hideColumn(val); | |
} | |
if (that.prefSelectedName != '') { | |
that.disablePrefSave = false; | |
} | |
var getOptionField = grid.options.columns.find(elem => elem.field == val); | |
var getField = grid.columns.find(elem => elem.field == val); | |
if (getOptionField && getField) { | |
getField.width = getOptionField.width; | |
} | |
$(".controlGridScroll .horizontal-scroll .horizontal").css({ "width": $('.k-grid-header-wrap table').width() }); | |
if (($(window).width()) < $('.k-grid-header-wrap table').width()) { | |
$('.gridScrollIconsBox .nextGridColumns').addClass('active') | |
} else { | |
$('.gridScrollIconsBox .nextGridColumns').removeClass('active') | |
} | |
}); | |
// $('#bulk-context-menu-player').on('change', '.hideShowColumn', function (e) { | |
// if (that.prefSelectedName != undefined && that.prefSelectedName != "") { | |
// that.disablePrefSave = false; | |
// } | |
// else { | |
// that.disablePrefSave = true; | |
// } | |
// e.stopImmediatePropagation(); | |
// let grid = that.gridkendo.getGrid(); | |
// let gridColumns = that.gridkendo.getGrid().columns; | |
// let val = $(this).attr("id"); | |
// let columns = that.columns; | |
// //let columns = that.metaAggregateCopy.changeColumns; | |
// var index = -1; | |
// var filteredObj = columns.find(function (item, k) { | |
// if (item.airingPropertyParms === 'userAdded') { | |
// item.airingPropertyParms = 'userAddedName'; | |
// } | |
// if (item.airingPropertyParms === 'userUpdated') { | |
// item.airingPropertyParms = 'userUpdateName' | |
// } | |
// if (item.airingPropertyParms === val) { | |
// index = k; | |
// return k; | |
// } | |
// }); | |
// let dataVal = index; | |
// that.columns[dataVal].visible = (that.columns[dataVal].visible == true) ? false : true; | |
// // that.metaAggregateCopy.changeColumns[dataVal].visible = (that.metaAggregateCopy.changeColumns[dataVal].visible == true) ? false : true; | |
// var colIndex = -1; | |
// var filteredObj = gridColumns.find(function (item, m) { | |
// if (item.field === val) { | |
// index = m; | |
// return m; | |
// } | |
// }); | |
// colIndex = index; | |
// if ($(this).is(':checked')) { | |
// grid.columns[colIndex].hidden = false; | |
// grid.columns[colIndex].sortable = true; | |
// // grid.showColumn(that.metaAggregateCopy.changeColumns[dataVal].airingPropertyParms); | |
// grid.showColumn(that.columns[dataVal].airingPropertyParms); | |
// //$("#KendoGridView table th:nth-child(" + colIndex + "),td:nth-child(" + (colIndex) + "),col:nth-child(" + (colIndex-1) + ")").show(); | |
// $("#KendoGridView table th:nth-child(" + (colIndex) + "),td:nth-child(" + (colIndex) + "),col:nth-child(" + (colIndex) + ")").show(); | |
// } | |
// else { | |
// grid.columns[colIndex].hidden = true; | |
// grid.columns[colIndex].sortable = false; | |
// // setTimeout(function(){ | |
// grid.hideColumn(that.columns[dataVal].airingPropertyParms); | |
// //grid.hideColumn(that.metaAggregateCopy.changeColumns[dataVal].airingPropertyParms); | |
// // $("#KendoGridView table th:nth-child(" + colIndex + "),td:nth-child(" + (colIndex) + "),col:nth-child(" + (colIndex-1) + ")").hide(); | |
// $("#KendoGridView table th:nth-child(" + (colIndex) + "),td:nth-child(" + (colIndex) + "),col:nth-child(" + (colIndex) + ")").hide(); | |
// // },100) | |
// } | |
// }); | |
} | |
convertTo24Hour(time) { | |
var hours = parseInt(time.substr(0, 2)); | |
if (time.indexOf('AM') != -1 && hours == 12) { | |
time = time.replace('12', '0'); | |
} | |
if (time.indexOf('PM') != -1 && hours < 12) { | |
time = time.replace(hours, (hours + 12)); | |
} | |
return time.replace(/(AM|PM)/, ''); | |
} | |
addTimes(start: any, end: any) { | |
if (start && end) { | |
let times = []; | |
let times1 = start.split(':'); | |
let times2 = end.split(':'); | |
let timeCondition = "PM"; | |
for (let i = 0; i < 2; i++) { | |
times1[i] = (isNaN(parseInt(times1[i]))) ? 0 : parseInt(times1[i]) | |
times2[i] = (isNaN(parseInt(times2[i]))) ? 0 : parseInt(times2[i]) | |
times[i] = times1[i] + times2[i]; | |
} | |
//let seconds = times[2]; | |
let minutes = times[1]; | |
let hours = times[0]; | |
/* if (seconds % 60 === 0) { | |
hours += seconds / 60; | |
}*/ | |
if (minutes % 60 === 0) { | |
let res = minutes / 60; | |
hours += res; | |
minutes = minutes - (60 * res); | |
} | |
if (minutes > 60) { | |
minutes = minutes - 60; | |
hours = hours + 1; | |
} | |
hours = hours % 24; | |
if (hours < 12) { | |
timeCondition = "AM"; | |
} | |
if (hours > 12 && hours < 24) { | |
hours = hours - 12; | |
timeCondition = "PM"; | |
} | |
if (hours === 12) { | |
timeCondition = "PM"; | |
} | |
if (hours === 0) { | |
hours = hours + 12; | |
timeCondition = "AM"; | |
} | |
/*if (hours >= 12 && hours < 25) { | |
hours = hours - 12; | |
if (start.indexOf('AM') != -1) { | |
timeCondition = "PM"; | |
} | |
} else if (hours > 24) { | |
hours = hours - 24; | |
if (start.indexOf('AM') == -1) { | |
timeCondition = "PM"; | |
} | |
} | |
if (hours == 0) { | |
hours = 12; | |
} | |
if (end == "00:00") { | |
if (start.indexOf('AM') == -1) { | |
timeCondition = "PM"; | |
} else { | |
timeCondition = "AM"; | |
} | |
} */ | |
hours = hours < 10 ? "0" + hours : hours; | |
minutes = minutes < 10 ? "0" + minutes : minutes; | |
return hours + ':' + minutes + ' ' + timeCondition; | |
} | |
} | |
validateStartEndTime(sTime, eTime) { | |
let isValidTime = false; | |
// if (eTime == "" || eTime == undefined) { | |
// return isValidTime; | |
// } | |
// if (sTime == "" || sTime == undefined) { | |
// return isValidTime; | |
// } | |
if (eTime == undefined) { | |
return isValidTime; | |
} | |
if (sTime == undefined) { | |
return isValidTime; | |
} | |
eTime = "7:00 AM "; | |
sTime = "6:00 PM"; | |
// if(eTime != null || eTime !="" ){ | |
// eTime = kendo.parseDate(eTime).getTime(); | |
// } | |
// if(sTime != null || sTime !=""){ | |
// console.log("sTime----->"+sTime); | |
// sTime = kendo.parseDate(sTime).getTime(); | |
// // console.log("kendo.parseDate(sTime)----->", kendo.parseDate(sTime)); | |
// // console.log("kendo.parseDate(sTime).getTime()----->", kendo.parseDate(sTime).getTime()); | |
// } | |
if (eTime == kendo.parseDate("6:00 AM").getTime()) { | |
isValidTime = true; | |
} | |
if (eTime >= kendo.parseDate("12:00 AM").getTime()) { | |
//checking between 12am to 6 am | |
if (sTime >= (kendo.parseDate("12:00 AM").getTime()) | |
&& sTime < (kendo.parseDate("6:00 AM").getTime()) | |
&& eTime < (kendo.parseDate("6:00 AM").getTime()) | |
&& eTime > (kendo.parseDate("12:00 AM").getTime()) | |
) { | |
if (sTime < eTime) { | |
isValidTime = true; | |
} | |
} | |
// checking between (start time)6am to 12 and (ent time) bw 12 to 6am | |
else if (sTime < (kendo.parseDate("11:59 PM").getTime()) | |
&& sTime >= (kendo.parseDate("6:00 AM").getTime()) | |
&& eTime < (kendo.parseDate("6:00 AM").getTime()) | |
&& eTime >= (kendo.parseDate("12:00 AM").getTime())) { | |
isValidTime = true; | |
} | |
} | |
// checking between 6am to 12 | |
if (eTime < (kendo.parseDate("11:59 PM").getTime()) | |
&& sTime >= (kendo.parseDate("6:00 AM").getTime())) { | |
if (sTime < eTime) { | |
isValidTime = true; | |
} | |
} | |
// return isValidTime; | |
return true; | |
} | |
TimeDifference(end, start) { | |
var startTimeArray = start.split(":"); | |
var startInputHrs = parseInt(startTimeArray[0]); | |
var startInputMins = parseInt(startTimeArray[1]); | |
var endTimeArray = end.split(":"); | |
var endInputHrs = parseInt(endTimeArray[0]); | |
var endInputMins = parseInt(endTimeArray[1]); | |
var startMin = startInputHrs * 60 + startInputMins; | |
var endMin = endInputHrs * 60 + endInputMins; | |
var result; | |
if (endMin < startMin) { | |
var minutesPerDay = 24 * 60; | |
result = minutesPerDay - startMin; | |
result += endMin; | |
} else { | |
result = endMin - startMin; | |
} | |
var minutesElapsed = result % 60; | |
var hoursElapsed = (result - minutesElapsed) / 60; | |
return (hoursElapsed < 9 ? "0" : "") + hoursElapsed + ":" + (minutesElapsed < 9 ? "0" : "") + minutesElapsed; | |
} | |
applyValueToAllRow(field, value, selectedRow) { | |
this.countingUpdates(); | |
// this.resetUpdateCount(); | |
let that = this; | |
let grid = that.gridkendo.getGrid(); | |
let gridData = grid.dataSource.data(); | |
let sel = $(".gridCheckBox:checked", grid.tbody).closest("tr"); | |
if (field == "blockDuration") { | |
let changedRows = sel.map((index, event) => { | |
let dataItem: any = grid.dataItem(event); | |
let endTimeDuration = that.addTimes(dataItem.startTime, value); | |
let startTime = that.convertTo24Hour(dataItem.startTime); | |
let endTime = that.addTimes(startTime, value); | |
let actualStartTime = that.convertTo24Hour(dataItem.actualStartTime); | |
let actualEndTime = that.addTimes(actualStartTime, value); | |
// if (value == "00:00" && dataItem.startTime != that.pickerStartTime) { | |
// that.gridkendo.setdialog("Cannot span across", "ok", null); | |
// } else { | |
// if (that.validateStartEndTime(startTime, endTimeDuration)) { | |
// if (!that.validateStartEndTime(actualStartTime, actualEndTime)) { | |
// that.gridkendo.setdialog("Cannot span across", "ok", null); | |
// } else { | |
// dataItem[field] = value; | |
// dataItem["endTime"] = endTimeDuration; | |
// dataItem["actualDuration"] = value; | |
// dataItem["actualEndTime"] = actualEndTime; | |
// } | |
// } else { | |
// that.gridkendo.setdialog("Cannot span across", "ok", null); | |
// } | |
// } | |
}) | |
} | |
else if (field == "player") { | |
let changedRows = sel.map((index, event) => { | |
let dataItem: any = grid.dataItem(event); | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
// template: "# if (dirty) { # <span class='eventType newEvent text-succcess'><span class='displayBlock gridUpdateIcon'></span></span> # }# #if(checkedOutUserId){# <span class='eventType newEvent text-succcess'><span class='displayBlock gridLockIcon'></span></span> # } #", | |
if (value) { | |
dataItem["player"] = value; | |
// dataItem["foul"] = value; | |
// dataItem["record"]= value; | |
} else { | |
dataItem["player"] = ''; | |
//bulkCreateValplayer | |
if (that.bulkCreateValplayer.defaultfoulOnplayer == 'N') { | |
//if (that.bulkCreateLovs.defaultfoulOnplayer == 'N') { | |
// dataItem["foul"] = ''; | |
} | |
// dataItem["record"]= ''; | |
} | |
this.countingUpdates(); | |
dataItem[field] = value; | |
} | |
}) | |
} | |
else if (field == "foul") { | |
let changedRows = sel.map((index, event) => { | |
let dataItem: any = grid.dataItem(event); | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
// template: "# if (dirty) { # <span class='eventType newEvent text-succcess'><span class='displayBlock gridUpdateIcon'></span></span> # }# #if(checkedOutUserId){# <span class='eventType newEvent text-succcess'><span class='displayBlock gridLockIcon'></span></span> # } #", | |
if (value) { | |
// dataItem["player"] = value; | |
dataItem["foul"] = value; | |
// dataItem["record"]= value; | |
} else { | |
dataItem["foul"] = ''; | |
//bulkCreateValplayer | |
if (that.bulkCreateValplayer.defaultfoulOnplayer == 'N') { | |
//if (that.bulkCreateLovs.defaultfoulOnplayer == 'N') { | |
// dataItem["foul"] = ''; | |
} | |
// dataItem["record"]= ''; | |
} | |
dataItem[field] = value; | |
this.countingUpdates(); | |
} | |
}) | |
} | |
else if (field == "record") { | |
let changedRows = sel.map((index, event) => { | |
let dataItem: any = grid.dataItem(event); | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
// template: "# if (dirty) { # <span class='eventType newEvent text-succcess'><span class='displayBlock gridUpdateIcon'></span></span> # }# #if(checkedOutUserId){# <span class='eventType newEvent text-succcess'><span class='displayBlock gridLockIcon'></span></span> # } #", | |
if (value) { | |
// dataItem["player"] = value; | |
// dataItem["foul"] = value; | |
dataItem["record"] = value; | |
} else { | |
dataItem["record"] = ''; | |
//bulkCreateValplayer | |
if (that.bulkCreateValplayer.defaultfoulOnplayer == 'N') { | |
//if (that.bulkCreateLovs.defaultfoulOnplayer == 'N') { | |
// dataItem["foul"] = ''; | |
} | |
// dataItem["record"]= ''; | |
} | |
dataItem[field] = value; | |
this.countingUpdates(); | |
} | |
}) | |
} | |
// else if (field == "propertyListValue") { | |
// let changedRows = sel.map((index, event) => { | |
// let dataItem: any = grid.dataItem(event); | |
// if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
// || dataItem["checkedOutUserId"] === '')) { | |
// if ((dataItem.mobileNo === null || dataItem.mobileNo === undefined) && dataItem.titleOwnermobile != null) { | |
// dataItem["propertyListValue"] = ""; | |
// dataItem["propertyListValueID"] = ""; | |
// } else { | |
// dataItem["dirty"] = true; | |
// this.isSaveDisableGrid = false; | |
// //that.totalUpdates++; | |
// if (value) { | |
// dataItem["propertyListValue"] = value; | |
// } else { | |
// dataItem["propertyListValue"] = ''; | |
// } | |
// let sType = that.gridDataAll.BUG == undefined ? [] : that.gridDataAll.BUG; | |
// dataItem[field] = value; | |
// let sTypeBug = sType.find(elem => elem.propertyListValue == value); | |
// if (sTypeBug) { | |
// dataItem["bug"] = sTypeBug.propertyListValueID; | |
// dataItem["propertyListValueID"] = sTypeBug.propertyListValueID; | |
// this.countingUpdates(); | |
// } | |
// }); | |
// } | |
else if (field == "propertyListValue") { | |
let changedRows = sel.map((index, event) => { | |
let dataItem: any = grid.dataItem(event); | |
if ((selectedRow.schedItemNo === null || selectedRow.schedItemNo === undefined) && selectedRow.titleOwnermobile != null) { | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
// if ((dataItem.mobileNo === null || dataItem.mobileNo === undefined) && dataItem.titleOwnermobile != null) { | |
// // dataItem["propertyListValue"] = ""; | |
// // dataItem["tickerPropertyListValueID"] = ""; | |
// } else { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
if (value) { | |
dataItem["propertyListValue"] = value; | |
} else { | |
dataItem["propertyListValue"] = ''; | |
} | |
let sType = that.gridDataAll.BUG == undefined ? [] : that.gridDataAll.BUG; | |
dataItem[field] = value; | |
let sTypeplayerSource = sType.find(elem => elem.propertyListValue == value); | |
if (sTypeplayerSource) { | |
dataItem["bug"] = sTypeplayerSource.propertyListValueID; | |
dataItem["propertyListValueID"] = sTypeplayerSource.propertyListValueID; | |
this.countingUpdates(); | |
} | |
// } | |
} | |
} else { | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
if ((dataItem.schedItemNo === null || dataItem.schedItemNo === undefined)) { | |
//if ((dataItem.schedItemNo === null || dataItem.schedItemNo === undefined) && dataItem.titleOwnermobile != null) { | |
// dataItem["propertyListValue"] = ""; | |
// dataItem["propertyListValueID"] = ""; | |
} else { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
if (value) { | |
dataItem["propertyListValue"] = value; | |
} else { | |
dataItem["propertyListValue"] = ''; | |
} | |
let sType = that.gridDataAll.BUG == undefined ? [] : that.gridDataAll.BUG; | |
dataItem[field] = value; | |
let sTypeplayerSource = sType.find(elem => elem.propertyListValue == value); | |
if (sTypeplayerSource) { | |
dataItem["bug"] = sTypeplayerSource.propertyListValueID; | |
dataItem["propertyListValueID"] = sTypeplayerSource.propertyListValueID; | |
this.countingUpdates(); | |
} | |
} | |
} ); | |
} | |
// else if (field == "tickerPropertyListValue") { | |
// let changedRows = sel.map((index, event) => { | |
// let dataItem: any = grid.dataItem(event); | |
// if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
// || dataItem["checkedOutUserId"] === '')) { | |
// if ((dataItem.mobileNo === null || dataItem.mobileNo === undefined) && dataItem.titleOwnermobile != null) { | |
// dataItem["tickerPropertyListValue"] = ""; | |
// dataItem["tickerPropertyListValueID"] = ""; | |
// } else { | |
// dataItem["dirty"] = true; | |
// this.isSaveDisableGrid = false; | |
// //that.totalUpdates++; | |
// if (value) { | |
// dataItem["tickerPropertyListValue"] = value; | |
// } else { | |
// dataItem["tickerPropertyListValue"] = ''; | |
// } | |
// let sType = that.gridDataAll.TICKER == undefined ? [] : that.gridDataAll.TICKER; | |
// dataItem[field] = value; | |
// let sTypeTicker = sType.find(elem => elem.propertyListValue == value); | |
// if (sTypeTicker) { | |
// dataItem["ticker"] = sTypeTicker.propertyListValueID; | |
// dataItem["tickerPropertyListValueID"] = sTypeTicker.propertyListValueID; | |
// this.countingUpdates(); | |
// } | |
// }); | |
// } | |
else if (field == "tickerPropertyListValue") { | |
let changedRows = sel.map((index, event) => { | |
let dataItem: any = grid.dataItem(event); | |
if ((selectedRow.schedItemNo === null || selectedRow.schedItemNo === undefined) && selectedRow.titleOwnermobile != null) { | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
// if ((dataItem.mobileNo === null || dataItem.mobileNo === undefined) && dataItem.titleOwnermobile != null) { | |
// // dataItem["tickerPropertyListValue"] = ""; | |
// // dataItem["tickerPropertyListValueID"] = ""; | |
// } else { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
if (value) { | |
dataItem["tickerPropertyListValue"] = value; | |
} else { | |
dataItem["tickerPropertyListValue"] = ''; | |
} | |
let sType = that.gridDataAll.TICKER == undefined ? [] : that.gridDataAll.TICKER; | |
dataItem[field] = value; | |
let sTypeplayerSource = sType.find(elem => elem.propertyListValue == value); | |
if (sTypeplayerSource) { | |
dataItem["ticker"] = sTypeplayerSource.propertyListValueID; | |
dataItem["tickerPropertyListValueID"] = sTypeplayerSource.propertyListValueID; | |
this.countingUpdates(); | |
} | |
// } | |
} | |
} else { | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
if ((dataItem.schedItemNo === null || dataItem.schedItemNo === undefined)) { | |
//if ((dataItem.schedItemNo === null || dataItem.schedItemNo === undefined) && dataItem.titleOwnermobile != null) { | |
// dataItem["tickerPropertyListValue"] = ""; | |
// dataItem["tickerPropertyListValueID"] = ""; | |
} else { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
if (value) { | |
dataItem["tickerPropertyListValue"] = value; | |
} else { | |
dataItem["tickerPropertyListValue"] = ''; | |
} | |
let sType = that.gridDataAll.TICKER == undefined ? [] : that.gridDataAll.TICKER; | |
dataItem[field] = value; | |
let sTypeplayerSource = sType.find(elem => elem.propertyListValue == value); | |
if (sTypeplayerSource) { | |
dataItem["ticker"] = sTypeplayerSource.propertyListValueID; | |
dataItem["tickerPropertyListValueID"] = sTypeplayerSource.propertyListValueID; | |
this.countingUpdates(); | |
} | |
} | |
} ); | |
} | |
else if (field == "playerSourcePropertyListValue") { | |
let changedRows = sel.map((index, event) => { | |
let dataItem: any = grid.dataItem(event); | |
if ((selectedRow.schedItemNo === null || selectedRow.schedItemNo === undefined) && selectedRow.titleOwnermobile != null) { | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
// if ((dataItem.mobileNo === null || dataItem.mobileNo === undefined) && dataItem.titleOwnermobile != null) { | |
// // dataItem["playerSourcePropertyListValue"] = ""; | |
// // dataItem["playerSourcePropertyListValueID"] = ""; | |
// } else { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
if (value) { | |
dataItem["playerSourcePropertyListValue"] = value; | |
} else { | |
dataItem["playerSourcePropertyListValue"] = ''; | |
} | |
let sType = that.gridDataAll.player_SOURCE == undefined ? [] : that.gridDataAll.player_SOURCE; | |
dataItem[field] = value; | |
let sTypeplayerSource = sType.find(elem => elem.propertyListValue == value); | |
if (sTypeplayerSource) { | |
dataItem["playerSource"] = sTypeplayerSource.propertyListValueID; | |
dataItem["playerSourcePropertyListValueID"] = sTypeplayerSource.propertyListValueID; | |
this.countingUpdates(); | |
} | |
// } | |
} | |
} else { | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
if ((dataItem.schedItemNo === null || dataItem.schedItemNo === undefined)) { | |
//if ((dataItem.schedItemNo === null || dataItem.schedItemNo === undefined) && dataItem.titleOwnermobile != null) { | |
// dataItem["playerSourcePropertyListValue"] = ""; | |
// dataItem["playerSourcePropertyListValueID"] = ""; | |
} else { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
if (value) { | |
dataItem["playerSourcePropertyListValue"] = value; | |
} else { | |
dataItem["playerSourcePropertyListValue"] = ''; | |
} | |
let sType = that.gridDataAll.player_SOURCE == undefined ? [] : that.gridDataAll.player_SOURCE; | |
dataItem[field] = value; | |
let sTypeplayerSource = sType.find(elem => elem.propertyListValue == value); | |
if (sTypeplayerSource) { | |
dataItem["playerSource"] = sTypeplayerSource.propertyListValueID; | |
dataItem["playerSourcePropertyListValueID"] = sTypeplayerSource.propertyListValueID; | |
this.countingUpdates(); | |
} | |
} | |
} ); | |
} | |
else if (field == "playerStartTime") { | |
let changedRows = sel.map((index, event) => { | |
let dataItem: any = grid.dataItem(event); | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
if (value) { | |
dataItem["playerStartTime"] = value; | |
if (that.addTimes(value, dataItem["playerDuration"])) | |
dataItem["playerEndTime"] = that.addTimes(value, dataItem["playerDuration"]); | |
//dataItem.endTime = that.addTimes(value, dataItem.duration); | |
} else { | |
dataItem["playerStartTime"] = ''; | |
} | |
dataItem[field] = value; | |
this.countingUpdates(); | |
} | |
}) | |
} | |
else if (field == "playerDuration") { | |
let changedRows = sel.map((index, event) => { | |
let dataItem: any = grid.dataItem(event); | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
if (value) { | |
dataItem["playerDuration"] = ""; | |
if (that.addTimes(dataItem["playerStartTime"], value)) { | |
dataItem["playerEndTime"] = that.addTimes(dataItem["playerStartTime"], value); | |
dataItem["playerDuration"] = value; | |
} | |
//dataItem.endTime = that.addTimes(value, dataItem.duration); | |
} else { | |
dataItem["playerDuration"] = ''; | |
} | |
//dataItem[field] = value; | |
this.countingUpdates(); | |
} | |
}) | |
} | |
else { | |
let changedRows = sel.map((index, event) => { | |
let dataItem: any = grid.dataItem(event); | |
//dataItem[field] = value; | |
if (dataItem && (dataItem["checkedOutUserId"] === undefined || dataItem["checkedOutUserId"] === null | |
|| dataItem["checkedOutUserId"] === '')) { | |
dataItem["dirty"] = true; | |
this.isSaveDisableGrid = false; | |
//that.totalUpdates++; | |
if (value) { | |
dataItem[field] = value; | |
} else { | |
dataItem[field] = ''; | |
} | |
dataItem[field] = value; | |
this.countingUpdates(); | |
} | |
}) | |
} | |
this.gridkendo.getGrid().refresh(); | |
that.highlightoverlap(); | |
} | |
highlightoverlap() { | |
let that = this; | |
let grid = that.gridkendo.getGrid(); | |
let gridData = grid.dataSource.data(); | |
$('.bulkCreateGrid .k-grid-content tbody').find("tr").removeClass('duplicateRows'); | |
for (let k = 0; k < gridData.length; k++) { | |
gridData[k].duplicateRow = false; | |
let startDate = kendo.toString(new Date(gridData[k].startDate), "dd/MM/yyyy"); | |
let startTime = kendo.parseDate(gridData[k].startTime); | |
let endTime = kendo.parseDate(gridData[k].endTime); | |
let actutalStartTime = kendo.parseDate(gridData[k].actualStartTime); | |
let actualEndTime = kendo.parseDate(gridData[k].actualEndTime); | |
for (var i = k; i < gridData.length; i++) { | |
if (gridData[k].action != 'Delete' && gridData[i].action != 'Delete' && i != k) { | |
let startSelTime = kendo.parseDate(gridData[i].startTime); | |
let endSelTime = kendo.parseDate(gridData[i].endTime); | |
let actualStartSelTime = kendo.parseDate(gridData[i].actualStartTime); | |
let actualEndSelTime = kendo.parseDate(gridData[i].actualEndTime); | |
let startSelDate = kendo.toString(new Date(gridData[i].startDate), "dd/MM/yyyy"); | |
if (startDate == startSelDate && ((startTime == startSelTime || (endTime == endSelTime) || (startTime < endSelTime && endTime > startSelTime)) || (actutalStartTime == actualStartSelTime || (actualEndTime == actualEndSelTime) || (actutalStartTime < actualEndSelTime && actualEndTime > actualStartSelTime)))) { | |
gridData[i].duplicateRow = true; | |
gridData[k].duplicateRow = true; | |
$('.bulkCreateGrid .k-grid-content tbody').find("tr[data-uid='" + gridData[i].uid + "']").addClass('duplicateRows'); | |
$('.bulkCreateGrid .k-grid-content tbody').find("tr[data-uid='" + gridData[k].uid + "']").addClass('duplicateRows'); | |
} | |
} | |
} | |
} | |
} | |
// resetUpdateCount() { | |
// this.totalUpdates = 0; | |
// } | |
countingUpdates() { | |
let count = 0; | |
let that = this; | |
let grid = that.gridkendo.getGrid(); | |
let tempData = grid.dataSource.data(); | |
for (let i = 0; i < tempData.length; i++) { | |
if (tempData[i].dirty === true) { | |
count++; | |
} | |
} | |
this.totalUpdates = count; | |
} | |
canDeactivate(): Promise<boolean> | boolean { | |
let that = this; | |
return new Promise<boolean>((resolve, reject) => { | |
if (this.totalUpdates > 0) { | |
//if (this.playerDataAPI.length) { | |
this.goBtnPayload(); | |
//that.scheduleCablesService.bulkCreateMetaVal = this.goBtnReqPayload; | |
window.sessionStorage.setItem('playerSessionSearch', JSON.stringify(this.goBtnReqPayload)); | |
if (this.gridDataSourceHaveChanges()) { | |
//$("#unsavedDataDialogplayer .kendoContent").text("Do you want to keep the changes and continue?"); | |
$("#unsavedDataDialogplayer .kendoContent").text("There are unsaved changes on the screen that will be lost if you navigate away from screen. Do you wish to proceed?"); | |
let newdialog = $("#unsavedDataDialogplayer").data("kendoWindow").center().open(); | |
$("#unsavedDataDialogplayerYes").unbind().click(function () { | |
newdialog.close(); | |
// sessionStorage.setItem("bulkCreateMetaVal", JSON.stringify(that.bulkCreateVal)) | |
// that.scheduleCablesService.bulkCreateMetaVal=that.goBtnReqPayload; | |
resolve(true); | |
}); | |
// $("#unsavedDataDialogplayerNo").click(function () { | |
// newdialog.close(); | |
// resolve(true); | |
// }); | |
$("#unsavedDataDialogplayerCancel").click(function () { | |
newdialog.close(); | |
resolve(false); | |
}); | |
} else { resolve(true); } | |
} | |
else { resolve(true); } | |
}); | |
} | |
gridDataSourceHaveChanges() { | |
let ds = this.gridkendo.getGrid().dataSource; | |
let dirty = false; | |
let resultArray = ds._data.find(elem => elem.dirty == true); | |
if (ds._destroyed.length > 0 || resultArray) dirty = true; | |
return dirty; | |
} | |
getTotalAiringCount() { | |
let that = this; | |
that.totalAiringsCount = 0; | |
let grid = that.gridkendo.getGrid(); | |
let tempData = grid.dataSource.data(); | |
for (let i = 0; i < tempData.length; i++) { | |
if (tempData[i].checkedOutUserId === undefined || tempData[i].checkedOutUserId === null || tempData[i].checkedOutUserId === '') { | |
// if (tempData[i].checkedOutUserId == null && tempData[i].titleNo != 1023643) { | |
that.totalAiringsCount++; | |
} | |
} | |
} | |
ngOnDestroy() { | |
$('body').css({ "padding-bottom": "" }); | |
if ($("#createPreferencesPopupplayer")) { | |
$("#createPreferencesPopupplayer").remove(); | |
} | |
//saveWarningPopupplayer | |
if ($("#saveWarningPopupplayer")) { | |
$("#saveWarningPopupplayer").remove(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment