*Code batchedit
This commit is contained in:
@@ -7,20 +7,17 @@
|
||||
*/
|
||||
function changeDate(planID)
|
||||
{
|
||||
$("input[name='end[" + planID + "]']").val('');
|
||||
$("input[name='begin[" + planID + "]']").val('');
|
||||
if($("#future"+planID).prop('checked'))
|
||||
{
|
||||
$("input[name='begin[" + planID + "]']").val('2030-01-01').removeClass('form-input-show').addClass('form-input-hidden');
|
||||
$("input[name='end[" + planID + "]']").val('2030-01-01').removeClass('form-input-show').addClass('form-input-hidden');
|
||||
$("input[name='begin" + planID + "']").val('').removeClass('form-input-hidden').addClass('form-input-show');
|
||||
$("input[name='end" + planID + "']").val('').removeClass('form-input-hidden').addClass('form-input-show');
|
||||
$("input[name='begin[" + planID + "]']").attr('disabled', 'disabled');
|
||||
$("input[name='end[" + planID + "]']").attr('disabled', 'disabled');
|
||||
}
|
||||
else
|
||||
{
|
||||
$("input[name='begin[" + planID + "]']").val('').removeClass('form-input-hidden').addClass('form-input-show');
|
||||
$("input[name='end[" + planID + "]']").val('').removeClass('form-input-hidden').addClass('form-input-show');
|
||||
$("input[name='begin" + planID + "']").removeClass('form-input-show').addClass('form-input-hidden');
|
||||
$("input[name='end" + planID + "']").removeClass('form-input-show').addClass('form-input-hidden');
|
||||
|
||||
$("input[name='begin[" + planID + "]']").removeAttr('disabled', 'disabled');
|
||||
$("input[name='end[" + planID + "]']").removeAttr('disabled', 'disabled');
|
||||
$('.form-date').datetimepicker('update');
|
||||
}
|
||||
};
|
||||
@@ -38,27 +35,28 @@ function setPlanStatus(planID, status)
|
||||
if(status != 'wait')
|
||||
{
|
||||
$('#future' + planID).closest('div').addClass('hidden');
|
||||
|
||||
$("input[name='begin[" + planID + "]']").closest('td').addClass('required');
|
||||
$("input[name='end[" + planID + "]']").closest('td').addClass('required');
|
||||
$("input[name='begin" + planID + "']").removeAttr('disabled');
|
||||
$("input[name='end" + planID + "']").removeAttr('disabled');
|
||||
$("input[name='begin[" + planID + "]']").val('').removeClass('form-input-hidden').addClass('form-input-show');
|
||||
$("input[name='end[" + planID + "]']").val('').removeClass('form-input-hidden').addClass('form-input-show');
|
||||
$("input[name='begin" + planID + "']").removeClass('form-input-show').addClass('form-input-hidden');
|
||||
$("input[name='end" + planID + "']").removeClass('form-input-show').addClass('form-input-hidden');
|
||||
$("input[name='begin[" + planID + "]']").removeAttr('disabled');
|
||||
$("input[name='end[" + planID + "]']").removeAttr('disabled');
|
||||
|
||||
$('.form-date').datetimepicker('update');
|
||||
}
|
||||
else
|
||||
{
|
||||
var isFuture = $('#future' + planID).prop('checked');
|
||||
|
||||
$('#future' + planID).closest('div').removeClass('hidden');
|
||||
$("input[name='begin[" + planID + "]']").closest('td').removeClass('required');
|
||||
$("input[name='end[" + planID + "]']").closest('td').removeClass('required');
|
||||
$("input[name='begin" + planID + "']").attr('disabled', 'disabled').val('');
|
||||
$("input[name='end" + planID + "']").attr('disabled', 'disabled').val('');
|
||||
$("input[name='begin[" + planID + "]']").val('2030-01-01').removeClass('form-input-show').addClass('form-input-hidden');
|
||||
$("input[name='end[" + planID + "]']").val('2030-01-01').removeClass('form-input-show').addClass('form-input-hidden');
|
||||
$("input[name='begin" + planID + "']").val('').removeClass('form-input-hidden').addClass('form-input-show');
|
||||
$("input[name='end" + planID + "']").val('').removeClass('form-input-hidden').addClass('form-input-show');
|
||||
|
||||
if(isFuture)
|
||||
{
|
||||
$("input[name='begin[" + planID + "]']").attr('disabled', 'disabled');
|
||||
$("input[name='end[" + planID + "]']").attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($plans as $plan):?>
|
||||
<?php $hiddenInput = ($plan->begin == '2030-01-01' || $plan->end == '2030-01-01') ? 'form-input-hidden' : 'form-input-show';?>
|
||||
<?php $showInput = ($plan->begin == '2030-01-01' || $plan->end == '2030-01-01') ? 'form-input-show' : 'form-input-hidden';?>
|
||||
<?php $isChecked = ($plan->begin == '2030-01-01' || $plan->end == '2030-01-01') ? 'checked="checked"' : '';?>
|
||||
<tr>
|
||||
<td class='text-center'><?php echo $plan->id . html::hidden("id[$plan->id]", $plan->id);?></td>
|
||||
@@ -59,8 +57,11 @@
|
||||
<?php echo html::hidden("status[$plan->id]", $plan->status);?>
|
||||
<?php endif;?>
|
||||
<?php $required = $plan->status != 'wait' ? 'required' : '' ;?>
|
||||
<td class=<?php echo $required;?>><?php echo html::input("begin[$plan->id]", $plan->begin, "class='form-control form-date $hiddenInput'");echo html::input("begin$plan->id", '', "class='form-control form-date $showInput' disabled='disabled'");?></td>
|
||||
<td class=<?php echo $required;?>><?php echo html::input("end[$plan->id]", $plan->end, "class='form-control form-date $hiddenInput'");echo html::input("end$plan->id", '', "class='form-control form-date $showInput' disabled='disabled'");?></td>
|
||||
<?php $disabled = ($plan->begin == '2030-01-01' || $plan->end == '2030-01-01') ? 'disabled="disabled"' : '';?>
|
||||
<?php if($plan->begin == '2030-01-01') $plan->begin = '';?>
|
||||
<?php if($plan->end == '2030-01-01') $plan->end = '';?>
|
||||
<td class=<?php echo $required;?>><?php echo html::input("begin[$plan->id]", $plan->begin, "class='form-control form-date' $disabled");?></td>
|
||||
<td class=<?php echo $required;?>><?php echo html::input("end[$plan->id]", $plan->end, "class='form-control form-date' $disabled");?></td>
|
||||
<?php $hidden = $plan->status != 'wait' ? 'hidden' : '';?>
|
||||
<td><div class='checkbox-primary <?php echo $hidden;?>'><input type='checkbox' id="future<?php echo $plan->id; ?>" name='future<?php echo $plan->id; ?>' <?php echo $isChecked;?> onclick="changeDate(<?php echo $plan->id;?>);"/><label for='future<?php echo $plan->id; ?>'><?php echo $lang->productplan->future;?></label></div></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $plan, $extendField->field . "[{$plan->id}]") . "</td>";?>
|
||||
|
||||
Reference in New Issue
Block a user