NYBU#55434 Diverse aanpassingen, maar voornamelijk de time- en datepickers correct laten werken bij nieuw toegevoegde flex-velden
svn path=/Website/branches/v2019.1/; revision=41872
This commit is contained in:
@@ -241,7 +241,7 @@ function make_cat(discipline_key, rsv_ruimte_key, existing_only, res_artikel_key
|
||||
}
|
||||
}
|
||||
}
|
||||
any_noshow = any_noshow || (existing_only && !existing); // die hidden we initieel namelijk
|
||||
any_noshow = any_noshow || (existing_only && !existing); // die hiden we initieel namelijk
|
||||
ch = (ch<10?'0'+ch:ch);
|
||||
cm = (cm<10?'0'+cm:cm);
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
<%
|
||||
FCLTHeader.Requires({ plugins: ["jQuery"],
|
||||
js: ["date.js", "jquery-ui.js", rooturl+"/appl/res/res_plan.js"],
|
||||
css: [rooturl+"/appl/res/res.css"]});
|
||||
js: ["date.js", "jquery.timepicker-table.js", "jquery-ui.js", rooturl+"/appl/res/res_plan.js"],
|
||||
css: [rooturl+"/appl/res/res.css", "timePicker-table.css"]});
|
||||
|
||||
var urole = getQParamSafe("urole");
|
||||
var rsv_ruimte_key = getQParamInt("rsv_ruimte_key");
|
||||
@@ -183,8 +183,8 @@ var new_item_key = -1; // Globaal
|
||||
var artkey = $tr.attr("id").substring(3);
|
||||
var res_rsv = artkey + "_" + new_item_key;
|
||||
// De clone bijwerken..
|
||||
$clone.find(':button').parent().remove(); // De toevoeg knop eraf halen.
|
||||
$("[id^='inpbh1_c_']", $clone).val(""); // Urenveld leeg maken.
|
||||
$clone.find(':button').parent().remove(); // De toevoeg knop eraf halen.
|
||||
$("[id^='inpbh1_c_']", $clone).val(""); // Urenveld leeg maken.
|
||||
var id_num = $("[id^='inpbh1_c_']", $clone).attr('id').substring(9);
|
||||
// Nieuwe unieke id's aan de velden toekennen.
|
||||
$("[id^='inpb_c_']", $clone).attr({id: "inpb_c_" + res_rsv, name: "inpb_c_" + res_rsv}); // Aantal.
|
||||
@@ -217,13 +217,63 @@ var new_item_key = -1; // Globaal
|
||||
// Aan het hidden checkbox veld has_xxx ook een nieuwe unieke id aan toekennen.
|
||||
$("[id^='has_art" + id_num + "_" + flex_num + "val']", $cloneflex).attr({id: "has_art" + res_rsv + "_" + flex_num + "val", name: "has_art" + res_rsv + "_" + flex_num + "val"}); // Hidden checkbox veld has_xxx.
|
||||
|
||||
// Op kalender klikken moet kalender openen in eigen veld. TODO: waarde wordt nu nog ingevuld in veld van orgineel.
|
||||
$("i[onclick^=\"$(\'#art" + id_num + "_" + flex_num + "val'\"]", $cloneflex).attr({onclick: "$('#art" + res_rsv + "_" + flex_num + "val').datepicker('show')"}); // datum uitklappen.
|
||||
// If the existing field had a timePicker, get the options from that timePicker and remove it from the new field (but remember the settings)
|
||||
if (typeof minMax != "undefined" && ("art" + id_num + "_" + flex_num) in minMax)
|
||||
{
|
||||
$(".fldflexT[id^='art" + res_rsv + "_" + flex_num + "val']", $cloneflex).each(function()
|
||||
{
|
||||
// Create new object from the existing timePicker options for later use
|
||||
minMax["art" + res_rsv + "_" + flex_num] = $.extend({}, { step: 15, // Default options from kenmerk_common
|
||||
startTime: "00:00",
|
||||
endTime : "23:59",
|
||||
columns : <%=S("timepickercolumns")%>,
|
||||
onChange : function () {
|
||||
$timeInput = $(this).parents("div.time-holder").prev("input.fldflexT")
|
||||
$timeInput.removeClass("bad");
|
||||
$timeInput.trigger("change");
|
||||
}
|
||||
},
|
||||
minMax["art" + id_num + "_" + flex_num], // Existing properties from original timepicker
|
||||
{ "instantiated": false }); // Re-instantiate this timePicker
|
||||
// Remove old timePicker
|
||||
$(this).next(".time-holder").remove();
|
||||
$(this).off("click");
|
||||
});
|
||||
}
|
||||
|
||||
$(".fldflexD.hasDatepicker[id^='art" + res_rsv + "_" + flex_num + "val']", $cloneflex).addClass("remakeDatepicker");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Voeg beide clones onder de huidige regel toe.
|
||||
$trnext.after($clone, $cloneflex);
|
||||
|
||||
// Initiate newly created timePickers
|
||||
// minMax holds all (custom) options for timePickers
|
||||
// minMax.instantiated = false if the timePicker has not been made yet, if so -> make it now
|
||||
if (typeof minMax != "undefined")
|
||||
for (x in minMax)
|
||||
if (minMax[x].instantiated === false && $("#"+x+"val").length == 1)
|
||||
{
|
||||
$("#"+x+"val").timePicker(minMax[x]);
|
||||
minMax[x].instantiated = true;
|
||||
}
|
||||
|
||||
// Remake flex datepickers
|
||||
$(".remakeDatepicker").each(function()
|
||||
{
|
||||
// Just to identify
|
||||
$(this).removeClass("remakeDatepicker");
|
||||
|
||||
var $id = $(this).attr("id");
|
||||
var dpOptions = $(this).datepicker("option", "all");
|
||||
|
||||
$(this).datepicker("destroy")
|
||||
.datepicker(dpOptions)
|
||||
.next("i.dateklikker").attr({ onclick: "$('#" + $id + "').datepicker('show')" });
|
||||
});
|
||||
|
||||
$("[id^='inpbh1_c_']",$clone).focus(); // Zet cursor in urenveld.
|
||||
|
||||
FcltMgr.resized();
|
||||
@@ -578,7 +628,7 @@ var new_item_key = -1; // Globaal
|
||||
<% // Hier wordt met Ajax res_load_cat.asp code tussen geplakt bij openklappen
|
||||
if (existing || oRs("inArrangement").Value == 1)
|
||||
{
|
||||
make_cat(curr_disc_key, rsv_ruimte_key, true, res_artikel_key);
|
||||
make_cat(curr_disc_key, rsv_ruimte_key, existing, res_artikel_key);
|
||||
discArr.push(curr_disc_key);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -254,9 +254,8 @@ function ItemChoosed_obj(elm, fromID, disc_key, hour_px)
|
||||
|
||||
function ItemChoosed_cat(elm, jq_div, disc_key, existing)
|
||||
{
|
||||
$(elm).toggleClass("closed");
|
||||
$(elm).find("i.fa").toggleClass('fa-plus-square-o');
|
||||
$(elm).find("i.fa").toggleClass('fa-minus-square-o');
|
||||
$(elm).toggleClass("closed")
|
||||
.find("i.fa").toggleClass("fa-plus-square-o fa-minus-square-o");
|
||||
|
||||
var tabel = $("#table_dis" + disc_key);
|
||||
if (tabel.length)
|
||||
|
||||
@@ -1549,7 +1549,7 @@ function listKenmerk(sql, module, key, props)
|
||||
kmin = pad(String(kminH), 2) + ":" + pad(String(kminM), 2);
|
||||
kmax = pad(String(kmaxH), 2) + ":" + pad(String(kmaxM), 2);
|
||||
|
||||
minMax.push({id: idCounter, kmin: kmin, kmax: kmax});
|
||||
minMax.push({namePrefix: nameprefix, id: idCounter, kmin: kmin, kmax: kmax});
|
||||
|
||||
kv = "<input type='text'"
|
||||
+ (!readonlyfield && kregexp ? " regexp='" + kregexp + "' " : "")
|
||||
@@ -2202,30 +2202,34 @@ function listKenmerk(sql, module, key, props)
|
||||
// FCLTHeader.Requires is hier te laat
|
||||
%><script type="text/javascript">
|
||||
|
||||
var minMax = minMax || {};
|
||||
$(function()
|
||||
{
|
||||
if (typeof Modernizr == "undefined" || !Modernizr.inputtypes.time)
|
||||
{
|
||||
|
||||
// Kan niet achteraf
|
||||
var minMax = [];
|
||||
<% for (i=0; i < minMax.length; i++)
|
||||
<% for (i = 0; i < minMax.length; i++)
|
||||
{ %>
|
||||
minMax[<%=minMax[i].id%>] = {"kmin": "<%=minMax[i].kmin%>", "kmax": "<%=minMax[i].kmax%>"}; <%
|
||||
} %>
|
||||
|
||||
$(".fldflexT").not("[readonly]").each(function() {
|
||||
$(this).timePicker({
|
||||
step: 15,
|
||||
startTime : minMax[$(this).attr("id").slice(1, -3)].kmin,
|
||||
endTime : minMax[$(this).attr("id").slice(1, -3)].kmax,
|
||||
columns : <%=S("timepickercolumns")%>,
|
||||
onChange : function () {
|
||||
$timeInput = $(this).parents("div.time-holder").prev("input.fldflexT")
|
||||
$timeInput.removeClass("bad");
|
||||
$timeInput.trigger("change");
|
||||
}
|
||||
});
|
||||
$.extend(minMax, {"<%=minMax[i].namePrefix + minMax[i].id%>": {"instantiated": false, "startTime": "<%=minMax[i].kmin%>", "endTime": "<%=minMax[i].kmax%>"}} );
|
||||
<% } %>
|
||||
var entry;
|
||||
$(".fldflexT").not("[readonly]").each(function()
|
||||
{
|
||||
entry = $(this).attr("id").slice(0, -3);
|
||||
if (entry in minMax && !minMax[entry].instantiated)
|
||||
{
|
||||
$(this).timePicker({
|
||||
step: 15,
|
||||
startTime : minMax[entry].startTime,
|
||||
endTime : minMax[entry].endTime,
|
||||
columns : <%=S("timepickercolumns")%>,
|
||||
onChange : function () {
|
||||
$timeInput = $(this).parents("div.time-holder").prev("input.fldflexT")
|
||||
$timeInput.removeClass("bad");
|
||||
$timeInput.trigger("change");
|
||||
}
|
||||
});
|
||||
minMax[entry].instantiated = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user