* Adjust code.

This commit is contained in:
leiyong
2020-11-27 16:59:27 +08:00
parent d587642cb1
commit 175443edaf
8 changed files with 54 additions and 26 deletions

View File

@@ -1,9 +1,10 @@
function setProgramType(type)
{
$.cookie('programType', type, {expires:config.cookieLife, path:config.webRoot});
location.href = location.href;
}
/**
* Access rights are equal to private, and the white list settings are displayed.
*
* @param string acl
* @access public
* @return void
*/
function setWhite(acl)
{
acl != 'open' ? $('#whitelistBox').removeClass('hidden') : $('#whitelistBox').addClass('hidden');
@@ -12,7 +13,7 @@ function setWhite(acl)
/**
* Convert a date string like 2011-11-11 to date object in js.
*
* @param string $date
* @param string dateString
* @access public
* @return date
*/
@@ -25,8 +26,8 @@ function convertStringToDate(dateString)
/**
* Compute delta of two days.
*
* @param string $date1
* @param string $date1
* @param string date1
* @param string date2
* @access public
* @return int
*/
@@ -50,6 +51,7 @@ function computeDaysDelta(date1, date2)
/**
* Compute work days.
*
* @param string currentID
* @access public
* @return void
*/
@@ -124,12 +126,15 @@ function computeEndDate(delta)
/**
* Load branches.
*
* @param int $product
* @param object product
* @access public
* @return void
*/
function loadBranches(product)
{
/* When selecting a product, delete a plan that is empty by default. */
$("#planDefault").remove();
$('#productsBox select').each(function()
{
var $product = $(product);
@@ -196,7 +201,12 @@ function loadPlans(product, branchID)
}
}
/**
* Adjust the layout of product selection.
*
* @access public
* @return void
*/
function adjustProductBoxMargin()
{
var productRows = Math.ceil($('#productsBox > .row > .col-sm-4').length / 3);
@@ -209,6 +219,12 @@ function adjustProductBoxMargin()
}
}
/**
* Adjust the layout of the plan selection.
*
* @access public
* @return void
*/
function adjustPlanBoxMargin()
{
var planRows = Math.ceil($('#plansBox > .row > .col-sm-4').length / 3);
@@ -221,6 +237,12 @@ function adjustPlanBoxMargin()
}
}
/**
* Initialization operation.
*
* @access public
* @return void
*/
$(function()
{
$('#privList > tbody > tr > th input[type=checkbox]').change(function()

View File

@@ -63,7 +63,7 @@
</div>
<?php $i++;?>
<?php endforeach;?>
<div class='col-sm-4 <?php if($programID) echo 'required';?>'>
<div class='col-sm-4 <?php if($programID) echo 'required';?>'>
<div class='input-group'>
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");?>
<span class='input-group-addon fix-border'></span>
@@ -78,10 +78,11 @@
<div class='row'>
<?php $i = 0;?>
<?php foreach($linkedProducts as $product):?>
<?php $plans = zget($productPlans, $product->id, array(0 => ''));?>
<div class="col-sm-4" id="plan<?php echo $i;?>"><?php echo html::select("plans[" . $product->id . "]", $plans, $product->plan, "class='form-control chosen'");?></div>
<?php $i++;?>
<?php $plans = zget($productPlans, $product->id, array(0 => ''));?>
<div class="col-sm-4" id="plan<?php echo $i;?>"><?php echo html::select("plans[" . $product->id . "]", $plans, $product->plan, "class='form-control chosen'");?></div>
<?php $i++;?>
<?php endforeach;?>
<div class="col-sm-4" id="planDefault"><?php echo html::select("plans[0]", array(), 0, "class='form-control chosen'");?></div>
</div>
</td>
</tr>