diff --git a/module/project/css/create.css b/module/project/css/create.css
index fa0cdf6e0d..30ede19d20 100644
--- a/module/project/css/create.css
+++ b/module/project/css/create.css
@@ -1,6 +1,4 @@
#tipsModal {margin-top: 10%;}
-#begin + .input-group-addon {border-left: none; border-right: none;}
-#begin,#end {max-width: 150px; width: auto}
#copyProjectModal {padding: 0}
#copyProjectModal {padding: 0 2px}
@@ -16,4 +14,5 @@
.checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] {margin-top: 1px;}
-.type-tips {display: none; margin: 5px 0; color: #545454;}
+.type-tips {display: none;}
+.chosen-container-single .chosen-single > span{max-width:200px;}
diff --git a/module/project/js/common.js b/module/project/js/common.js
index b27ac9b066..cd2ea7ffe4 100644
--- a/module/project/js/common.js
+++ b/module/project/js/common.js
@@ -129,7 +129,7 @@ function loadBranches(product)
var $product = $(product);
if($product.val() != 0 && $product.val() == $(this).val() && $product.attr('id') != $(this).attr('id'))
{
- bootbox.alert(errorSameProducts);
+ alert(errorSameProducts);
$product.val(0);
$product.trigger("chosen:updated");
return false;
@@ -139,11 +139,13 @@ function loadBranches(product)
if($('#productsBox .input-group:last select:first').val() != 0)
{
var length = $('#productsBox .input-group').size();
- $('#productsBox .row').append('
' + $('#productsBox .col-sm-3:last').html() + '
');
+ $('#productsBox .row').append('' + $('#productsBox .col-sm-4:last').html() + '
');
if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove();
$('#productsBox .input-group:last .chosen-container').remove();
$('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
- $('#productsBox .input-group:last .chosen').chosen(defaultChosenOptions);
+ $('#productsBox .input-group:last .chosen').chosen();
+
+ adjustProductBoxMargin();
}
var $inputgroup = $(product).closest('.input-group');
@@ -169,13 +171,40 @@ function loadBranches(product)
{
if(data)
{
- $("#plansBox .row").append('' + data + '
');
+ $("#plansBox .row").append('' + data + '
');
$("#plan" + $(product).val()).find('select').attr('name', 'plans[' + productID + ']').attr('id', 'plans' + productID);
+
+ adjustPlanBoxMargin();
}
});
}
}
+
+function adjustProductBoxMargin()
+{
+ var productRows = Math.ceil($('#productsBox > .row > .col-sm-4').length / 3);
+ if(productRows > 1)
+ {
+ for(i = 1; i <= productRows - 1; i++)
+ {
+ $('#productsBox .col-sm-4:lt(' + (i * 3) + ')').css('margin-bottom', '10px');
+ }
+ }
+}
+
+function adjustPlanBoxMargin()
+{
+ var planRows = Math.ceil($('#plansBox > .row > .col-sm-4').length / 3);
+ if(planRows > 1)
+ {
+ for(j = 1; j <= productRows - 1; j++)
+ {
+ $('#plansBox .col-sm-4:lt(' + (j * 3) + ')').css('margin-bottom', '10px');
+ }
+ }
+}
+
function loadBranch(){}
/* Auto compute the work days. */
@@ -217,4 +246,6 @@ $(function()
e.stopPropagation();
e.preventDefault();
});
+
+ adjustProductBoxMargin();
});
diff --git a/module/project/js/create.js b/module/project/js/create.js
index cec75c4dff..54a809d03a 100644
--- a/module/project/js/create.js
+++ b/module/project/js/create.js
@@ -7,12 +7,6 @@ $(function()
{
$('#cpmBtn').click(function(){$('#copyProjectModal').modal('show')});
$('#copyProjects a').click(function(){setCopyProject($(this).data('id')); $('#copyProjectModal').modal('hide')});
- var typeWidth = $('#type').closest('td').width();
- $('#productsBox .col-sm-3,#plansBox .col-sm-3').width(typeWidth);
- $(document).on('change', "#productsBox select", function()
- {
- $('#productsBox .col-sm-3,#plansBox .col-sm-3').width(typeWidth);
- });
$('#begin').on('change', function()
{
$("#end").val('');
diff --git a/module/project/view/create.html.php b/module/project/view/create.html.php
index 0b823d15e1..0765739716 100644
--- a/module/project/view/create.html.php
+++ b/module/project/view/create.html.php
@@ -27,120 +27,114 @@