|
|
|
@@ -142,8 +142,8 @@ window.loadPlan = function(product)
|
|
|
|
|
{
|
|
|
|
|
let productID = product.val();
|
|
|
|
|
let branchID = product.closest('.productBox').find('.linkBranch .pick-value').val();
|
|
|
|
|
if(typeof branchID == 'undefined') $branchID = '';
|
|
|
|
|
let link = $.createLink('charter', 'ajaxGetPlans', 'productID=' + productID + '&branchID' + branchID);
|
|
|
|
|
if(typeof branchID == 'undefined') branchID = '';
|
|
|
|
|
let link = $.createLink('charter', 'ajaxGetPlans', 'productID=' + productID + '&branchID=' + branchID);
|
|
|
|
|
const $items = [{text: '', value: '', key: ''}];
|
|
|
|
|
const $plan = product.closest('.productBox').find('.planBox .pick-value');
|
|
|
|
|
|
|
|
|
@@ -162,11 +162,24 @@ window.refreshPicker = function(event)
|
|
|
|
|
{
|
|
|
|
|
if(typeof event !== "undefined")
|
|
|
|
|
{
|
|
|
|
|
const objectType = $(event.target).closest('.productsBox').data('objecttype');
|
|
|
|
|
if(objectType == 'roadmap') loadRoadmap($(event.target));
|
|
|
|
|
if(objectType == 'plan') loadPlan($(event.target));
|
|
|
|
|
const $product = $(event.target);
|
|
|
|
|
const productID = $product.val();
|
|
|
|
|
if(multiBranchProducts[productID])
|
|
|
|
|
{
|
|
|
|
|
loadBranches($product);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
updateItems();
|
|
|
|
|
|
|
|
|
|
loadBranches($(event.target));
|
|
|
|
|
const objectType = $product.closest('.productsBox').data('objecttype');
|
|
|
|
|
if(objectType == 'roadmap') loadRoadmap($product);
|
|
|
|
|
if(objectType == 'plan') loadPlan($product);
|
|
|
|
|
|
|
|
|
|
let $formRow = $product.closest('.productBox');
|
|
|
|
|
$formRow.find('.form-group').eq(0).addClass('w-1/2').removeClass('w-1/4');
|
|
|
|
|
$formRow.find('.form-group').eq(1).addClass('hidden');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -186,11 +199,6 @@ window.loadBranches = function(product)
|
|
|
|
|
let $formRow = product.closest('.productBox');
|
|
|
|
|
let charterID = $('[name="charter"]').length ? $('[name="charter"]').val() : 0;
|
|
|
|
|
const objectType = $('.productsBox').data('linkType');
|
|
|
|
|
if(!multiBranchProducts[currentProduct])
|
|
|
|
|
{
|
|
|
|
|
$formRow.find('.form-group').eq(0).addClass('w-1/2').removeClass('w-1/4');
|
|
|
|
|
$formRow.find('.form-group').eq(1).addClass('hidden');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(typeof projectID == 'undefined') projectID = 0;
|
|
|
|
|
$.getJSON($.createLink('branch', 'ajaxGetBranches', "productID=" + currentProduct + "&oldBranch=¶m=active&projectID=" + projectID + "&withMainBranch=true&isTwins=no&fieldID=0&multiple=&charterID=" + charterID), function(data)
|
|
|
|
@@ -272,7 +280,7 @@ window.updateItems = function(currentProduct = '', currentBranch = '')
|
|
|
|
|
const branchItems = $branch.zui('picker').options.items
|
|
|
|
|
|
|
|
|
|
if(!chosenBranches[productID]) chosenBranches[productID] = [];
|
|
|
|
|
$('[name^=product][value="' + productID + '"]').closest('.productBox').find('[name^="branch"]').each(function()
|
|
|
|
|
$branch.each(function()
|
|
|
|
|
{
|
|
|
|
|
const branchID = $(this).val().toString();
|
|
|
|
|
if(!isNaN(branchID) && !chosenBranches[productID].includes(branchID) && branchID !== '') chosenBranches[productID].push(branchID);
|
|
|
|
@@ -302,5 +310,4 @@ window.updateItems = function(currentProduct = '', currentBranch = '')
|
|
|
|
|
window.branchChange = function(event)
|
|
|
|
|
{
|
|
|
|
|
const productID = $(event.target).closest('.productBox').find('.linkProduct .picker-box').zui('picker').$.value;
|
|
|
|
|
updateItems(productID, $(event.target).val());
|
|
|
|
|
}
|
|
|
|
|