%@page session="true" contentType="application/x-javascript; charset=UTF-8"%><%@ page import="com.edeal.frontline.FlLocale" %><%@ page import="com.edeal.frontline.navigation.FlRequest" %><%@ page import="java.util.Date" %><%@ page import="com.edeal.frontline.FlContext" %><%@ page import="com.edeal.frontline.DataDictionary" %><%@ page import="com.edeal.frontline.Utils" %><%@ page import="com.edeal.frontline.controller.actions.SelectAction" %><%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %><%
response.setContentType("application/x-javascript");
FlRequest flRequest = new FlRequest(request);
FlContext context = flRequest.getContext();
DataDictionary dico = context.getDataDictionary();
String salesModel = context.getContextParameter("SalesModel");
%>
function doComputeDisp() {
var val = Utils.getNormalizedValuesFromView("IntActID");
var f = document.forms[0];
var query = '';
if(f.IntDate.value != '') {
query += '&date=' + f.IntDate.value;
}
if(val != '') {
query += '&actor=' + val;
}
if(f.IntTimeBeg.value != '' && f.IntTimeEnd.value != '') {
s1 = checkHour(f.IntTimeBeg.value, '<%= FlLocale.getInstance(session).getHourSeparator() %>');
s1 = s1.split('<%= FlLocale.getInstance(session).getHourSeparator() %>').join(':');
s2 = checkDate('01/01/1970', 'DD/MM/yyyy', 'MM/DD/yyyy').concat(' ').concat(s1);
s3 = checkHour(f.IntTimeEnd.value, '<%= FlLocale.getInstance(session).getHourSeparator() %>');
s3 = s3.split('<%= FlLocale.getInstance(session).getHourSeparator() %>').join(':');
s4 = checkDate('01/01/1970', 'DD/MM/yyyy', 'MM/DD/yyyy').concat(' ').concat(s3);
var startTime = new Date(s2);
var endTime = new Date(s4);
var milliDiff = endTime - startTime;
var minDiff = Math.floor(milliDiff / (60 * 1000)).toString();
query += '&length=' + minDiff;
}
if(f.$$multivalSeparator && f.$$multivalSeparator.value != '') {
query += '&$$multivalSeparator=' + f.$$multivalSeparator.value;
}
window.open('/availability.fl?origin=Interaction&from=' + f.id.value + query, 'CompDisp', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=700,height=470,screenX=50,screenY=10');
}
function doVerifDisp() {
var val = Utils.getNormalizedValuesFromView("IntActID");
var f = document.forms[0];
if(val != '') {
var url = '/verify_disponibility.fl?actID=' + val;
if(f.$$multivalSeparator && f.$$multivalSeparator.value != '') {
url += '&$$multivalSeparator=' + f.$$multivalSeparator.value;
}
if(f.IntDate.value != '') {
url += '&date=' + f.IntDate.value;
if (f.IntTimeBeg.value != '' && f.IntTimeEnd.value != '') {
url += '&timeBeg=' + encodeURIComponent(f.IntTimeBeg.value);
url += '&timeEnd=' + encodeURIComponent(f.IntTimeEnd.value);
url += '&id=' + f.id.value;
var fenetreChoix = window.open(url, 'VerifDisp', 'menubar=no,status=no,toolbar=no,scrollbars=no,resizable=yes,width=600,height=150,screenX=80,screenY=10');
} else {
window.alert('');
}
} else {
window.alert('');
}
} else {
window.alert('');
}
}
function doSelectCorrespondent() {
var f = document.forms[0];
//var corID = f.IntCorID.value;
var corID = Utils.getNormalizedValuesFromView("IntCorID");
var url = '/select_correspondent.fl?field=IntCorID';
var multivalSeparator = '|';
if (f.$$multivalSeparator) {
multivalSeparator = f.$$multivalSeparator.value;
}
if (corID != '') {
url += '&CorID=' + encodeURIComponent(corID);
}
if (multivalSeparator != '') {
url += '&multivalSeparator=' + encodeURIComponent(multivalSeparator);
}
<% if (!salesModel.equalsIgnoreCase("B2C")) { %>
window.open(url, 'ChoixCorres', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=835,height=640,screenX=30,screenY=10');
<% } else { %>
window.open(url, 'ChoixCorres', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=360,height=640,screenX=30,screenY=10');
<% } %>
}
function changeStatus() {
var f = document.forms[0];
if(f.IntStiID.value == '<%= dico.getRefIdByCode("IntStiID","DONE") %>') {
if(compareDate(f.IntDate.value, '', '<%= Utils.formatToWebDate(session, new Date(), false) %>', '') > 0) {
f.IntDate.value = '<%= Utils.formatToWebDate(session, new Date(), false) %>';
}
}
}
function chooseStage() {
var f = document.forms[0];
if (f.IntCpgID) {
var cpgID = f.IntCpgID.value;
if (cpgID != '') {
window.open('/select.fl?type=Stage&field=IntStgID&query=' + encodeURIComponent('StgCpgID = \'' + cpgID + '\''), 'SelectActor', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=<%= SelectAction.SELECT_WINDOW_WIDTH %>,height=500');
} else {
window.alert('');
}
}
}
function doEditTimeEnd() {
var f = document.forms[0];
if (typeof f.duree != "undefined") {
if(parseFloat(f.duree.value)!='0'){
var heure = f.IntTimeBeg.value.substring(0,2);
var min = f.IntTimeBeg.value.substring(3,5);
var duree = parseFloat(f.duree.value);
var heureN = parseFloat(heure);
var minN = parseFloat(min);
res = ((heureN * 60 + minN) + (duree * 60)) / 60 ;
var heureFin = '00' + Math.floor(res).toString();
heureFin = heureFin.substring(heureFin.length - 2);
if (heureFin > 24) {
heureFin = heureFin - 24 ;
}
var minFin = '00' + (Math.round((res - Math.floor(res)) * 60)).toString();
minFin = minFin.substring(minFin.length - 2);
f.IntTimeEnd.value = checkHour(heureFin + ":" + minFin, ":");
}
}
}
function doTimeBegBlur() {
var f = document.forms[0];
ctrlHourField(f.IntTimeBeg, '');
//doEditTimeEnd();
}
function doViewTimeZone(){
var f = document.forms[0];
if(f.IntActID.value != '' || f.IntCorID!='') {
//var url = '/sales/interaction/viewtimezone.jsp?1=1';
var url ='/view_TimeZones.fl?1=1';
if(f.$$multivalSeparator && f.$$multivalSeparator.value != '') {
url += '&$$multivalSeparator=' + f.$$multivalSeparator.value;
}
url += '&actID=' + f.IntActID.value;
if (f.IntCorID){
url += '&corID=' + f.IntCorID.value;
}
if(f.IntDate.value != '') {
url += '&date=' + f.IntDate.value;
if (f.IntTimeBeg.value != '' && f.IntTimeEnd.value != '') {
url += '&timeBeg=' + encodeURIComponent(f.IntTimeBeg.value);
url += '&timeEnd=' + encodeURIComponent(f.IntTimeEnd.value);
window.open(url, 'ViewTimeZone', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=800,height=600,screenX=50,screenY=10');
} else {
window.alert('');
}
} else {
window.alert('');
}
} else {
window.alert('');
}
}