diff --git a/module/execution/js/task.js b/module/execution/js/task.js index 20f58c4146..d66daf4a2f 100644 --- a/module/execution/js/task.js +++ b/module/execution/js/task.js @@ -38,6 +38,6 @@ function adjustTableFooter() { $('.table.with-footer-fixed').css('margin-bottom', '0'); $('.table-footer').removeClass('fixed-footer'); - $('.table-footer').css({"left":"0", "bottom":"0", "width":"unset"}); + $('.table-footer').css({'left': 0, 'bottom': 0, 'width': 'unset'}); } } diff --git a/module/personnel/model.php b/module/personnel/model.php index 80da5f7ff5..14456461f9 100644 --- a/module/personnel/model.php +++ b/module/personnel/model.php @@ -497,7 +497,7 @@ class personnelModel extends model { $path = $this->dao->select('path')->from(TABLE_PROJECT)->where('id')->eq($objectID)->fetch('path'); $path = explode(',', trim($path, ',')); - $parentID = $path[0]; + $parentID = $path[0] == $objectID ? 0 : $path[0]; $objects = $this->loadModel('project')->getPairsByProgram($parentID); } elseif($objectType == 'product') diff --git a/module/project/css/create.css b/module/project/css/create.css index 92825f4fa9..20acbd1503 100644 --- a/module/project/css/create.css +++ b/module/project/css/create.css @@ -13,3 +13,5 @@ #budgetUnit {border-left: 0px;} #projectName {display: inline-block; width: 32%;} #productsBox a {border-radius: 2px !important;} +#productsBox .addProduct {padding-left: 0px !important;} +#productsBox > .required:after{right: -6px !important;} diff --git a/module/project/js/create.js b/module/project/js/create.js index db8045c3a5..cf21ccf145 100644 --- a/module/project/js/create.js +++ b/module/project/js/create.js @@ -102,19 +102,32 @@ function addNewProduct(obj) { if($(obj).attr('checked')) { - $('#productName').removeAttr('disabled', true); - $('#productName').closest('tr').removeClass('hidden'); - $('#plansBox .col-sm-4').find('select').attr('disabled', true).trigger("chosen:updated"); + /* Hide product and plan dropdown controls. */ + $('#productsBox .row .col-sm-4').addClass('hidden'); + $('#productsBox .row .col-sm-4 .input-group').find('select').attr('disabled', true).trigger("chosen:updated"); $('#plansBox').closest('tr').addClass('hidden'); - $('#productsBox .col-sm-4 .input-group').find('select').attr('disabled', true).trigger("chosen:updated"); + $('#plansBox .col-sm-4').find('select').attr('disabled', true).trigger("chosen:updated"); + + /* Displays the input box for creating a product. */ + $("[name^='newProduct']").prop('checked', true); + $('#productName').removeAttr('disabled', true); + $('#productsBox .addProduct').removeClass('hidden'); + $('#productTitle').html(productName); } else { - $('#productName').attr('disabled', true); - $('#productName').closest('tr').addClass('hidden'); - $('#plansBox .col-sm-4').find('select').removeAttr('disabled', true).trigger("chosen:updated"); + /* Show product and product dropdown controls. */ + $('#productsBox .row .col-sm-4').removeClass('hidden'); + $('#productsBox .row .col-sm-4 .input-group').find('select').removeAttr('disabled').trigger("chosen:updated"); $('#plansBox').closest('tr').removeClass('hidden'); - $('#productsBox .col-sm-4 .input-group').find('select').removeAttr('disabled').trigger("chosen:updated"); + $('#plansBox .col-sm-4').find('select').removeAttr('disabled', true).trigger("chosen:updated"); + + /* Hide the input box for creating a product. */ + $("[name^='newProduct']").prop('checked', false); + $('#productName').attr('disabled', true); + $('#productsBox .addProduct').addClass('hidden'); + + $('#productTitle').html(manageProducts); } } @@ -159,16 +172,16 @@ function loadBranches(product, branchID) } }); - if($('#productsBox .input-group:last select:first').val() != 0) + if($('#productsBox .row .input-group:last select:first').val() != 0) { - var length = $('#productsBox .input-group').size(); - var $html = $('#productsBox .col-sm-4:last').html(); - $('#productsBox .col-sm-4:last').find('.input-group-addon').remove(); + var length = $('#productsBox .row .input-group').size(); + var $html = $('#productsBox .row .col-sm-4:last').html(); + $('#productsBox .row .col-sm-4:last').find('.input-group-addon').remove(); $('#productsBox .row').append('